Re: problem with sysctlbyname on 10.4 or ppc
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hello darwin dev, I use sysctlbyname() to get some information like kern.version. It works fine on my mac (10.5 on i386) but on the mac of one of my client, he have this error: Can't get 'kern.version' from sysctl: Bad file descriptor What can be the problem? The code (c++) I used to get sysctl: string getsysctlstr(const string &name) { string value("Unknown"); size_t len; -Wall -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes and either pay attention to the warnings, or also add: -Werror so you can't compile at all if there are any warnings. -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Feb 20, 2008, at 8:16 AM, Vianney Lecroart wrote: When I asked him to do a sysctl -A, I saw that kern.version is available: http://pastebin.com/f395945d I'm going to guess he's using a 64 bit application rather than a 32 bit application, and does not realize sizeof(size_t) == 8 while sizeof(int) == 4 in the LP64 compilation environment, whereas they are both 4 in the ILP32 compilation environment. You really need to specify the following warning options in your compilation: This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert