• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: problem with sysctlbyname on 10.4 or ppc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with sysctlbyname on 10.4 or ppc


  • Subject: Re: problem with sysctlbyname on 10.4 or ppc
  • From: Terry Lambert <email@hidden>
  • Date: Wed, 20 Feb 2008 14:44:36 -0800

On Feb 20, 2008, at 8:16 AM, Vianney Lecroart wrote:
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

When I asked him to do a sysctl -A, I saw that kern.version is available:
http://pastebin.com/f395945d


What can be the problem?

The code (c++) I used to get sysctl:

string getsysctlstr(const string &name)
{
	string value("Unknown");
	size_t len;

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:

	-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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >problem with sysctlbyname on 10.4 or ppc (From: "Vianney Lecroart" <email@hidden>)

  • Prev by Date: Re: USB device prevented from mounting
  • Next by Date: Sun RPC in OSX
  • Previous by thread: problem with sysctlbyname on 10.4 or ppc
  • Next by thread: A Couple launchd user agent questions
  • Index(es):
    • Date
    • Thread