> I'm studying a book on UNIX programming and in the SysV IPC chapter
>the book states that these interfaces will soon be obsoleted by
>improved Posix interfaces to solve the same IPC problems. I tried
>finding info on this and all I came up with was that Posix.1b now
>incorporates these calls and that shared memory is implemented as
>mmap() in Posix.1b. Are these the only changes? What about semaphores
>and message queues? Do these "new" Posix calls use file descriptors or
>are they still non-UNIX-oriented as the SysV calls?
mmap(), et al. instead of shm*()
void *mmap(void *addr, size_t len, int prot,
int flags, int filedes, off_t off);
int munmap(void *addr, size_t len);
int mprotect(const void *addr, size_t len, int prot);
int msync(void *addr, size_t len, int flags);
int shm_open(const char *name, int oflag, mode_t mode);
int shm_unlink(const char *name);
The "filedes" option to mmap() is either a file descriptor from
open() or from shm_open(). The "name" parameter for the shm_*()
functions may or may not be part of the filename space, depending on
the implementation. (Except for embedded systems one would
typically expect the "name" to be in the regular filename space.)
sem_*() instead of sem*()
int sem_init(sem_t *sem, int pshared, unsigned int value);
int sem_destroy(sem_t *sem);
sem_t *sem_open(const char *name, int oflag, ...);
int sem_close(sem_t *sem);
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);
The msg*() routines have no direct replacement in POSIX.1b, as it was
considered that shared memory plus semaphores should be an adequate
mechanism for an application to define its own messaging discipline.
--Ken Pizzini