summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/semctl.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-06-24 21:10:52 +0000
committerjhb <jhb@FreeBSD.org>2009-06-24 21:10:52 +0000
commit6f52fe78fb1fc421bc6abb38286a4483aac9cdc0 (patch)
tree9bcf2215ae277f261cc7bf33f2dde8db38fe41c4 /lib/libc/gen/semctl.c
parentce189363a0ec4e65f27076207a88142a8554bfbb (diff)
downloadFreeBSD-src-6f52fe78fb1fc421bc6abb38286a4483aac9cdc0.zip
FreeBSD-src-6f52fe78fb1fc421bc6abb38286a4483aac9cdc0.tar.gz
Change the ABI of some of the structures used by the SYSV IPC API:
- The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned short. - The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned short. - The mode member of struct ipc_perm is now mode_t instead of unsigned short (this is merely a style bug). - The rather dubious padding fields for ABI compat with SV/I386 have been removed from struct msqid_ds and struct semid_ds. - The shm_segsz member of struct shmid_ds is now a size_t instead of an int. This removes the need for the shm_bsegsz member in struct shmid_kernel and should allow for complete support of SYSV SHM regions >= 2GB. - The shm_nattch member of struct shmid_ds is now an int instead of a short. - The shm_internal member of struct shmid_ds is now gone. The internal VM object pointer for SHM regions has been moved into struct shmid_kernel. - The existing __semctl(), msgctl(), and shmctl() system call entries are now marked COMPAT7 and new versions of those system calls which support the new ABI are now present. - The new system calls are assigned to the FBSD-1.1 version in libc. The FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls. - A simplistic framework for tagging system calls with compatibility symbol versions has been added to libc. Version tags are added to system calls by adding an appropriate __sym_compat() entry to src/lib/libc/incldue/compat.h. [1] PR: kern/16195 kern/113218 bin/129855 Reviewed by: arch@, rwatson Discussed with: kan, kib [1]
Diffstat (limited to 'lib/libc/gen/semctl.c')
-rw-r--r--lib/libc/gen/semctl.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/libc/gen/semctl.c b/lib/libc/gen/semctl.c
index 4b5283f..156d18c 100644
--- a/lib/libc/gen/semctl.c
+++ b/lib/libc/gen/semctl.c
@@ -29,15 +29,19 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#define _WANT_SEMUN_OLD
+
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <stdarg.h>
#include <stdlib.h>
-extern int __semctl(int semid, int semnum, int cmd, union semun *arg);
+int __semctl(int semid, int semnum, int cmd, union semun *arg);
+int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg);
-int semctl(int semid, int semnum, int cmd, ...)
+int
+semctl(int semid, int semnum, int cmd, ...)
{
va_list ap;
union semun semun;
@@ -55,3 +59,25 @@ int semctl(int semid, int semnum, int cmd, ...)
return (__semctl(semid, semnum, cmd, semun_ptr));
}
+
+int
+freebsd7_semctl(int semid, int semnum, int cmd, ...)
+{
+ va_list ap;
+ union semun_old semun;
+ union semun_old *semun_ptr;
+
+ va_start(ap, cmd);
+ if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL
+ || cmd == SETVAL || cmd == SETALL) {
+ semun = va_arg(ap, union semun_old);
+ semun_ptr = &semun;
+ } else {
+ semun_ptr = NULL;
+ }
+ va_end(ap);
+
+ return (freebsd7___semctl(semid, semnum, cmd, semun_ptr));
+}
+
+__sym_compat(semctl, freebsd7_semctl, FBSD_1.0);
OpenPOWER on IntegriCloud