P
plumber
Invité
#include <sys/param.h>
#include <sys/file.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <ctype.h>
#include <errno.h>
#include <kvm.h>
#include <limits.h>
#include <netdb.h>
#include <nlist.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char err[_POSIX2_LINE_MAX];
kvm_t *kd;
int NetTrafficSize;
struct nlist nl[] = {
{ "_mbstat" },
{ "_ipstat" },
{ "_tcbtable" },
{ "_tcpstat" },
{ "_udbtable" },
{ "_udpstat" },
};
int main( int argc,char *argv[]){
kd = kvm_open(NULL, NULL, NULL, O_RDONLY, err)
kvm_nlist(kd, nl);
kvm_read(kd, nl->n_value, &NetTrafficSize, sizeof(int));
printf("networksize %i bytes\n", NetTrafficSize);
kvm_close(kd);
}
voila une petite question sur kvm
je voudrais lire le network traffic input bytes ouput bytes
voila si quelqu'un connait bien ca
#include <sys/file.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <ctype.h>
#include <errno.h>
#include <kvm.h>
#include <limits.h>
#include <netdb.h>
#include <nlist.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char err[_POSIX2_LINE_MAX];
kvm_t *kd;
int NetTrafficSize;
struct nlist nl[] = {
{ "_mbstat" },
{ "_ipstat" },
{ "_tcbtable" },
{ "_tcpstat" },
{ "_udbtable" },
{ "_udpstat" },
};
int main( int argc,char *argv[]){
kd = kvm_open(NULL, NULL, NULL, O_RDONLY, err)
kvm_nlist(kd, nl);
kvm_read(kd, nl->n_value, &NetTrafficSize, sizeof(int));
printf("networksize %i bytes\n", NetTrafficSize);
kvm_close(kd);
}
voila une petite question sur kvm
je voudrais lire le network traffic input bytes ouput bytes
voila si quelqu'un connait bien ca