1848824 Members
7584 Online
104037 Solutions
New Discussion

HP-UX semop 32 vs 64 bit

 
SOLVED
Go to solution
Tan, Wei-Chong
New Member

HP-UX semop 32 vs 64 bit

Hi,

I am developing a multi task (fork) program that uses semaphore to prevent concurrent access on some resources. On a 32 bit compilation, the process can obtain the semaphore on semop() but on a 64 bit compilation of the same code base, semop() would either "hang" there waiting forever or if IPC_NOWAIT is specified, it will return with EAGAIN.
Is there something I need to do when compile under +DD64 for semop()? semget() and semctl() correctly obtain and release the semaphore though, as can be seen using ipcs -s.

Any help is appreciated.
Thanks.

Yours truly,
Wei-Chong.
2 REPLIES 2
Laurent Menase
Honored Contributor
Solution

Re: HP-UX semop 32 vs 64 bit

This is usually due to a bad arg in semctl
The arg of semctl must be defined as an union, not a plain int:

union semun {
int val;
struct semid_ds *buf;
ushort *array;
} arg;

semctl(semid, 0, SETVAL, arg)
harry d brown jr
Honored Contributor

Re: HP-UX semop 32 vs 64 bit

This is a good link to start at http://h21007.www2.hp.com/dev/

live free or die
harry d brown jr
Live Free or Die