Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Shmget Fail

Posted on 2004-07-30
1
Medium Priority
?
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 45

Accepted Solution

by:
sunnycoder earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

647 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