Manual commit from my local git-svn which is broken :/
svn path=/trunk/; revision=2578
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2007-05-08 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (_glibtop_bsd_get_fsusage_read_write):
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
|
||||
Fixed build on OpenBSD.
|
||||
Patch by Jasper Lievisse Adriaanse <jasper@nedbsd.nl>.
|
||||
|
||||
2007-02-18 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* AUTHORS:
|
||||
|
@@ -54,7 +54,9 @@ _glibtop_bsd_get_fsusage_read_write(glibtop *server,
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(__OpenBSD__)
|
||||
buf->read = sfs.f_syncreads + sfs.f_asyncreads;
|
||||
#endif
|
||||
buf->write = sfs.f_syncwrites + sfs.f_asyncwrites;
|
||||
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
|
||||
}
|
||||
|
@@ -233,7 +233,11 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
||||
buf->flags |= GLIBTOP_NETLOAD_ADDRESS6;
|
||||
}
|
||||
/* FIXME prefix6, scope6 */
|
||||
#if defined (__OpenBSD__)
|
||||
ifaddraddr = (u_long) ifaddr.ifa.ifa_list.tqe_next;
|
||||
#else
|
||||
ifaddraddr = (u_long) ifaddr.ifa.ifa_link.tqe_next;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@@ -352,5 +352,19 @@ glibtop_get_sysdeps(glibtop_sysdeps *buf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_wd:
|
||||
* @buf:
|
||||
* @pid: Process id to get the user and tty information
|
||||
*
|
||||
* Get the root directory and the working directories
|
||||
*
|
||||
* Returns: A NULL-terminated list of working directories.
|
||||
*/
|
||||
char**
|
||||
glibtop_get_proc_wd(glibtop_proc_wd *buf, pid_t pid)
|
||||
{
|
||||
return glibtop_get_proc_wd_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,3 +1,29 @@
|
||||
2007-05-07 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* procwd.c:
|
||||
|
||||
Always set buf->number.
|
||||
|
||||
2007-05-07 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* glibtop_private.c (safe_readlink):
|
||||
|
||||
Simplified.
|
||||
|
||||
* procopenfiles.c:
|
||||
|
||||
Use safe_readlink.
|
||||
|
||||
2007-05-07 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* procwd.c:
|
||||
|
||||
Implemented.
|
||||
|
||||
* glibtop_private.c (safe_readlink):
|
||||
|
||||
New function.
|
||||
|
||||
2007-03-13 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (get_sys_path), (linux_2_6_0):
|
||||
|
@@ -8,7 +8,7 @@ libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procargs.c procmap.c siglist.c \
|
||||
sysinfo.c netload.c ppp.c glibtop_private.c \
|
||||
fsusage.c netlist.c procopenfiles.c
|
||||
fsusage.c netlist.c procopenfiles.c procwd.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@
|
||||
|
||||
|
@@ -184,3 +184,20 @@ has_sysfs(void)
|
||||
|
||||
return sysfs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
ret = readlink(path, buf, bufsiz - 1);
|
||||
|
||||
if (ret == -1) {
|
||||
g_warning("Could not read link %s : %s", path, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buf[ret] = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -145,6 +145,8 @@ check_cpu_line_warn(glibtop *server, const char *line, unsigned i)
|
||||
gboolean
|
||||
has_sysfs(void) G_GNUC_INTERNAL G_GNUC_CONST;
|
||||
|
||||
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#define GLIBTOP_SUID_PROC_MAP 0
|
||||
#define GLIBTOP_SUID_NETLOAD 0
|
||||
#define GLIBTOP_SUID_NETLIST 0
|
||||
#define GLIBTOP_SUID_PROC_WD 0
|
||||
#define GLIBTOP_SUID_PPP 0
|
||||
#define GLIBTOP_SUID_PROC_FILE 0
|
||||
|
||||
|
@@ -204,9 +204,8 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi
|
||||
g_snprintf(fn, sizeof fn, "/proc/%d/fd/%s",
|
||||
pid, direntry->d_name);
|
||||
|
||||
rv = readlink(fn, tgt, sizeof(tgt) - 1);
|
||||
if(rv < 0) continue;
|
||||
tgt[rv] = '\0';
|
||||
if (!safe_readlink(fn, tgt, tgt))
|
||||
continue;
|
||||
|
||||
entry.fd = atoi(direntry->d_name);
|
||||
|
||||
|
Reference in New Issue
Block a user