* man/limits.5.xml, libmisc/limits.c: Sort limit identifiers.
* libmisc/limits.c: Fix support for the K limit identifier. * libmisc/limits.c: Add missing default limit for L and U.
This commit is contained in:
parent
f4d95eecc0
commit
e4fbf98b18
@ -1,3 +1,9 @@
|
|||||||
|
2011-10-31 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* man/limits.5.xml, libmisc/limits.c: Sort limit identifiers.
|
||||||
|
* libmisc/limits.c: Fix support for the K limit identifier.
|
||||||
|
* libmisc/limits.c: Add missing default limit for L and U.
|
||||||
|
|
||||||
2011-10-31 Nicolas François <nicolas.francois@centraliens.net>
|
2011-10-31 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/pwck.c, man/pwck.8.xml: Add support for long options.
|
* src/pwck.c, man/pwck.8.xml: Add support for long options.
|
||||||
|
@ -214,17 +214,17 @@ static int check_logins (const char *name, const char *maxlogins)
|
|||||||
* [Cc]: c = RLIMIT_CORE max core file size (KB)
|
* [Cc]: c = RLIMIT_CORE max core file size (KB)
|
||||||
* [Dd]: d = RLIMIT_DATA max data size (KB)
|
* [Dd]: d = RLIMIT_DATA max data size (KB)
|
||||||
* [Ff]: f = RLIMIT_FSIZE max file size (KB)
|
* [Ff]: f = RLIMIT_FSIZE max file size (KB)
|
||||||
|
* [Ii]: i = RLIMIT_NICE max nice value (0..39 translates to 20..-19)
|
||||||
|
* [Kk]: k = file creation masK (umask)
|
||||||
|
* [Ll]: l = max number of logins for this user
|
||||||
* [Mm]: m = RLIMIT_MEMLOCK max locked-in-memory address space (KB)
|
* [Mm]: m = RLIMIT_MEMLOCK max locked-in-memory address space (KB)
|
||||||
* [Nn]: n = RLIMIT_NOFILE max number of open files
|
* [Nn]: n = RLIMIT_NOFILE max number of open files
|
||||||
|
* [Oo]: o = RLIMIT_RTPRIO max real time priority (linux/sched.h 0..MAX_RT_PRIO)
|
||||||
|
* [Pp]: p = process priority -20..20 (negative = high, positive = low)
|
||||||
* [Rr]: r = RLIMIT_RSS max resident set size (KB)
|
* [Rr]: r = RLIMIT_RSS max resident set size (KB)
|
||||||
* [Ss]: s = RLIMIT_STACK max stack size (KB)
|
* [Ss]: s = RLIMIT_STACK max stack size (KB)
|
||||||
* [Tt]: t = RLIMIT_CPU max CPU time (MIN)
|
* [Tt]: t = RLIMIT_CPU max CPU time (MIN)
|
||||||
* [Uu]: u = RLIMIT_NPROC max number of processes
|
* [Uu]: u = RLIMIT_NPROC max number of processes
|
||||||
* [Kk]: k = file creation masK (umask)
|
|
||||||
* [Ll]: l = max number of logins for this user
|
|
||||||
* [Pp]: p = process priority -20..20 (negative = high, positive = low)
|
|
||||||
* [Ii]: i = RLIMIT_NICE max nice value (0..39 translates to 20..-19)
|
|
||||||
* [Oo]: o = RLIMIT_RTPRIO max real time priority (linux/sched.h 0..MAX_RT_PRIO)
|
|
||||||
*
|
*
|
||||||
* NOTE: Remember to extend the "no-limits" string below when adding a new
|
* NOTE: Remember to extend the "no-limits" string below when adding a new
|
||||||
* limit...
|
* limit...
|
||||||
@ -258,9 +258,9 @@ static int do_user_limits (const char *buf, const char *name)
|
|||||||
if (strcmp (pp, "-") == 0) {
|
if (strcmp (pp, "-") == 0) {
|
||||||
/* Remember to extend this, too, when adding new limits!
|
/* Remember to extend this, too, when adding new limits!
|
||||||
* Oh... but "unlimited" does not make sense for umask,
|
* Oh... but "unlimited" does not make sense for umask,
|
||||||
* or does it?
|
* or does it? (K-)
|
||||||
*/
|
*/
|
||||||
pp = "A- C- D- F- M- N- R- S- T- P- I- O-";
|
pp = "A- C- D- F- I- L- M- N- O- P- R- S- T- U-";
|
||||||
}
|
}
|
||||||
|
|
||||||
while ('\0' != *pp) {
|
while ('\0' != *pp) {
|
||||||
@ -272,11 +272,11 @@ static int do_user_limits (const char *buf, const char *name)
|
|||||||
retval |= setrlimit_value (RLIMIT_AS, pp, 1024);
|
retval |= setrlimit_value (RLIMIT_AS, pp, 1024);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_CPU
|
#ifdef RLIMIT_CORE
|
||||||
case 't':
|
case 'c':
|
||||||
case 'T':
|
case 'C':
|
||||||
/* RLIMIT_CPU - max CPU time (MIN) */
|
/* RLIMIT_CORE - max core file size (KB) */
|
||||||
retval |= setrlimit_value (RLIMIT_CPU, pp, 60);
|
retval |= setrlimit_value (RLIMIT_CORE, pp, 1024);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_DATA
|
#ifdef RLIMIT_DATA
|
||||||
@ -293,20 +293,22 @@ static int do_user_limits (const char *buf, const char *name)
|
|||||||
retval |= setrlimit_value (RLIMIT_FSIZE, pp, 1024);
|
retval |= setrlimit_value (RLIMIT_FSIZE, pp, 1024);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_NPROC
|
#ifdef RLIMIT_NICE
|
||||||
case 'u':
|
case 'i':
|
||||||
case 'U':
|
case 'I':
|
||||||
/* RLIMIT_NPROC - max number of processes */
|
/* RLIMIT_NICE - max scheduling priority (0..39) */
|
||||||
retval |= setrlimit_value (RLIMIT_NPROC, pp, 1);
|
retval |= setrlimit_value (RLIMIT_NICE, pp, 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_CORE
|
case 'k':
|
||||||
case 'c':
|
case 'K':
|
||||||
case 'C':
|
retval |= set_umask (pp);
|
||||||
/* RLIMIT_CORE - max core file size (KB) */
|
break;
|
||||||
retval |= setrlimit_value (RLIMIT_CORE, pp, 1024);
|
case 'l':
|
||||||
|
case 'L':
|
||||||
|
/* LIMIT the number of concurrent logins */
|
||||||
|
retval |= check_logins (name, pp);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef RLIMIT_MEMLOCK
|
#ifdef RLIMIT_MEMLOCK
|
||||||
case 'm':
|
case 'm':
|
||||||
case 'M':
|
case 'M':
|
||||||
@ -321,6 +323,17 @@ static int do_user_limits (const char *buf, const char *name)
|
|||||||
retval |= setrlimit_value (RLIMIT_NOFILE, pp, 1);
|
retval |= setrlimit_value (RLIMIT_NOFILE, pp, 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RLIMIT_RTPRIO
|
||||||
|
case 'o':
|
||||||
|
case 'O':
|
||||||
|
/* RLIMIT_RTPRIO - max real time priority (0..MAX_RT_PRIO) */
|
||||||
|
retval |= setrlimit_value (RLIMIT_RTPRIO, pp, 1);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case 'p':
|
||||||
|
case 'P':
|
||||||
|
retval |= set_prio (pp);
|
||||||
|
break;
|
||||||
#ifdef RLIMIT_RSS
|
#ifdef RLIMIT_RSS
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -335,33 +348,20 @@ static int do_user_limits (const char *buf, const char *name)
|
|||||||
retval |= setrlimit_value (RLIMIT_STACK, pp, 1024);
|
retval |= setrlimit_value (RLIMIT_STACK, pp, 1024);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_NICE
|
#ifdef RLIMIT_CPU
|
||||||
case 'i':
|
case 't':
|
||||||
case 'I':
|
case 'T':
|
||||||
/* RLIMIT_NICE - max scheduling priority (0..39) */
|
/* RLIMIT_CPU - max CPU time (MIN) */
|
||||||
retval |= setrlimit_value (RLIMIT_NICE, pp, 1);
|
retval |= setrlimit_value (RLIMIT_CPU, pp, 60);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_RTPRIO
|
#ifdef RLIMIT_NPROC
|
||||||
case 'o':
|
case 'u':
|
||||||
case 'O':
|
case 'U':
|
||||||
/* RLIMIT_RTPRIO - max real time priority (0..MAX_RT_PRIO) */
|
/* RLIMIT_NPROC - max number of processes */
|
||||||
retval |= setrlimit_value (RLIMIT_RTPRIO, pp, 1);
|
retval |= setrlimit_value (RLIMIT_NPROC, pp, 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'k':
|
|
||||||
case 'K':
|
|
||||||
retval |= set_umask (pp);
|
|
||||||
break;
|
|
||||||
case 'l':
|
|
||||||
case 'L':
|
|
||||||
/* LIMIT the number of concurrent logins */
|
|
||||||
retval |= check_logins (name, pp);
|
|
||||||
break;
|
|
||||||
case 'p':
|
|
||||||
case 'P':
|
|
||||||
retval |= set_prio (pp);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
/* Only report invalid strings once */
|
/* Only report invalid strings once */
|
||||||
/* Note: A string can be invalid just because a
|
/* Note: A string can be invalid just because a
|
||||||
@ -473,7 +473,7 @@ static int setup_user_limits (const char *uname)
|
|||||||
* the last encountered entry for a matching group rules.
|
* the last encountered entry for a matching group rules.
|
||||||
* If there is no matching group entry, the default limits rule.
|
* If there is no matching group entry, the default limits rule.
|
||||||
*/
|
*/
|
||||||
if (sscanf (buf, "%s%[ACDFMNRSTULPIOacdfmnrstulpio0-9 \t-]",
|
if (sscanf (buf, "%s%[ACDFIKLMNOPRSTUacdfiklmnoprstu0-9 \t-]",
|
||||||
name, tempbuf) == 2) {
|
name, tempbuf) == 2) {
|
||||||
if (strcmp (name, uname) == 0) {
|
if (strcmp (name, uname) == 0) {
|
||||||
strcpy (limits, tempbuf);
|
strcpy (limits, tempbuf);
|
||||||
|
@ -89,26 +89,26 @@
|
|||||||
<listitem><para>C: max core file size (KB)</para></listitem>
|
<listitem><para>C: max core file size (KB)</para></listitem>
|
||||||
<listitem><para>D: max data size (KB)</para></listitem>
|
<listitem><para>D: max data size (KB)</para></listitem>
|
||||||
<listitem><para>F: maximum filesize (KB)</para></listitem>
|
<listitem><para>F: maximum filesize (KB)</para></listitem>
|
||||||
<listitem><para>M: max locked-in-memory address space (KB)</para></listitem>
|
|
||||||
<listitem><para>N: max number of open files</para></listitem>
|
|
||||||
<listitem><para>R: max resident set size (KB)</para></listitem>
|
|
||||||
<listitem><para>S: max stack size (KB)</para></listitem>
|
|
||||||
<listitem><para>T: max CPU time (MIN)</para></listitem>
|
|
||||||
<listitem><para>U: max number of processes</para></listitem>
|
|
||||||
<listitem><para>K: file creation mask, set by
|
<listitem><para>K: file creation mask, set by
|
||||||
<citerefentry>
|
<citerefentry>
|
||||||
<refentrytitle>umask</refentrytitle><manvolnum>2</manvolnum>
|
<refentrytitle>umask</refentrytitle><manvolnum>2</manvolnum>
|
||||||
</citerefentry>.</para>
|
</citerefentry>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem><para>I: max nice value (0..39 which translates to
|
||||||
|
20..-19)</para></listitem>
|
||||||
<listitem><para>L: max number of logins for this user</para></listitem>
|
<listitem><para>L: max number of logins for this user</para></listitem>
|
||||||
|
<listitem><para>M: max locked-in-memory address space (KB)</para></listitem>
|
||||||
|
<listitem><para>N: max number of open files</para></listitem>
|
||||||
|
<listitem><para>O: max real time priority</para></listitem>
|
||||||
<listitem><para>P: process priority, set by
|
<listitem><para>P: process priority, set by
|
||||||
<citerefentry>
|
<citerefentry>
|
||||||
<refentrytitle>setpriority</refentrytitle><manvolnum>2</manvolnum>
|
<refentrytitle>setpriority</refentrytitle><manvolnum>2</manvolnum>
|
||||||
</citerefentry>.</para>
|
</citerefentry>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem><para>I: max nice value (0..39 which translates to
|
<listitem><para>R: max resident set size (KB)</para></listitem>
|
||||||
20..-19)</para></listitem>
|
<listitem><para>S: max stack size (KB)</para></listitem>
|
||||||
<listitem><para>O: max real time priority</para></listitem>
|
<listitem><para>T: max CPU time (MIN)</para></listitem>
|
||||||
|
<listitem><para>U: max number of processes</para></listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
Loading…
Reference in New Issue
Block a user