Only in usr.bin/limits: limits diff -ru usr.bin/limits.orig/limits.1 usr.bin/limits/limits.1 --- usr.bin/limits.orig/limits.1 2004-04-22 14:08:07.000000000 -0300 +++ usr.bin/limits/limits.1 2004-09-12 18:04:38.000000000 -0300 @@ -218,6 +218,10 @@ command. The total number of simultaneously open files in the entire system is limited to the value displayed by the 'sysctl kern.maxfiles' command. +.It Fl r Op Ar limit +Select or set the +.Em forkdepth +resource limit. .It Fl s Op Ar limit Select or set the .Em stacksize Only in usr.bin/limits: limits.1.gz diff -ru usr.bin/limits.orig/limits.c usr.bin/limits/limits.c --- usr.bin/limits.orig/limits.c 2004-04-22 14:08:07.000000000 -0300 +++ usr.bin/limits/limits.c 2004-09-12 18:12:02.000000000 -0300 @@ -89,6 +89,7 @@ #ifdef RLIMIT_POSIXLOCKS { " posixlocks%-4s %8s", "\n", 1 }, #endif + { " forkdepth%-4s %8s", "\n", 1 }, } }, { "sh", "unlimited", "", " -H", " -S", "", @@ -107,6 +108,7 @@ #ifdef RLIMIT_POSIXLOCKS { "ulimit%s -k %s", ";\n", 1 }, #endif + { "ulimit%s -r %s", ";\n", 1 }, } }, { "csh", "unlimited", "", " -h", "", NULL, @@ -125,6 +127,7 @@ #ifdef RLIMIT_POSIXLOCKS { "limit%s advlocks %s", ";\n", 1 }, #endif + { "limit%s forkdepth %s", ";\n", 1 }, } }, { "bash|bash2", "unlimited", "", " -H", " -S", "", @@ -143,6 +146,7 @@ #ifdef RLIMIT_POSIXLOCKS { "ulimit%s -k %s", ";\n", 1 }, #endif + { "ulimit%s -r %s", ";\n", 1 }, } }, { "tcsh", "unlimited", "", " -h", "", NULL, @@ -161,6 +165,7 @@ #ifdef RLIMIT_POSIXLOCKS { "limit%s advlocks %s", ";\n", 1 }, #endif + { "limit%s forkdepth %s", ";\n", 1 }, } }, { "ksh|pdksh", "unlimited", "", " -H", " -S", "", @@ -179,6 +184,7 @@ #ifdef RLIMIT_POSIXLOCKS { "ulimit%s -k %s", ";\n", 1 }, #endif + { "ulimit%s -r %s", ";\n", 1 }, } }, { "zsh", "unlimited", "", " -H", " -S", "", @@ -197,6 +203,7 @@ #ifdef RLIMIT_POSIXLOCKS { "ulimit%s -k %s", ";\n", 1 }, #endif + { "ulimit%s -r %s", ";\n", 1 }, } }, { "rc|es", "unlimited", "", " -h", "", NULL, @@ -215,6 +222,7 @@ #ifdef RLIMIT_POSIXLOCKS { "limit%s advlocks %s", ";\n", 1 }, #endif + { "limit%s forkdepth %s", ";\n", 1 }, } }, { NULL } @@ -236,6 +244,7 @@ { "sbsize", login_getcapsize }, { "vmemoryuse", login_getcapsize }, { "posixlocks", login_getcapnum }, + { "forkdepth", login_getcapnum }, }; /* @@ -246,7 +255,7 @@ * to be modified accordingly! */ -#define RCS_STRING "tfdscmlunbvk" +#define RCS_STRING "tfdscmlunbvkr" static rlim_t resource_num(int which, int ch, const char *str); static void usage(void); @@ -285,7 +294,7 @@ } optarg = NULL; - while ((ch = getopt(argc, argv, ":EeC:U:BSHabc:d:f:k:l:m:n:s:t:u:v:")) != -1) { + while ((ch = getopt(argc, argv, ":EeC:U:BSHabc:d:f:k:l:m:n:r:s:t:u:v:")) != -1) { switch(ch) { case 'a': doall = 1; @@ -503,7 +512,7 @@ usage(void) { (void)fprintf(stderr, -"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuvk [val]] [[name=val ...] cmd]\n"); +"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuvkr [val]] [[name=val ...] cmd]\n"); exit(EXIT_FAILURE); } @@ -608,6 +617,7 @@ break; case RLIMIT_NPROC: case RLIMIT_NOFILE: + case RLIMIT_FORK: res = strtoq(s, &e, 0); s = e; break; Only in usr.bin/limits: limits.o