Fix xenmon/xentrace compile on Solaris
PATCH 1/1 Fix xenmon/xentrace compile on Solaris
# HG changeset patch
# User [email protected]
# Date 1186492378 25200
# Node ID ae465d2d2b2ec9ab31598511fb35814ba6ab5602 # Parent 1ddb3b21f4d8a6b449580ae45cf707f4b43198f9 Fix xenmon/xentrace compile on Solaris
The argp interface is only present in GNU libc. Include a local copy when compiling on Solaris, and fix a couple of a trivial compile problems.
tools/Makefile +1 -0
@@ -5,6 +5,7 @@ SUBDIRS-y += xenstore SUBDIRS-y += xenstore SUBDIRS-y += misc SUBDIRS-y += examples +SUBDIRS-$(CONFIG_SunOS) += libargp SUBDIRS-y += xentrace SUBDIRS-$(CONFIG_XCUTILS) += xcutils SUBDIRS-$(CONFIG_X86) += firmware
tools/libargp/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +XEN_ROOT=../.. +include $(XEN_ROOT)/tools/Rules.mk + +ARFLAGS = cru +DEFINES = -DHAVE_CONFIG_H +CFLAGS += $(DEFINES) -Wmissing-prototypes \ + -Wmissing-declarations -Waggregate-return \ + -Wpointer-arith -Wbad-function-cast -Wnested-externs +CPPFLAGS += -I. +OBJECTS = argp-ba.o argp-eexst.o argp-fmtstream.o argp-help.o \ + argp-parse.o argp-pv.o argp-pvh.o mempcpy.o strndup.o strchrnul.o +LIB = libargp.a + +.PHONY: all +all: $(LIB) + +.PHONY: install +install: all + +.PHONY: clean +clean: + -rm -f *.o $(LIB) + +$(LIB): $(OBJECTS) + -rm -f $(LIB) + $(AR) $(ARFLAGS) $(LIB) $(OBJECTS) + $(RANLIB) $(LIB) +
tools/libargp/argp-ba.c new file +26 -0
@@ -0,0 +1,26 @@ +/* Default definition for ARGP_PROGRAM_BUG_ADDRESS. +Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Written by Miles Bader <[email protected]>. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* If set by the user program, it should point to string that is the +bug-reporting address for the program. It will be printed by argp_help if +the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help +messages), embedded in a sentence that says something like `Report bugs to +ADDR.'. */ +const char *argp_program_bug_address =0 ;
tools/libargp/argp-eexst.c new file +32 -0
@@ -0,0 +1,32 @@ +/* Default definition for ARGP_ERR_EXIT_STATUS +Copyright (C) 1997 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Written by Miles Bader <[email protected]>. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sysexits.h> + +#include "argp.h" + +/* The exit status that argp will use when exiting due to a parsing error. +If not defined or set by the user program, this defaults to EX_USAGE from +<sysexits.h>. */ +error_t argp_err_exit_status =EX_USAGE ;
tools/libargp/argp-fmtstream.c new file +475 -0
475 lines not on this page · raw message
tools/libargp/argp-fmtstream.h new file +311 -0
311 lines not on this page · raw message
tools/libargp/argp-help.c new file +1855 -0
1,855 lines not on this page · raw message
tools/libargp/argp-namefrob.h new file +96 -0
96 lines not on this page · raw message
tools/libargp/argp-parse.c new file +1303 -0
170 lines not on this page · raw message
tools/libargp/argp.h new file +602 -0
602 lines not on this page · raw message
tools/libargp/config.h new file +106 -0
106 lines not on this page · raw message
tools/xenmon/Makefile +6 -2
Lines of this file are not shown. View the raw message.
tools/xenmon/xenbaked.c +0 -1
Lines of this file are not shown. View the raw message.
tools/xentrace/Makefile +6 -3
Lines of this file are not shown. View the raw message.
tools/xentrace/xentrace.c +0 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
That's a lot of code to include verbatim in our repository, especially for two non-essential build targets.
There are two potential better alternatives:
1. Don't use argp at all in xentrace/xenmon -- do they really need
super-advanced argument parsing such that getopt will not suffice? As low-level not-usually-user-visible daemons I would say that porting them to getopt would be acceptable even if the command-line option syntax needs changing a little to cleanly do so.
2. Is libargp available separately from libc? If so you could require
users to install it if they wish to build xentrace/xenmon. Or you could maintain the libargp you posted out-of-tree.
-- Keir
Quoted 11 lines · On 7/8/07 14:14, "[email protected]" <[email protected]> wrote:
# HG changeset patch
# User [email protected]
# Date 1186492378 25200
# Node IDae465d2d2b2ec9ab31598511fb35814ba6ab5602# Parent1ddb3b21f4d8a6b449580ae45cf707f4b43198f9Fix xenmon/xentrace compile on SolarisThe argp interface is only present in GNU libc. Include a local copy when compiling on Solaris, and fix a couple of a trivial compile problems.
Signed-off-by Tariq Magdon-Ismail <[email protected]>
Quoted 5 lines · Keir Fraser
1. Don't use argp at all in xentrace/xenmon -- do they really need
super-advanced argument parsing such that getopt will not suffice? As low-level not-usually-user-visible daemons I would say that porting them to getopt would be acceptable even if the command-line option syntax needs changing a little to cleanly do so.
We'd presumed that somebody had gone out of their way to use argp for a reason. If it's not necessary we're certainly fine with doing that instead.
regards,
john
For the Xentrace side, I'd say:
Quoted 6 lines · Keir Fraser
Quoted 5 lines
1. Don't use argp at all in xentrace/xenmon -- do they really need
super-advanced argument parsing such that getopt will not suffice? As low-level not-usually-user-visible daemons I would say that porting them to getopt would be acceptable even if the command-line option syntax needs changing a little to cleanly do so.
This is what I was going to suggest. The existing syntax should probably work fine, argp just expresses it more nicely (IMO) at the expense of non-GNU portability.
Quoted 2 lines
We'd presumed that somebody had gone out of their way to use argp for a reason. If it's not necessary we're certainly fine with doing that instead.
Nope, no reason :-)
As far as I'm concerned, feel free to drop argp and replace with getopt. Maintaining existing syntax might be nice, but isn't required.
As far as Xenmon is concerned, I didn't know it used argp. The original authors might have some useful comment to make, but my guess would be that they used argp to match the existing practice in Xentrace.
Cheers,
Mark
Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel!