diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2009-07-31 20:32:55 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2009-07-31 20:32:55 +0000 |
| commit | 8da54652091fcad3e830641d8816ae3a597bf018 (patch) | |
| tree | ad18b966c1bbeac1cee89ce589624d6ed84005fc /lib/libc | |
| parent | 66c5b4f06276a22a4e712e53cc05c825283d8d2e (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/Symbol.map | 2 | ||||
| -rw-r--r-- | lib/libc/gen/msgctl.3 | 26 | ||||
| -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 | ||||
| -rw-r--r-- | lib/libc/sys/semctl.2 | 3 | ||||
| -rw-r--r-- | lib/libc/sys/shmctl.2 | 15 |
8 files changed, 97 insertions, 39 deletions
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index 60a397cc120c..473f4e6ec2b9 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -257,7 +257,6 @@ FBSD_1.0 { sem_timedwait; sem_post; sem_getvalue; - semctl; setdomainname; sethostname; longjmperror; @@ -339,6 +338,7 @@ FBSD_1.0 { FBSD_1.1 { fdopendir; feature_present; + semctl; }; FBSDprivate_1.0 { diff --git a/lib/libc/gen/msgctl.3 b/lib/libc/gen/msgctl.3 index 79787255395c..7d4ec0d81285 100644 --- a/lib/libc/gen/msgctl.3 +++ b/lib/libc/gen/msgctl.3 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd November 24, 1997 +.Dd April 3, 2008 .Dt MSGCTL 3 .Os .Sh NAME @@ -65,18 +65,14 @@ struct msqid_ds { struct ipc_perm msg_perm; /* msg queue permission bits */ struct msg *msg_first; /* first message in the queue */ struct msg *msg_last; /* last message in the queue */ - u_long msg_cbytes; /* number of bytes in use on the queue */ - u_long msg_qnum; /* number of msgs in the queue */ - u_long msg_qbytes; /* max # of bytes on the queue */ + msglen_t msg_cbytes; /* number of bytes in use on the queue */ + msgqnum_t msg_qnum; /* number of msgs in the queue */ + msglen_t msg_qbytes; /* max # of bytes on the queue */ pid_t msg_lspid; /* pid of last msgsnd() */ pid_t msg_lrpid; /* pid of last msgrcv() */ time_t msg_stime; /* time of last msgsnd() */ - long msg_pad1; time_t msg_rtime; /* time of last msgrcv() */ - long msg_pad2; time_t msg_ctime; /* time of last msgctl() */ - long msg_pad3; - long msg_pad4[4]; }; .Ed .Pp @@ -89,13 +85,13 @@ structure is defined in and looks like this: .Bd -literal struct ipc_perm { - ushort cuid; /* creator user id */ - ushort cgid; /* creator group id */ - ushort uid; /* user id */ - ushort gid; /* group id */ - ushort mode; /* r/w permission */ - ushort seq; /* sequence # (to generate unique msg/sem/shm id) */ - key_t key; /* user specified msg/sem/shm key */ + uid_t cuid; /* creator user id */ + gid_t cgid; /* creator group id */ + uid_t uid; /* user id */ + gid_t gid; /* group id */ + mode_t mode; /* r/w permission */ + unsigned short seq; /* sequence # (to generate unique ipcid) */ + key_t key; /* user specified msg/sem/shm key */ }; .Ed .Pp diff --git a/lib/libc/gen/semctl.c b/lib/libc/gen/semctl.c index 4b5283f897c8..156d18cac70d 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 000000000000..13c1d2043e76 --- /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 e0064fce99e3..e74850e20008 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+= _exit.2 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 03e6bb2e47a1..a6376c068584 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; @@ -190,7 +189,6 @@ FBSD_1.0 { modstat; mount; mprotect; - msgctl; msgget; msgrcv; msgsnd; @@ -271,7 +269,6 @@ FBSD_1.0 { settimeofday; setuid; shmat; - shmctl; shmdt; shmget; shmsys; @@ -336,13 +333,16 @@ FBSD_1.0 { }; FBSD_1.1 { + __semctl; closefrom; cpuset; cpuset_getid; cpuset_setid; cpuset_getaffinity; cpuset_setaffinity; + msgctl; setfib; + shmctl; }; FBSDprivate_1.0 { diff --git a/lib/libc/sys/semctl.2 b/lib/libc/sys/semctl.2 index 01a984ac4c84..adfb9ef52d79 100644 --- a/lib/libc/sys/semctl.2 +++ b/lib/libc/sys/semctl.2 @@ -148,12 +148,9 @@ struct semid_ds { struct sem *sem_base; /* pointer to first semaphore in set */ u_short sem_nsems; /* number of sems in set */ time_t sem_otime; /* last operation time */ - long sem_pad1; /* SVABI/386 says I need this here */ time_t sem_ctime; /* last change time */ /* Times measured in secs since */ /* 00:00:00 GMT, Jan. 1, 1970 */ - long sem_pad2; /* SVABI/386 says I need this here */ - long sem_pad3[4]; /* SVABI/386 says I need this here */ }; .Ed .Sh RETURN VALUES diff --git a/lib/libc/sys/shmctl.2 b/lib/libc/sys/shmctl.2 index 2ac7d0541c11..d3299af0e402 100644 --- a/lib/libc/sys/shmctl.2 +++ b/lib/libc/sys/shmctl.2 @@ -100,14 +100,13 @@ structure is defined as follows: .Bd -literal struct shmid_ds { struct ipc_perm shm_perm; /* operation permission structure */ - int shm_segsz; /* size of segment in bytes */ + size_t shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ - short shm_nattch; /* number of current attaches */ + int shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ - void *shm_internal; /* sysv stupidity */ }; .Ed .Sh RETURN VALUES @@ -133,16 +132,6 @@ the shared memory segment's owner or creator. Permission denied due to mismatch between operation and mode of shared memory segment. .El -.Sh "BUGS" -The segment size has size_t type. -The shm_segsz member of the -.Vt shmid_ds -structure has type int, which is too short to represent the full range -of values for a segment size. -If shared memory limits are raised to allow segments with size > 2 GB -to be created, be aware that IPC_STAT call may return a truncated value -for shm_segsz. -.El .Sh "SEE ALSO" .Xr shmat 2 , .Xr shmdt 2 , |
