diff --git a/lib/libc/sys/getrlimit.2 b/lib/libc/sys/getrlimit.2 index abadf3234666..add20bf7e811 100644 --- a/lib/libc/sys/getrlimit.2 +++ b/lib/libc/sys/getrlimit.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: getrlimit.2,v 1.17 2001/09/16 01:39:01 wiz Exp $ +.\" $NetBSD: getrlimit.2,v 1.18 2001/11/23 19:50:13 jdolecek Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" @(#)getrlimit.2 8.1 (Berkeley) 6/4/93 .\" -.Dd June 4, 1993 +.Dd November 23, 2001 .Dt GETRLIMIT 2 .Os .Sh NAME @@ -126,10 +126,15 @@ value for a limit is defined as .Pp Because this information is stored in the per-process information, this system call must be executed directly by the shell if it -is to affect all future processes created by the shell; -.Ic limit -is thus a built-in command to -.Xr csh 1 . +is to affect all future processes created by the shell. +Thus, shells provide built-in commands to change the limits +.No ( Ic limit +for +.Xr csh 1 , +or +.Ic ulimit +for +.Xr sh 1 No ). .Pp The system refuses to extend the data or stack space when the limits would be exceeded in the normal way: a @@ -153,11 +158,12 @@ is sent to the offending process. .Sh RETURN VALUES A 0 return value indicates that the call succeeded, changing -or returning the resource limit. A return value of -1 indicates -that an error occurred, and an error code is stored in the global -location -.Va errno . +or returning the resource limit. Otherwise, a -1 is returned +and the global variable +.Va errno +is set to indicate the error. .Sh ERRORS +The .Fn getrlimit and .Fn setrlimit @@ -167,12 +173,33 @@ will fail if: The address specified for .Fa rlp is invalid. +.It Bq Er EINVAL +Specified +.Fa resource +was invalid. +.It Bq Er EINVAL +In the +.Fn setrlimit +call, the specified +.Fa rlim_cur +exceeds the specified +.Fa rlim_max . .It Bq Er EPERM The limit specified to .Fn setrlimit would have raised the maximum limit value, and the caller is not the super-user. .El +.Pp +The +.Fn setrlimit +function may fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The limit specified to +.Fn setrlimit +cannot be lowered, because current usage is already higher than the limit. +.El .Sh SEE ALSO .Xr csh 1 , .Xr sh 1 , @@ -180,6 +207,15 @@ raised the maximum limit value, and the caller is not the super-user. .Xr sigaction 2 , .Xr sigaltstack 2 , .Xr sysctl 3 +.Sh STANDARDS +With exception of +.Li RLIMIT_AS +(which is not currently supported), the +.Fn getrlimit +and +.Fn setrlimit +functions conform to +.St -susv2 . .Sh HISTORY The .Fn getrlimit