Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2009 13:41:42 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        arch@FreeBSD.org
Subject:   [PATCH] SYSV IPC ABI rototill
Message-ID:  <200906231341.43104.jhb@freebsd.org>

next in thread | raw e-mail | index | archive | help
There have been a several issues with the existing ABI of the SYSV IPC 
structures over the past several years and it has been on the todo list for 
at least both 7.0 and 8.0.  Rather than putting it off until 9.0 I sat down 
and worked on it this week.  The patch is not super complex.  First, the ABI 
changes done to each structure:

- struct ipc_perm
  - The uid/cuid members are now of type uid_t instead of unsigned short.
  - The gid/cgid members are now of type gid_t instead of unsigned short.
  - The mode member is now of type mode_t instead of unsigned short.  This
    is just a comsetic tweak though on current architectures since mode_t ==
    uint16_t.
- struct msqid_ds
  - The various pad fields have been removed.
- struct semid_ds
  - The various pad fields have been removed.  The comments suggest that these
    fields were added to follow the SV/I386 ABI.  However, if FreeBSD ever
    supports SYSV binaries, I imagine they will use a separate system call
    ABI.  In that case there is no reason that the FreeBSD ABI needs the
    padding, so I have removed them.
- struct shmid_ds and struct shmid_kernel
  - shm_segsz is now a size_t instead of an int.  As a result of this fix I've
    retired shm_bsegsz from shmid_kernel as it is no longer needed.
  - shm_nattch is now an int instead of a short.  The structure padding was
    such that the space was already there anyway.
  - shm_internal is gone.  There is no good reason to be exposing random
    kernel pointers to userland.  I've replaced the in-kernel use by moving
    the VM object pointer into a new 'object' field in shmid_kernel.

As far as system calls, the only functions in the SYSV IPC API that are 
affected are msgctl(), semctl(), and shmctl().  As a result, I have made new 
versions of __semctl(), msgctl(), and shmctl() and marked the old slots as 
COMPAT7.  However, another set of system calls provide an old interface to 
the SYSV IPC API: msgsys(), semsys(), and shmsys().  Rather than adding 
compat shims for these kludgy syscalls, I am simply deprecating them 
altogether and they will only exist under COMPAT7.

Binaries and libraries (including libc) have not used the foosys() system 
calls to implement the SYSV IPC API since FreeBSD 4.x.  They proved 
problematic on certain architectures such as sparc64, etc.  Given that, I 
think that they can safely be relegated to the legacy bin.

The patch is at http://www.FreeBSD.org/~jhb/patches/sysvipc_abi.patch

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906231341.43104.jhb>