From 45f48220bb95a27195cdf63fb3cae4c09c053cde Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 24 Jun 2009 20:01:13 +0000 Subject: Deprecate the msgsys(), semsys(), and shmsys() system calls by moving them under COMPAT_FREEBSD[4567]. Starting with FreeBSD 5.0 the SYSV IPC API was implemented via direct system calls (e.g. msgctl(), msgget(), etc.) rather than indirecting through the var-args *sys() system calls. The shmsys() system call was already effectively deprecated for all but COMPAT_FREEBSD4 already as its implementation for the !COMPAT_FREEBSD4 case was to simply invoke nosys(). --- sys/kern/sysv_msg.c | 74 +++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 34 deletions(-) (limited to 'sys/kern/sysv_msg.c') diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 3a05a347bd5b..e2f0c5d4144e 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -50,6 +50,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_sysvipc.h" #include @@ -85,12 +86,6 @@ static int sysvmsg_modload(struct module *, int, void *); static void msg_freehdr(struct msg *msghdr); -/* 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 *)msgsnd, (sy_call_t *)msgrcv -}; - #ifndef MSGSSZ #define MSGSSZ 8 /* Each segment must be 2^N long */ #endif @@ -308,7 +303,6 @@ static moduledata_t sysvmsg_mod = { NULL }; -SYSCALL_MODULE_HELPER(msgsys); SYSCALL_MODULE_HELPER(msgctl); SYSCALL_MODULE_HELPER(msgget); SYSCALL_MODULE_HELPER(msgsnd); @@ -317,33 +311,6 @@ SYSCALL_MODULE_HELPER(msgrcv); DECLARE_MODULE(sysvmsg, sysvmsg_mod, SI_SUB_SYSV_MSG, SI_ORDER_FIRST); MODULE_VERSION(sysvmsg, 1); -/* - * Entry point for all MSG calls. - */ -int -msgsys(td, uap) - struct thread *td; - /* XXX actually varargs. */ - struct msgsys_args /* { - int which; - int a2; - int a3; - int a4; - int a5; - int a6; - } */ *uap; -{ - int error; - - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) - return (ENOSYS); - if (uap->which < 0 || - uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) - return (EINVAL); - error = (*msgcalls[uap->which])(td, &uap->a2); - return (error); -} - static void msg_freehdr(msghdr) struct msg *msghdr; @@ -1289,3 +1256,42 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN, &msginfo.msgseg, 0, "Number of message segments"); SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_RD, NULL, 0, sysctl_msqids, "", "Message queue IDs"); + +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +SYSCALL_MODULE_HELPER(msgsys); + +/* 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 *)msgsnd, (sy_call_t *)msgrcv +}; + +/* + * Entry point for all MSG calls. + */ +int +msgsys(td, uap) + struct thread *td; + /* XXX actually varargs. */ + struct msgsys_args /* { + int which; + int a2; + int a3; + int a4; + int a5; + int a6; + } */ *uap; +{ + int error; + + if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + return (ENOSYS); + if (uap->which < 0 || + uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) + return (EINVAL); + error = (*msgcalls[uap->which])(td, &uap->a2); + return (error); +} +#endif /* COMPAT_FREEBSD4 || COMPAT_FREEBSD5 || COMPAT_FREEBSD6 || + COMPAT_FREEBSD7 */ -- cgit v1.2.3