--- pdksh-5.2.14.old/c_ulimit.c Thu Apr 22 16:51:33 1999 +++ pdksh-5.2.14/c_ulimit.c Mon Apr 16 18:52:47 2001 @@ -111,6 +111,9 @@ #ifdef RLIMIT_SWAP { "swap(kbytes)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' }, #endif +#ifdef RLIMIT_LOCKS + { "flocks", RLIMIT, RLIMIT_LOCKS, RLIMIT_LOCKS, -1, 'L' }, +#endif { (char *) 0 } }; static char options[3 + NELEM(limits)]; @@ -189,7 +192,16 @@ for (l = limits; l->name; l++) { #ifdef HAVE_SETRLIMIT if (l->which == RLIMIT) { - getrlimit(l->gcmd, &limit); + int getreturn; + + getreturn=getrlimit(l->gcmd, &limit); + if ( getreturn < 0 ) { + if ( ( errno == EINVAL ) && + ( l->gcmd == RLIMIT_LOCKS ) ) { + limit.rlim_cur = RLIM_INFINITY; + limit.rlim_max = RLIM_INFINITY; + } + } if (how & SOFT) val = limit.rlim_cur; else if (how & HARD) @@ -227,9 +239,14 @@ if (setrlimit(l->scmd, &limit) < 0) { if (errno == EPERM) bi_errorf("exceeds allowable limit"); - else + else { + if ( ( errno == EINVAL ) && + ( l->scmd == RLIMIT_LOCKS ) ) { + bi_errorf("unable to set it on the current kernel"); + } else bi_errorf("bad limit: %s", strerror(errno)); + } return 1; } } else { --- pdksh-5.2.14.old/ksh.Man Tue Jul 13 14:23:27 1999 +++ pdksh-5.2.14/ksh.Man Mon Apr 16 18:54:28 2001 @@ -2541,8 +2541,8 @@ T} .TE .\"}}} -.\"{{{ ulimit [-acdfHlmnpsStvw] [value] -.IP "\fBulimit\fP [\fB\-acdfHlmnpsStvw\fP] [\fIvalue\fP]" +.\"{{{ ulimit [-acdfHlmnpsStvwL] [value] +.IP "\fBulimit\fP [\fB\-acdfHlmnpsStvwL\fP] [\fIvalue\fP]" Display or set process limits. If no options are used, the file size limit (\fB\-f\fP) is assumed. \fBvalue\fP, if specified, may be either be an arithmetic expression or the @@ -2587,6 +2587,8 @@ not kbytes). .IP \fB\-w\fP Impose a limit of \fIn\fP kbytes on the amount of swap space used. +.IP \fB\-L\fP +Impose a limit of \fIn\fP locks that can be held on files. .PP As far as \fBulimit\fP is concerned, a block is 512 bytes. .RE