New directory. This is mainly used as example for people porting libgtop
1998-08-07 Martin Baulig <martin@home-of-linux.org> * sysdeps/stub_suid: New directory. This is mainly used as example for people porting libgtop to other systems.
This commit is contained in:
committed by
Martin Baulig
parent
4b3fcf149a
commit
d72da1bb2f
@@ -1,5 +1,8 @@
|
||||
1998-08-07 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* sysdeps/stub_suid: New directory. This is mainly used as example
|
||||
for people porting libgtop to other systems.
|
||||
|
||||
* glibtop.h (_glibtop): New fields `error_method', `sysdeps' and
|
||||
`required'. I added an improved error handling: the client can tell
|
||||
the libraries which fields are absolutely required for each features
|
||||
|
25
sysdeps/stub_suid/.cvsignore
Normal file
25
sysdeps/stub_suid/.cvsignore
Normal file
@@ -0,0 +1,25 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
close.lo
|
||||
cpu.lo
|
||||
init.lo
|
||||
libgtop_sysdeps.la
|
||||
loadavg.lo
|
||||
mem.lo
|
||||
msg_limits.lo
|
||||
open.lo
|
||||
prockernel.lo
|
||||
proclist.lo
|
||||
procmem.lo
|
||||
procsegment.lo
|
||||
procsignal.lo
|
||||
procstate.lo
|
||||
proctime.lo
|
||||
procuid.lo
|
||||
sem_limits.lo
|
||||
shm_limits.lo
|
||||
swap.lo
|
||||
sysdeps.lo
|
||||
uptime.lo
|
15
sysdeps/stub_suid/Makefile.am
Normal file
15
sysdeps/stub_suid/Makefile.am
Normal file
@@ -0,0 +1,15 @@
|
||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
CFLAGS = -Wall -W @CFLAGS@
|
||||
|
||||
lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
|
||||
|
||||
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
|
||||
|
||||
libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c
|
||||
|
||||
include_HEADERS = glibtop_server.h glibtop_machine.h
|
28
sysdeps/stub_suid/close.c
Normal file
28
sysdeps/stub_suid/close.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop/close.h>
|
||||
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
46
sysdeps/stub_suid/cpu.c
Normal file
46
sysdeps/stub_suid/cpu.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_cpu_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
}
|
37
sysdeps/stub_suid/glibtop_machine.h
Normal file
37
sysdeps/stub_suid/glibtop_machine.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#ifndef __GLIBTOP_MACHINE_H__
|
||||
#define __GLIBTOP_MACHINE_H__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef struct _glibtop_machine glibtop_machine;
|
||||
|
||||
struct _glibtop_machine
|
||||
{
|
||||
uid_t uid, euid; /* Real and effective user id */
|
||||
gid_t gid, egid; /* Real and effective group id */
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
46
sysdeps/stub_suid/glibtop_server.h
Normal file
46
sysdeps/stub_suid/glibtop_server.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#ifndef __GLIBTOP_SERVER_H__
|
||||
#define __GLIBTOP_SERVER_H__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_SUID_CPU (1 << GLIBTOP_SYSDEPS_CPU)
|
||||
#define GLIBTOP_SUID_MEM (1 << GLIBTOP_SYSDEPS_MEM)
|
||||
#define GLIBTOP_SUID_SWAP (1 << GLIBTOP_SYSDEPS_SWAP)
|
||||
#define GLIBTOP_SUID_UPTIME (1 << GLIBTOP_SYSDEPS_UPTIME)
|
||||
#define GLIBTOP_SUID_LOADAVG (1 << GLIBTOP_SYSDEPS_LOADAVG)
|
||||
#define GLIBTOP_SUID_SHM_LIMITS (1 << GLIBTOP_SYSDEPS_SHM_LIMITS)
|
||||
#define GLIBTOP_SUID_MSG_LIMITS (1 << GLIBTOP_SYSDEPS_MSG_LIMITS)
|
||||
#define GLIBTOP_SUID_SEM_LIMITS (1 << GLIBTOP_SYSDEPS_SEM_LIMITS)
|
||||
#define GLIBTOP_SUID_PROCLIST (1 << GLIBTOP_SYSDEPS_PROCLIST)
|
||||
#define GLIBTOP_SUID_PROC_STATE (1 << GLIBTOP_SYSDEPS_PROC_STATE)
|
||||
#define GLIBTOP_SUID_PROC_UID (1 << GLIBTOP_SYSDEPS_PROC_UID)
|
||||
#define GLIBTOP_SUID_PROC_MEM (1 << GLIBTOP_SYSDEPS_PROC_MEM)
|
||||
#define GLIBTOP_SUID_PROC_TIME (1 << GLIBTOP_SYSDEPS_PROC_TIME)
|
||||
#define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL)
|
||||
#define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL)
|
||||
#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
42
sysdeps/stub_suid/glibtop_suid.h
Normal file
42
sysdeps/stub_suid/glibtop_suid.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#ifndef __GLIBTOP_SUID_H__
|
||||
#define __GLIBTOP_SUID_H__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
static inline void glibtop_suid_enter (glibtop *server) {
|
||||
setreuid (server->machine.uid, server->machine.euid);
|
||||
};
|
||||
|
||||
static inline void glibtop_suid_leave (glibtop *server) {
|
||||
if (setreuid (server->machine.euid, server->machine.uid))
|
||||
_exit (1);
|
||||
};
|
||||
|
||||
extern void glibtop_init_p __P((glibtop *, const unsigned long, const unsigned));
|
||||
|
||||
extern void glibtop_open_p __P((glibtop *, const char *, const unsigned long, const unsigned));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
43
sysdeps/stub_suid/init.c
Normal file
43
sysdeps/stub_suid/init.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
|
||||
static glibtop _glibtop_global_server;
|
||||
glibtop *glibtop_global_server = NULL;
|
||||
|
||||
glibtop *
|
||||
glibtop_init_r (glibtop **server,
|
||||
const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
if (*server != NULL)
|
||||
return *server;
|
||||
|
||||
if (glibtop_global_server == NULL) {
|
||||
glibtop_global_server = &_glibtop_global_server;
|
||||
glibtop_open (glibtop_global_server, "glibtop",
|
||||
features, flags);
|
||||
}
|
||||
|
||||
return *server = glibtop_global_server;
|
||||
}
|
46
sysdeps/stub_suid/loadavg.c
Normal file
46
sysdeps/stub_suid/loadavg.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/loadavg.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_loadavg = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_loadavg_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load averange. */
|
||||
|
||||
void
|
||||
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_LOADAVG, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
}
|
46
sysdeps/stub_suid/mem.c
Normal file
46
sysdeps/stub_suid/mem.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/mem.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_mem = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_mem_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
void
|
||||
glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_MEM, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
}
|
46
sysdeps/stub_suid/msg_limits.c
Normal file
46
sysdeps/stub_suid/msg_limits.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/msg_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_msg_limits = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_msg_limits_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
}
|
32
sysdeps/stub_suid/nosuid.c
Normal file
32
sysdeps/stub_suid/nosuid.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{ }
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
75
sysdeps/stub_suid/open.c
Normal file
75
sysdeps/stub_suid/open.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
|
||||
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
glibtop_init_func_t *init_fkt;
|
||||
|
||||
if (server == NULL)
|
||||
glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
|
||||
|
||||
/* Do the initialization, but only if not already initialized. */
|
||||
|
||||
if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
|
||||
glibtop_open_p (server, "glibtop", features, flags);
|
||||
|
||||
for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
|
||||
(*init_fkt) (server);
|
||||
|
||||
server->flags |= _GLIBTOP_INIT_STATE_INIT;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
|
||||
|
||||
server->name = program_name;
|
||||
|
||||
server->machine.uid = getuid ();
|
||||
server->machine.euid = geteuid ();
|
||||
server->machine.gid = getgid ();
|
||||
server->machine.egid = getegid ();
|
||||
|
||||
/* Drop priviledges. */
|
||||
|
||||
if (setreuid (server->machine.euid, server->machine.uid))
|
||||
_exit (1);
|
||||
|
||||
if (setregid (server->machine.egid, server->machine.gid))
|
||||
_exit (1);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
/* Our effective uid is now those of the user invoking the server,
|
||||
* so we do no longer have any priviledges. */
|
||||
}
|
||||
|
178
sysdeps/stub_suid/procdata.c
Normal file
178
sysdeps/stub_suid/procdata.c
Normal file
@@ -0,0 +1,178 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop/procdata.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
||||
|
||||
#define BIT_SHIFT(x) (1 << (x % 32))
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_procdata_0 =
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_CMD) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_STATE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_UID) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_PID) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_PPID) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_PGRP) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_SESSION) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_TTY) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_TPGID) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_PRIORITY) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_NICE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_SIGNAL) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_BLOCKED) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_SIGIGNORE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_SIGCATCH) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_START_TIME) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_UTIME) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_STIME) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_CUTIME) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_CSTIME) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_SIZE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_RESIDENT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_SHARE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_TRS) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_LRS) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_DRS) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_DT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_VSIZE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_RSS) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_RSS_RLIM) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_TIMEOUT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_IT_REAL_VALUE);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_procdata_1 =
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_K_FLAGS) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_MIN_FLT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_MAJ_FLT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_CMIN_FLT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_CMAJ_FLT) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_START_CODE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_END_CODE) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_START_STACK) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_KSTK_ESP) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_KSTK_EIP) +
|
||||
BIT_SHIFT(GLIBTOP_PROCDATA_WCHAN);
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
|
||||
{
|
||||
char input [BUFSIZ], *tmp;
|
||||
struct stat statb;
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_procdata));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags [0] = _glibtop_sysdeps_procdata_0;
|
||||
buf->flags [1] = _glibtop_sysdeps_procdata_1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
if (stat (input, &statb)) return;
|
||||
|
||||
buf->uid = statb.st_uid;
|
||||
|
||||
f = fopen (input, "r");
|
||||
if (!f) return;
|
||||
|
||||
nread = fread (input, 1, BUFSIZ, f);
|
||||
|
||||
if (nread < 0) {
|
||||
fclose (f);
|
||||
return;
|
||||
}
|
||||
|
||||
input [nread] = 0;
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
/* split into "PID (cmd" and "<rest>" */
|
||||
tmp = strrchr (input, ')');
|
||||
*tmp = '\0'; /* replace trailing ')' with NUL */
|
||||
/* parse these two strings separately, skipping the leading "(". */
|
||||
memset (buf->cmd, 0, sizeof (buf->cmd));
|
||||
sscanf (input, "%d (%39c", &buf->pid, buf->cmd);
|
||||
sscanf(tmp + 2, /* skip space after ')' too */
|
||||
"%c %d %d %d %d %d %lu %lu %lu %lu %lu "
|
||||
"%ld %ld %ld %ld %d %d %lu %lu %ld %lu "
|
||||
"%lu %lu %lu %lu %lu %lu %lu %d %d %d %d %lu",
|
||||
&buf->state, &buf->ppid, &buf->pgrp, &buf->session,
|
||||
&buf->tty, &buf->tpgid, &buf->k_flags, &buf->min_flt,
|
||||
&buf->cmin_flt, &buf->maj_flt, &buf->cmaj_flt,
|
||||
&buf->utime, &buf->stime, &buf->cutime, &buf->cstime,
|
||||
&buf->priority, &buf->nice, &buf->timeout,
|
||||
&buf->it_real_value, &buf->start_time, &buf->vsize,
|
||||
&buf->rss, &buf->rss_rlim, &buf->start_code,
|
||||
&buf->end_code, &buf->start_stack, &buf->kstk_esp,
|
||||
&buf->kstk_eip, &buf->signal, &buf->blocked,
|
||||
&buf->sigignore, &buf->sigcatch, &buf->wchan);
|
||||
|
||||
if (buf->tty == 0)
|
||||
/* the old notty val, update elsewhere bef. moving to 0 */
|
||||
buf->tty = -1;
|
||||
|
||||
if (server->os_version_code < LINUX_VERSION(1,3,39)) {
|
||||
/* map old meanings to new */
|
||||
buf->priority = 2*15 - buf->priority;
|
||||
buf->nice = 15 - buf->nice;
|
||||
}
|
||||
if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1)
|
||||
/* when tty wasn't full devno */
|
||||
buf->tty = 4*0x100 + buf->tty;
|
||||
|
||||
fclose (f);
|
||||
|
||||
sprintf (input, "/proc/%d/statm", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
if (!f) return;
|
||||
|
||||
nread = fread (input, 1, BUFSIZ, f);
|
||||
|
||||
if (nread < 0) {
|
||||
fclose (f);
|
||||
return;
|
||||
}
|
||||
|
||||
input [nread] = 0;
|
||||
|
||||
sscanf (input, "%ld %ld %ld %ld %ld %ld %ld",
|
||||
&buf->size, &buf->resident, &buf->share,
|
||||
&buf->trs, &buf->lrs, &buf->drs, &buf->dt);
|
||||
|
||||
fclose (f);
|
||||
|
||||
buf->flags [0] = _glibtop_sysdeps_procdata_0;
|
||||
buf->flags [1] = _glibtop_sysdeps_procdata_1;
|
||||
}
|
47
sysdeps/stub_suid/prockernel.c
Normal file
47
sysdeps/stub_suid/prockernel.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_kernel_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
}
|
46
sysdeps/stub_suid/proclist.c
Normal file
46
sysdeps/stub_suid/proclist.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/proclist.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proclist = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proclist_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
unsigned *
|
||||
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROCLIST, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
return NULL;
|
||||
}
|
47
sysdeps/stub_suid/procmem.c
Normal file
47
sysdeps/stub_suid/procmem.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmem.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_mem = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_mem_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_MEM, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
}
|
47
sysdeps/stub_suid/procsegment.c
Normal file
47
sysdeps/stub_suid/procsegment.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_segment = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_segment_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
}
|
47
sysdeps/stub_suid/procsignal.c
Normal file
47
sysdeps/stub_suid/procsignal.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procsignal.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_signal = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_signal_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
}
|
47
sysdeps/stub_suid/procstate.c
Normal file
47
sysdeps/stub_suid/procstate.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procstate.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_state = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_state_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
}
|
47
sysdeps/stub_suid/proctime.c
Normal file
47
sysdeps/stub_suid/proctime.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/proctime.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_time_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
}
|
47
sysdeps/stub_suid/procuid.c
Normal file
47
sysdeps/stub_suid/procuid.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procuid.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_uid = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_uid_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_UID, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
}
|
46
sysdeps/stub_suid/sem_limits.c
Normal file
46
sysdeps/stub_suid/sem_limits.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/sem_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sem_limits = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_sem_limits_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
}
|
46
sysdeps/stub_suid/shm_limits.c
Normal file
46
sysdeps/stub_suid/shm_limits.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/shm_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_shm_limits = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
}
|
26
sysdeps/stub_suid/siglist.c
Normal file
26
sysdeps/stub_suid/siglist.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/signal.h>
|
||||
|
||||
const glibtop_signame glibtop_sys_siglist [] =
|
||||
{ { 0, NULL, NULL } };
|
46
sysdeps/stub_suid/swap.c
Normal file
46
sysdeps/stub_suid/swap.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/swap.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_swap = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_swap_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
void
|
||||
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_SWAP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
}
|
46
sysdeps/stub_suid/uptime.c
Normal file
46
sysdeps/stub_suid/uptime.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top 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 Gnome Top 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. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/uptime.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_uptime = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_uptime_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_UPTIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
}
|
Reference in New Issue
Block a user