Solved

Shmget Fail

Posted on 2004-07-30
1
271 Views
Last Modified: 2010-04-21
Hello expert,

  I am trying to create a section of share memory using

shmget((key_t)1234, sizeof(struct shared_use_st), 0666 | IPC_CREAT);

it return ok if the size I want to create is around 552 (printf("Size:%d", sizeof(struct shared_use_st));

However shmget() return -1 if the size of the structure is increase to 560.

I do a "free" command on my console and it shows I should have 10.9M free RAM

          total          used     free
mem: 14844        3900     10944

Any suggestion?
0
Comment
Question by:sctccomm
1 Comment
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 11683191
if ( shmget((key_t)1234, sizeof(struct shared_use_st), 0666 | IPC_CREAT) < 0 )
     perror ("shmget error:");

add this perror statement .. this will tell you the cause of failure and its code ... More details of the code can be found at the shmget man page
man shmget
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question