diff options
Diffstat (limited to 'sys/compat/common')
-rw-r--r-- | sys/compat/common/Makefile | 8 | ||||
-rw-r--r-- | sys/compat/common/kern_ipc_35.c | 79 |
2 files changed, 83 insertions, 4 deletions
diff --git a/sys/compat/common/Makefile b/sys/compat/common/Makefile index cd44db92fb3..90c4e67399f 100644 --- a/sys/compat/common/Makefile +++ b/sys/compat/common/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2004/02/27 17:36:16 deraadt Exp $ +# $OpenBSD: Makefile,v 1.17 2004/05/03 17:38:48 millert Exp $ # $NetBSD: Makefile,v 1.8 1996/05/18 15:52:19 christos Exp $ LIB= compat @@ -10,9 +10,9 @@ MACHINE_ARCH= ${XMACHINE_ARCH} .PATH: ${COMPATDIR} SRCS= compat_exec.c compat_util.c compat_dir.c compat_vm.c \ - kern_exit_43.c kern_ipc_23.c kern_info_09.c kern_info_43.c \ - kern_resource_43.c kern_sig_43.c tty_43.c uipc_syscalls_43.c \ - vfs_syscalls_25.c vfs_syscalls_43.c vm_43.c + kern_exit_43.c kern_ipc_23.c kern_ipc_35.c kern_info_09.c \ + kern_info_43.c kern_resource_43.c kern_sig_43.c tty_43.c \ + uipc_syscalls_43.c vfs_syscalls_25.c vfs_syscalls_43.c vm_43.c # really, all machines where sizeof(int) != sizeof(long) .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "amd64") && \ diff --git a/sys/compat/common/kern_ipc_35.c b/sys/compat/common/kern_ipc_35.c new file mode 100644 index 00000000000..d3956b24070 --- /dev/null +++ b/sys/compat/common/kern_ipc_35.c @@ -0,0 +1,79 @@ +/* $OpenBSD: kern_ipc_35.c,v 1.1 2004/05/03 17:38:48 millert Exp $ */ + +/* + * Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/proc.h> +#include <sys/sem.h> +#include <sys/shm.h> + +#include <sys/mount.h> +#include <sys/syscallargs.h> + +#ifdef SYSVMSG +/* + * Old-style shmget(2) used int for the size parameter, we now use size_t. + */ +int +compat_35_sys_shmget(struct proc *p, void *v, register_t *retval) +{ + struct compat_35_sys_shmget_args /* { + syscallarg(key_t) key; + syscallarg(int) size; + syscallarg(int) shmflg; + } */ *uap = v; + struct sys_shmget_args /* { + syscallarg(key_t) key; + syscallarg(size_t) size; + syscallarg(int) shmflg; + } */ shmget_args; + + SCARG(&shmget_args, key) = SCARG(uap, key); + SCARG(&shmget_args, size) = (size_t)SCARG(uap, size); + SCARG(&shmget_args, shmflg) = SCARG(uap, shmflg); + + return (sys_shmget(p, &shmget_args, retval)); +} +#endif + +#ifdef SYSVSEM +/* + * Old-style shmget(2) used u_int for the nsops parameter, we now use size_t. + */ +int +compat_35_sys_semop(struct proc *p, void *v, register_t *retval) +{ + struct compat_35_sys_semop_args /* { + syscallarg(int) semid; + syscallarg(struct sembuf *) sops; + syscallarg(u_int) nsops; + } */ *uap = v; + struct sys_semop_args /* { + syscallarg(int) semid; + syscallarg(struct sembuf *) sops; + syscallarg(size_t) nsops; + } */ semop_args; + + SCARG(&semop_args, semid) = SCARG(uap, semid); + SCARG(&semop_args, sops) = SCARG(uap, sops); + SCARG(&semop_args, nsops) = (size_t)SCARG(uap, nsops); + + return (sys_semop(p, &semop_args, retval)); +} +#endif |