Solved

Shmget Fail

Posted on 2004-07-30
1
279 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 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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