473,795 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6566
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.l earn.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
3901
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" a command-file for new commands. If a new commands arrives a split of the workload to threads is under- taken that "control themselves" via Semaphore and are joined finally. It works.
4
16932
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, backing up to d: produces the error below. Thanks in advance for any help. Here is the command : backup database model to TestM2 2003-07-19 09:21:35.77 spid51 Error: 15457, Severity: 0, State: 1 2003-07-19 09:21:35.77 spid51 Configuration...
1
2648
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 manager classes in php which perform all the single table related activity. Before inserting new record we are acquiring semaphore on specific key (all the tables are having seprate sem keys), insert the record and release the semaphore.
5
5498
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 applications connecting to other instances of the database works fine. lsattr -E -l sys0 | grep maxuproc gave the output maxuproc 4096
26
4820
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: (void)sprintf(ptr_testing, "This is my string"); This in itself isn't where the actual error occurs. The error occurs at any later point, in the same function where the sprintf() call is made, where I try to assign a value to one of the...
32
4234
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
4607
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 error occassionally: 08/28/2005 17:32:42.82, Verbose, QueryObject.MergeSubQuery, Exception: Too many posts were made to a semaphore in mscorlib. Server stack trace:
5
2523
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 the system is only 128. This could be increased to a higher value but that would not be a permanant solution to my belief. We are using the sem_get, sem_acquire php functions. After the use we are releasing the semaphore by using sem_release.
0
2253
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 when using that code to create a Semaphore instance for an existing system semaphore (i.e., the second time the code gets hit), I get an UnauthorizedAccessException. So I tried specifying that everyone has read rights:
0
10448
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10167
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.