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][solved] Re: [tlug] shmget fails with error code = 22
- Date: Wed, 16 Jan 2008 15:02:31 +0900
- From: "Nguyen Vu Hung" <vuhung16plus@example.com>
- Subject: [solved] Re: [tlug] shmget fails with error code = 22
- References: <78d7dd350801150332o4682b307pdac1e74a8b102771@mail.gmail.com> <20080115133651.7907911f@siliconium.net>
2008/1/15, Botond Botyanszki <tlug@example.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)); > } I did have an error handling. The cause of the problem turns out to be: We tried to shmget() with mem_size = 64MB but the shared memory, which was created before that, is a different value. The size of shared memory is define in configuration file someone has changed it. Thanks all for hinting me. -- Best Regards, Nguyen Hung Vu ( Nguyễn Vũ Hưng ) vuhung16plus{remove}@example.com An inquisitive look at Harajuku http://www.flickr.com/photos/vuhung/sets/72157600109218238/
- References:
- [tlug] shmget fails with error code = 22
- From: Nguyen Vu Hung
- Re: [tlug] shmget fails with error code = 22
- From: Botond Botyanszki
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] shmget fails with error code = 22
- Next by Date: [tlug] detect fake HTTP referrer
- Previous by thread: Re: [tlug] shmget fails with error code = 22
- Next by thread: Re: [tlug] shmget fails with error code = 22
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links