From 9aff4d78fe417efaf54fe3c35ab7874824f90c18 Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 3 Apr 2009 09:45:23 +0000 Subject: [PATCH] make {get,set}rlimit code depend on RLIM_INFINITY existence (PW32, Minix 3) --- Build.sh | 4 ++-- funcs.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Build.sh b/Build.sh index 436dd76..dc5b223 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.380 2009/04/03 09:42:37 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.381 2009/04/03 09:45:22 tg Exp $' #- # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI @@ -351,7 +351,7 @@ Plan9) PW32*) HAVE_SIG_T=0 # incompatible warn=' and will currently not work' - # missing: killpg() getrlimit() + # missing: killpg() : ${HAVE_SETLOCALE_CTYPE=0} ;; QNX) diff --git a/funcs.c b/funcs.c index 4c5c5b3..5636e17 100644 --- a/funcs.c +++ b/funcs.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.101 2009/04/03 09:39:05 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.102 2009/04/03 09:45:23 tg Exp $"); /* A leading = means assignments before command are kept; * a leading * means a POSIX special builtin; @@ -2847,6 +2847,7 @@ ptest_error(Test_env *te, int ofs, const char *msg) bi_errorf("%s", msg); } +#ifdef RLIM_INFINITY #define SOFT 0x1 #define HARD 0x2 @@ -2859,10 +2860,12 @@ struct limits { static void print_ulimit(const struct limits *, int); static int set_ulimit(const struct limits *, const char *, int); +#endif int c_ulimit(const char **wp) { +#ifdef RLIM_INFINITY static const struct limits limits[] = { /* do not use options -H, -S or -a or change the order */ #ifdef RLIMIT_CPU @@ -2959,9 +2962,11 @@ c_ulimit(const char **wp) shprintf("%-20s ", l->name); print_ulimit(l, how); } +#endif return (0); } +#ifdef RLIM_INFINITY static int set_ulimit(const struct limits *l, const char *v, int how) { @@ -3025,6 +3030,7 @@ print_ulimit(const struct limits *l, int how) else shprintf("%ld\n", (long)(val / l->factor)); } +#endif int c_rename(const char **wp)