Re: resource limits bug

Matthew Wilcox (Matthew.Wilcox@genedata.com)
Sun, 5 Sep 1999 22:38:38 +0200


On Sun, Sep 05, 1999 at 12:21:43PM +0100, Alan Cox wrote:
> > BTW, why are most "unlimited" kernel limits set to 2G (that is, LONG_MAX in
> > include/asm-*/resource.h) while 3G or so would be more correct?
>
> Because the ulimit values are signed. 2.2.12 has most of the checks fixed,
> 2.3.x someone need sto shift to using an unsigned rlimit_t.

I posted that patch on Wednesday. In case you missed it I include
it below. Incidentally, I spotted this problem by using the -W flag.
It's a shame that some of the warnings this generates can't be worked
around; we can't make the header files clean. (in particular, the test
against zero always being false is something we don't want warned about in
the signal.h file. I tried a couple of things to eliminate that warning,
but I can't see a way.)

diff -u linux-2.2.12/include/linux/resource.h linux-2.2.12-Wclean/include/linux/resource.h
--- linux-2.2.12/include/linux/resource.h Thu Aug 26 21:41:53 1999
+++ linux-2.2.12-Wclean/include/linux/resource.h Wed Sep 1 18:10:23 1999
@@ -38,10 +38,14 @@
};

#define RLIM_INFINITY ((long)(~0UL>>1))
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+typedef unsigned long rlim_t;

struct rlimit {
- long rlim_cur;
- long rlim_max;
+ rlim_t rlim_cur;
+ rlim_t rlim_max;
};

#define PRIO_MIN (-20)

-- 
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/