Posix.1b IPC and SysV IPC

Posix.1b IPC and SysV IPC

Post by Yoav Cohen-Siv » Sun, 02 Feb 1997 04:00:00



 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?

        Thanks,
        Yoav

 
 
 

Posix.1b IPC and SysV IPC

Post by Ken Pizzi » Wed, 05 Feb 1997 04:00:00




> 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

 
 
 

1. Berkeley IPC & SysV IPC

I've noticed that SunOS4.1.3 has include files sys/msg.h, sys/sem.h,
and sys/shm.h even though it is a BSD4.3 os. OSF/1 V1.3 has the include
file socket.h, even though it is a SysV os. Since Berkeley IPC and
SysV IPC are distinct methods and useful in their own ways, I was wondering
how universal it is for Unices to have both methods. i.e. would it be
wise for a piece of PD software to rely on a system to have one, the other,
or both?
--
                                        Nelson Brown

2. Newbie question cache-DNS on AIX4.3.2

3. posix.1b IPC?

4. apache + unix: >1 domain possible?

5. Posix.1b IPC support in 2.5.1 ?

6. detecting a piped input from csh script

7. RFI: POSIX 1b IPC Status

8. testing accesibility of directory?

9. Reg. POSIX.1b IPC methods (shared Memory)

10. SYSV/Posix IPC with fds.

11. SYS V IPC, how does "ipcs" get list of existing IPC structures

12. AT&T IPC-802 /IPC-900 Drivers for SCO?

13. How to discover current SYSV IPC status under Solaris 5.3