Added new features to get network load:
typedef struct _glibtop_netload glibtop_netload;
struct _glibtop_netload
{
u_int64_t flags,
mtu, /* GLIBTOP_NETLOAD_MTU */
address, /* GLIBTOP_NETLOAD_ADDRESS */
packets_in, /* GLIBTOP_NETLOAD_PACKETS_IN */
packets_out, /* GLIBTOP_NETLOAD_PACKETS_OUT */
bytes_in, /* GLIBTOP_NETLOAD_BYTES_IN */
bytes_out, /* GLIBTOP_NETLOAD_BYTES_OUT */
errors_in, /* GLIBTOP_NETLOAD_ERRORS_IN */
errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */
collisions; /* GLIBTOP_NETLOAD_COLLISIONS */
};
Returns network load of the given interface, it is specified as string
like `isppp' or `ippp0':
extern void glibtop_get_netload_l __P((glibtop *, glibtop_netload *, const char *));
This commit is contained in:
@@ -47,6 +47,7 @@ GLIBTOP_SUID_PROC_KERNEL +
|
||||
GLIBTOP_SUID_PROC_SEGMENT +
|
||||
GLIBTOP_SUID_PROC_ARGS +
|
||||
GLIBTOP_SUID_PROC_MAP +
|
||||
GLIBTOP_SUID_NETLOAD +
|
||||
GLIBTOP_SUID_PPP;
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -26,7 +26,7 @@ handle_slave_connection (int input, int output)
|
||||
{
|
||||
glibtop *server = glibtop_global_server;
|
||||
int64_t *param_ptr;
|
||||
void *ptr;
|
||||
const void *ptr;
|
||||
|
||||
unsigned short max_len;
|
||||
pid_t pid;
|
||||
@@ -230,6 +230,12 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
|
||||
resp->offset = _offset_data (proc_segment);
|
||||
break;
|
||||
#endif
|
||||
#if GLIBTOP_SUID_NETLOAD
|
||||
case GLIBTOP_CMND_NETLOAD:
|
||||
glibtop_get_netload_p (server, &resp->u.data.netload, parameter);
|
||||
resp->offset = _offset_data (netload);
|
||||
break;
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PPP
|
||||
case GLIBTOP_CMND_PPP:
|
||||
memcpy (&device, parameter, sizeof (unsigned short));
|
||||
|
||||
Reference in New Issue
Block a user