Sponsored Content
Top Forums Programming Compilation problem with semtimedop Post 302143389 by rimon on Thursday 1st of November 2007 05:45:50 AM
Old 11-01-2007
The relevant portion of the code I am porting manages semphores between the threads in my application. The specific call which gives me the compliation error is:
Code:
               rc = semtimedop(*sem_idp, sops, nsops, t_spec);

I tried the flags you mention but I'm afraid they don't solve the problem - I still get the compilation error.
 

10 More Discussions You Might Find Interesting

1. Solaris

compilation problem

I am compiling a software named wine When i run make then at the end following error generated. DVAPI32_ -foversion.res version.rc ld.so.1: ../../tools/wrc/wrc: fatal: relocation error: file ../../tools/wrc/wrc: symbol wine_casemap_upper: referenced symbol not found *** Signal 9 make:... (0 Replies)
Discussion started by: mansoorulhaq
0 Replies

2. Programming

compilation problem

i have a class name 1.c in tht i am using function n wich has his body in 2.c and declaration in 2.h now how can i compile 1.c. ex; 1.c int main() { //some data n(10); //somedata } ***** 2.c int n(int k) { //some data } int main() { some data (2 Replies)
Discussion started by: phani_sree
2 Replies

3. Programming

Compilation problem on HP-UX

Hi, Environment : HP-UX avalon B.11.11 U 9000/800 3547052374 unlimited-user license aCC version :aCC: HP ANSI C++ B3910B A.03.37 I need to find a way out of this errors.can anyone help me . $ aCC db.cc -I$ORACLE_HOME/rdbms/public -I/disk1/oracle/product/10.2.0.2/* Error (future)... (1 Reply)
Discussion started by: varuntayur
1 Replies

4. Solaris

A compilation problem when using templates

Hello life savers, I'm having trouble compiling a specific program. The program was originally written for gcc and was compiled successfully under it. When trying to compile under Solaris 11, I get this error: "Hashtable.h", line 170: Error: Could not find a match for hash needed in... (2 Replies)
Discussion started by: yp515
2 Replies

5. AIX

Pro C Compilation problem

Hi, I have AIX 5.3 and my code is written in proc . i am getting following error during compilation Please help?////..... :-d: Compiling with RMS cc -w -q32 -qidirfirst -ISource/Header -I/usr/vacpp/include -q32 -DRMS -DDISEC -DDBG -DBIGENDIAN -DBIT32 -c -q32... (0 Replies)
Discussion started by: ajaysahoo
0 Replies

6. UNIX for Advanced & Expert Users

Problem on Pro*C compilation on HP-UX

Hi, This is my first post to this forum. I have been facing a strange compilation error message. When I try to make a pro*C file on HP-UX ( uname -a shows HP-UX aopc7449 B.11.11 U 9000/800 2416083493 unlimited-user license), ::: Linking... /usr/ccs/bin/ld: profls.o: Not a valid object file... (5 Replies)
Discussion started by: asutoshch
5 Replies

7. AIX

Compilation problem

hi, I first want to apologize for my poor english ! I'm a newbe on Unix system and I have to install NRPE on an AIX 5.3. I have downloaded the NRPE Source code and i need to compile them... the problem is, when I do a: ./configure --enable-command-args --disable-ssl it returns me :... (1 Reply)
Discussion started by: Cyr1us
1 Replies

8. Programming

C Compilation problem

Dear all I am new to C programming In response to the post cat get_time.c #include <stdlib.h> #include <sys/time.h> main() { struct timeval tv; struct timezone tz; struct tm *tm; gettimeofday(&tv, &tz); tm=localtime(&tv.tv_sec); printf("... (2 Replies)
Discussion started by: on9west
2 Replies

9. AIX

Problem in compilation.

Hi, I am executing the below mentioned code:- proc SQLCHECK=SEMANTICS iname=CDBInteractor.pc parse=none code=cpp cpp_suffix=cpp g++ -c main.cpp g++ -o pre_request_engine main.o -I/oracle/oracle/app/product/10g/precomp -L/oracle/oracle/app/product/10g/lib32 -lnsl -ldl And... (2 Replies)
Discussion started by: tushar_tus
2 Replies

10. Programming

Compilation problem with gfortran

Hello everyone, I'm trying since a few days to compile a f90 program with gfortran (on Ubuntu) with a makefile. The fortran program calls 2 routines written in C. Here is my makefile: FC = gfortran SFC = gfortran FFLAGS = -ffree-form -O... (21 Replies)
Discussion started by: leroygr
21 Replies
SEMOP(2)						     Linux Programmer's Manual							  SEMOP(2)

NAME
semop, semtimedop - System V semaphore operations SYNOPSIS
#include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> int semop(int semid, struct sembuf *sops, unsigned nsops); int semtimedop(int semid, struct sembuf *sops, unsigned nsops, struct timespec *timeout); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): semtimedop(): _GNU_SOURCE DESCRIPTION
Each semaphore in a System V semaphore set has the following associated values: unsigned short semval; /* semaphore value */ unsigned short semzcnt; /* # waiting for zero */ unsigned short semncnt; /* # waiting for increase */ pid_t sempid; /* ID of process that did last op */ semop() performs operations on selected semaphores in the set indicated by semid. Each of the nsops elements in the array pointed to by sops specifies an operation to be performed on a single semaphore. The elements of this structure are of type struct sembuf, containing the following members: unsigned short sem_num; /* semaphore number */ short sem_op; /* semaphore operation */ short sem_flg; /* operation flags */ Flags recognized in sem_flg are IPC_NOWAIT and SEM_UNDO. If an operation specifies SEM_UNDO, it will be automatically undone when the process terminates. The set of operations contained in sops is performed in array order, and atomically, that is, the operations are performed either as a com- plete unit, or not at all. The behavior of the system call if not all operations can be performed immediately depends on the presence of the IPC_NOWAIT flag in the individual sem_flg fields, as noted below. Each operation is performed on the sem_num-th semaphore of the semaphore set, where the first semaphore of the set is numbered 0. There are three types of operation, distinguished by the value of sem_op. If sem_op is a positive integer, the operation adds this value to the semaphore value (semval). Furthermore, if SEM_UNDO is specified for this operation, the system subtracts the value sem_op from the semaphore adjustment (semadj) value for this semaphore. This operation can always proceed--it never forces a thread to wait. The calling process must have alter permission on the semaphore set. If sem_op is zero, the process must have read permission on the semaphore set. This is a "wait-for-zero" operation: if semval is zero, the operation can immediately proceed. Otherwise, if IPC_NOWAIT is specified in sem_flg, semop() fails with errno set to EAGAIN (and none of the operations in sops is performed). Otherwise semzcnt (the count of threads waiting until this semaphore's value becomes zero) is incre- mented by one and the thread sleeps until one of the following occurs: o semval becomes 0, at which time the value of semzcnt is decremented. o The semaphore set is removed: semop() fails, with errno set to EIDRM. o The calling thread catches a signal: the value of semzcnt is decremented and semop() fails, with errno set to EINTR. o The time limit specified by timeout in a semtimedop() call expires: semop() fails, with errno set to EAGAIN. If sem_op is less than zero, the process must have alter permission on the semaphore set. If semval is greater than or equal to the abso- lute value of sem_op, the operation can proceed immediately: the absolute value of sem_op is subtracted from semval, and, if SEM_UNDO is specified for this operation, the system adds the absolute value of sem_op to the semaphore adjustment (semadj) value for this semaphore. If the absolute value of sem_op is greater than semval, and IPC_NOWAIT is specified in sem_flg, semop() fails, with errno set to EAGAIN (and none of the operations in sops is performed). Otherwise semncnt (the counter of threads waiting for this semaphore's value to increase) is incremented by one and the thread sleeps until one of the following occurs: o semval becomes greater than or equal to the absolute value of sem_op: the operation now proceeds, as described above. o The semaphore set is removed from the system: semop() fails, with errno set to EIDRM. o The calling thread catches a signal: the value of semncnt is decremented and semop() fails, with errno set to EINTR. o The time limit specified by timeout in a semtimedop() call expires: the system call fails, with errno set to EAGAIN. On successful completion, the sempid value for each semaphore specified in the array pointed to by sops is set to the caller's process ID. In addition, the sem_otime is set to the current time. semtimedop() behaves identically to semop() except that in those cases where the calling thread would sleep, the duration of that sleep is limited by the amount of elapsed time specified by the timespec structure whose address is passed in the timeout argument. (This sleep interval will be rounded up to the system clock granularity, and kernel scheduling delays mean that the interval may overrun by a small amount.) If the specified time limit has been reached, semtimedop() fails with errno set to EAGAIN (and none of the operations in sops is performed). If the timeout argument is NULL, then semtimedop() behaves exactly like semop(). RETURN VALUE
If successful semop() and semtimedop() return 0; otherwise they return -1 with errno indicating the error. ERRORS
On failure, errno is set to one of the following: E2BIG The argument nsops is greater than SEMOPM, the maximum number of operations allowed per system call. EACCES The calling process does not have the permissions required to perform the specified semaphore operations, and does not have the CAP_IPC_OWNER capability. EAGAIN An operation could not proceed immediately and either IPC_NOWAIT was specified in sem_flg or the time limit specified in timeout expired. EFAULT An address specified in either the sops or the timeout argument isn't accessible. EFBIG For some operation the value of sem_num is less than 0 or greater than or equal to the number of semaphores in the set. EIDRM The semaphore set was removed. EINTR While blocked in this system call, the thread caught a signal; see signal(7). EINVAL The semaphore set doesn't exist, or semid is less than zero, or nsops has a nonpositive value. ENOMEM The sem_flg of some operation specified SEM_UNDO and the system does not have enough memory to allocate the undo structure. ERANGE For some operation sem_op+semval is greater than SEMVMX, the implementation dependent maximum value for semval. VERSIONS
semtimedop() first appeared in Linux 2.5.52, and was subsequently backported into kernel 2.4.22. Glibc support for semtimedop() first appeared in version 2.3.3. CONFORMING TO
SVr4, POSIX.1-2001. NOTES
The inclusion of <sys/types.h> and <sys/ipc.h> isn't required on Linux or by any version of POSIX. However, some old implementations required the inclusion of these header files, and the SVID also documented their inclusion. Applications intended to be portable to such old systems may need to include these header files. The sem_undo structures of a process aren't inherited by the child produced by fork(2), but they are inherited across an execve(2) system call. semop() is never automatically restarted after being interrupted by a signal handler, regardless of the setting of the SA_RESTART flag when establishing a signal handler. A semaphore adjustment (semadj) value is a per-process, per-semaphore integer that is the negated sum of all operations performed on a sem- aphore specifying the SEM_UNDO flag. Each process has a list of semadj values--one value for each semaphore on which it has operated using SEM_UNDO. When a process terminates, each of its per-semaphore semadj values is added to the corresponding semaphore, thus undoing the effect of that process's operations on the semaphore (but see BUGS below). When a semaphore's value is directly set using the SETVAL or SETALL request to semctl(2), the corresponding semadj values in all processes are cleared. The semval, sempid, semzcnt, and semnct values for a semaphore can all be retrieved using appropriate semctl(2) calls. The following limits on semaphore set resources affect the semop() call: SEMOPM Maximum number of operations allowed for one semop() call (32) (on Linux, this limit can be read and modified via the third field of /proc/sys/kernel/sem). SEMVMX Maximum allowable value for semval: implementation dependent (32767). The implementation has no intrinsic limits for the adjust on exit maximum value (SEMAEM), the system wide maximum number of undo structures (SEMMNU) and the per-process maximum number of undo entries system parameters. BUGS
When a process terminates, its set of associated semadj structures is used to undo the effect of all of the semaphore operations it per- formed with the SEM_UNDO flag. This raises a difficulty: if one (or more) of these semaphore adjustments would result in an attempt to decrease a semaphore's value below zero, what should an implementation do? One possible approach would be to block until all the semaphore adjustments could be performed. This is however undesirable since it could force process termination to block for arbitrarily long peri- ods. Another possibility is that such semaphore adjustments could be ignored altogether (somewhat analogously to failing when IPC_NOWAIT is specified for a semaphore operation). Linux adopts a third approach: decreasing the semaphore value as far as possible (i.e., to zero) and allowing process termination to proceed immediately. In kernels 2.6.x, x <= 10, there is a bug that in some circumstances prevents a thread that is waiting for a semaphore value to become zero from being woken up when the value does actually become zero. This bug is fixed in kernel 2.6.11. EXAMPLE
The following code segment uses semop() to atomically wait for the value of semaphore 0 to become zero, and then increment the semaphore value by one. struct sembuf sops[2]; int semid; /* Code to set semid omitted */ sops[0].sem_num = 0; /* Operate on semaphore 0 */ sops[0].sem_op = 0; /* Wait for value to equal 0 */ sops[0].sem_flg = 0; sops[1].sem_num = 0; /* Operate on semaphore 0 */ sops[1].sem_op = 1; /* Increment value by one */ sops[1].sem_flg = 0; if (semop(semid, sops, 2) == -1) { perror("semop"); exit(EXIT_FAILURE); } SEE ALSO
clone(2), semctl(2), semget(2), sigaction(2), capabilities(7), sem_overview(7), svipc(7), time(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2013-04-17 SEMOP(2)
All times are GMT -4. The time now is 02:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy