diff options
author | jhb <jhb@FreeBSD.org> | 2009-06-24 21:10:52 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-06-24 21:10:52 +0000 |
commit | 6f52fe78fb1fc421bc6abb38286a4483aac9cdc0 (patch) | |
tree | 9bcf2215ae277f261cc7bf33f2dde8db38fe41c4 /lib/libc | |
parent | ce189363a0ec4e65f27076207a88142a8554bfbb (diff) | |
download | FreeBSD-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')
-rw-r--r-- | lib/libc/gen/Symbol.map | 2 | ||||
-rw-r--r-- | lib/libc/gen/semctl.c | 30 | ||||
-rw-r--r-- | lib/libc/include/compat.h | 48 | ||||
-rw-r--r-- | lib/libc/sys/Makefile.inc | 6 | ||||
-rw-r--r-- | lib/libc/sys/Symbol.map | 6 |
5 files changed, 84 insertions, 8 deletions
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index 2d23153..4f1efaf 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -247,7 +247,6 @@ FBSD_1.0 { sem_timedwait; sem_post; sem_getvalue; - semctl; setdomainname; sethostname; longjmperror; @@ -362,6 +361,7 @@ FBSD_1.1 { posix_spawnattr_setsigdefault; posix_spawnattr_setsigmask; posix_spawnp; + semctl; tcgetsid; tcsetsid; }; 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); diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h new file mode 100644 index 0000000..13c1d20 --- /dev/null +++ b/lib/libc/include/compat.h @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin <jhb@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This file defines compatiblity symbol versions for old system calls. It + * is included in all generated system call files. + */ + +#ifndef __LIBC_COMPAT_H__ +#define __LIBC_COMPAT_H__ + +#define __sym_compat(sym,impl,verid) \ + .symver impl , sym @ verid + +__sym_compat(__semctl, freebsd7___semctl, FBSD_1.0); +__sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0); +__sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); + +#undef __sym_compat + +#endif /* __LIBC_COMPAT_H__ */ + diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 7e65aa4..ad6b06e 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -53,11 +53,13 @@ SYM_MAPS+= ${.CURDIR}/sys/Symbol.map CLEANFILES+= ${SASM} ${SPSEUDO} ${SASM}: - printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' > ${.TARGET} + printf '#include "compat.h"\n' > ${.TARGET} + printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET} ${SPSEUDO}: + printf '#include "compat.h"\n' > ${.TARGET} printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \ - > ${.TARGET} + >> ${.TARGET} MAN+= abort2.2 accept.2 access.2 acct.2 adjtime.2 \ aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \ diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index d7da905..88bc779 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -31,7 +31,6 @@ FBSD_1.0 { __mac_set_file; __mac_set_link; __mac_set_proc; - __semctl; __setugid; __syscall; __sysctl; @@ -184,7 +183,6 @@ FBSD_1.0 { modstat; mount; mprotect; - msgctl; msgget; msgrcv; msgsnd; @@ -267,7 +265,6 @@ FBSD_1.0 { shm_open; shm_unlink; shmat; - shmctl; shmdt; shmget; shmsys; @@ -332,6 +329,7 @@ FBSD_1.0 { }; FBSD_1.1 { + __semctl; closefrom; cpuset; cpuset_getid; @@ -351,10 +349,12 @@ FBSD_1.1 { mkdirat; mkfifoat; mknodat; + msgctl; openat; readlinkat; renameat; setfib; + shmctl; symlinkat; unlinkat; }; |