Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat LINUX_RLIM_INFINITY doesn't fit into the value ra...



details:   https://anonhg.NetBSD.org/src/rev/df3e067076b9
branches:  trunk
changeset: 781682:df3e067076b9
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Sep 22 22:34:02 2012 +0000

description:
LINUX_RLIM_INFINITY doesn't fit into the value range for linux32, so
introduce a variant with correct value.

diffstat:

 sys/compat/linux/common/linux_limit.h        |  8 +++++++-
 sys/compat/linux/common/linux_misc.h         |  4 +++-
 sys/compat/linux32/common/linux32_resource.c |  6 +++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diffs (69 lines):

diff -r 66f4a6c173b3 -r df3e067076b9 sys/compat/linux/common/linux_limit.h
--- a/sys/compat/linux/common/linux_limit.h     Sat Sep 22 19:53:03 2012 +0000
+++ b/sys/compat/linux/common/linux_limit.h     Sat Sep 22 22:34:02 2012 +0000
@@ -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 @@
     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)
 {      
diff -r 66f4a6c173b3 -r df3e067076b9 sys/compat/linux/common/linux_misc.h
--- a/sys/compat/linux/common/linux_misc.h      Sat Sep 22 19:53:03 2012 +0000
+++ b/sys/compat/linux/common/linux_misc.h      Sat Sep 22 22:34:02 2012 +0000
@@ -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 @@
 #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
 
 
diff -r 66f4a6c173b3 -r df3e067076b9 sys/compat/linux32/common/linux32_resource.c
--- a/sys/compat/linux32/common/linux32_resource.c      Sat Sep 22 19:53:03 2012 +0000
+++ b/sys/compat/linux32/common/linux32_resource.c      Sat Sep 22 22:34:02 2012 +0000
@@ -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 @@
        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);
 }



Home | Main Index | Thread Index | Old Index