summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_misc.c
diff options
context:
space:
mode:
authormanu <manu@NetBSD.org>2005-11-23 16:14:57 +0000
committermanu <manu@NetBSD.org>2005-11-23 16:14:57 +0000
commit23cf341ea0c698662d73d09d39f8fc9b35d23ca7 (patch)
treed8b60bf812314f9185bab6914934a39ae01f8118 /sys/compat/linux/common/linux_misc.c
parent81789679db89e103f1cd611a4789f28789110af8 (diff)
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
Diffstat (limited to 'sys/compat/linux/common/linux_misc.c')
-rw-r--r--sys/compat/linux/common/linux_misc.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index 4148e1c4888..12a7e2ee818 100644
--- a/sys/compat/linux/common/linux_misc.c
+++ b/sys/compat/linux/common/linux_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.143 2005/11/07 14:17:45 manu Exp $ */
+/* $NetBSD: linux_misc.c,v 1.144 2005/11/23 16:14:57 manu Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.143 2005/11/07 14:17:45 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.144 2005/11/23 16:14:57 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1614,10 +1614,17 @@ linux_sys_sysinfo(l, v, retval)
return (copyout(&si, SCARG(uap, arg), sizeof si));
}
+#ifdef LINUX_LARGEFILE64
+#define bsd_to_linux_rlimit1(l, b, f) \
+ (l)->f = ((b)->f == RLIM_INFINITY || \
+ ((b)->f & 0x8000000000000000UL) != 0) ? \
+ LINUX_RLIM_INFINITY : (b)->f
+#else
#define bsd_to_linux_rlimit1(l, b, f) \
(l)->f = ((b)->f == RLIM_INFINITY || \
((b)->f & 0xffffffff00000000ULL) != 0) ? \
LINUX_RLIM_INFINITY : (int32_t)(b)->f
+#endif
#define bsd_to_linux_rlimit(l, b) \
bsd_to_linux_rlimit1(l, b, rlim_cur); \
bsd_to_linux_rlimit1(l, b, rlim_max)
@@ -1668,13 +1675,21 @@ linux_sys_getrlimit(l, v, retval)
{
struct linux_sys_getrlimit_args /* {
syscallarg(int) which;
+#ifdef LINUX_LARGEFILE64
+ syscallarg(struct rlimit *) rlp;
+#else
syscallarg(struct orlimit *) rlp;
+#endif
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
struct sys_getrlimit_args ap;
struct rlimit rl;
+#ifdef LINUX_LARGEFILE64
+ struct rlimit orl;
+#else
struct orlimit orl;
+#endif
int error;
SCARG(&ap, which) = linux_to_bsd_limit(SCARG(uap, which));
@@ -1685,7 +1700,9 @@ linux_sys_getrlimit(l, v, retval)
return error;
if ((error = copyin(SCARG(&ap, rlp), &rl, sizeof(rl))) != 0)
return error;
+ printf("bsd max limit: %lx\n", rl.rlim_max);
bsd_to_linux_rlimit(&orl, &rl);
+ printf(" %lx\n", (unsigned long)orl.rlim_max);
return copyout(&orl, SCARG(uap, rlp), sizeof(orl));
}
@@ -1697,13 +1714,21 @@ linux_sys_setrlimit(l, v, retval)
{
struct linux_sys_setrlimit_args /* {
syscallarg(int) which;
+#ifdef LINUX_LARGEFILE64
+ syscallarg(struct rlimit *) rlp;
+#else
syscallarg(struct orlimit *) rlp;
+#endif
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
struct sys_getrlimit_args ap;
struct rlimit rl;
+#ifdef LINUX_LARGEFILE64
+ struct rlimit orl;
+#else
struct orlimit orl;
+#endif
int error;
SCARG(&ap, which) = linux_to_bsd_limit(SCARG(uap, which));