Fix handling of umtxp resource limit in sh(1)/ulimit(1), limits(1), add
login.conf(5) support. Reviewed by: jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D5610
This commit is contained in:
parent
77e6a4072b
commit
250d9fd8aa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296723
@ -452,7 +452,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
|
|||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
|
|
||||||
what = 'f';
|
what = 'f';
|
||||||
while ((optc = nextopt("HSatfdsmcnuvlbpwk")) != '\0')
|
while ((optc = nextopt("HSatfdsmcnuvlbpwko")) != '\0')
|
||||||
switch (optc) {
|
switch (optc) {
|
||||||
case 'H':
|
case 'H':
|
||||||
how = HARD;
|
how = HARD;
|
||||||
|
@ -2615,7 +2615,7 @@ and not found.
|
|||||||
For aliases the alias expansion is printed;
|
For aliases the alias expansion is printed;
|
||||||
for commands and tracked aliases
|
for commands and tracked aliases
|
||||||
the complete pathname of the command is printed.
|
the complete pathname of the command is printed.
|
||||||
.It Ic ulimit Oo Fl HSabcdfklmnpstuvw Oc Op Ar limit
|
.It Ic ulimit Oo Fl HSabcdfklmnopstuvw Oc Op Ar limit
|
||||||
Set or display resource limits (see
|
Set or display resource limits (see
|
||||||
.Xr getrlimit 2 ) .
|
.Xr getrlimit 2 ) .
|
||||||
If
|
If
|
||||||
@ -2674,6 +2674,11 @@ kilobytes.
|
|||||||
The maximal resident set size of a process, in kilobytes.
|
The maximal resident set size of a process, in kilobytes.
|
||||||
.It Fl n Ar nofiles
|
.It Fl n Ar nofiles
|
||||||
The maximal number of descriptors that could be opened by a process.
|
The maximal number of descriptors that could be opened by a process.
|
||||||
|
.It Fl o Ar umtxp
|
||||||
|
The maximal number of process-shared locks
|
||||||
|
(see
|
||||||
|
.Xr pthread 3 )
|
||||||
|
for this user ID.
|
||||||
.It Fl p Ar pseudoterminals
|
.It Fl p Ar pseudoterminals
|
||||||
The maximal number of pseudo-terminals for this user ID.
|
The maximal number of pseudo-terminals for this user ID.
|
||||||
.It Fl s Ar stacksize
|
.It Fl s Ar stacksize
|
||||||
|
@ -43,6 +43,7 @@ default:\
|
|||||||
:swapuse=unlimited:\
|
:swapuse=unlimited:\
|
||||||
:pseudoterminals=unlimited:\
|
:pseudoterminals=unlimited:\
|
||||||
:kqueues=unlimited:\
|
:kqueues=unlimited:\
|
||||||
|
:umtxp=unlimited:\
|
||||||
:priority=0:\
|
:priority=0:\
|
||||||
:ignoretime@:\
|
:ignoretime@:\
|
||||||
:umask=022:
|
:umask=022:
|
||||||
|
@ -199,6 +199,7 @@ notation may be used.
|
|||||||
.It "stacksize size Maximum stack size limit."
|
.It "stacksize size Maximum stack size limit."
|
||||||
.It "pseudoterminals number Maximum number of pseudo-terminals."
|
.It "pseudoterminals number Maximum number of pseudo-terminals."
|
||||||
.It "swapuse size Maximum swap space size limit."
|
.It "swapuse size Maximum swap space size limit."
|
||||||
|
.It "umtxp number Maximum number of process-shared pthread locks."
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
These resource limit entries actually specify both the maximum
|
These resource limit entries actually specify both the maximum
|
||||||
|
@ -119,6 +119,7 @@ vmemoryuse RLIMIT_VMEM
|
|||||||
pseudoterminals RLIMIT_NPTS
|
pseudoterminals RLIMIT_NPTS
|
||||||
swapuse RLIMIT_SWAP
|
swapuse RLIMIT_SWAP
|
||||||
kqueues RLIMIT_KQUEUES
|
kqueues RLIMIT_KQUEUES
|
||||||
|
umtxp RLIMIT_UMTXP
|
||||||
.Ed
|
.Ed
|
||||||
.It LOGIN_SETPRIORITY
|
.It LOGIN_SETPRIORITY
|
||||||
Set the scheduling priority for the current process based on the
|
Set the scheduling priority for the current process based on the
|
||||||
|
@ -67,6 +67,7 @@ static struct login_res {
|
|||||||
{ "pseudoterminals", login_getcapnum, RLIMIT_NPTS },
|
{ "pseudoterminals", login_getcapnum, RLIMIT_NPTS },
|
||||||
{ "swapuse", login_getcapsize, RLIMIT_SWAP },
|
{ "swapuse", login_getcapsize, RLIMIT_SWAP },
|
||||||
{ "kqueues", login_getcapsize, RLIMIT_KQUEUES },
|
{ "kqueues", login_getcapsize, RLIMIT_KQUEUES },
|
||||||
|
{ "umtxp", login_getcapnum, RLIMIT_UMTXP },
|
||||||
{ NULL, 0, 0 }
|
{ NULL, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@
|
|||||||
.Op Fl C Ar class | Fl P Ar pid | Fl U Ar user
|
.Op Fl C Ar class | Fl P Ar pid | Fl U Ar user
|
||||||
.Op Fl SHB
|
.Op Fl SHB
|
||||||
.Op Fl ea
|
.Op Fl ea
|
||||||
.Op Fl bcdfklmnstuvpw Op Ar val
|
.Op Fl bcdfklmnopstuvw Op Ar val
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl C Ar class | Fl U Ar user
|
.Op Fl C Ar class | Fl U Ar user
|
||||||
.Op Fl SHB
|
.Op Fl SHB
|
||||||
.Op Fl bcdfklmnstuvpw Op Ar val
|
.Op Fl bcdfklmnopstuvw Op Ar val
|
||||||
.Op Fl E
|
.Op Fl E
|
||||||
.Oo
|
.Oo
|
||||||
.Op Ar name Ns = Ns Ar value ...
|
.Op Ar name Ns = Ns Ar value ...
|
||||||
@ -233,6 +233,18 @@ system is limited to the value displayed by the
|
|||||||
.Va kern.maxfiles
|
.Va kern.maxfiles
|
||||||
.Xr sysctl 8
|
.Xr sysctl 8
|
||||||
variable.
|
variable.
|
||||||
|
.It Fl o Op Ar val
|
||||||
|
Select or set the
|
||||||
|
.Va umtxp
|
||||||
|
resource limit.
|
||||||
|
The limit determines the maximal number of the process-shared locks
|
||||||
|
which may be simultaneously created by the processes owned by the
|
||||||
|
user, see
|
||||||
|
.Xr pthread 3 .
|
||||||
|
.It Fl p Op Ar val
|
||||||
|
Select or set the
|
||||||
|
.Va pseudoterminals
|
||||||
|
resource limit.
|
||||||
.It Fl s Op Ar val
|
.It Fl s Op Ar val
|
||||||
Select or set the
|
Select or set the
|
||||||
.Va stacksize
|
.Va stacksize
|
||||||
@ -266,10 +278,6 @@ and is inclusive of text, data, bss, stack,
|
|||||||
and
|
and
|
||||||
.Xr mmap 2 Ns 'd
|
.Xr mmap 2 Ns 'd
|
||||||
space.
|
space.
|
||||||
.It Fl p Op Ar val
|
|
||||||
Select or set the
|
|
||||||
.Va pseudoterminals
|
|
||||||
resource limit.
|
|
||||||
.It Fl w Op Ar val
|
.It Fl w Op Ar val
|
||||||
Select or set the
|
Select or set the
|
||||||
.Va swapuse
|
.Va swapuse
|
||||||
|
@ -254,7 +254,7 @@ static struct {
|
|||||||
* to be modified accordingly!
|
* to be modified accordingly!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RCS_STRING "tfdscmlunbvpwk"
|
#define RCS_STRING "tfdscmlunbvpwko"
|
||||||
|
|
||||||
static rlim_t resource_num(int which, int ch, const char *str);
|
static rlim_t resource_num(int which, int ch, const char *str);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
@ -551,7 +551,7 @@ usage(void)
|
|||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: limits [-C class|-P pid|-U user] [-eaSHBE] "
|
"usage: limits [-C class|-P pid|-U user] [-eaSHBE] "
|
||||||
"[-bcdflmnstuvpwk [val]] [[name=val ...] cmd]\n");
|
"[-bcdfklmnostuvpw [val]] [[name=val ...] cmd]\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,6 +660,7 @@ resource_num(int which, int ch, const char *str)
|
|||||||
case RLIMIT_NOFILE:
|
case RLIMIT_NOFILE:
|
||||||
case RLIMIT_NPTS:
|
case RLIMIT_NPTS:
|
||||||
case RLIMIT_KQUEUES:
|
case RLIMIT_KQUEUES:
|
||||||
|
case RLIMIT_UMTXP:
|
||||||
res = strtoq(s, &e, 0);
|
res = strtoq(s, &e, 0);
|
||||||
s = e;
|
s = e;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user