Compare commits
6 Commits
2.41.2
...
LIBGTOP_2_
Author | SHA1 | Date | |
---|---|---|---|
|
d07192b5c9 | ||
|
b6464a97ec | ||
|
89aac22fac | ||
|
935d321bf0 | ||
|
9ea7201e24 | ||
|
f4089fa71f |
8
NEWS
8
NEWS
@@ -1,3 +1,11 @@
|
|||||||
|
12 January 2009: Overview of changes in 2.24.3
|
||||||
|
==============================================
|
||||||
|
* linux:
|
||||||
|
- fixed potential memory leak. Vincent Untz.
|
||||||
|
- fixed read(2) usage. Should fix the missing cpus bug in system-monitor.
|
||||||
|
* darwin:
|
||||||
|
- fixed build. "paul".
|
||||||
|
|
||||||
22 Septembre 2008: Overview of changes in 2.24.0
|
22 Septembre 2008: Overview of changes in 2.24.0
|
||||||
================================================
|
================================================
|
||||||
* Translation updates.
|
* Translation updates.
|
||||||
|
@@ -4,7 +4,7 @@ dnl
|
|||||||
|
|
||||||
m4_define([libgtop_major_version], [2])
|
m4_define([libgtop_major_version], [2])
|
||||||
m4_define([libgtop_minor_version], [24])
|
m4_define([libgtop_minor_version], [24])
|
||||||
m4_define([libgtop_micro_version], [0])
|
m4_define([libgtop_micro_version], [3])
|
||||||
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
|
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
|
||||||
|
|
||||||
dnl increment if the interface has additions, changes, removals.
|
dnl increment if the interface has additions, changes, removals.
|
||||||
|
@@ -101,7 +101,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
libgtop_use_machine_h=yes
|
libgtop_use_machine_h=yes
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_have_sysinfo=yes
|
libgtop_have_sysinfo=yes
|
||||||
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod g+s $(bindir)/libgtop_server2'
|
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod g+s $(bindir)/libgtop_server2'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if test x$hacker_mode = xyes ; then
|
if test x$hacker_mode = xyes ; then
|
||||||
|
@@ -6,7 +6,7 @@ libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c sysinfo.c
|
|||||||
|
|
||||||
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c \
|
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c \
|
||||||
cpu.c mem.c swap.c uptime.c loadavg.c shm_limits.c msg_limits.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 \
|
sem_limits.c procaffinity.c proclist.c procstate.c procuid.c proctime.c \
|
||||||
procmem.c procsignal.c prockernel.c procsegment.c procargs.c \
|
procmem.c procsignal.c prockernel.c procsegment.c procargs.c \
|
||||||
procmap.c netload.c ppp.c netlist.c procopenfiles.c procwd.c
|
procmap.c netload.c ppp.c netlist.c procopenfiles.c procwd.c
|
||||||
|
|
||||||
|
@@ -44,6 +44,7 @@ G_BEGIN_DECLS
|
|||||||
#define GLIBTOP_SUID_NETLIST 0
|
#define GLIBTOP_SUID_NETLIST 0
|
||||||
#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
|
#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
|
||||||
#define GLIBTOP_SUID_PROC_WD (1 << GLIBTOP_SYSDEPS_PROC_WD)
|
#define GLIBTOP_SUID_PROC_WD (1 << GLIBTOP_SYSDEPS_PROC_WD)
|
||||||
|
#define GLIBTOP_SUID_PROC_AFFINITY 0
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -129,29 +129,29 @@ get_sys_path(glibtop* server, const char *device, char **stat_path, const char *
|
|||||||
|
|
||||||
static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename = NULL;
|
||||||
const char *format;
|
const char *format;
|
||||||
int ret;
|
int ret;
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ];
|
||||||
char device[64];
|
char device[64];
|
||||||
|
|
||||||
if (!get_device(server, path, device, sizeof device))
|
if (!get_device(server, path, device, sizeof device))
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
get_sys_path(server, device, &filename, &format);
|
get_sys_path(server, device, &filename, &format);
|
||||||
|
|
||||||
ret = try_file_to_buffer(buffer, sizeof buffer, filename);
|
ret = try_file_to_buffer(buffer, sizeof buffer, filename);
|
||||||
|
|
||||||
if(ret < 0) return;
|
if (ret < 0) goto out;
|
||||||
|
|
||||||
if (sscanf(buffer, format, &buf->read, &buf->write) != 2) {
|
if (sscanf(buffer, format, &buf->read, &buf->write) != 2) {
|
||||||
glibtop_warn_io_r(server, "Could not parse %s", filename);
|
glibtop_warn_io_r(server, "Could not parse %s", filename);
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(filename);
|
|
||||||
|
|
||||||
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
|
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
|
||||||
|
out:
|
||||||
|
g_free(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -67,14 +67,18 @@ enum TRY_FILE_TO_BUFFER
|
|||||||
TRY_FILE_TO_BUFFER_READ = -2
|
TRY_FILE_TO_BUFFER_READ = -2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Doesn't handle bufsiz == 0
|
||||||
|
*/
|
||||||
int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
|
int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
|
||||||
{
|
{
|
||||||
char path[4096];
|
char path[4096];
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t len;
|
size_t len = 0;
|
||||||
|
ssize_t nread = 0;
|
||||||
va_list pa;
|
va_list pa;
|
||||||
|
|
||||||
if (bufsiz <= sizeof(char*))
|
if (G_UNLIKELY(bufsiz <= sizeof(char*)))
|
||||||
g_warning("Huhu, bufsiz of %lu looks bad", (gulong)bufsiz);
|
g_warning("Huhu, bufsiz of %lu looks bad", (gulong)bufsiz);
|
||||||
|
|
||||||
va_start(pa, format);
|
va_start(pa, format);
|
||||||
@@ -84,15 +88,31 @@ int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
|
|||||||
|
|
||||||
va_end(pa);
|
va_end(pa);
|
||||||
|
|
||||||
|
bufsiz--; /* reserve 1 for trailing NUL */
|
||||||
buffer [0] = '\0';
|
buffer [0] = '\0';
|
||||||
|
|
||||||
if((fd = open (path, O_RDONLY)) < 0)
|
if((fd = open (path, O_RDONLY)) < 0)
|
||||||
return TRY_FILE_TO_BUFFER_OPEN;
|
return TRY_FILE_TO_BUFFER_OPEN;
|
||||||
|
|
||||||
len = read (fd, buffer, bufsiz - 1);
|
while (len < bufsiz) {
|
||||||
|
nread = read (fd, buffer + len, bufsiz - len);
|
||||||
|
|
||||||
|
if (G_UNLIKELY(nread < 0)) {
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
len += nread;
|
||||||
|
|
||||||
|
if (nread == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
if (len < 0)
|
if (nread < 0)
|
||||||
return TRY_FILE_TO_BUFFER_READ;
|
return TRY_FILE_TO_BUFFER_READ;
|
||||||
|
|
||||||
buffer [len] = '\0';
|
buffer [len] = '\0';
|
||||||
|
Reference in New Issue
Block a user