i am trying to compile transcode on AIX v 4.3.3 with gcc 3.0.1
i am getting this error:
gcc -shared -o .libs/libexport_null.so.0 export_null.o -lpthread -ldl -lc -Wl,-bnoentry -Wl,-bexport:.libs/libexport_null.exp
ld: 0711-317 ERROR: Undefined symbol: capability_flag
ld: 0711-317... (0 Replies)
Apparently there are three similar features in the linux API. Can someone explain the difference between the data structures that are initialized by these functions:
(1) pthread_mutex_init
(2) sem_init
(3) sem_get
Thanks,
Siegfried (5 Replies)
Hi
following is a simple shell script,
--------------------------------
#!/usr/bin/tcsh
u=$USER
echo $u
string="cp c2960-lanbase-mz /tftpboot/$u/c2960-lanbase-mz"
string2="cp c2960-lanlite-mz /tftpboot/$u/c2960-lanlite-mz"
output=/users/$u/c2960-log.txt
if &&
then
echo... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
i know when undefined reference shows up the program is saying it is not link to that function but the problem... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
The problem is a function which i typed although it kept saying that it is a undefined reference still. other... (1 Reply)
Hi friends,
I have written this small program using the concept of semaphores. I am a bit confused, hope u can help me with it.
The idea is that
1. Two threads are created
2. First will be displaying 0(zero) on the screen
3. Second will be displaing 1(one) on the screen
4. This process... (2 Replies)
When I try to link a .so file I get the undefined symbol error. Though I have the library file in my system. The compile and linking commands used are as follows
g++ -m64 -g -Wall -I./include -c dxl_sample.c
g++ -o firstprogram -m64 -g -Wall -I./include -Bdynamic... (1 Reply)
When I try to link a .so file I get the undefined symbol error. Though I have the library file in my system. The compile and linking commands used are as follows
g++ -m64 -g -Wall -I./include -c dxl_sample.c
g++ -o firstprogram -m64 -g -Wall -I./include -Bdynamic... (1 Reply)
hallo!
if there are many processes running and I initialize the semaphore like this:
my_sem = sem_open(SEM_NAME, O_CREAT | O_RDWR,
S_IRUSR | S_IWUSR, 10);
(the last argument is 10)
and then i use
sem_wait(my_sem);
sleep(5);
sem_post;
Will 10 processes be able to access the... (1 Reply)
Discussion started by: whatevernever
1 Replies
LEARN ABOUT REDHAT
sem_init
SEMAPHORES(3) Library Functions Manual SEMAPHORES(3)NAME
sem_init, sem_wait, sem_trywait, sem_post, sem_getvalue, sem_destroy - operations on semaphores
SYNOPSIS
#include <semaphore.h>
int sem_init(sem_t *sem, int pshared, unsigned int value);
int sem_wait(sem_t * sem);
int sem_trywait(sem_t * sem);
int sem_post(sem_t * sem);
int sem_getvalue(sem_t * sem, int * sval);
int sem_destroy(sem_t * sem);
DESCRIPTION
This manual page documents POSIX 1003.1b semaphores, not to be confused with SystemV semaphores as described in ipc(5), semctl(2) and
semop(2).
Semaphores are counters for resources shared between threads. The basic operations on semaphores are: increment the counter atomically, and
wait until the counter is non-null and decrement it atomically.
sem_init initializes the semaphore object pointed to by sem. The count associated with the semaphore is set initially to value. The
pshared argument indicates whether the semaphore is local to the current process ( pshared is zero) or is to be shared between several pro-
cesses ( pshared is not zero). LinuxThreads currently does not support process-shared semaphores, thus sem_init always returns with error
ENOSYS if pshared is not zero.
sem_wait suspends the calling thread until the semaphore pointed to by sem has non-zero count. It then atomically decreases the semaphore
count.
sem_trywait is a non-blocking variant of sem_wait. If the semaphore pointed to by sem has non-zero count, the count is atomically
decreased and sem_trywait immediately returns 0. If the semaphore count is zero, sem_trywait immediately returns with error EAGAIN.
sem_post atomically increases the count of the semaphore pointed to by sem. This function never blocks and can safely be used in asynchro-
nous signal handlers.
sem_getvalue stores in the location pointed to by sval the current count of the semaphore sem.
sem_destroy destroys a semaphore object, freeing the resources it might hold. No threads should be waiting on the semaphore at the time
sem_destroy is called. In the LinuxThreads implementation, no resources are associated with semaphore objects, thus sem_destroy actually
does nothing except checking that no thread is waiting on the semaphore.
CANCELLATION
sem_wait is a cancellation point.
ASYNC-SIGNAL SAFETY
On processors supporting atomic compare-and-swap (Intel 486, Pentium and later, Alpha, PowerPC, MIPS II, Motorola 68k), the sem_post func-
tion is async-signal safe and can therefore be called from signal handlers. This is the only thread synchronization function provided by
POSIX threads that is async-signal safe.
On the Intel 386 and the Sparc, the current LinuxThreads implementation of sem_post is not async-signal safe by lack of the required atomic
operations.
RETURN VALUE
The sem_wait and sem_getvalue functions always return 0. All other semaphore functions return 0 on success and -1 on error, in addition to
writing an error code in errno.
ERRORS
The sem_init function sets errno to the following codes on error:
EINVAL value exceeds the maximal counter value SEM_VALUE_MAX
ENOSYS pshared is not zero
The sem_trywait function sets errno to the following error code on error:
EAGAIN the semaphore count is currently 0
The sem_post function sets errno to the following error code on error:
ERANGE after incrementation, the semaphore value would exceed SEM_VALUE_MAX (the semaphore count is left unchanged in this case)
The sem_destroy function sets errno to the following error code on error:
EBUSY some threads are currently blocked waiting on the semaphore.
AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
SEE ALSO pthread_mutex_init(3), pthread_cond_init(3), pthread_cancel(3), ipc(5).
LinuxThreads SEMAPHORES(3)