Re: First prg with sysctl

2001-10-13 Thread David Taylor
On Sat, 13 Oct 2001, Paolo Pisati wrote: > > Someone can tell me why this piece of code doesn't work? > > #include > #include > #include > #include > #include > #include > #include > > int main(void) { > int mib[5], *count; Here you define 'count' as an uninitialised pointer to an inte

Re: First prg with sysctl

2001-10-13 Thread Dan Nelson
In the last episode (Oct 13), Paolo Pisati said: > Someone can tell me why this piece of code doesn't work? The sysctl(3) manpage says that arg 4 is a pointer to the length of the storage area pointed to by arg 3. In fact, there's an example in the manpage: mib[0] = CTL_KERN;

First prg with sysctl

2001-10-13 Thread Paolo Pisati
Someone can tell me why this piece of code doesn't work? #include #include #include #include #include #include #include int main(void) { int mib[5], *count; mib[0]=CTL_NET; mib[1]=PF_LINK; mib[2]=NETLINK_GENERIC; mib[3]=IFMIB_SYSTEM; mib[4]=IFMIB_IFCOUNT; sysctl(mib, 5, co