mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-25 07:49:18 +00:00
Rename UL_GETSIZE to UL_GETFSIZE and UL_SETSIZE to UL_SETFSIZE; these are
the names required by 1003.1-2001. The old names are retained for source compatibility with FreeBSD 5.0 and will be removed before 6.0.
This commit is contained in:
parent
91c6113bdc
commit
86e1d4729f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108637
@ -31,8 +31,17 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
#define UL_GETSIZE 1
|
#define UL_GETFSIZE 1
|
||||||
#define UL_SETSIZE 2
|
#define UL_SETFSIZE 2
|
||||||
|
|
||||||
|
#if __BSD_VISIBLE
|
||||||
|
/*
|
||||||
|
* The "F" was mistakenly omitted from the macro names in FreeBSD 5.0.
|
||||||
|
* Do not use these names; they will be removed before 6.0.
|
||||||
|
*/
|
||||||
|
#define UL_GETSIZE UL_GETFSIZE
|
||||||
|
#define UL_SETSIZE UL_SETFSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
long ulimit(int, ...);
|
long ulimit(int, ...);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd August 8, 2002
|
.Dd January 4, 2003
|
||||||
.Dt ULIMIT 3
|
.Dt ULIMIT 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -43,11 +43,11 @@ Currently this is limited to the maximum file size.
|
|||||||
The
|
The
|
||||||
.Fa cmd
|
.Fa cmd
|
||||||
argument is one of the following:
|
argument is one of the following:
|
||||||
.Bl -tag -width ".Dv UL_GETSIZE"
|
.Bl -tag -width ".Dv UL_GETFSIZE"
|
||||||
.It Dv UL_GETSIZE
|
.It Dv UL_GETFSIZE
|
||||||
will return the maximum file size in units of 512 blocks of
|
will return the maximum file size in units of 512 blocks of
|
||||||
the current process.
|
the current process.
|
||||||
.It Dv UL_SETSIZE
|
.It Dv UL_SETFSIZE
|
||||||
will attempt to set the maximum file size of the current
|
will attempt to set the maximum file size of the current
|
||||||
process and its children with the second argument expressed as a long.
|
process and its children with the second argument expressed as a long.
|
||||||
.El
|
.El
|
||||||
|
@ -42,14 +42,14 @@ ulimit(int cmd, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
long arg;
|
long arg;
|
||||||
|
|
||||||
if (cmd == UL_GETSIZE) {
|
if (cmd == UL_GETFSIZE) {
|
||||||
if (getrlimit(RLIMIT_FSIZE, &limit) == -1)
|
if (getrlimit(RLIMIT_FSIZE, &limit) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
limit.rlim_cur /= 512;
|
limit.rlim_cur /= 512;
|
||||||
if (limit.rlim_cur > LONG_MAX)
|
if (limit.rlim_cur > LONG_MAX)
|
||||||
return (LONG_MAX);
|
return (LONG_MAX);
|
||||||
return ((long)limit.rlim_cur);
|
return ((long)limit.rlim_cur);
|
||||||
} else if (cmd == UL_SETSIZE) {
|
} else if (cmd == UL_SETFSIZE) {
|
||||||
va_start(ap, cmd);
|
va_start(ap, cmd);
|
||||||
arg = va_arg(ap, long);
|
arg = va_arg(ap, long);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
Loading…
Reference in New Issue
Block a user