Module Name: src
Committed By: joerg
Date: Sat Sep 22 22:34:03 UTC 2012
Modified Files:
src/sys/compat/linux/common: linux_limit.h linux_misc.h
src/sys/compat/linux32/common: linux32_resource.c
Log Message:
LINUX_RLIM_INFINITY doesn't fit into the value range for linux32, so
introduce a variant with correct value.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/linux/common/linux_limit.h
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/linux/common/linux_misc.h
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_resource.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/common/linux_limit.h
diff -u src/sys/compat/linux/common/linux_limit.h:1.5 src/sys/compat/linux/common/linux_limit.h:1.6
--- src/sys/compat/linux/common/linux_limit.h:1.5 Sun Mar 29 01:02:50 2009
+++ src/sys/compat/linux/common/linux_limit.h Sat Sep 22 22:34:02 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_limit.h,v 1.5 2009/03/29 01:02:50 mrg Exp $ */
+/* $NetBSD: linux_limit.h,v 1.6 2012/09/22 22:34:02 joerg Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -56,6 +56,12 @@ static int linux_to_bsd_limit(int);
linux_to_bsd_rlimit1(b, l, rlim_cur); \
linux_to_bsd_rlimit1(b, l, rlim_max)
+#define linux32_to_bsd_rlimit1(b, l, f) \
+ (b)->f = (l)->f == LINUX32_RLIM_INFINITY ? RLIM_INFINITY : (l)->f
+#define linux32_to_bsd_rlimit(b, l) \
+ linux32_to_bsd_rlimit1(b, l, rlim_cur); \
+ linux32_to_bsd_rlimit1(b, l, rlim_max)
+
static int
linux_to_bsd_limit(int lim)
{
Index: src/sys/compat/linux/common/linux_misc.h
diff -u src/sys/compat/linux/common/linux_misc.h:1.22 src/sys/compat/linux/common/linux_misc.h:1.23
--- src/sys/compat/linux/common/linux_misc.h:1.22 Thu Sep 13 13:59:33 2012
+++ src/sys/compat/linux/common/linux_misc.h Sat Sep 22 22:34:02 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.h,v 1.22 2012/09/13 13:59:33 pooka Exp $ */
+/* $NetBSD: linux_misc.h,v 1.23 2012/09/22 22:34:02 joerg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,8 +78,10 @@ struct linux_sysinfo {
#define LINUX_RLIMIT_LOCKS 10
#ifdef __mips__ /* XXX only mips32. On mips64, it's ~0ul */
#define LINUX_RLIM_INFINITY 0x7fffffffUL
+#define LINUX32_RLIM_INFINITY 0x7fffffffU
#else
#define LINUX_RLIM_INFINITY ~0ul
+#define LINUX32_RLIM_INFINITY ~0u
#endif
Index: src/sys/compat/linux32/common/linux32_resource.c
diff -u src/sys/compat/linux32/common/linux32_resource.c:1.10 src/sys/compat/linux32/common/linux32_resource.c:1.11
--- src/sys/compat/linux32/common/linux32_resource.c:1.10 Wed Nov 19 18:36:04 2008
+++ src/sys/compat/linux32/common/linux32_resource.c Sat Sep 22 22:34:03 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_resource.c,v 1.10 2008/11/19 18:36:04 ad Exp $ */
+/* $NetBSD: linux32_resource.c,v 1.11 2012/09/22 22:34:03 joerg Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_resource.c,v 1.10 2008/11/19 18:36:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_resource.c,v 1.11 2012/09/22 22:34:03 joerg Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -111,7 +111,7 @@ linux32_sys_setrlimit(struct lwp *l, con
if (which < 0)
return -which;
- linux_to_bsd_rlimit(&rl, &orl);
+ linux32_to_bsd_rlimit(&rl, &orl);
return dosetrlimit(l, l->l_proc, which, &rl);
}