From owner-freebsd-arch@FreeBSD.ORG Tue Jun 23 18:01:05 2009 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81913106566C for ; Tue, 23 Jun 2009 18:01:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 568408FC14 for ; Tue, 23 Jun 2009 18:01:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EDF7046B45 for ; Tue, 23 Jun 2009 14:01:04 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id E83CD8A085 for ; Tue, 23 Jun 2009 14:01:03 -0400 (EDT) From: John Baldwin To: arch@FreeBSD.org Date: Tue, 23 Jun 2009 13:41:42 -0400 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906231341.43104.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 23 Jun 2009 14:01:03 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Subject: [PATCH] SYSV IPC ABI rototill X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 18:01:05 -0000 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