Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit


» HP STK home
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
Content starts here

non-critical impact:

msem_init - msemaphores must be in mapped memory (NcWn349)

KN Impacts

Problem description

msemaphore structures can be on the heap and the stack on Tru64 UNIX but not on HP-UX.

An msemaphore structure represents a binary semaphore and is initialized with the msem_init function. On both platforms, they are only supported within a mapped file or anonymous memory region created by a successful call to the mmap function, and having both read and write access.

On Tru64 UNIX, however, msemaphore structures can also be on the heap or the stack, although that is not documented or supported. Some applications use this feature because it lets them use the msemaphore interfaces as general synchronization interfaces for both processes and threads.

On HP-UX, the msem_init function will fail if the msemaphore structure is on the heap or the stack. It will return NULL and set errno to EINVAL. The manpage notes that the return value may change to -1 in a future release, but that is incorrect.


C/C++ Functionsmsem_init        

See also

Solution description

If you are using msemaphore structures on the heap or the stack to synchronize threads, use pthread mutexes instead.

See also

Problem summary

classifications source types OS release severity type
KN C, C++ any HP-UX 11i version non-critical warning
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.