* [PATCH for-4.5 0/4] Build systems fixes/improvements
@ 2014-10-15 17:33 Andrew Cooper
2014-10-15 17:33 ` [PATCH for-4.5 1/4] tools/mceinject: Fix build after 31d2d1e08a Andrew Cooper
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Andrew Cooper @ 2014-10-15 17:33 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Ian Jackson, Ian Campbell
Patches 1 and 2 are bugfixes, so certainly qualify for inclusion at this
point.
Patches 3 and 4 are improvements to tools/misc without impact to the tools as
currently built. As such, I request a release exception for them, on the
grounds of contributing to a more awesome release.
Andrew Cooper (4):
tools/mceinject: Fix build after 31d2d1e08a
tools/build: Fix root build target
tools/misc: Delete more obsolete utilities
tools/misc: Cleanup makefile
tools/Makefile | 4 +-
tools/misc/Makefile | 76 ++--
tools/misc/nsplitd/Makefile | 25 --
tools/misc/nsplitd/nsplitd.c | 686 -----------------------------------
tools/misc/xen-python-path | 24 --
tools/tests/mce-test/tools/Makefile | 6 +-
6 files changed, 49 insertions(+), 772 deletions(-)
delete mode 100644 tools/misc/nsplitd/Makefile
delete mode 100644 tools/misc/nsplitd/nsplitd.c
delete mode 100644 tools/misc/xen-python-path
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH for-4.5 1/4] tools/mceinject: Fix build after 31d2d1e08a 2014-10-15 17:33 [PATCH for-4.5 0/4] Build systems fixes/improvements Andrew Cooper @ 2014-10-15 17:33 ` Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 2/4] tools/build: Fix root build target Andrew Cooper ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Andrew Cooper @ 2014-10-15 17:33 UTC (permalink / raw) To: Xen-devel Cc: Wei Liu, Ian Campbell, Andrew Cooper, Ian Jackson, Stefano Stabellini xen-mceinj is another utility which incorrectly makes use of xg_private.h Fix up its include path. While fixing this Makefile, remove some trailing whitespace. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Stefano Stabellini <stefano.stabellini@citrix.com> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- tools/tests/mce-test/tools/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tests/mce-test/tools/Makefile b/tools/tests/mce-test/tools/Makefile index 5ee001f..aba7177 100644 --- a/tools/tests/mce-test/tools/Makefile +++ b/tools/tests/mce-test/tools/Makefile @@ -3,9 +3,11 @@ include $(XEN_ROOT)/tools/Rules.mk CFLAGS += -Werror CFLAGS += $(CFLAGS_libxenctrl) +# xen-mceinj.c incorrectly use libxc internals +CFLAGS += -I$(XEN_ROOT)/tools/libxc CFLAGS += $(CFLAGS_libxenguest) -CFLAGS += $(CFLAGS_libxenstore) -CFLAGS += $(CFLAGS_xeninclude) +CFLAGS += $(CFLAGS_libxenstore) +CFLAGS += $(CFLAGS_xeninclude) .PHONY: all all: xen-mceinj -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH for-4.5 2/4] tools/build: Fix root build target 2014-10-15 17:33 [PATCH for-4.5 0/4] Build systems fixes/improvements Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 1/4] tools/mceinject: Fix build after 31d2d1e08a Andrew Cooper @ 2014-10-15 17:33 ` Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 4/4] tools/misc: Cleanup makefile Andrew Cooper 3 siblings, 0 replies; 8+ messages in thread From: Andrew Cooper @ 2014-10-15 17:33 UTC (permalink / raw) To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Wei Liu The root Makefile 'build' rule recurses into the tools directory and invokes the 'build' rule. However, the tools Makefile doesn't contain a 'build' rule, resulting in failure. Introduce a 'build' rule identical to the existing 'all' rule. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- tools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 543cd29..af9798a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -54,8 +54,8 @@ export CROSS_SYS_ROOT # exported for check/funcs.sh export CROSS_BIN_PATH # exported for cross-install.sh endif -.PHONY: all -all: subdirs-all +.PHONY: build all +build all: subdirs-all .PHONY: install install: subdirs-install -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities 2014-10-15 17:33 [PATCH for-4.5 0/4] Build systems fixes/improvements Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 1/4] tools/mceinject: Fix build after 31d2d1e08a Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 2/4] tools/build: Fix root build target Andrew Cooper @ 2014-10-15 17:33 ` Andrew Cooper 2014-10-17 16:13 ` Konrad Rzeszutek Wilk 2014-10-15 17:33 ` [PATCH for-4.5 4/4] tools/misc: Cleanup makefile Andrew Cooper 3 siblings, 1 reply; 8+ messages in thread From: Andrew Cooper @ 2014-10-15 17:33 UTC (permalink / raw) To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Wei Liu * nsplitd has been orphaned from the build since its introduction in c/s dc44ed4764 (in 2004), and never been developed since. While it does appear to compile, it is full of pointer width mismatch, pointer sign mismatch, and uninitialised variable warnings, which makes it unlikely to function correctly when compiled for a 64bit environment. * xen-python-path was declared obsolete in c/s 11e1149fe (in 2009) and can't actually be used correctly by out-of-tree components. 5 years is long enough for out-of-tree callers to catch up. There are no subdirectories any more, so drop the notion from the Makefile. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- tools/misc/Makefile | 7 +- tools/misc/nsplitd/Makefile | 25 -- tools/misc/nsplitd/nsplitd.c | 686 ------------------------------------------ tools/misc/xen-python-path | 24 -- 4 files changed, 1 insertion(+), 741 deletions(-) delete mode 100644 tools/misc/nsplitd/Makefile delete mode 100644 tools/misc/nsplitd/nsplitd.c delete mode 100644 tools/misc/xen-python-path diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 3237461..7a2bfd2 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -16,13 +16,11 @@ TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfnd TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y) -SUBDIRS := $(SUBDIRS-y) - INSTALL_BIN-y := xencons xencov_split INSTALL_BIN-$(CONFIG_X86) += xen-detect INSTALL_BIN := $(INSTALL_BIN-y) -INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xenpm xen-tmem-list-parse gtraceview \ +INSTALL_SBIN-y := xen-bugtool xenperf xenpm xen-tmem-list-parse gtraceview \ gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool @@ -39,7 +37,6 @@ all: build .PHONY: build build: $(TARGETS) - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d; done .PHONY: install install: build @@ -49,12 +46,10 @@ install: build $(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR) $(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR) $(INSTALL_PYTHON_PROG) $(INSTALL_PRIVBIN) $(DESTDIR)$(LIBEXEC_BIN) - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done .PHONY: clean clean: $(RM) *.o $(TARGETS) *~ $(DEPS) - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done xen-hvmctx: xen-hvmctx.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) diff --git a/tools/misc/nsplitd/Makefile b/tools/misc/nsplitd/Makefile deleted file mode 100644 index 91ccf4d..0000000 --- a/tools/misc/nsplitd/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -XEN_ROOT := $(CURDIR)/../../.. -include $(XEN_ROOT)/tools/Rules.mk - -CFILES = $(wildcard *.c) - -HDRS = $(wildcard *.h) -OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) - -TARGET = nsplitd - -.PHONY: all -all: $(TARGET) - -.PHONY: install -install: all - -.PHONY: clean -clean: - $(RM) *.o $(TARGET) *~ - -$(TARGET): $(OBJS) - $(HOSTCC) $(HOSTCFLAGS) -o $@ $^ - -%.o: %.c $(HDRS) Makefile - $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< diff --git a/tools/misc/nsplitd/nsplitd.c b/tools/misc/nsplitd/nsplitd.c deleted file mode 100644 index 32f0b56..0000000 --- a/tools/misc/nsplitd/nsplitd.c +++ /dev/null @@ -1,686 +0,0 @@ -/* - * nsplitd.c - * --------- - * - * $Id: nsplitd.c,v 2.6 1998/09/17 14:28:37 sde1000 Exp $ - * - * Copyright (c) 1995, University of Cambridge Computer Laboratory, - * Copyright (c) 1995, Richard Black, All Rights Reserved. - * - * - * A complete re-implementation of DME's nsplitd for use from inetd - * - */ - -/* The basic stream comes in (via inetd) and we then conenct to - * somewhere else providing a loop-through service, except we offer - * two other ports for connection - one of which gets a second channel - * using the top bit to distinguish, and the other is a master control - * port (normally used for gdb) which gets complete exclusive access - * for its duration. - * - * Originally designed for multiplexing a xwcons/telnet with a gdb - * post-mortem debugging session. - * - * Here is a picture: - * - * port0 (from inetd) - * 8-bit connection / - * made by us <----> nsplitd <-----gdbport (default port0+2) - * to host:port/tcp |\ - * | port1 (default port0+1) - * \ - * control (default port0+3) - * - * If port1 is explicitly disabled (through a command-line option) then - * port0 becomes 8-bit clean. - */ - -/* - * N.B.: We do NOT support 8 bit stdin/stdout usage on a - * /dev/... because to do that right involves much messing with ioctl - * and TIOC... etc. If you want to do that sort of thing then the - * right way to do it is to chain this onto wconsd (which does know - * about and understand all the ioctl and TIOC grief). - */ - -#include <sys/types.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include <errno.h> -#include <unistd.h> -#include <ctype.h> -#include <netdb.h> -#include <string.h> - -#include <sys/time.h> -#include <sys/signal.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <sys/ioctl.h> -#include <syslog.h> - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef LOG_DAEMON -#define LOG_DAEMON 0 -#endif - -#define DB(x) /* ((x), fflush(stderr)) */ - -extern char *optarg; - -extern int optind, opterr, optopt; - -static char *prog_name; - -static void usage(void) -{ - fprintf(stderr, "This program (%s) should be run via inetd (tcp)\n\n", - prog_name); - fprintf(stderr, "usage: %s [-h<highport>][-g<gdbport>]" - "[-c<ctlport>][-8] host:service\n", - prog_name); - exit(1); -} - -static void fault(char *format, ...) -{ - va_list ap; - char logbuf[1024]; - - va_start(ap, format); - fprintf(stderr, "%s: ", prog_name); - vfprintf(stderr, format, ap); - fflush(stderr); - va_end(ap); - - /* XXX This is a bit dubious, but there is no vsyslog */ - va_start(ap, format); - vsnprintf(logbuf, sizeof(logbuf), format, ap); - syslog(LOG_ERR, logbuf); - va_end(ap); - exit(1); -} - -static int getservice(char *name, unsigned short *port) -{ - struct servent *se; - - if (!name) return -1; - - if (isdigit(name[0])) - *port = atoi(name); - else - { - if (!(se = getservbyname(name, "tcp"))) - return -1; - *port = ntohs(se->s_port); - } - return 0; -} - -/* - * connect_host: connect to ("name", "port") - */ -static int connect_host (char *name, unsigned int port) -{ - int fd; - struct hostent *hostent; - struct sockaddr_in sin; - int on; - - if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) - fault("socket"); - - if (!(hostent = gethostbyname(name))) - fault("gethostbyname: %s: %s\n", name, strerror(errno)); - - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = htons (port); - memcpy(&sin.sin_addr.s_addr, hostent->h_addr, sizeof(struct in_addr)); - - if (connect(fd, (struct sockaddr *) &sin, sizeof (sin)) < 0) - fault("connect: %s:%u: %s\n", name, port, strerror(errno)); - - on = 1; - if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof (on)) < 0) - syslog(LOG_WARNING, "setsockopt (TCP_NODELAY): %m"); - - on = 1; - if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) - syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m"); - - return fd; -} - -/* - * open a tcp socket and start listening for connections on it - */ -static int startlistening(unsigned short port) -{ - int fd, on; - struct sockaddr_in sin; - - if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) - fault("socket"); - - on = 1; - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0) - syslog(LOG_WARNING, "setsockopt (SO_REUSEADDR): %m"); - - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = htons (port); - sin.sin_addr.s_addr = INADDR_ANY; - if (bind(fd, &sin, sizeof(sin)) < 0) - fault("bind: %u: %s\n", port, strerror(errno)); - - if (listen(fd, 1) < 0) - fault("listen: %s\n", strerror(errno)); - - return fd; -} - -static void noblock(int fd) -{ - int on=1; - - if (ioctl(fd, FIONBIO, &on) < 0) - fault("ioctl: FIONBIO: %s\n", strerror(errno)); -} - - -/* You might not believe this, but fd_sets don't have to be a 32-bit - * integer. In particular, in glibc2 it is an array of unsigned - * longs. Hence, this hacked up FD_SET_rjb() that works out if it - * would have been a nop. */ -#define FD_SET_rjb(fd, setp) \ -do { \ - if ((fd) != 32) \ - FD_SET((fd), (setp)); \ -} while(0) - -#define FD_ISSET_rjb(fd, setp) (((fd) != 32)? FD_ISSET((fd), (setp)) : 0) - -#define MAXSIZE 256 - -/* ----------------------------------------------------------------- - * The main bit of the algorithm. Note we use 32 to mean not connected - * because this gives us 1<<32 == 0. We could have done this one - * character at a time, but that would have been very inefficient and - * not the unix way. */ -static int debug; - -static void doit(int actl, int acto, int lish, int lisg, int lisc) -{ - int acth, actg, actc; - int gdbmode = FALSE; - char gibuf[MAXSIZE], oibuf[MAXSIZE]; - char libuf[MAXSIZE], lobuf[MAXSIZE]; - char hibuf[MAXSIZE], hobuf[MAXSIZE]; - char ctlbuf[MAXSIZE]; - fd_set rdfs, wrfs, exfs; - int gicc, oicc, licc, locc, hicc, hocc, ctlcc; - char *giptr, *oiptr, *liptr, *loptr, *hiptr, *hoptr; - int rc, fromlen; - struct sockaddr_in from; - - gicc = oicc = licc = locc = hicc = hocc = ctlcc = 0; - acth = actg = actc = 32; /* XXX yummy */ - - noblock(actl); - noblock(acto); - - for(;;) - { - FD_ZERO(&rdfs); - FD_ZERO(&wrfs); - FD_ZERO(&exfs); - - /* always take input from the control port (if it's connected) */ - FD_SET_rjb(actc, &rdfs); - - if (gdbmode) - { - if (oicc) - FD_SET_rjb(actg, &wrfs); - else - FD_SET_rjb(acto, &rdfs); - - if (gicc) - FD_SET_rjb(acto, &wrfs); - else - FD_SET_rjb(actg, &rdfs); - } - else - { - /* There is no such thing as oibuf because its been split into - * lobuf and hobuf - */ - if (locc || hocc) - { - if (locc) - FD_SET_rjb(actl, &wrfs); - if (hocc) - FD_SET_rjb(acth, &wrfs); - } - else - FD_SET_rjb(acto, &rdfs); - - if (licc) - FD_SET_rjb(acto, &wrfs); - else - FD_SET_rjb(actl, &rdfs); - - if (hicc) - FD_SET_rjb(acto, &wrfs); - else - FD_SET_rjb(acth, &rdfs); - } - - if (acth == 32 && lish>=0) FD_SET_rjb(lish, &rdfs); - if (actg == 32) FD_SET_rjb(lisg, &rdfs); - if (actc == 32) FD_SET_rjb(lisc, &rdfs); - - /* now make exfs the union of the read and write fd sets, plus - * "actl" */ - { - int i; - exfs = rdfs; - for(i=0; i<32; i++) /* XXX we only copy fd numbers up to 31 */ - if (FD_ISSET(i, &wrfs)) - FD_SET_rjb(i, &exfs); - FD_SET_rjb(actl, &exfs); - } - - /* XXX AND: can't print something of type fd_set as %x - it - * might be an array */ - DB(fprintf(stderr, "%s: before select: %08x %08x %08x\n", - prog_name, rdfs, wrfs, exfs)); - - if (select(32, &rdfs, &wrfs, &exfs, NULL) < 0) - fault("select: %s\n", strerror(errno)); - - DB(fprintf(stderr, "%s: after select: %08x %08x %08x\n", - prog_name, rdfs, wrfs, exfs)); - - /* XXX it appears that a non-blocking socket may not show up - * correctly in exfs but instead goes readable with no data in - * it. Thus we check for zero and goto the appropriate close - * method. */ - - /* Deal with exceptions */ - if (FD_ISSET_rjb(actg, &exfs)) - { - exfs_actg: - close(actg); - gdbmode = FALSE; - oicc = 0; - oiptr = oibuf; - actg = 32; - continue; /* because assumptions changed */ - } - if (FD_ISSET_rjb(acth, &exfs)) - { - exfs_acth: - close(acth); - hicc = hocc = 0; - hiptr = hibuf; - hoptr = hibuf; - acth = 32; - continue; /* because assumptions changed */ - } - if (FD_ISSET_rjb(actl, &exfs) || - FD_ISSET_rjb(acto, &exfs)) - { - exfs_actl: - exfs_acto: - /* Thats all folks ... */ - break; - } - if (FD_ISSET_rjb(actc, &exfs)) - { - exfs_ctl: - close(actc); - actc = 32; - ctlcc = 0; - continue; - } - - /* Deal with reading */ - if (FD_ISSET_rjb(acto, &rdfs)) - { - if ((oicc = read(acto, oiptr = oibuf, MAXSIZE)) < 0) - fault("read acto: %d: %s\n", oicc, strerror(errno)); - if (!oicc) goto exfs_acto; - - if (!gdbmode) - { - int t; - - assert((locc == 0) && (hocc == 0)); - loptr = lobuf; - hoptr = hobuf; - - if (lish>=0) { - for(t=0; t<oicc; t++) - if (oibuf[t] & 0x80) - hobuf[hocc++] = oibuf[t] & 0x7f; - else - lobuf[locc++] = oibuf[t]; - } else { - for (t=0; t<oicc; t++) - lobuf[locc++] = oibuf[t]; - } - /* If no high connection scratch that */ - if (acth == 32) - hocc=0; - } - } - if (FD_ISSET_rjb(actl, &rdfs)) - { - if ((licc = read(actl, liptr = libuf, MAXSIZE)) < 0) - fault("read actl: %d: %s\n", licc, strerror(errno)); - if (!licc) goto exfs_actl; - } - if (FD_ISSET_rjb(acth, &rdfs)) - { - int t; - - if ((hicc = read(acth, hiptr = hibuf, MAXSIZE)) < 0) - fault("read acth: %d: %s\n", hicc, strerror(errno)); - if (!hicc) goto exfs_acth; - for(t=0; t<hicc; t++) - hibuf[t] |= 0x80; - } - if (FD_ISSET_rjb(actg, &rdfs)) - { - if ((gicc = read(actg, giptr = gibuf, MAXSIZE)) < 0) - fault("read actg: %d: %s\n", gicc, strerror(errno)); - if (debug) write(1, giptr, gicc); /* XXX */ - if (!gicc) goto exfs_actg; - } - if (FD_ISSET_rjb(actc, &rdfs)) - { - if ((ctlcc = read(actc, ctlbuf, MAXSIZE)) < 0) - fault("read actc: %d: %s\n", ctlcc, strerror(errno)); - if (debug) write(1, ctlbuf, gicc); - if (!ctlcc) goto exfs_ctl; - if (ctlbuf[0] == 'r') /* reset command */ - { - syslog(LOG_INFO, "reset command read, exiting"); - if (debug) write(1, "reseting\n", sizeof("reseting\n")); - break; - } - } - - /* Deal with writing */ - if (FD_ISSET_rjb(actg, &wrfs)) - { - /* We must be in gdb mode so send oi buffer data */ - assert(gdbmode); - if (debug) write(2, oiptr, oicc); /* XXX */ - if ((rc = write(actg, oiptr, oicc)) <= 0) - fault("write actg: %d: %s\n", rc, strerror(errno)); - oiptr += rc; - oicc -= rc; - } - if (FD_ISSET_rjb(actl, &wrfs)) - { - if ((rc = write(actl, loptr, locc)) <= 0) - fault("write actl: %d: %s\n", rc, strerror(errno)); - loptr += rc; - locc -= rc; - } - if (FD_ISSET_rjb(acth, &wrfs)) - { - if ((rc = write(acth, hoptr, hocc)) <= 0) - fault("write acth: %d: %s\n", rc, strerror(errno)); - hoptr += rc; - hocc -= rc; - } - if (FD_ISSET_rjb(acto, &wrfs)) - { - /* If in gdb mode send gdb input, otherwise send low data - preferentially */ - if (gdbmode) - { - assert(gicc); - if ((rc = write(acto, giptr, gicc)) <= 0) - fault("write acto: %d: %s\n", rc, strerror(errno)); - giptr += rc; - gicc -= rc; - } - else - { - if (licc) - { - if ((rc = write(acto, liptr, licc)) <= 0) - fault("write acto: %d: %s\n", rc, strerror(errno)); - liptr += rc; - licc -= rc; - } - else - { - assert(hicc); - if ((rc = write(acto, hiptr, hicc)) <= 0) - fault("write acto: %d: %s\n", rc, strerror(errno)); - hiptr += rc; - hicc -= rc; - } - } - } - - /* Deals with new connections */ - if ((acth == 32) && lish>=0 && (FD_ISSET_rjb(lish, &rdfs))) - { - fromlen = sizeof(from); - if ((acth = accept(lish, &from, &fromlen)) < 0) - { - syslog(LOG_WARNING, "accept: %m"); - acth = 32; - } - else - { - noblock(acth); - hicc = hocc = 0; - syslog(LOG_INFO, "highbit client peer is %s:%u\n", - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); - } - } - - if ((actg == 32) && (FD_ISSET_rjb(lisg, &rdfs))) - { - fromlen = sizeof(from); - if ((actg = accept(lisg, &from, &fromlen)) < 0) - { - syslog(LOG_WARNING, "accept: %m"); - actg = 32; - } - else - { - noblock(actg); - gicc = 0; - gdbmode = TRUE; - syslog(LOG_INFO, "gdb client peer is %s:%u\n", - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); - } - } - - if ((actc == 32) && (FD_ISSET_rjb(lisc, &rdfs))) - { - fromlen = sizeof(from); - if ((actc = accept(lisc, &from, &fromlen)) < 0) - { - syslog(LOG_WARNING, "accept (ctl): %m"); - actc = 32; - } - else - { - noblock(actc); - syslog(LOG_INFO, "ctl client peer is %s:%u\n", - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); - } - } - - /* Back to top of loop */ - } - - /* We are bailing because one of the primary connections has gone - * away. We close these all explicitly here because that way the - * timeout on reusing the port numbers is smnaller. */ - - close(acth); - close(actg); - /* XXX AND: why are we closing all these "character counts" ?? */ - close(gicc); - close(oicc); - close(licc); - close(locc); - close(hicc); - close(hocc); -} - -/* - * ------------------------------------------------------------ - */ -int main(int argc, char **argv) -{ - /* In general, suffix "l" is low channel, "h" is high channel, "g" - * is gdb channel, "c" is control channel and "o" is output channel. - */ - struct sockaddr_in from; - int infd = 0, outfd; - unsigned short portl, porth, portg, portc, porto; - int on = 1, c; - char *outname, *outservice; - int fromlen; - int lish, lisg, lisc; -#if 0 - FILE *newerr; -#endif /* 0 */ - - prog_name = argv[0]; - - if (isatty(infd)) - usage(); - - /* Here, then not just a simple idiot. */ - - signal(SIGPIPE, SIG_IGN); - - openlog(prog_name, LOG_PID, LOG_DAEMON); - - fromlen = sizeof(from); - if (getsockname(infd, &from, &fromlen) < 0) - fault("getsockname: %s", strerror(errno)); - if ((fromlen != sizeof(from)) || (from.sin_family != AF_INET)) - fault("not an inet socket (family=%d)\n", from.sin_family); - - portl = ntohs(from.sin_port); - porth = portl+1; - portg = porth+1; - portc = portg+1; - - fromlen = sizeof(from); - if (getpeername(infd, &from, &fromlen) < 0) - fault("getpeername: %s", strerror(errno)); - if ((fromlen != sizeof(from)) || (from.sin_family != AF_INET)) - fault("not an inet socket (family=%d)\n", from.sin_family); - - syslog(LOG_INFO, "on port %u peer is %s:%u\n", portl, - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); - - if (setsockopt(infd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) - syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m"); - - /* from here on, we map stderr to output on the connection so we can - * report errors to the remote user. - */ -#if 0 - if (!(newerr = fdopen(infd, "w"))) - syslog(LOG_WARNING, "fdopen: %m"); - else - *stderr = *newerr; -#endif - - while((c = getopt(argc, argv, "d8h:g:c:")) != EOF) - { - switch(c) - { - case 'd': - debug++; - break; - - case 'h': - /* high bit port */ - if (getservice(optarg, &porth) < 0) - fault("getservice failed (high port '%s')\n", optarg); - break; - - case 'g': - /* gdb port */ - if (getservice(optarg, &portg) < 0) - fault("getservice failed (gdb port '%s')\n", optarg); - break; - - case 'c': - /* control port */ - if (getservice(optarg, &portc) < 0) - fault("getservice failed (control port '%s')\n", optarg); - break; - - case '8': - /* 8-bit clean; no high port */ - porth=0; - break; - - default: - fault("bad argument list!\n"); - } - } - - if (argc != optind + 1) - fault("unparsed arguments (%d!=%d)\n", argc, optind+1); - - outname = argv[optind]; - if (!(outservice = strchr(outname, ':'))) - fault("output arg '%s' doesn't contain ':'\n", outname); - *outservice++ = 0; - if (getservice(outservice, &porto) < 0) - fault("getservice failed (output port '%s')\n", outservice); - - /* Time to start the sockets */ - - if (porth) { - lish = startlistening(porth); - } else { - lish = -1; - } - lisg = startlistening(portg); - lisc = startlistening(portc); - - outfd = connect_host(outname, porto); - - doit(infd, outfd, lish, lisg, lisc); - - syslog(LOG_INFO, "terminating normally\n"); - - fclose(stderr); - - closelog(); - exit(0); -} - -/* End $Id: nsplitd.c,v 2.6 1998/09/17 14:28:37 sde1000 Exp $ */ diff --git a/tools/misc/xen-python-path b/tools/misc/xen-python-path deleted file mode 100644 index 073abae..0000000 --- a/tools/misc/xen-python-path +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- mode: python; -*- -#============================================================================ -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#============================================================================ -# Copyright (C) 2007 XenSource Inc. -#============================================================================ - -# Nowadays we install xen in the standard python site-packages -# directories. This script is still provided for the benefit of old -# out-of-xen-tree callers. It is deprecated and will be removed. - -print '/dev/enoent/xen/python-path' -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities 2014-10-15 17:33 ` [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities Andrew Cooper @ 2014-10-17 16:13 ` Konrad Rzeszutek Wilk 2014-10-20 15:08 ` Ian Campbell 0 siblings, 1 reply; 8+ messages in thread From: Konrad Rzeszutek Wilk @ 2014-10-17 16:13 UTC (permalink / raw) To: Andrew Cooper; +Cc: Wei Liu, Ian Jackson, Ian Campbell, Xen-devel On Wed, Oct 15, 2014 at 06:33:56PM +0100, Andrew Cooper wrote: > * nsplitd has been orphaned from the build since its introduction in c/s > dc44ed4764 (in 2004), and never been developed since. While it does appear > to compile, it is full of pointer width mismatch, pointer sign mismatch, and > uninitialised variable warnings, which makes it unlikely to function > correctly when compiled for a 64bit environment. > > * xen-python-path was declared obsolete in c/s 11e1149fe (in 2009) and can't > actually be used correctly by out-of-tree components. 5 years is long enough > for out-of-tree callers to catch up. > > There are no subdirectories any more, so drop the notion from the Makefile. Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > CC: Ian Campbell <Ian.Campbell@citrix.com> > CC: Ian Jackson <Ian.Jackson@eu.citrix.com> > CC: Wei Liu <wei.liu2@citrix.com> > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > --- > tools/misc/Makefile | 7 +- > tools/misc/nsplitd/Makefile | 25 -- > tools/misc/nsplitd/nsplitd.c | 686 ------------------------------------------ > tools/misc/xen-python-path | 24 -- > 4 files changed, 1 insertion(+), 741 deletions(-) I think I know what the release code-name is going to be: SlimDiet! > delete mode 100644 tools/misc/nsplitd/Makefile > delete mode 100644 tools/misc/nsplitd/nsplitd.c > delete mode 100644 tools/misc/xen-python-path > > diff --git a/tools/misc/Makefile b/tools/misc/Makefile > index 3237461..7a2bfd2 100644 > --- a/tools/misc/Makefile > +++ b/tools/misc/Makefile > @@ -16,13 +16,11 @@ TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfnd > TARGETS-$(CONFIG_MIGRATE) += xen-hptool > TARGETS := $(TARGETS-y) > > -SUBDIRS := $(SUBDIRS-y) > - > INSTALL_BIN-y := xencons xencov_split > INSTALL_BIN-$(CONFIG_X86) += xen-detect > INSTALL_BIN := $(INSTALL_BIN-y) > > -INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xenpm xen-tmem-list-parse gtraceview \ > +INSTALL_SBIN-y := xen-bugtool xenperf xenpm xen-tmem-list-parse gtraceview \ > gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov > INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump > INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool > @@ -39,7 +37,6 @@ all: build > > .PHONY: build > build: $(TARGETS) > - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d; done > > .PHONY: install > install: build > @@ -49,12 +46,10 @@ install: build > $(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR) > $(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR) > $(INSTALL_PYTHON_PROG) $(INSTALL_PRIVBIN) $(DESTDIR)$(LIBEXEC_BIN) > - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done > > .PHONY: clean > clean: > $(RM) *.o $(TARGETS) *~ $(DEPS) > - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done > > xen-hvmctx: xen-hvmctx.o > $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) > diff --git a/tools/misc/nsplitd/Makefile b/tools/misc/nsplitd/Makefile > deleted file mode 100644 > index 91ccf4d..0000000 > --- a/tools/misc/nsplitd/Makefile > +++ /dev/null > @@ -1,25 +0,0 @@ > -XEN_ROOT := $(CURDIR)/../../.. > -include $(XEN_ROOT)/tools/Rules.mk > - > -CFILES = $(wildcard *.c) > - > -HDRS = $(wildcard *.h) > -OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) > - > -TARGET = nsplitd > - > -.PHONY: all > -all: $(TARGET) > - > -.PHONY: install > -install: all > - > -.PHONY: clean > -clean: > - $(RM) *.o $(TARGET) *~ > - > -$(TARGET): $(OBJS) > - $(HOSTCC) $(HOSTCFLAGS) -o $@ $^ > - > -%.o: %.c $(HDRS) Makefile > - $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< > diff --git a/tools/misc/nsplitd/nsplitd.c b/tools/misc/nsplitd/nsplitd.c > deleted file mode 100644 > index 32f0b56..0000000 > --- a/tools/misc/nsplitd/nsplitd.c > +++ /dev/null > @@ -1,686 +0,0 @@ > -/* > - * nsplitd.c > - * --------- > - * > - * $Id: nsplitd.c,v 2.6 1998/09/17 14:28:37 sde1000 Exp $ > - * > - * Copyright (c) 1995, University of Cambridge Computer Laboratory, > - * Copyright (c) 1995, Richard Black, All Rights Reserved. > - * > - * > - * A complete re-implementation of DME's nsplitd for use from inetd > - * > - */ > - > -/* The basic stream comes in (via inetd) and we then conenct to > - * somewhere else providing a loop-through service, except we offer > - * two other ports for connection - one of which gets a second channel > - * using the top bit to distinguish, and the other is a master control > - * port (normally used for gdb) which gets complete exclusive access > - * for its duration. > - * > - * Originally designed for multiplexing a xwcons/telnet with a gdb > - * post-mortem debugging session. > - * > - * Here is a picture: > - * > - * port0 (from inetd) > - * 8-bit connection / > - * made by us <----> nsplitd <-----gdbport (default port0+2) > - * to host:port/tcp |\ > - * | port1 (default port0+1) > - * \ > - * control (default port0+3) > - * > - * If port1 is explicitly disabled (through a command-line option) then > - * port0 becomes 8-bit clean. > - */ > - > -/* > - * N.B.: We do NOT support 8 bit stdin/stdout usage on a > - * /dev/... because to do that right involves much messing with ioctl > - * and TIOC... etc. If you want to do that sort of thing then the > - * right way to do it is to chain this onto wconsd (which does know > - * about and understand all the ioctl and TIOC grief). > - */ > - > -#include <sys/types.h> > -#include <stdarg.h> > -#include <stdio.h> > -#include <stdlib.h> > -#include <assert.h> > -#include <errno.h> > -#include <unistd.h> > -#include <ctype.h> > -#include <netdb.h> > -#include <string.h> > - > -#include <sys/time.h> > -#include <sys/signal.h> > -#include <sys/socket.h> > -#include <netinet/in.h> > -#include <netinet/tcp.h> > -#include <arpa/inet.h> > -#include <sys/ioctl.h> > -#include <syslog.h> > - > -#ifndef FALSE > -#define FALSE 0 > -#endif > -#ifndef TRUE > -#define TRUE 1 > -#endif > - > -#ifndef LOG_DAEMON > -#define LOG_DAEMON 0 > -#endif > - > -#define DB(x) /* ((x), fflush(stderr)) */ > - > -extern char *optarg; > - > -extern int optind, opterr, optopt; > - > -static char *prog_name; > - > -static void usage(void) > -{ > - fprintf(stderr, "This program (%s) should be run via inetd (tcp)\n\n", > - prog_name); > - fprintf(stderr, "usage: %s [-h<highport>][-g<gdbport>]" > - "[-c<ctlport>][-8] host:service\n", > - prog_name); > - exit(1); > -} > - > -static void fault(char *format, ...) > -{ > - va_list ap; > - char logbuf[1024]; > - > - va_start(ap, format); > - fprintf(stderr, "%s: ", prog_name); > - vfprintf(stderr, format, ap); > - fflush(stderr); > - va_end(ap); > - > - /* XXX This is a bit dubious, but there is no vsyslog */ > - va_start(ap, format); > - vsnprintf(logbuf, sizeof(logbuf), format, ap); > - syslog(LOG_ERR, logbuf); > - va_end(ap); > - exit(1); > -} > - > -static int getservice(char *name, unsigned short *port) > -{ > - struct servent *se; > - > - if (!name) return -1; > - > - if (isdigit(name[0])) > - *port = atoi(name); > - else > - { > - if (!(se = getservbyname(name, "tcp"))) > - return -1; > - *port = ntohs(se->s_port); > - } > - return 0; > -} > - > -/* > - * connect_host: connect to ("name", "port") > - */ > -static int connect_host (char *name, unsigned int port) > -{ > - int fd; > - struct hostent *hostent; > - struct sockaddr_in sin; > - int on; > - > - if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) > - fault("socket"); > - > - if (!(hostent = gethostbyname(name))) > - fault("gethostbyname: %s: %s\n", name, strerror(errno)); > - > - memset(&sin, 0, sizeof(sin)); > - sin.sin_family = AF_INET; > - sin.sin_port = htons (port); > - memcpy(&sin.sin_addr.s_addr, hostent->h_addr, sizeof(struct in_addr)); > - > - if (connect(fd, (struct sockaddr *) &sin, sizeof (sin)) < 0) > - fault("connect: %s:%u: %s\n", name, port, strerror(errno)); > - > - on = 1; > - if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof (on)) < 0) > - syslog(LOG_WARNING, "setsockopt (TCP_NODELAY): %m"); > - > - on = 1; > - if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) > - syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m"); > - > - return fd; > -} > - > -/* > - * open a tcp socket and start listening for connections on it > - */ > -static int startlistening(unsigned short port) > -{ > - int fd, on; > - struct sockaddr_in sin; > - > - if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) > - fault("socket"); > - > - on = 1; > - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0) > - syslog(LOG_WARNING, "setsockopt (SO_REUSEADDR): %m"); > - > - memset(&sin, 0, sizeof(sin)); > - sin.sin_family = AF_INET; > - sin.sin_port = htons (port); > - sin.sin_addr.s_addr = INADDR_ANY; > - if (bind(fd, &sin, sizeof(sin)) < 0) > - fault("bind: %u: %s\n", port, strerror(errno)); > - > - if (listen(fd, 1) < 0) > - fault("listen: %s\n", strerror(errno)); > - > - return fd; > -} > - > -static void noblock(int fd) > -{ > - int on=1; > - > - if (ioctl(fd, FIONBIO, &on) < 0) > - fault("ioctl: FIONBIO: %s\n", strerror(errno)); > -} > - > - > -/* You might not believe this, but fd_sets don't have to be a 32-bit > - * integer. In particular, in glibc2 it is an array of unsigned > - * longs. Hence, this hacked up FD_SET_rjb() that works out if it > - * would have been a nop. */ > -#define FD_SET_rjb(fd, setp) \ > -do { \ > - if ((fd) != 32) \ > - FD_SET((fd), (setp)); \ > -} while(0) > - > -#define FD_ISSET_rjb(fd, setp) (((fd) != 32)? FD_ISSET((fd), (setp)) : 0) > - > -#define MAXSIZE 256 > - > -/* ----------------------------------------------------------------- > - * The main bit of the algorithm. Note we use 32 to mean not connected > - * because this gives us 1<<32 == 0. We could have done this one > - * character at a time, but that would have been very inefficient and > - * not the unix way. */ > -static int debug; > - > -static void doit(int actl, int acto, int lish, int lisg, int lisc) > -{ > - int acth, actg, actc; > - int gdbmode = FALSE; > - char gibuf[MAXSIZE], oibuf[MAXSIZE]; > - char libuf[MAXSIZE], lobuf[MAXSIZE]; > - char hibuf[MAXSIZE], hobuf[MAXSIZE]; > - char ctlbuf[MAXSIZE]; > - fd_set rdfs, wrfs, exfs; > - int gicc, oicc, licc, locc, hicc, hocc, ctlcc; > - char *giptr, *oiptr, *liptr, *loptr, *hiptr, *hoptr; > - int rc, fromlen; > - struct sockaddr_in from; > - > - gicc = oicc = licc = locc = hicc = hocc = ctlcc = 0; > - acth = actg = actc = 32; /* XXX yummy */ > - > - noblock(actl); > - noblock(acto); > - > - for(;;) > - { > - FD_ZERO(&rdfs); > - FD_ZERO(&wrfs); > - FD_ZERO(&exfs); > - > - /* always take input from the control port (if it's connected) */ > - FD_SET_rjb(actc, &rdfs); > - > - if (gdbmode) > - { > - if (oicc) > - FD_SET_rjb(actg, &wrfs); > - else > - FD_SET_rjb(acto, &rdfs); > - > - if (gicc) > - FD_SET_rjb(acto, &wrfs); > - else > - FD_SET_rjb(actg, &rdfs); > - } > - else > - { > - /* There is no such thing as oibuf because its been split into > - * lobuf and hobuf > - */ > - if (locc || hocc) > - { > - if (locc) > - FD_SET_rjb(actl, &wrfs); > - if (hocc) > - FD_SET_rjb(acth, &wrfs); > - } > - else > - FD_SET_rjb(acto, &rdfs); > - > - if (licc) > - FD_SET_rjb(acto, &wrfs); > - else > - FD_SET_rjb(actl, &rdfs); > - > - if (hicc) > - FD_SET_rjb(acto, &wrfs); > - else > - FD_SET_rjb(acth, &rdfs); > - } > - > - if (acth == 32 && lish>=0) FD_SET_rjb(lish, &rdfs); > - if (actg == 32) FD_SET_rjb(lisg, &rdfs); > - if (actc == 32) FD_SET_rjb(lisc, &rdfs); > - > - /* now make exfs the union of the read and write fd sets, plus > - * "actl" */ > - { > - int i; > - exfs = rdfs; > - for(i=0; i<32; i++) /* XXX we only copy fd numbers up to 31 */ > - if (FD_ISSET(i, &wrfs)) > - FD_SET_rjb(i, &exfs); > - FD_SET_rjb(actl, &exfs); > - } > - > - /* XXX AND: can't print something of type fd_set as %x - it > - * might be an array */ > - DB(fprintf(stderr, "%s: before select: %08x %08x %08x\n", > - prog_name, rdfs, wrfs, exfs)); > - > - if (select(32, &rdfs, &wrfs, &exfs, NULL) < 0) > - fault("select: %s\n", strerror(errno)); > - > - DB(fprintf(stderr, "%s: after select: %08x %08x %08x\n", > - prog_name, rdfs, wrfs, exfs)); > - > - /* XXX it appears that a non-blocking socket may not show up > - * correctly in exfs but instead goes readable with no data in > - * it. Thus we check for zero and goto the appropriate close > - * method. */ > - > - /* Deal with exceptions */ > - if (FD_ISSET_rjb(actg, &exfs)) > - { > - exfs_actg: > - close(actg); > - gdbmode = FALSE; > - oicc = 0; > - oiptr = oibuf; > - actg = 32; > - continue; /* because assumptions changed */ > - } > - if (FD_ISSET_rjb(acth, &exfs)) > - { > - exfs_acth: > - close(acth); > - hicc = hocc = 0; > - hiptr = hibuf; > - hoptr = hibuf; > - acth = 32; > - continue; /* because assumptions changed */ > - } > - if (FD_ISSET_rjb(actl, &exfs) || > - FD_ISSET_rjb(acto, &exfs)) > - { > - exfs_actl: > - exfs_acto: > - /* Thats all folks ... */ > - break; > - } > - if (FD_ISSET_rjb(actc, &exfs)) > - { > - exfs_ctl: > - close(actc); > - actc = 32; > - ctlcc = 0; > - continue; > - } > - > - /* Deal with reading */ > - if (FD_ISSET_rjb(acto, &rdfs)) > - { > - if ((oicc = read(acto, oiptr = oibuf, MAXSIZE)) < 0) > - fault("read acto: %d: %s\n", oicc, strerror(errno)); > - if (!oicc) goto exfs_acto; > - > - if (!gdbmode) > - { > - int t; > - > - assert((locc == 0) && (hocc == 0)); > - loptr = lobuf; > - hoptr = hobuf; > - > - if (lish>=0) { > - for(t=0; t<oicc; t++) > - if (oibuf[t] & 0x80) > - hobuf[hocc++] = oibuf[t] & 0x7f; > - else > - lobuf[locc++] = oibuf[t]; > - } else { > - for (t=0; t<oicc; t++) > - lobuf[locc++] = oibuf[t]; > - } > - /* If no high connection scratch that */ > - if (acth == 32) > - hocc=0; > - } > - } > - if (FD_ISSET_rjb(actl, &rdfs)) > - { > - if ((licc = read(actl, liptr = libuf, MAXSIZE)) < 0) > - fault("read actl: %d: %s\n", licc, strerror(errno)); > - if (!licc) goto exfs_actl; > - } > - if (FD_ISSET_rjb(acth, &rdfs)) > - { > - int t; > - > - if ((hicc = read(acth, hiptr = hibuf, MAXSIZE)) < 0) > - fault("read acth: %d: %s\n", hicc, strerror(errno)); > - if (!hicc) goto exfs_acth; > - for(t=0; t<hicc; t++) > - hibuf[t] |= 0x80; > - } > - if (FD_ISSET_rjb(actg, &rdfs)) > - { > - if ((gicc = read(actg, giptr = gibuf, MAXSIZE)) < 0) > - fault("read actg: %d: %s\n", gicc, strerror(errno)); > - if (debug) write(1, giptr, gicc); /* XXX */ > - if (!gicc) goto exfs_actg; > - } > - if (FD_ISSET_rjb(actc, &rdfs)) > - { > - if ((ctlcc = read(actc, ctlbuf, MAXSIZE)) < 0) > - fault("read actc: %d: %s\n", ctlcc, strerror(errno)); > - if (debug) write(1, ctlbuf, gicc); > - if (!ctlcc) goto exfs_ctl; > - if (ctlbuf[0] == 'r') /* reset command */ > - { > - syslog(LOG_INFO, "reset command read, exiting"); > - if (debug) write(1, "reseting\n", sizeof("reseting\n")); > - break; > - } > - } > - > - /* Deal with writing */ > - if (FD_ISSET_rjb(actg, &wrfs)) > - { > - /* We must be in gdb mode so send oi buffer data */ > - assert(gdbmode); > - if (debug) write(2, oiptr, oicc); /* XXX */ > - if ((rc = write(actg, oiptr, oicc)) <= 0) > - fault("write actg: %d: %s\n", rc, strerror(errno)); > - oiptr += rc; > - oicc -= rc; > - } > - if (FD_ISSET_rjb(actl, &wrfs)) > - { > - if ((rc = write(actl, loptr, locc)) <= 0) > - fault("write actl: %d: %s\n", rc, strerror(errno)); > - loptr += rc; > - locc -= rc; > - } > - if (FD_ISSET_rjb(acth, &wrfs)) > - { > - if ((rc = write(acth, hoptr, hocc)) <= 0) > - fault("write acth: %d: %s\n", rc, strerror(errno)); > - hoptr += rc; > - hocc -= rc; > - } > - if (FD_ISSET_rjb(acto, &wrfs)) > - { > - /* If in gdb mode send gdb input, otherwise send low data > - preferentially */ > - if (gdbmode) > - { > - assert(gicc); > - if ((rc = write(acto, giptr, gicc)) <= 0) > - fault("write acto: %d: %s\n", rc, strerror(errno)); > - giptr += rc; > - gicc -= rc; > - } > - else > - { > - if (licc) > - { > - if ((rc = write(acto, liptr, licc)) <= 0) > - fault("write acto: %d: %s\n", rc, strerror(errno)); > - liptr += rc; > - licc -= rc; > - } > - else > - { > - assert(hicc); > - if ((rc = write(acto, hiptr, hicc)) <= 0) > - fault("write acto: %d: %s\n", rc, strerror(errno)); > - hiptr += rc; > - hicc -= rc; > - } > - } > - } > - > - /* Deals with new connections */ > - if ((acth == 32) && lish>=0 && (FD_ISSET_rjb(lish, &rdfs))) > - { > - fromlen = sizeof(from); > - if ((acth = accept(lish, &from, &fromlen)) < 0) > - { > - syslog(LOG_WARNING, "accept: %m"); > - acth = 32; > - } > - else > - { > - noblock(acth); > - hicc = hocc = 0; > - syslog(LOG_INFO, "highbit client peer is %s:%u\n", > - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); > - } > - } > - > - if ((actg == 32) && (FD_ISSET_rjb(lisg, &rdfs))) > - { > - fromlen = sizeof(from); > - if ((actg = accept(lisg, &from, &fromlen)) < 0) > - { > - syslog(LOG_WARNING, "accept: %m"); > - actg = 32; > - } > - else > - { > - noblock(actg); > - gicc = 0; > - gdbmode = TRUE; > - syslog(LOG_INFO, "gdb client peer is %s:%u\n", > - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); > - } > - } > - > - if ((actc == 32) && (FD_ISSET_rjb(lisc, &rdfs))) > - { > - fromlen = sizeof(from); > - if ((actc = accept(lisc, &from, &fromlen)) < 0) > - { > - syslog(LOG_WARNING, "accept (ctl): %m"); > - actc = 32; > - } > - else > - { > - noblock(actc); > - syslog(LOG_INFO, "ctl client peer is %s:%u\n", > - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); > - } > - } > - > - /* Back to top of loop */ > - } > - > - /* We are bailing because one of the primary connections has gone > - * away. We close these all explicitly here because that way the > - * timeout on reusing the port numbers is smnaller. */ > - > - close(acth); > - close(actg); > - /* XXX AND: why are we closing all these "character counts" ?? */ > - close(gicc); > - close(oicc); > - close(licc); > - close(locc); > - close(hicc); > - close(hocc); > -} > - > -/* > - * ------------------------------------------------------------ > - */ > -int main(int argc, char **argv) > -{ > - /* In general, suffix "l" is low channel, "h" is high channel, "g" > - * is gdb channel, "c" is control channel and "o" is output channel. > - */ > - struct sockaddr_in from; > - int infd = 0, outfd; > - unsigned short portl, porth, portg, portc, porto; > - int on = 1, c; > - char *outname, *outservice; > - int fromlen; > - int lish, lisg, lisc; > -#if 0 > - FILE *newerr; > -#endif /* 0 */ > - > - prog_name = argv[0]; > - > - if (isatty(infd)) > - usage(); > - > - /* Here, then not just a simple idiot. */ > - > - signal(SIGPIPE, SIG_IGN); > - > - openlog(prog_name, LOG_PID, LOG_DAEMON); > - > - fromlen = sizeof(from); > - if (getsockname(infd, &from, &fromlen) < 0) > - fault("getsockname: %s", strerror(errno)); > - if ((fromlen != sizeof(from)) || (from.sin_family != AF_INET)) > - fault("not an inet socket (family=%d)\n", from.sin_family); > - > - portl = ntohs(from.sin_port); > - porth = portl+1; > - portg = porth+1; > - portc = portg+1; > - > - fromlen = sizeof(from); > - if (getpeername(infd, &from, &fromlen) < 0) > - fault("getpeername: %s", strerror(errno)); > - if ((fromlen != sizeof(from)) || (from.sin_family != AF_INET)) > - fault("not an inet socket (family=%d)\n", from.sin_family); > - > - syslog(LOG_INFO, "on port %u peer is %s:%u\n", portl, > - inet_ntoa(from.sin_addr), ntohs(from.sin_port)); > - > - if (setsockopt(infd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) > - syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m"); > - > - /* from here on, we map stderr to output on the connection so we can > - * report errors to the remote user. > - */ > -#if 0 > - if (!(newerr = fdopen(infd, "w"))) > - syslog(LOG_WARNING, "fdopen: %m"); > - else > - *stderr = *newerr; > -#endif > - > - while((c = getopt(argc, argv, "d8h:g:c:")) != EOF) > - { > - switch(c) > - { > - case 'd': > - debug++; > - break; > - > - case 'h': > - /* high bit port */ > - if (getservice(optarg, &porth) < 0) > - fault("getservice failed (high port '%s')\n", optarg); > - break; > - > - case 'g': > - /* gdb port */ > - if (getservice(optarg, &portg) < 0) > - fault("getservice failed (gdb port '%s')\n", optarg); > - break; > - > - case 'c': > - /* control port */ > - if (getservice(optarg, &portc) < 0) > - fault("getservice failed (control port '%s')\n", optarg); > - break; > - > - case '8': > - /* 8-bit clean; no high port */ > - porth=0; > - break; > - > - default: > - fault("bad argument list!\n"); > - } > - } > - > - if (argc != optind + 1) > - fault("unparsed arguments (%d!=%d)\n", argc, optind+1); > - > - outname = argv[optind]; > - if (!(outservice = strchr(outname, ':'))) > - fault("output arg '%s' doesn't contain ':'\n", outname); > - *outservice++ = 0; > - if (getservice(outservice, &porto) < 0) > - fault("getservice failed (output port '%s')\n", outservice); > - > - /* Time to start the sockets */ > - > - if (porth) { > - lish = startlistening(porth); > - } else { > - lish = -1; > - } > - lisg = startlistening(portg); > - lisc = startlistening(portc); > - > - outfd = connect_host(outname, porto); > - > - doit(infd, outfd, lish, lisg, lisc); > - > - syslog(LOG_INFO, "terminating normally\n"); > - > - fclose(stderr); > - > - closelog(); > - exit(0); > -} > - > -/* End $Id: nsplitd.c,v 2.6 1998/09/17 14:28:37 sde1000 Exp $ */ > diff --git a/tools/misc/xen-python-path b/tools/misc/xen-python-path > deleted file mode 100644 > index 073abae..0000000 > --- a/tools/misc/xen-python-path > +++ /dev/null > @@ -1,24 +0,0 @@ > -#!/usr/bin/env python > -# -*- mode: python; -*- > -#============================================================================ > -# This library is free software; you can redistribute it and/or > -# modify it under the terms of version 2.1 of the GNU Lesser General Public > -# License as published by the Free Software Foundation. > -# > -# This library is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > -# Lesser General Public License for more details. > -# > -# You should have received a copy of the GNU Lesser General Public > -# License along with this library; if not, write to the Free Software > -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > -#============================================================================ > -# Copyright (C) 2007 XenSource Inc. > -#============================================================================ > - > -# Nowadays we install xen in the standard python site-packages > -# directories. This script is still provided for the benefit of old > -# out-of-xen-tree callers. It is deprecated and will be removed. > - > -print '/dev/enoent/xen/python-path' > -- > 1.7.10.4 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities 2014-10-17 16:13 ` Konrad Rzeszutek Wilk @ 2014-10-20 15:08 ` Ian Campbell 2014-10-20 17:04 ` Konrad Rzeszutek Wilk 0 siblings, 1 reply; 8+ messages in thread From: Ian Campbell @ 2014-10-20 15:08 UTC (permalink / raw) To: Konrad Rzeszutek Wilk; +Cc: Andrew Cooper, Ian Jackson, Wei Liu, Xen-devel On Fri, 2014-10-17 at 12:13 -0400, Konrad Rzeszutek Wilk wrote: > On Wed, Oct 15, 2014 at 06:33:56PM +0100, Andrew Cooper wrote: > > * nsplitd has been orphaned from the build since its introduction in c/s > > dc44ed4764 (in 2004), and never been developed since. While it does appear > > to compile, it is full of pointer width mismatch, pointer sign mismatch, and > > uninitialised variable warnings, which makes it unlikely to function > > correctly when compiled for a 64bit environment. > > > > * xen-python-path was declared obsolete in c/s 11e1149fe (in 2009) and can't > > actually be used correctly by out-of-tree components. 5 years is long enough > > for out-of-tree callers to catch up. > > > > There are no subdirectories any more, so drop the notion from the Makefile. > > Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked + applied up to here then. I wasn't quite sure what to make of 4/4 release wise. > I think I know what the release code-name is going to be: SlimDiet! $ git diff --stat RELEASE-4.4.0 says "76136 insertions(+), 141713 deletions(-)", which is pretty close to removing twice as much code as we added in this cycle... ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities 2014-10-20 15:08 ` Ian Campbell @ 2014-10-20 17:04 ` Konrad Rzeszutek Wilk 0 siblings, 0 replies; 8+ messages in thread From: Konrad Rzeszutek Wilk @ 2014-10-20 17:04 UTC (permalink / raw) To: Ian Campbell; +Cc: Andrew Cooper, Ian Jackson, Wei Liu, Xen-devel On Mon, Oct 20, 2014 at 04:08:51PM +0100, Ian Campbell wrote: > On Fri, 2014-10-17 at 12:13 -0400, Konrad Rzeszutek Wilk wrote: > > On Wed, Oct 15, 2014 at 06:33:56PM +0100, Andrew Cooper wrote: > > > * nsplitd has been orphaned from the build since its introduction in c/s > > > dc44ed4764 (in 2004), and never been developed since. While it does appear > > > to compile, it is full of pointer width mismatch, pointer sign mismatch, and > > > uninitialised variable warnings, which makes it unlikely to function > > > correctly when compiled for a 64bit environment. > > > > > > * xen-python-path was declared obsolete in c/s 11e1149fe (in 2009) and can't > > > actually be used correctly by out-of-tree components. 5 years is long enough > > > for out-of-tree callers to catch up. > > > > > > There are no subdirectories any more, so drop the notion from the Makefile. > > > > Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > Acked + applied up to here then. > > I wasn't quite sure what to make of 4/4 release wise. > > > I think I know what the release code-name is going to be: SlimDiet! > > $ git diff --stat RELEASE-4.4.0 > > says "76136 insertions(+), 141713 deletions(-)", which is pretty close > to removing twice as much code as we added in this cycle... Thanks to the axing of xend by Ian-The-Machete :-) > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH for-4.5 4/4] tools/misc: Cleanup makefile 2014-10-15 17:33 [PATCH for-4.5 0/4] Build systems fixes/improvements Andrew Cooper ` (2 preceding siblings ...) 2014-10-15 17:33 ` [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities Andrew Cooper @ 2014-10-15 17:33 ` Andrew Cooper 3 siblings, 0 replies; 8+ messages in thread From: Andrew Cooper @ 2014-10-15 17:33 UTC (permalink / raw) To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Wei Liu The existing makefile was awkward with needing to express conditional inclusion for both the build and install rules, and contained both split and unsplit long lines. The INSTALL_* rules now contain the conditional inclusion information, while the TARGET_* rules generate the build list from the complete install list, less the minority of scripts which simply need copying into place. Comments are introduces to aid clarity. In addition, collect the CFLAGS expressions, and remove the unreferenced and empty HDRS list. No functional change as a result of this patch, but it is rather more simple to add or remove utilities. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- tools/misc/Makefile | 71 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 7a2bfd2..fb1833f 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -1,7 +1,8 @@ XEN_ROOT=$(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk -CFLAGS += -Werror +# Include configure output (config.h) to headers search path +CFLAGS += -Werror -I$(XEN_ROOT)/tools CFLAGS += $(CFLAGS_libxenctrl) CFLAGS += $(CFLAGS_xeninclude) @@ -9,34 +10,48 @@ CFLAGS += $(CFLAGS_libxenstore) # xen-hptool.c and xen-mfndump.c incorrectly use libxc internals CFLAGS += -I$(XEN_ROOT)/tools/libxc -HDRS = $(wildcard *.h) - -TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov -TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump -TARGETS-$(CONFIG_MIGRATE) += xen-hptool -TARGETS := $(TARGETS-y) +# Everything to be installed in regular bin/ +INSTALL_BIN-$(CONFIG_X86) += xen-detect +INSTALL_BIN += xencons +INSTALL_BIN += xencov_split +INSTALL_BIN += $(INSTALL_BIN-y) -INSTALL_BIN-y := xencons xencov_split -INSTALL_BIN-$(CONFIG_X86) += xen-detect -INSTALL_BIN := $(INSTALL_BIN-y) - -INSTALL_SBIN-y := xen-bugtool xenperf xenpm xen-tmem-list-parse gtraceview \ - gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov -INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump +# Everything to be installed in regular sbin/ +INSTALL_SBIN += gtracestat +INSTALL_SBIN += gtraceview +INSTALL_SBIN += xen-bugtool INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool -INSTALL_SBIN := $(INSTALL_SBIN-y) - -INSTALL_PRIVBIN-y := xenpvnetboot -INSTALL_PRIVBIN := $(INSTALL_PRIVBIN-y) - -# Include configure output (config.h) to headers search path -CFLAGS += -I$(XEN_ROOT)/tools - -.PHONY: all -all: build - -.PHONY: build -build: $(TARGETS) +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmcrash +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx +INSTALL_SBIN-$(CONFIG_X86) += xen-lowmemd +INSTALL_SBIN-$(CONFIG_X86) += xen-mfndump +INSTALL_SBIN += xen-ringwatch +INSTALL_SBIN += xen-tmem-list-parse +INSTALL_SBIN += xencov +INSTALL_SBIN += xenlockprof +INSTALL_SBIN += xenperf +INSTALL_SBIN += xenpm +INSTALL_SBIN += xenwatchdogd +INSTALL_SBIN += $(INSTALL_SBIN-y) + +# Everything to be installed in a private bin/ +INSTALL_PRIVBIN += xenpvnetboot + +# Everything to be installed +TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN) + +# Everything which only needs copying to install +TARGETS_COPY += xen-bugtool +TARGETS_COPY += xen-ringwatch +TARGETS_COPY += xencons +TARGETS_COPY += xencov_split +TARGETS_COPY += xenpvnetboot + +# Everything which needs to be built +TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL)) + +.PHONY: all build +all build: $(TARGETS_BUILD) .PHONY: install install: build @@ -49,7 +64,7 @@ install: build .PHONY: clean clean: - $(RM) *.o $(TARGETS) *~ $(DEPS) + $(RM) *.o $(TARGETS_BUILD) *~ $(DEPS) xen-hvmctx: xen-hvmctx.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-10-20 17:04 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-15 17:33 [PATCH for-4.5 0/4] Build systems fixes/improvements Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 1/4] tools/mceinject: Fix build after 31d2d1e08a Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 2/4] tools/build: Fix root build target Andrew Cooper 2014-10-15 17:33 ` [PATCH for-4.5 3/4] tools/misc: Delete more obsolete utilities Andrew Cooper 2014-10-17 16:13 ` Konrad Rzeszutek Wilk 2014-10-20 15:08 ` Ian Campbell 2014-10-20 17:04 ` Konrad Rzeszutek Wilk 2014-10-15 17:33 ` [PATCH for-4.5 4/4] tools/misc: Cleanup makefile Andrew Cooper
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.