Solved

Shmget Fail

Posted on 2004-07-30
1
251 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now