diff --git a/sysdeps/solaris/Makefile.am b/sysdeps/solaris/Makefile.am new file mode 100644 index 00000000..ef7846b0 --- /dev/null +++ b/sysdeps/solaris/Makefile.am @@ -0,0 +1,18 @@ +LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ + +INCLUDES = @INCLUDES@ + +lib_LTLIBRARIES = libgtop_sysdeps.la + +libgtop_sysdeps_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 procargs.c procmap.c netload.c \ + ppp.c procdata.c + +libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) + +include_HEADERS = glibtop_server.h glibtop_machine.h +noinst_HEADERS = glibtop_private.h + diff --git a/sysdeps/solaris/close.c b/sysdeps/solaris/close.c new file mode 100644 index 00000000..4262d2f0 --- /dev/null +++ b/sysdeps/solaris/close.c @@ -0,0 +1,30 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +/* Closes pipe to gtop server. */ + +void +glibtop_close_s (glibtop *server) +{ } diff --git a/sysdeps/solaris/cpu.c b/sysdeps/solaris/cpu.c new file mode 100644 index 00000000..3ddfdfb8 --- /dev/null +++ b/sysdeps/solaris/cpu.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_cpu = 0; + +/* Init function. */ + +void +glibtop_init_cpu_s (glibtop *server) +{ + server->sysdeps.cpu = _glibtop_sysdeps_cpu; +} + +/* Provides information about cpu usage. */ + +void +glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) +{ + memset (buf, 0, sizeof (glibtop_cpu)); +} diff --git a/sysdeps/solaris/glibtop_machine.h b/sysdeps/solaris/glibtop_machine.h new file mode 100644 index 00000000..c7767826 --- /dev/null +++ b/sysdeps/solaris/glibtop_machine.h @@ -0,0 +1,46 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , March 1999. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. 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__ + +#include +#include +#include +#include + +BEGIN_LIBGTOP_DECLS + +typedef struct _glibtop_machine glibtop_machine; + +struct _glibtop_machine +{ + uid_t uid, euid; + gid_t gid, egid; + + kstat_ctl_t *kstat; +}; + +END_LIBGTOP_DECLS + +#endif __GLIBTOP_MACHINE_H__ diff --git a/sysdeps/solaris/glibtop_private.h b/sysdeps/solaris/glibtop_private.h new file mode 100644 index 00000000..62e25f1e --- /dev/null +++ b/sysdeps/solaris/glibtop_private.h @@ -0,0 +1,45 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , March 1999. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __GLIBTOP_PRIVATE_H__ +#define __GLIBTOP_PRIVATE_H__ + +#include +#include + +#include +#include +#include +#include + +BEGIN_LIBGTOP_DECLS + +/* Read /proc//psinfo */ +int glibtop_get_proc_data_psinfo_s (glibtop *server, struct psinfo *psinfo, pid_t pid); + +/* Read /proc//usage */ +int glibtop_get_proc_data_usage_s (glibtop *server, struct prusage *prusage, pid_t pid); + +END_LIBGTOP_DECLS + +#endif __GLIBTOP_PRIVATE_H__ diff --git a/sysdeps/solaris/glibtop_server.h b/sysdeps/solaris/glibtop_server.h new file mode 100644 index 00000000..b3822d47 --- /dev/null +++ b/sysdeps/solaris/glibtop_server.h @@ -0,0 +1,52 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. 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_LIBGTOP_DECLS + +#define GLIBTOP_SUID_CPU 0 +#define GLIBTOP_SUID_MEM 0 +#define GLIBTOP_SUID_SWAP 0 +#define GLIBTOP_SUID_UPTIME 0 +#define GLIBTOP_SUID_LOADAVG 0 +#define GLIBTOP_SUID_SHM_LIMITS 0 +#define GLIBTOP_SUID_MSG_LIMITS 0 +#define GLIBTOP_SUID_SEM_LIMITS 0 +#define GLIBTOP_SUID_PROCLIST 0 +#define GLIBTOP_SUID_PROC_STATE 0 +#define GLIBTOP_SUID_PROC_UID 0 +#define GLIBTOP_SUID_PROC_MEM 0 +#define GLIBTOP_SUID_PROC_TIME 0 +#define GLIBTOP_SUID_PROC_SIGNAL 0 +#define GLIBTOP_SUID_PROC_KERNEL 0 +#define GLIBTOP_SUID_PROC_SEGMENT 0 +#define GLIBTOP_SUID_PROC_ARGS 0 +#define GLIBTOP_SUID_PROC_MAP 0 +#define GLIBTOP_SUID_NETLOAD 0 +#define GLIBTOP_SUID_PPP 0 + +END_LIBGTOP_DECLS + +#endif diff --git a/sysdeps/solaris/loadavg.c b/sysdeps/solaris/loadavg.c new file mode 100644 index 00000000..c35c180b --- /dev/null +++ b/sysdeps/solaris/loadavg.c @@ -0,0 +1,51 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , March 1999. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include + +static const unsigned long _glibtop_sysdeps_loadavg = +(1 << GLIBTOP_LOADAVG_LOADAVG); + +/* Init function. */ + +void +glibtop_init_loadavg_s (glibtop *server) +{ + server->sysdeps.loadavg = _glibtop_sysdeps_loadavg; +} + +/* Provides load averange. */ + +void +glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf) +{ + memset (buf, 0, sizeof (glibtop_loadavg)); + + if (getloadavg (buf->loadavg, 3)) + return; + + buf->flags = _glibtop_sysdeps_loadavg; +} diff --git a/sysdeps/solaris/mem.c b/sysdeps/solaris/mem.c new file mode 100644 index 00000000..8a2c31a5 --- /dev/null +++ b/sysdeps/solaris/mem.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_mem = 0; + +/* Init function. */ + +void +glibtop_init_mem_s (glibtop *server) +{ + server->sysdeps.mem = _glibtop_sysdeps_mem; +} + +/* Provides information about memory usage. */ + +void +glibtop_get_mem_s (glibtop *server, glibtop_mem *buf) +{ + memset (buf, 0, sizeof (glibtop_mem)); +} diff --git a/sysdeps/solaris/msg_limits.c b/sysdeps/solaris/msg_limits.c new file mode 100644 index 00000000..adee0dae --- /dev/null +++ b/sysdeps/solaris/msg_limits.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_msg_limits = 0; + +/* Init function. */ + +void +glibtop_init_msg_limits_s (glibtop *server) +{ + server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits; +} + +/* Provides information about sysv ipc limits. */ + +void +glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) +{ + memset (buf, 0, sizeof (glibtop_msg_limits)); +} diff --git a/sysdeps/solaris/netload.c b/sysdeps/solaris/netload.c new file mode 100644 index 00000000..beebedba --- /dev/null +++ b/sysdeps/solaris/netload.c @@ -0,0 +1,45 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , October 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +static const unsigned long _glibtop_sysdeps_netload = 0; + +/* Init function. */ + +void +glibtop_init_netload_s (glibtop *server) +{ + server->sysdeps.netload = _glibtop_sysdeps_netload; +} + +/* Provides network statistics. */ + +void +glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, + const char *interface) +{ + memset (buf, 0, sizeof (glibtop_netload)); +} diff --git a/sysdeps/solaris/open.c b/sysdeps/solaris/open.c new file mode 100644 index 00000000..e9a9888a --- /dev/null +++ b/sysdeps/solaris/open.c @@ -0,0 +1,38 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */ + +void +glibtop_open_s (glibtop *server, const char *program_name, + const unsigned long features, const unsigned flags) +{ + server->name = program_name; + + server->machine.kstat = kstat_open (); + + if (!server->machine.kstat) + glibtop_error_io_r (server, "kstat_open ()"); +} diff --git a/sysdeps/solaris/ppp.c b/sysdeps/solaris/ppp.c new file mode 100644 index 00000000..6d0905d5 --- /dev/null +++ b/sysdeps/solaris/ppp.c @@ -0,0 +1,44 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , October 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +static const unsigned long _glibtop_sysdeps_ppp = 0; + +/* Init function. */ + +void +glibtop_init_ppp_s (glibtop *server) +{ + server->sysdeps.ppp = _glibtop_sysdeps_ppp; +} + +/* Provides PPP/ISDN information. */ + +void +glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device) +{ + memset (buf, 0, sizeof (glibtop_ppp)); +} diff --git a/sysdeps/solaris/procargs.c b/sysdeps/solaris/procargs.c new file mode 100644 index 00000000..7d010d5e --- /dev/null +++ b/sysdeps/solaris/procargs.c @@ -0,0 +1,47 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +static const unsigned long _glibtop_sysdeps_proc_args = 0; + +/* Init function. */ + +void +glibtop_init_proc_args_s (glibtop *server) +{ + server->sysdeps.proc_args = _glibtop_sysdeps_proc_args; +} + +/* Provides detailed information about a process. */ + +char * +glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf, + pid_t pid, unsigned max_len) +{ + memset (buf, 0, sizeof (glibtop_proc_args)); + return NULL; +} diff --git a/sysdeps/solaris/procdata.c b/sysdeps/solaris/procdata.c new file mode 100644 index 00000000..68bbf168 --- /dev/null +++ b/sysdeps/solaris/procdata.c @@ -0,0 +1,73 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +/* Read /proc//psinfo. */ + +int +glibtop_get_proc_data_psinfo_s (glibtop *server, struct psinfo *psinfo, pid_t pid) +{ + int fd; + char buffer [BUFSIZ]; + + sprintf (buffer, "/proc/%d/psinfo", (int) pid); + fd = open (buffer, O_RDONLY); + if (fd < 0) { + glibtop_warn_io_r (server, "open (%s)", buffer); + return -1; + } + + if (read (fd, psinfo, sizeof (struct psinfo)) != sizeof (struct psinfo)) { + close (fd); + glibtop_warn_io_r (server, "read (%s)", buffer); + return -1; + } + + close (fd); + return 0; +} + +int +glibtop_get_proc_data_usage_s (glibtop *server, struct prusage *prusage, pid_t pid) +{ + int fd; + char buffer [BUFSIZ]; + + sprintf (buffer, "/proc/%d/usage", (int) pid); + fd = open (buffer, O_RDONLY); + if (fd < 0) { + glibtop_warn_io_r (server, "open (%s)", buffer); + return -1; + } + + if (read (fd, prusage, sizeof (struct prusage)) != sizeof (struct prusage)) { + close (fd); + glibtop_warn_io_r (server, "read (%s)", buffer); + return -1; + } + + close (fd); + return 0; +} diff --git a/sysdeps/solaris/prockernel.c b/sysdeps/solaris/prockernel.c new file mode 100644 index 00000000..d06f6cab --- /dev/null +++ b/sysdeps/solaris/prockernel.c @@ -0,0 +1,44 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_proc_kernel = 0; + +/* Init function. */ + +void +glibtop_init_proc_kernel_s (glibtop *server) +{ + server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_kernel)); +} diff --git a/sysdeps/solaris/proclist.c b/sysdeps/solaris/proclist.c new file mode 100644 index 00000000..a3451453 --- /dev/null +++ b/sysdeps/solaris/proclist.c @@ -0,0 +1,162 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#define GLIBTOP_PROCLIST_FLAGS 3 + +static const unsigned long _glibtop_sysdeps_proclist = +(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) + +(1 << GLIBTOP_PROCLIST_SIZE); + +/* Init function. */ + +void +glibtop_init_proclist_s (glibtop *server) +{ + server->sysdeps.proclist = _glibtop_sysdeps_proclist; +} + +#define BLOCK_COUNT 256 +#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned)) + +/* Fetch list of currently running processes. + * + * IMPORTANT NOTE: + * On error, this function MUST return NULL and set buf->flags to zero ! + * On success, it returnes a pointer to a list of buf->number elements + * each buf->size big. The total size is stored in buf->total. */ + +unsigned * +glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf, + int64_t which, int64_t arg) +{ + DIR *proc; + struct dirent *entry; + char buffer [BUFSIZ]; + unsigned count, total, pid; + unsigned pids [BLOCK_COUNT], *pids_chain = NULL; + unsigned pids_size = 0, pids_offset = 0, new_size; + struct stat statb; + int len, i, ok; + + memset (buf, 0, sizeof (glibtop_proclist)); + + proc = opendir ("/proc"); + if (!proc) return NULL; + + /* read every every entry in /proc */ + + for (count = total = 0, entry = readdir (proc); + entry; entry = readdir (proc)) { + ok = 1; len = strlen (entry->d_name); + + /* does it consist entirely of digits? */ + + for (i = 0; i < len; i++) + if (!isdigit (entry->d_name [i])) ok = 0; + if (!ok) continue; + + /* convert it in a number */ + + if (sscanf (entry->d_name, "%u", &pid) != 1) continue; + + /* is it really a directory? */ + + sprintf (buffer, "/proc/%d", pid); + + if (stat (buffer, &statb)) continue; + + if (!S_ISDIR (statb.st_mode)) continue; + + /* Fine. Now we first try to store it in pids. If this buffer is + * full, we copy it to the pids_chain. */ + + if (count >= BLOCK_COUNT) { + /* The following call to glibtop_realloc will be + * equivalent to glibtop_malloc () if `pids_chain' is + * NULL. We just calculate the new size and copy `pids' + * to the beginning of the newly allocated block. */ + + new_size = pids_size + BLOCK_SIZE; + + pids_chain = glibtop_realloc_r + (server, pids_chain, new_size); + + memcpy (pids_chain + pids_offset, pids, BLOCK_SIZE); + + pids_size = new_size; + + pids_offset += BLOCK_COUNT; + + count = 0; + } + + /* pids is now big enough to hold at least one single pid. */ + + pids [count++] = pid; + + total++; + } + + closedir (proc); + + /* count is only zero if an error occured (one a running Linux system, + * we have at least one single process). */ + + if (!count) return NULL; + + /* The following call to glibtop_realloc will be equivalent to + * glibtop_malloc if pids_chain is NULL. We just calculate the + * new size and copy pids to the beginning of the newly allocated + * block. */ + + new_size = pids_size + count * sizeof (unsigned); + + pids_chain = glibtop_realloc_r (server, pids_chain, new_size); + + memcpy (pids_chain + pids_offset, pids, count * sizeof (unsigned)); + + pids_size = new_size; + + pids_offset += BLOCK_COUNT; + + /* Since everything is ok now, we can set buf->flags, fill in the + * remaining fields and return the `pids_chain'. */ + + buf->flags = _glibtop_sysdeps_proclist; + + buf->size = sizeof (unsigned); + buf->number = total; + + buf->total = total * sizeof (unsigned); + + return pids_chain; +} diff --git a/sysdeps/solaris/procmap.c b/sysdeps/solaris/procmap.c new file mode 100644 index 00000000..5a6c479a --- /dev/null +++ b/sysdeps/solaris/procmap.c @@ -0,0 +1,50 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + + +#include +#include +#include +#include + +static const unsigned long _glibtop_sysdeps_proc_map = 0; + +/* Init function. */ + +void +glibtop_init_proc_map_s (glibtop *server) +{ + server->sysdeps.proc_map = _glibtop_sysdeps_proc_map; +} + +/* Provides detailed information about a process. */ + +glibtop_map_entry * +glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid) +{ + glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0); + + memset (buf, 0, sizeof (glibtop_proc_map)); + + return NULL; +} diff --git a/sysdeps/solaris/procmem.c b/sysdeps/solaris/procmem.c new file mode 100644 index 00000000..ab0c4170 --- /dev/null +++ b/sysdeps/solaris/procmem.c @@ -0,0 +1,44 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_proc_mem = 0; + +/* Init function. */ + +void +glibtop_init_proc_mem_s (glibtop *server) +{ + server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_mem)); +} diff --git a/sysdeps/solaris/procsegment.c b/sysdeps/solaris/procsegment.c new file mode 100644 index 00000000..b03709d4 --- /dev/null +++ b/sysdeps/solaris/procsegment.c @@ -0,0 +1,44 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_proc_segment = 0; + +/* Init function. */ + +void +glibtop_init_proc_segment_s (glibtop *server) +{ + server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_segment)); +} diff --git a/sysdeps/solaris/procsignal.c b/sysdeps/solaris/procsignal.c new file mode 100644 index 00000000..540960f5 --- /dev/null +++ b/sysdeps/solaris/procsignal.c @@ -0,0 +1,44 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_proc_signal = 0; + +/* Init function. */ + +void +glibtop_init_proc_signal_s (glibtop *server) +{ + server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_signal)); +} diff --git a/sysdeps/solaris/procstate.c b/sysdeps/solaris/procstate.c new file mode 100644 index 00000000..a7d7a143 --- /dev/null +++ b/sysdeps/solaris/procstate.c @@ -0,0 +1,59 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include + +static const unsigned long _glibtop_sysdeps_proc_state = +(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID) + +(1 << GLIBTOP_PROC_STATE_CMD); + +/* Init function. */ + +void +glibtop_init_proc_state_s (glibtop *server) +{ + server->sysdeps.proc_state = _glibtop_sysdeps_proc_state; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid) +{ + struct psinfo psinfo; + + memset (buf, 0, sizeof (glibtop_proc_state)); + + if (glibtop_get_proc_data_psinfo_s (server, &psinfo, pid)) + return; + + buf->uid = psinfo.pr_uid; + buf->gid = psinfo.pr_gid; + + strncpy (buf->cmd, psinfo.pr_fname, 39); + + buf->flags = _glibtop_sysdeps_proc_state; +} diff --git a/sysdeps/solaris/proctime.c b/sysdeps/solaris/proctime.c new file mode 100644 index 00000000..88dfaf4f --- /dev/null +++ b/sysdeps/solaris/proctime.c @@ -0,0 +1,65 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include + +static const unsigned long _glibtop_sysdeps_proc_time = +(1 << GLIBTOP_PROC_TIME_START_TIME) + (1 << GLIBTOP_PROC_TIME_RTIME) + +(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_STIME); + +/* Init function. */ + +void +glibtop_init_proc_time_s (glibtop *server) +{ + server->sysdeps.proc_time = _glibtop_sysdeps_proc_time; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, + pid_t pid) +{ + struct prusage prusage; + + memset (buf, 0, sizeof (glibtop_proc_time)); + + if (glibtop_get_proc_data_usage_s (server, &prusage, pid)) + return; + + buf->start_time = prusage.pr_create.tv_sec * 1E+6 + + prusage.pr_create.tv_nsec / 1E+3; + + buf->rtime = prusage.pr_rtime.tv_sec * 1E+6 + + prusage.pr_rtime.tv_nsec / 1E+3; + buf->utime = prusage.pr_utime.tv_sec * 1E+6 + + prusage.pr_utime.tv_nsec / 1E+3; + buf->stime = prusage.pr_stime.tv_sec * 1E+6 + + prusage.pr_stime.tv_nsec / 1E+3; + + buf->flags = _glibtop_sysdeps_proc_time; +} diff --git a/sysdeps/solaris/procuid.c b/sysdeps/solaris/procuid.c new file mode 100644 index 00000000..bb65c9d8 --- /dev/null +++ b/sysdeps/solaris/procuid.c @@ -0,0 +1,69 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include + +static const unsigned long _glibtop_sysdeps_proc_uid = +(1 << GLIBTOP_PROC_UID_EUID) + (1 << GLIBTOP_PROC_UID_UID) + +(1 << GLIBTOP_PROC_UID_EGID) + (1 << GLIBTOP_PROC_UID_GID) + +(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) + +(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) + +(1 << GLIBTOP_PROC_UID_TTY); + +/* Init function. */ + +void +glibtop_init_proc_uid_s (glibtop *server) +{ + server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid; +} + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid) +{ + struct psinfo psinfo; + + memset (buf, 0, sizeof (glibtop_proc_uid)); + + if (glibtop_get_proc_data_psinfo_s (server, &psinfo, pid)) + return; + + buf->euid = psinfo.pr_euid; + buf->uid = psinfo.pr_uid; + buf->egid = psinfo.pr_egid; + buf->gid = psinfo.pr_gid; + + buf->pid = psinfo.pr_pid; + buf->ppid = psinfo.pr_ppid; + buf->pgrp = psinfo.pr_pgid; + + buf->session = psinfo.pr_sid; + buf->tty = psinfo.pr_ttydev; + + buf->flags = _glibtop_sysdeps_proc_uid; +} diff --git a/sysdeps/solaris/sem_limits.c b/sysdeps/solaris/sem_limits.c new file mode 100644 index 00000000..474ce8c7 --- /dev/null +++ b/sysdeps/solaris/sem_limits.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_sem_limits = 0; + +/* Init function. */ + +void +glibtop_init_sem_limits_s (glibtop *server) +{ + server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits; +} + +/* Provides information about sysv sem limits. */ + +void +glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) +{ + memset (buf, 0, sizeof (glibtop_sem_limits)); +} diff --git a/sysdeps/solaris/shm_limits.c b/sysdeps/solaris/shm_limits.c new file mode 100644 index 00000000..8a024b4a --- /dev/null +++ b/sysdeps/solaris/shm_limits.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_shm_limits = 0; + +/* Init function. */ + +void +glibtop_init_shm_limits_s (glibtop *server) +{ + server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits; +} + +/* Provides information about sysv ipc limits. */ + +void +glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) +{ + memset (buf, 0, sizeof (glibtop_shm_limits)); +} diff --git a/sysdeps/solaris/siglist.c b/sysdeps/solaris/siglist.c new file mode 100644 index 00000000..94abfdc6 --- /dev/null +++ b/sysdeps/solaris/siglist.c @@ -0,0 +1,28 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +const glibtop_signame glibtop_sys_siglist [] = +{ { 0, NULL, NULL } }; diff --git a/sysdeps/solaris/swap.c b/sysdeps/solaris/swap.c new file mode 100644 index 00000000..4731b8e3 --- /dev/null +++ b/sysdeps/solaris/swap.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_swap = 0; + +/* Init function. */ + +void +glibtop_init_swap_s (glibtop *server) +{ + server->sysdeps.swap = _glibtop_sysdeps_swap; +} + +/* Provides information about swap usage. */ + +void +glibtop_get_swap_s (glibtop *server, glibtop_swap *buf) +{ + memset (buf, 0, sizeof (glibtop_swap)); +} diff --git a/sysdeps/solaris/uptime.c b/sysdeps/solaris/uptime.c new file mode 100644 index 00000000..a6189448 --- /dev/null +++ b/sysdeps/solaris/uptime.c @@ -0,0 +1,43 @@ +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , April 1998. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +static const unsigned long _glibtop_sysdeps_uptime = 0; + +/* Init function. */ + +void +glibtop_init_uptime_s (glibtop *server) +{ + server->sysdeps.uptime = _glibtop_sysdeps_uptime; +} + +/* Provides uptime and idle time. */ + +void +glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) +{ + memset (buf, 0, sizeof (glibtop_uptime)); +}