Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] shmget fails with error code = 22
- Date: Tue, 15 Jan 2008 13:36:51 +0100
- From: Botond Botyanszki <tlug@example.com>
- Subject: Re: [tlug] shmget fails with error code = 22
- References: <78d7dd350801150332o4682b307pdac1e74a8b102771@mail.gmail.com>
On Tue, 15 Jan 2008 20:32:50 +0900 "Nguyen Vu Hung" <vuhung16plus@example.com> wrote: > Hi, > > The following code has failed and the error code ( errno ) is 22. > > > shmid = shmget((key_t)ShmKey, (size_t)mem_size, 0666 | IPC_CREAT); > iErrorCode = errno; > > > I've checked /usr/include/asm/error.h and found that > > #define EINVAL 22 /* Invalid argument */ > > which is not very informative. If you check the manpage on linux, it says: EINVAL A new segment was to be created and size < SHMMIN or size > SHMMAX, or no new segment was to be created, a segment with given key existed, but size is greater than the size of that segment. Adding proper error handling with debug helpers to your code can help a lot is such situations, ie: if ( errno != 0 ) { fprintf(STDERR, "shmget(mem_size: %d) failed, %s", mem_size, strerror(errno)); }Attachment: signature.asc
Description: PGP signature
- Follow-Ups:
- [solved] Re: [tlug] shmget fails with error code = 22
- From: Nguyen Vu Hung
- References:
- [tlug] shmget fails with error code = 22
- From: Nguyen Vu Hung
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] shmget fails with error code = 22
- Next by Date: Re: [tlug] shmget fails with error code = 22
- Previous by thread: Re: [tlug] shmget fails with error code = 22
- Next by thread: [solved] Re: [tlug] shmget fails with error code = 22
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links