473,385 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Semaphore Error - Storage size of arg

Gvs
Hi,

I'm trying to compile an example semaphore .c file taken straight from the
internet, but it won't compile with the error;

gcc seminit.c -o seminit
seminit.c: In function `main':
seminit.c:16: error: storage size of 'arg' isn't known

Does anyone know how to correct this error.??

for reference the code is located at

http://www.ecst.csuchico.edu/~beej/guide/ipc/seminit.c

Any help would be much appreciated.

Kind Regards,

Matt
Nov 14 '05 #1
2 6521
On Tue, 17 May 2005 11:08:44 +0800, "Gvs" <tr****@westnet.com.au>
wrote in comp.lang.c:
Hi,

I'm trying to compile an example semaphore .c file taken straight from the
internet, but it won't compile with the error;

gcc seminit.c -o seminit
seminit.c: In function `main':
seminit.c:16: error: storage size of 'arg' isn't known

Does anyone know how to correct this error.??

for reference the code is located at

http://www.ecst.csuchico.edu/~beej/guide/ipc/seminit.c

Any help would be much appreciated.

Kind Regards,

Matt


There is no definition of the type 'enum semun', so it is an
incomplete type and you cannot define objects of an incomplete type.

This is not a standard C type, so presumably it is defined in one of
the three non-standard headers (the ones beginning with "sys/"), at
least on the implementation of the person who wrote the code.

That platform and implementation might or might be the same as yours,
and it might or might not have this type defined in one of those
headers. In any case, you need to take this to a group that supports
your compiler/operating system combination, because it is an extension
and not a type defined by the C language.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2
Gvs wrote:
Hi,

I'm trying to compile an example semaphore .c file taken straight from the
internet, but it won't compile with the error;

gcc seminit.c -o seminit
seminit.c: In function `main':
seminit.c:16: error: storage size of 'arg' isn't known

Does anyone know how to correct this error.??
for reference the code is located at
http://www.ecst.csuchico.edu/~beej/guide/ipc/seminit.c
Any help would be much appreciated.


Please post a small compilable program demonstrating your problem rather
than a URL.
Unfortunately,

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>

make your example code non-standard and implementation-specific, so
off-topic here. Further, the calls of exit with an argument of 1 make
your code non-portable; the only values with standard meanings are 0,
EXIT_SUCCESS, and EXIT_FAILURE.

Your error message comes from this line:
union semun arg;
The meaning of "union semun" is expected by your code to be provided in
one of those non-standard header files. Apparently your versions of
these does not do so.
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: dede | last post by:
Dear community, having written a working example for using Semphores on a windows client, I created a little "server-application" that does the following: A Server continously "listens/tails"...
4
by: Margie | last post by:
Hi, has anyone gotten the error "semaphore timeout" when trying to do a backup to disk? The disk is a logical partition. There are two drives, c: and d:. Backing up to c: is fine. However,...
1
by: rushik | last post by:
Hello all, I m facing an interesting problem related to semaphore in php. We are using a huge business application running on LAMP. For database operations we are maintaining centralized DB...
5
by: Udy | last post by:
Hi, We have a custom application used by a customer on DB2 8.1.5 AIX 5.1, we have tested it with 8.1.0 AIX 5.1 and everything works fine. But with 8.1.5 we get the above error. The other...
26
by: steve | last post by:
Well I've been working all morning and have finally found the source of my "bus error (signal 10)" errors. The source is odd. The error occurs in any function where I make the function call: ...
32
by: William Stacey [MVP] | last post by:
Here is the link. If you find an issue or think of a feature, please post a reply or send an email. Cheers! http://www.mvptools.com/doco/csharp/semaphoredjikstra.htm -- William Stacey, MVP
5
by: marvind | last post by:
I tried using a Semaphore class (have included the full listing reproduced from article Figure 1 at the end of this email) in .NET 1.1. It works fine most of the time, however, I see the following...
5
by: Unni | last post by:
Hello all, I m facing a memory related problem with semaphores. Our business application uses semaphores extensively and the limit imposed by the OS on the number of semaphores that can exist on...
0
by: Samuel R. Neff | last post by:
I'm having trouble creating a Semaphore with read-access rights for everyone. Originally I was trying to use this code: semaphore = new Semaphore(maxLocks, maxLocks, "RwLock#" + name); but...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.