always use `-I$(top_srcdir)/sysdeps/@sysdeps_dir@'; it's no longer

* configure.in (@machine_incs@): always use
`-I$(top_srcdir)/sysdeps/@sysdeps_dir@'; it's no
longer conditional.

* examples/Makefile.am: removed the '_linux' examples.

* src/server/main.c: we now use the '__p' functions,
but only if the appropriate 'GLIBTOP_SUID_<feature>'
has a non-zero value.
This commit is contained in:
Martin Baulig
1998-05-28 19:29:29 +00:00
parent 95b9d824ea
commit 68162783dc
5 changed files with 96 additions and 43 deletions

View File

@@ -1,3 +1,42 @@
1998-05-28 Martin Baulig <baulig@merkur.uni-trier.de>
* src/server/main.c: we now use the '__p' functions,
but only if the appropriate 'GLIBTOP_SUID_<feature>'
has a non-zero value.
* configure.in (@machine_incs@): always use
`-I$(top_srcdir)/sysdeps/@sysdeps_dir@'; it's no
longer conditional.
* examples/Makefile.am: removed the '_linux' examples.
* sysdeps/linux/*.c: renamed all functions implementing
features to '__s'.
* lib/*.c: renamed all functions implementing features
to '__l'; we only emit code for those functions if the
corresponding 'GLIBTOP_SUID_<feature>' has a positive value.
* sysdeps/linux/*.h: added some new function suffixes:
'__l' is a function defined in the client part;
'__s' is a function defined in the sysdeps part and
'__p' is a function that needs special priviledges.
'__r' is mapped either on '__l' or on '__s'.
* sysdeps/linux/glibtop_server.h: New file -
defines system dependent constants 'GLIBTOP_SUID_<feature>'
being either 'GLIBTOP_SYSDEPS_<feature>'+1 depending upon
whether or not this feature requires using the server.
* lib/sysdeps.c: removed that file; it is no longer
needed.
1998-05-25 Martin Baulig <baulig@merkur.uni-trier.de>
* src/server/main.c: Fixed `broken pipe' error when server
is running SUID; accidentally uses setreuid () instead of
setregid ().
1998-05-24 Martin Baulig <martin@home-of-linux.org>
* sysdeps/sun4/{open.c, mem.c, glibtop_machine.h}: added

View File

@@ -32,7 +32,7 @@ if test x$libgtop_want_guile = xyes ; then
if test x$libgtop_want_names = xyes ; then
AC_DEFINE(GLIBTOP_GUILE_NAMES)
fi
guile_examples='third third_static third_linux'
guile_examples='third third_static'
guile_subdirs='guile'
else
guile_examples=
@@ -157,9 +157,7 @@ if test "x$ac_cv_guile_found" = "xyes" ; then
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $GUILE_LIBS"
fi
if test "x$libgtop_use_machine_h" = "xyes" ; then
machine_incs='-I$(top_srcdir)/sysdeps/@sysdeps_dir@'
fi
machine_incs='-I$(top_srcdir)/sysdeps/@sysdeps_dir@'
AC_SUBST(machine_incs)

View File

