• 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: How can I get the maximum shared memory segment size in program?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I get the maximum shared memory segment size in program?


  • Subject: Re: How can I get the maximum shared memory segment size in program?
  • From: bady yu <email@hidden>
  • Date: Fri, 4 Jan 2008 17:17:42 +0800

Terry,

You are right.

In my original codes, I declared shmmax variable as long. And sysctlbyname can't return the correct value.
After I changed shmmax to long long. sysctlbyname return the exact value as sysctl command.


Then my question is how can I know the exact type of each return value for kinds of keys? Although I can know some information from "man 8 sysctl", I don't know the exact type of the integer/string/struct, like whether integer is long long , long or something else.


On Dec 31, 2007, at 4:38 AM, Terry Lambert wrote:

You did not provie the types of len or shmmax, nor whether or not len contains sizeof(shmmax), nor whether you are calling this from a 32 or 64 bit program. But I suspect you are passing the wrong type and size in to the sysctlbyname() call.

-- Terry

On Dec 28, 2007, at 9:34 PM, bady yu <email@hidden> wrote:
I can use "sysctl kern.sysv.shmmax" or "ipcs -M" to get the integer(4194304). But they are both command line tools. It is not convenient to call it inside the problem.

I also have tried to use the sysctlbyname system call: sysctlbyname("kern.sysv.shmmax", &shmmax, &len, NULL, NULL). Although this call return 0, the shmmax variable does not hold the correct value.

By the way, my system is Leopard.

Can anybody tell me an appropriate way? Thank you in advance!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com


This email sent to email@hidden

_______________________________________________ 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
  • Prev by Date: Re: calling sysctl at startup - how?
  • Next by Date: Re:Building kext for Leopard and Tiger
  • Previous by thread: Re: DKIOCCDREADTOC returning BCD numbers?
  • Next by thread: ECX_BAD_ACCESS again
  • Index(es):
    • Date
    • Thread