Date: Sat, 13 Oct 2001 13:06:29 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: Paolo Pisati <flag@libero.it> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: First prg with sysctl Message-ID: <20011013130629.A58520@dan.emsphone.com> In-Reply-To: <20011013194902.A38183@newluxor.skynet.org> References: <20011013194902.A38183@newluxor.skynet.org>
index | next in thread | previous in thread | raw e-mail
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;
mib[1] = KERN_MAXPROC;
len = sizeof(maxproc);
sysctl(mib, 2, &maxproc, &len, NULL, 0);
Note: always compile your programs with -Wall. gcc would have flagged
this as:
test.c:18: warning: passing arg 4 of `sysctl' makes pointer from integer without a cast
--
Dan Nelson
dnelson@allantgroup.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011013130629.A58520>