@@ -10,14 +10,14 @@ CFLAGS = -Wall -W @CFLAGS@
DEFS = @DEFS@
bin_PROGRAMS = first first_static first_linux \
second second_static second_linux \
bin_PROGRAMS = first first_static second second_static \
@guile_examples@
EXTRA_PROGRAMS = third third_static third_linux
EXTRA_PROGRAMS = third third_static
first_SOURCES = first.c
first_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
$(top_builddir)/lib/libgtop.la \
@INTLLIBS@ @LIBSUPPORT@
@@ -25,14 +25,9 @@ first_static_SOURCES = $(first_SOURCES)
first_static_LDADD = $(first_LDADD)
first_static_LDFLAGS = -static
first_linux_SOURCES = $(first_SOURCES)
first_linux_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@
first_linux_LDFLAGS = -static
second_SOURCES = second.c
second_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
$(top_builddir)/lib/libgtop.la \
@INTLLIBS@ @LIBSUPPORT@
@@ -40,12 +35,6 @@ second_static_SOURCES = $(second_SOURCES)
second_static_LDADD = $(second_LDADD)
second_static_LDFLAGS = -static
second_linux_SOURCES = $(second_SOURCES)
second_linux_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@
second_linux_LDFLAGS = -static
if GLIBTOP_NAMES
third_guile_names_LIBS = $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la
third_names_LIBS = $(top_builddir)/sysdeps/names/libgtop_names.la
@@ -55,17 +44,10 @@ third_SOURCES = third.c
third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
$(third_guile_names_LIBS) $(third_names_LIBS) \
$(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
$(top_builddir)/lib/libgtop.la \
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
third_static_SOURCES = $(third_SOURCES)
third_static_LDADD = $(third_LDADD)
third_static_LDFLAGS = -static
third_linux_SOURCES = $(third_SOURCES)
third_linux_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
$(third_guile_names_LIBS) $(third_names_LIBS) \
$(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
third_linux_LDFLAGS = -static

View File

@@ -24,6 +24,8 @@
#include <glibtop/global.h>
#include <glibtop_server.h>
#ifdef HAVE_GLIBTOP_MACHINE_H
#include <glibtop_machine.h>
#endif

View File

@@ -146,50 +146,68 @@ int main(int argc, char *argv[])
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_CPU:
glibtop_get_cpu__r (&server, &data.cpu);
#if GLIBTOP_SUID_CPU
glibtop_get_cpu__p (&server, &data.cpu);
#endif
glibtop_output (sizeof (glibtop_cpu), &data.cpu);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_MEM:
glibtop_get_mem__r (&server, &data.mem);
#if GLIBTOP_SUID_MEM
glibtop_get_mem__p (&server, &data.mem);
#endif
glibtop_output (sizeof (glibtop_mem), &data.mem);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_SWAP:
glibtop_get_swap__r (&server, &data.swap);
#if GLIBTOP_SUID_SWAP
glibtop_get_swap__p (&server, &data.swap);
#endif
glibtop_output (sizeof (glibtop_swap), &data.swap);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_UPTIME:
glibtop_get_uptime__r (&server, &data.uptime);
#if GLIBTOP_SUID_UPTIME
glibtop_get_uptime__p (&server, &data.uptime);
#endif
glibtop_output (sizeof (glibtop_uptime), &data.uptime);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_LOADAVG:
glibtop_get_loadavg__r (&server, &data.loadavg);
#if GLIBTOP_SUID_LOADAVG
glibtop_get_loadavg__p (&server, &data.loadavg);
#endif
glibtop_output (sizeof (glibtop_loadavg), &data.loadavg);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_SHM_LIMITS:
glibtop_get_shm_limits__r (&server, &data.shm_limits);
#if GLIBTOP_SUID_SHM_LIMITS
glibtop_get_shm_limits__p (&server, &data.shm_limits);
#endif
glibtop_output (sizeof (glibtop_shm_limits),
&data.shm_limits);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_MSG_LIMITS:
glibtop_get_msg_limits__r (&server, &data.msg_limits);
#if GLIBTOP_SUID_MSG_LIMITS
glibtop_get_msg_limits__p (&server, &data.msg_limits);
#endif
glibtop_output (sizeof (glibtop_msg_limits),
&data.msg_limits);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_SEM_LIMITS:
glibtop_get_sem_limits__r (&server, &data.sem_limits);
#if GLIBTOP_SUID_SEM_LIMITS
glibtop_get_sem_limits__p (&server, &data.sem_limits);
#endif
glibtop_output (sizeof (glibtop_sem_limits),
&data.sem_limits);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROCLIST:
ptr = glibtop_get_proclist__r (&server, &data.proclist);
#if GLIBTOP_SUID_PROCLIST
ptr = glibtop_get_proclist__p (&server, &data.proclist);
#endif
glibtop_output (sizeof (glibtop_proclist),
&data.proclist);
glibtop_output (data.proclist.total, ptr);
@@ -197,56 +215,70 @@ int main(int argc, char *argv[])
break;
case GLIBTOP_CMND_PROC_STATE:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_state__r
#if GLIBTOP_SUID_PROC_STATE
glibtop_get_proc_state__p
(&server, &data.proc_state, pid);
#endif
glibtop_output (sizeof (glibtop_proc_state),
&data.proc_state);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROC_UID:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_uid__r
#if GLIBTOP_SUID_PROC_UID
glibtop_get_proc_uid__p
(&server, &data.proc_uid, pid);
#endif
glibtop_output (sizeof (glibtop_proc_uid),
&data.proc_uid);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROC_MEM:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_mem__r
#if GLIBTOP_SUID_PROC_MEM
glibtop_get_proc_mem__p
(&server, &data.proc_mem, pid);
#endif
glibtop_output (sizeof (glibtop_proc_mem),
&data.proc_mem);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROC_TIME:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_time__r
#if GLIBTOP_SUID_PROC_TIME
glibtop_get_proc_time__p
(&server, &data.proc_time, pid);
#endif
glibtop_output (sizeof (glibtop_proc_time),
&data.proc_time);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROC_SIGNAL:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_signal__r
#if GLIBTOP_SUID_PROC_SIGNAL
glibtop_get_proc_signal__p
(&server, &data.proc_signal, pid);
#endif
glibtop_output (sizeof (glibtop_proc_signal),
&data.proc_signal);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROC_KERNEL:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_kernel__r
#if GLIBTOP_SUID_PROC_KERNEL
glibtop_get_proc_kernel__p
(&server, &data.proc_kernel, pid);
#endif
glibtop_output (sizeof (glibtop_proc_kernel),
&data.proc_kernel);
glibtop_output (0, NULL);
break;
case GLIBTOP_CMND_PROC_SEGMENT:
memcpy (&pid, parameter, sizeof (pid_t));
glibtop_get_proc_segment__r
#if GLIBTOP_SUID_PROC_SEGMENT
glibtop_get_proc_segment__p
(&server, &data.proc_segment, pid);
#endif
glibtop_output (sizeof (glibtop_proc_segment),
&data.proc_segment);
glibtop_output (0, NULL);