fix g_malloc usage on non-Linux platforms (patch by Benoit Dejean

2004-03-09  Bastien Nocera  <hadess@hadess.net>

	* fix g_malloc usage on non-Linux platforms (patch by Benoit
	Dejean <bnet@ifrance.com>)
This commit is contained in:
Bastien Nocera
2004-03-09 23:02:06 +00:00
committed by Bastien Nocera
parent 58c15ceeda
commit a795ff4847
20 changed files with 58 additions and 21 deletions

View File

@@ -1,3 +1,8 @@
2004-03-09 Bastien Nocera <hadess@hadess.net>
* procargs.c: (glibtop_get_proc_args_s): fix g_malloc usage on non-Linux
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
* Makefile.am: install only one library, libgtop-2.0

View File

@@ -73,7 +73,7 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
}
size = max_len != 0 ? max_len : 4096;
args_buffer = g_malloc (server, size);
args_buffer = g_malloc (size);
if (args_buffer == NULL)
{
glibtop_error_io_r (server, "Cannot malloc procsinfo");
@@ -111,7 +111,7 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
len += strlen(args_buffer + len) + 1;
}
args = g_malloc (server, len);
args = g_malloc (len);
if (args == NULL)
{
glibtop_error_io_r (server, "Cannot malloc procsinfo");

View File

@@ -1,3 +1,10 @@
2004-03-09 Bastien Nocera <hadess@hadess.net>
* procargs.c: (glibtop_get_proc_args_p):
* procmap.c: (glibtop_get_proc_map_p):
* swap.c: (glibtop_get_swap_p): fix g_malloc usage on non-Linux
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
* Makefile.am: install only one library, libgtop-2.0

View File

@@ -93,7 +93,7 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
size += strlen (*ptr)+1;
size += 2;
retval = g_malloc (server, size);
retval = g_malloc (size);
memset (retval, 0, size);
for (ptr = args; *ptr; ptr++) {

View File

@@ -131,7 +131,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
buf->total = buf->number * buf->size;
maps = g_malloc (server, buf->total);
maps = g_malloc (buf->total);
memset (maps, 0, buf->total);

View File

@@ -267,7 +267,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
/* List of swap devices and sizes. */
sw_size = nswdev * sizeof (*sw);
sw = g_malloc (server, sw_size);
sw = g_malloc (sw_size);
if (kvm_read (server->machine.kd, ptr, sw, sw_size) != (ssize_t)sw_size) {
glibtop_warn_io_r (server, "kvm_read (*swdevt)");
@@ -399,7 +399,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
return;
}
swaplist = g_malloc (server, nswap * sizeof (struct swapent));
swaplist = g_malloc (nswap * sizeof (struct swapent));
if (swapctl (SWAP_STATS, swaplist, nswap) != nswap) {
glibtop_warn_io_r (server, "swapctl (SWAP_STATS)");

View File

@@ -1,3 +1,8 @@
2004-03-09 Bastien Nocera <hadess@hadess.net>
* proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
* Makefile.am: install only one library, libgtop-2.0

View File

@@ -77,7 +77,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
buf->total = buf->number * sizeof (unsigned);
pids_chain = g_malloc (server, buf->total);
pids_chain = g_malloc (buf->total);
memcpy (pids_chain, tbl.proclist.pids, buf->total);

View File

@@ -1,3 +1,9 @@
2004-03-09 Bastien Nocera <hadess@hadess.net>
* procargs.c: (glibtop_get_proc_args_s):
* procmap.c: (glibtop_get_proc_map_s): fix g_malloc usage on non-Linux
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
* Makefile.am: install only one library, libgtop-2.0

View File

@@ -60,7 +60,7 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
break;
if(max_len)
{
ret = g_malloc(server, max_len + 1);
ret = g_malloc(max_len + 1);
if(max_len < len)
len = max_len;
memcpy(ret, pinfo.pr_psargs, len);
@@ -68,7 +68,7 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
}
else
{
ret = g_malloc(server, len + 1);
ret = g_malloc(len + 1);
memcpy(ret, pinfo.pr_psargs, len);
ret[len] = 0;

View File

@@ -120,8 +120,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
return NULL;
}
#endif
if(!(entry = g_malloc(server,
nmaps * sizeof(glibtop_map_entry))))
if(!(entry = g_malloc(nmaps * sizeof(glibtop_map_entry))))
return NULL;
buf->number = nmaps;
buf->size = sizeof(glibtop_map_entry);

View File

@@ -1,3 +1,9 @@
2004-03-09 Bastien Nocera <hadess@hadess.net>
* open.c: (glibtop_open_p):
* proclist.c: (glibtop_get_proclist_p): fix g_malloc usage on non-Linux
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
* Makefile.am: install only one library, libgtop-2.0

View File

@@ -169,7 +169,7 @@ glibtop_open_p (glibtop *server, const char *program_name,
sizeof (struct page);
server->machine.physpage = (struct page *)
g_malloc (server, server->machine.bytesize);
g_malloc (server->machine.bytesize);
/* get the page size with "getpagesize" and
* calculate pageshift from it */

View File

@@ -71,7 +71,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
proc_size = nproc * sizeof (unsigned);
proc_list = g_malloc (server, proc_size);
proc_list = g_malloc (proc_size);
/* Write process list. */