473,503 Members | 1,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP!!! Shared Memory Error

44 New Member
Hey everyone! I´ve been tying to create a shared memory segment with the size of a structure, as follows:

typedef struct{
int id;
char message[1024];
}data;


In the line where i create the shared memory segment,

if((shmid = shmget(key, sizeof(data), 0766 | IPC_CREAT)) < 0){
perror("Error shmget!\n");
exit(1);
}


i get the error: 'shared memory: "Invalid Argument"'. I´m using Linux SUSE and i´ve also tried to put into the shared memory int arrays of ten elements or less, arrays of ten chars, for example, and no matter the small the array is, wether is of ints or chars, i get always that error. Does somebody could give me a hint?

Thanks for the attention, regards
Dec 25 '06 #1
1 1852
horace1
1,510 Recognized Expert Top Contributor
have a look at the example programs in
http://www.cs.cf.ac.uk/Dave/C/node27.html

I have run these under SUSE 10.1
Dec 26 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3877
by: Google Mike | last post by:
I'm using PHP 4.2.2 on RH9 Linux (with Progeny.com updates, in case you're wondering). I was using shared memory (shm* API) a great deal in my web applications because I have 1GB of RAM on this...
0
4356
by: Srijit Kumar Bhadra | last post by:
Hello, Here is some sample code with pywin32 build 203 and ctypes 0.9.6. Best regards, /Srijit File: SharedMemCreate_Mutex_win32all.py # This application should be used with...
3
2117
by: alanrn | last post by:
I would like to start a dialog on how to implement the equivalent functionality of UNIX shared memory in .NET. I work with a factory automation system. The bulk of the system is written in C/C++....
5
7041
by: Jim | last post by:
Hello, I have a broken server that we are going to be moving off to a new server with a new version of DB2 but here is what I have right now: RedHat 7.0 (2.2.24smp) DB2 v6.1.0.40 I am...
4
1977
by: Zeya | last post by:
I am executing OSQL using System.Diagnostic.Process with the following parameters: -S <servername> -E -Q "BACKUP DATABASE <databasename> to DISK='E:\Temp\Now.bak'" This works from command...
1
3137
by: Alexander Cohen | last post by:
Hi, sometimes ill get this error: FATAL: could not create shared memory segment: Cannot allocate memory DETAIL: Failed system call was shmget(key=2, size=4153344, 03600). HINT: This error...
1
3240
by: BAS | last post by:
Hi , For the past some days i could see the below error on my diag logs, MESSAGE : Unable to create or attach to the segment used for fenced routine communications. Decrease the amount of...
2
2237
by: zeny | last post by:
Hi everybody! In the file "server.c" i created a shared memory segment of the size of a 1024 byte string and then i attached a string to the segment, just like this: int key = 12345; char...
0
712
by: Smokey Grindel | last post by:
I have clients getting this message randomly and I absoulty can not track it down! Is there any way to diagnose these errors? when they happen they always show up as crashing in application.run and...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.