summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2011-07-07 01:19:41 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2011-07-07 01:19:41 +0000
commit4f4f5d50106d50e0e25cf63882f38f93735ea2c5 (patch)
tree753369d46a7e0fcbcd5d3828269180a64e981a74 /sys/compat/linux
parentc6b7429694901047aeae3768f6bafd34e6a0dc0d (diff)
remove all the old COMPAT_43 syscalls. The option itself remains for
the other things it enables. Move a few old wrappers into linux compat where they are still being used. ok deraadt guenther
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_file.c46
-rw-r--r--sys/compat/linux/linux_misc.c17
-rw-r--r--sys/compat/linux/linux_resource.c27
-rw-r--r--sys/compat/linux/linux_socket.c100
-rw-r--r--sys/compat/linux/syscalls.master11
5 files changed, 182 insertions, 19 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 3cce3741841..584aaf10bff 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_file.c,v 1.24 2010/07/26 01:56:27 guenther Exp $ */
+/* $OpenBSD: linux_file.c,v 1.25 2011/07/07 01:19:39 tedu Exp $ */
/* $NetBSD: linux_file.c,v 1.15 1996/05/20 01:59:09 fvdl Exp $ */
/*
@@ -205,6 +205,26 @@ linux_sys_open(p, v, retval)
return 0;
}
+int
+linux_sys_lseek(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct linux_sys_lseek_args /* {
+ syscallarg(int) fd;
+ syscallarg(long) offset;
+ syscallarg(int) whence;
+ } */ *uap = v;
+ struct sys_lseek_args bla;
+
+ SCARG(&bla, fd) = SCARG(uap, fd);
+ SCARG(&bla, offset) = SCARG(uap, offset);
+ SCARG(&bla, whence) = SCARG(uap, whence);
+
+ return sys_lseek(p, &bla, retval);
+}
+
/*
* This appears to be part of a Linux attempt to switch to 64 bits file sizes.
*/
@@ -828,6 +848,24 @@ linux_sys_readlink(p, v, retval)
}
int
+linux_sys_ftruncate(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct linux_sys_ftruncate_args /* {
+ syscallarg(int) fd;
+ syscallarg(long) length;
+ } */ *uap = v;
+ struct sys_ftruncate_args sta;
+
+ SCARG(&sta, fd) = SCARG(uap, fd);
+ SCARG(&sta, length) = SCARG(uap, length);
+
+ return sys_ftruncate(p, uap, retval);
+}
+
+int
linux_sys_truncate(p, v, retval)
struct proc *p;
void *v;
@@ -838,10 +876,14 @@ linux_sys_truncate(p, v, retval)
syscallarg(long) length;
} */ *uap = v;
caddr_t sg = stackgap_init(p->p_emul);
+ struct sys_truncate_args sta;
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
- return compat_43_sys_truncate(p, uap, retval);
+ SCARG(&sta, path) = SCARG(uap, path);
+ SCARG(&sta, length) = SCARG(uap, length);
+
+ return sys_truncate(p, &sta, retval);
}
/*
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index b6eb3c6f7c7..4733511b35c 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_misc.c,v 1.68 2011/06/05 19:41:09 deraadt Exp $ */
+/* $OpenBSD: linux_misc.c,v 1.69 2011/07/07 01:19:39 tedu Exp $ */
/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
/*-
@@ -55,6 +55,7 @@
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/socket.h>
+#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/vnode.h>
@@ -566,6 +567,20 @@ linux_sys_oldolduname(p, v, retval)
return copyout(&luts, SCARG(uap, up), sizeof(luts));
}
+int
+linux_sys_sethostname(struct proc *p, void *v, register_t *retval)
+{
+ struct linux_sys_sethostname_args *uap = v;
+ int name;
+ int error;
+
+ if ((error = suser(p, 0)) != 0)
+ return (error);
+ name = KERN_HOSTNAME;
+ return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname),
+ SCARG(uap, len), p));
+}
+
/*
* Linux wants to pass everything to a syscall in registers. However,
* mmap() has 6 of them. Oops: out of register error. They just pass
diff --git a/sys/compat/linux/linux_resource.c b/sys/compat/linux/linux_resource.c
index 4d8885187ab..11c86d852ca 100644
--- a/sys/compat/linux/linux_resource.c
+++ b/sys/compat/linux/linux_resource.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_resource.c,v 1.4 2003/06/03 20:49:28 deraadt Exp $ */
+/* $OpenBSD: linux_resource.c,v 1.5 2011/07/07 01:19:39 tedu Exp $ */
/*
* Copyright (c) 2000 Niklas Hallqvist
@@ -68,6 +68,29 @@ linux_to_bsd_rlimit(which)
return (linux_to_bsd_rlimit_map[which]);
}
+
+struct compat_sys_setrlimit_args {
+ syscallarg(int) which;
+ syscallarg(struct olimit *) rlp;
+};
+int compat_sys_setrlimit(struct proc *p, void *v, register_t *retval);
+int
+compat_sys_setrlimit(struct proc *p, void *v, register_t *retval)
+{
+ struct compat_sys_setrlimit_args *uap = v;
+ struct orlimit olim;
+ struct rlimit lim;
+ int error;
+
+ error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&olim,
+ sizeof (struct orlimit));
+ if (error)
+ return (error);
+ lim.rlim_cur = olim.rlim_cur;
+ lim.rlim_max = olim.rlim_max;
+ return (dosetrlimit(p, SCARG(uap, which), &lim));
+}
+
int
linux_sys_setrlimit(p, v, retval)
struct proc *p;
@@ -82,7 +105,7 @@ linux_sys_setrlimit(p, v, retval)
SCARG(uap, which) = linux_to_bsd_rlimit(SCARG(uap, which));
if (SCARG(uap, which) == RLIM_NLIMITS)
return (EINVAL);
- return (compat_43_sys_setrlimit(p, v, retval));
+ return (compat_sys_setrlimit(p, v, retval));
}
int
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 861fc69853c..50b5ee1cbd4 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_socket.c,v 1.39 2009/09/05 10:28:43 miod Exp $ */
+/* $OpenBSD: linux_socket.c,v 1.40 2011/07/07 01:19:39 tedu Exp $ */
/* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */
/*
@@ -356,6 +356,34 @@ linux_listen(p, v, retval)
return sys_listen(p, &bla, retval);
}
+int compat_sys_accept(struct proc *p, void *v, register_t *retval);
+int
+compat_sys_accept(struct proc *p, void *v, register_t *retval)
+{
+ struct sys_accept_args /* {
+ syscallarg(int) s;
+ syscallarg(caddr_t) name;
+ syscallarg(int *) anamelen;
+ } */ *uap = v;
+ int error;
+
+ if ((error = sys_accept(p, uap, retval)) != 0)
+ return error;
+
+ if (SCARG(uap, name)) {
+ struct sockaddr sa;
+
+ if ((error = copyin(SCARG(uap, name), &sa, sizeof(sa))) != 0)
+ return error;
+
+ ((struct osockaddr*) &sa)->sa_family = sa.sa_family;
+
+ if ((error = copyout(&sa, SCARG(uap, name), sizeof(sa))) != 0)
+ return error;
+ }
+ return 0;
+}
+
int
linux_accept(p, v, retval)
struct proc *p;
@@ -368,7 +396,7 @@ linux_accept(p, v, retval)
syscallarg(int *) namelen;
} */ *uap = v;
struct linux_accept_args laa;
- struct compat_43_sys_accept_args baa;
+ struct sys_accept_args baa;
struct sys_fcntl_args fca;
int error;
@@ -376,10 +404,10 @@ linux_accept(p, v, retval)
return error;
SCARG(&baa, s) = laa.s;
- SCARG(&baa, name) = (caddr_t) laa.addr;
+ SCARG(&baa, name) = laa.addr;
SCARG(&baa, anamelen) = laa.namelen;
- error = compat_43_sys_accept(p, &baa, retval);
+ error = compat_sys_accept(p, &baa, retval);
if (error)
return (error);
@@ -489,6 +517,34 @@ linux_socketpair(p, v, retval)
return sys_socketpair(p, &bsa, retval);
}
+int compat_sys_send(struct proc *, void *, register_t *);
+struct compat_sys_send_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) buf;
+ syscallarg(int) len;
+ syscallarg(int) flags;
+};
+int
+compat_sys_send(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct compat_sys_send_args *uap = v;
+ struct msghdr msg;
+ struct iovec aiov;
+
+ msg.msg_name = 0;
+ msg.msg_namelen = 0;
+ msg.msg_iov = &aiov;
+ msg.msg_iovlen = 1;
+ aiov.iov_base = SCARG(uap, buf);
+ aiov.iov_len = SCARG(uap, len);
+ msg.msg_control = 0;
+ msg.msg_flags = 0;
+ return (sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval));
+}
+
int
linux_send(p, v, retval)
struct proc *p;
@@ -501,8 +557,8 @@ linux_send(p, v, retval)
syscallarg(int) len;
syscallarg(int) flags;
} */ *uap = v;
+ struct compat_sys_send_args bsa;
struct linux_send_args lsa;
- struct compat_43_sys_send_args bsa;
int error;
if ((error = copyin((caddr_t) uap, (caddr_t) &lsa, sizeof lsa)))
@@ -513,7 +569,35 @@ linux_send(p, v, retval)
SCARG(&bsa, len) = lsa.len;
SCARG(&bsa, flags) = lsa.flags;
- return compat_43_sys_send(p, &bsa, retval);
+ return compat_sys_send(p, &bsa, retval);
+}
+
+struct compat_sys_recv_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) buf;
+ syscallarg(int) len;
+ syscallarg(int) flags;
+};
+int compat_sys_recv(struct proc *p, void *v, register_t *retval);
+int
+compat_sys_recv(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct compat_sys_recv_args *uap = v;
+ struct msghdr msg;
+ struct iovec aiov;
+
+ msg.msg_name = 0;
+ msg.msg_namelen = 0;
+ msg.msg_iov = &aiov;
+ msg.msg_iovlen = 1;
+ aiov.iov_base = SCARG(uap, buf);
+ aiov.iov_len = SCARG(uap, len);
+ msg.msg_control = 0;
+ msg.msg_flags = SCARG(uap, flags);
+ return (recvit(p, SCARG(uap, s), &msg, (caddr_t)0, retval));
}
int
@@ -529,7 +613,7 @@ linux_recv(p, v, retval)
syscallarg(int) flags;
} */ *uap = v;
struct linux_recv_args lra;
- struct compat_43_sys_recv_args bra;
+ struct compat_sys_recv_args bra;
int error;
if ((error = copyin((caddr_t) uap, (caddr_t) &lra, sizeof lra)))
@@ -540,7 +624,7 @@ linux_recv(p, v, retval)
SCARG(&bra, len) = lra.len;
SCARG(&bra, flags) = lra.flags;
- return compat_43_sys_recv(p, &bra, retval);
+ return compat_sys_recv(p, &bra, retval);
}
int
diff --git a/sys/compat/linux/syscalls.master b/sys/compat/linux/syscalls.master
index 1ee5c0ee254..cb411636a9b 100644
--- a/sys/compat/linux/syscalls.master
+++ b/sys/compat/linux/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.55 2011/04/05 15:44:40 pirofti Exp $
+ $OpenBSD: syscalls.master,v 1.56 2011/07/07 01:19:39 tedu Exp $
; $NetBSD: syscalls.master,v 1.15 1995/12/18 14:35:10 fvdl Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -67,7 +67,7 @@
int gid); }
17 STD { int linux_sys_break(char *nsize); }
18 STD { int linux_sys_ostat(void); }
-19 NOARGS { long compat_43_sys_lseek(int fd, long offset, \
+19 STD { long linux_sys_lseek(int fd, long offset, \
int whence); }
20 STD { pid_t linux_sys_getpid(void); }
21 STD { int linux_sys_mount(char *specialfile, char *dir, \
@@ -138,8 +138,7 @@
72 STD { int linux_sys_sigsuspend(caddr_t restart, \
int oldmask, int mask); }
73 STD { int linux_sys_sigpending(linux_old_sigset_t *mask); }
-74 NOARGS { int compat_43_sys_sethostname(char *hostname, \
- u_int len);}
+74 STD { int linux_sys_sethostname(char *hostname, u_int len);}
75 STD { int linux_sys_setrlimit(u_int which, \
struct linux_rlimit *rlp); }
76 STD { int linux_sys_getrlimit(u_int which, \
@@ -155,7 +154,7 @@
gid_t *gidset); }
82 STD { int linux_sys_oldselect(struct linux_select *lsp); }
83 STD { int linux_sys_symlink(char *path, char *to); }
-84 NOARGS { int compat_43_sys_lstat(char *path, \
+84 NOARGS { int linux_sys_lstat(char *path, \
struct stat43 *up); } olstat
85 STD { int linux_sys_readlink(char *name, char *buf, \
int count); }
@@ -167,7 +166,7 @@
90 STD { int linux_sys_mmap(struct linux_mmap *lmp); }
91 NOARGS { int sys_munmap(caddr_t addr, int len); }
92 STD { int linux_sys_truncate(char *path, long length); }
-93 NOARGS { int compat_43_sys_ftruncate(int fd, long length); }
+93 STD { int linux_sys_ftruncate(int fd, long length); }
94 NOARGS { int sys_fchmod(int fd, int mode); }
95 STD { int linux_sys_fchown16(int fd, int uid, int gid); }
96 NOARGS { int sys_getpriority(int which, int who); }