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 /sys/kern/sysv_msg.c | |
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 'sys/kern/sysv_msg.c')
-rw-r--r-- | sys/kern/sysv_msg.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index e2f0c5d..c7c67d4 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1260,10 +1260,11 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_RD, #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) SYSCALL_MODULE_HELPER(msgsys); +SYSCALL_MODULE_HELPER(freebsd7_msgctl); /* XXX casting to (sy_call_t *) is bogus, as usual. */ static sy_call_t *msgcalls[] = { - (sy_call_t *)msgctl, (sy_call_t *)msgget, + (sy_call_t *)freebsd7_msgctl, (sy_call_t *)msgget, (sy_call_t *)msgsnd, (sy_call_t *)msgrcv }; @@ -1293,5 +1294,65 @@ msgsys(td, uap) error = (*msgcalls[uap->which])(td, &uap->a2); return (error); } + +#define CP(src, dst, fld) do { (dst).fld = (src).fld; } while (0) + +#ifndef _SYS_SYSPROTO_H_ +struct freebsd7_msgctl_args { + int msqid; + int cmd; + struct msqid_ds_old *buf; +}; +#endif +int +freebsd7_msgctl(td, uap) + struct thread *td; + struct freebsd7_msgctl_args *uap; +{ + struct msqid_ds_old msqold; + struct msqid_ds msqbuf; + int error; + + DPRINTF(("call to freebsd7_msgctl(%d, %d, %p)\n", uap->msqid, uap->cmd, + uap->buf)); + if (uap->cmd == IPC_SET) { + error = copyin(uap->buf, &msqold, sizeof(msqold)); + if (error) + return (error); + ipcperm_old2new(&msqold.msg_perm, &msqbuf.msg_perm); + CP(msqold, msqbuf, msg_first); + CP(msqold, msqbuf, msg_last); + CP(msqold, msqbuf, msg_cbytes); + CP(msqold, msqbuf, msg_qnum); + CP(msqold, msqbuf, msg_qbytes); + CP(msqold, msqbuf, msg_lspid); + CP(msqold, msqbuf, msg_lrpid); + CP(msqold, msqbuf, msg_stime); + CP(msqold, msqbuf, msg_rtime); + CP(msqold, msqbuf, msg_ctime); + } + error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); + if (error) + return (error); + if (uap->cmd == IPC_STAT) { + bzero(&msqold, sizeof(msqold)); + ipcperm_new2old(&msqbuf.msg_perm, &msqold.msg_perm); + CP(msqbuf, msqold, msg_first); + CP(msqbuf, msqold, msg_last); + CP(msqbuf, msqold, msg_cbytes); + CP(msqbuf, msqold, msg_qnum); + CP(msqbuf, msqold, msg_qbytes); + CP(msqbuf, msqold, msg_lspid); + CP(msqbuf, msqold, msg_lrpid); + CP(msqbuf, msqold, msg_stime); + CP(msqbuf, msqold, msg_rtime); + CP(msqbuf, msqold, msg_ctime); + error = copyout(&msqold, uap->buf, sizeof(struct msqid_ds_old)); + } + return (error); +} + +#undef CP + #endif /* COMPAT_FREEBSD4 || COMPAT_FREEBSD5 || COMPAT_FREEBSD6 || COMPAT_FREEBSD7 */ |