shmget() returning EINVAL for constant size and flags
shmget() returning EINVAL for constant size and flags
- Subject: shmget() returning EINVAL for constant size and flags
- From: rohan a <email@hidden>
- Date: Sat, 5 Dec 2009 11:00:15 +0530
Hello All,
I am using shmget() to allocate shared memory in my backup/restore utility.
int shmget(key_t key, size_t size, int shmflg);
The size and shmflg I am passing are always constant. If shmget()
returns EEXIST I try again with another key until shared memory is
allocated.
On some occasions, shmget() fails and I am getting an EINVAL error.
I dont think the arguments are invalid because, I am using constant
values for size and shmflg for every call and most of the calls are
successful.
The Man page says this for EINVAL :
[EINVAL] No shared memory segment is to be created, and a
shared memory segment exists for
key, but the size of the segment associated
with it is less than size, which is non-zero. nonzero.
zero.
However, with every shmget() call, I use the same size 524288 and same
flags with different key ofcourse.
Then why should I get an EINVAL ?
Is it possible that another application is allocating shared memory
using this key but a size lesser than 524288 ?
Along with checking EEXIST for existence of a memory location with
this key should I also check for EINVAL ?
That is if EINVAL is returned, should I try to allocate with another key ?
Thanks,
Rohan
_______________________________________________
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