Manual commit from my local git-svn which is broken :/

svn path=/trunk/; revision=2578
This commit is contained in:
Benoît Dejean
2007-05-13 08:20:10 +00:00
parent cd389851b9
commit 3eb958dc6c
24 changed files with 160 additions and 56 deletions

View File

@@ -40,11 +40,10 @@ libgtop_daemon2_LDADD = $(top_builddir)/lib/libgtop-2.0.la \
@sysdeps_suid_lib@ \
$(suid_sysdeps) $(suid_common) \
$(LIBGTOP_LIBS) \
-lpopt \
@libs_xauth@
libgtop_server2_SOURCES = server.c slave.c io.c version.c daemon.h
libgtop_server2_LDADD = $(GLIB_LIBS) -lpopt $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid-2.0.la \
libgtop_server2_LDADD = $(GLIB_LIBS) $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid-2.0.la \
$(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la
EXTRA_DIST = server_config.h.in server_config.pl

View File

@@ -69,8 +69,8 @@ int do_read (int s, void *ptr, size_t total_size) G_GNUC_INTERNAL;
void syslog_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
void syslog_io_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
extern int enable_debug;
extern int verbose_output;
extern gboolean enable_debug;
extern gboolean verbose_output;
G_END_DECLS

View File

@@ -46,7 +46,6 @@
#include <glibtop/gnuserv.h>
#include <errno.h>
#include <popt.h>
#include "daemon.h"
@@ -79,10 +78,10 @@ static Xauth *server_xauth = NULL;
#endif /* AUTH_MAGIC_COOKIE */
int enable_debug = 0;
int verbose_output = 0;
static int no_daemon = 0;
static int invoked_from_inetd = 0;
gboolean enable_debug = FALSE;
gboolean verbose_output = FALSE;
static gboolean no_daemon = FALSE;
static gboolean invoked_from_inetd = FALSE;
static int changed_uid = 0;
void
@@ -454,27 +453,26 @@ handle_signal (int sig)
exit (1);
}
const struct poptOption popt_options [] = {
POPT_AUTOHELP
{ "debug", 'd', POPT_ARG_NONE, &enable_debug, 0,
N_("Enable debugging"), N_("DEBUG") },
{ "verbose", 'v', POPT_ARG_NONE, &verbose_output, 0,
N_("Enable verbose output"), N_("VERBOSE") },
{ "no-daemon", 'f', POPT_ARG_NONE, &no_daemon, 0,
N_("Don't fork into background"), N_("NO-DAEMON") },
{ "inetd", 'i', POPT_ARG_NONE, &invoked_from_inetd, 0,
N_("Invoked from inetd"), N_("INETD") },
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
static const GOptionEntry options [] = {
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &enable_debug,
N_("Enable debugging"), NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_output,
N_("Enable verbose output"), NULL },
{ "no-daemon", 'f', 0, G_OPTION_ARG_NONE, &no_daemon,
N_("Don't fork into background"), NULL },
{ "inetd", 'i', 0, G_OPTION_ARG_NONE, &invoked_from_inetd,
N_("Invoked from inetd"), NULL },
{ NULL }
};
int
main (int argc, const char **argv)
main (int argc, char **argv)
{
const unsigned method = GLIBTOP_METHOD_PIPE;
const unsigned long features = GLIBTOP_SYSDEPS_ALL;
glibtop *server = glibtop_global_server;
poptContext context;
int nextopt;
GOptionContext *goption_context;
GError *error = NULL;
int ils = -1; /* internet domain listen socket */
@@ -488,22 +486,19 @@ main (int argc, const char **argv)
arg ? (arg + 1) : program_invocation_name;
}
context = poptGetContext ("libgtop-daemon", argc, argv,
popt_options, 0);
g_set_prgname (program_invocation_short_name);
goption_context = g_option_context_new (NULL);
g_option_context_add_main_entries (goption_context, options, NULL);
g_option_context_parse (goption_context, &argc, &argv, &error);
g_option_context_free (goption_context);
poptReadDefaultConfig (context, TRUE);
while ((nextopt = poptGetNextOpt (context)) > 0)
/* do nothing */ ;
if(nextopt != -1) {
printf (_("Error on option %s: %s.\n"
"Run '%s --help' to see a full list of "
"available command line options.\n"),
poptBadOption (context, 0),
poptStrerror (nextopt),
argv[0]);
exit(1);
if (error != NULL) {
g_printerr ("%s\n", error->message);
g_error_free (error);
g_printerr (_("Run '%s --help' to see a full list of "
"available command line options.\n"),
program_invocation_name);
exit(1);
}
if (enable_debug)

View File

@@ -150,6 +150,15 @@ handle_parent_connection (int s)
resp->u.data.proc_map.total, ptr);
g_free (ptr);
break;
case GLIBTOP_CMND_PROC_WD:
/* FIXME */
break;
case GLIBTOP_CMND_NETLIST:
/* FIXME */
break;
case GLIBTOP_CMND_PROC_ARGS:
memcpy (&pid, parameter, sizeof (pid_t));
ptr = glibtop_get_proc_args_l (server,

View File

@@ -51,6 +51,8 @@ GLIBTOP_SUID_PROC_SEGMENT +
GLIBTOP_SUID_PROC_ARGS +
GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_NETLIST +
GLIBTOP_SUID_PROC_WD +
GLIBTOP_SUID_PPP;
#include <fcntl.h>