proc limits {} { # Desc "Here you set up different limits, which you want your shell"\ "to apply to your programs." ShortDesc "Limits" Entry cputime \ -text "Maximum cpu time a process may use"\ -width 10 \ -packEntry:side right Entry filesize\ -text "Largest single file allowed"\ -width 10 \ -packEntry:side right Entry datasize \ -text "Maximum data size for the process (including stack)" \ -width 10 \ -packEntry:side right Entry stacksize \ -text "Maximum stack size for the process"\ -width 10 \ -default 8192k \ -packEntry:side right Entry coredumpsize \ -text "Maximum size of a core dump file"\ -default 0k \ -width 10 \ -packEntry:side right Int descriptors \ -text "Maximum number of descriptors"\ -default 64 \ -packEntry:side right ################################ Help ################################ Help cputime \ "If a process takes more than this amount of cpu time, it will"\ "stop.\n\n Format:\nblank - unlimited\nxxxh - xxx hours\nxxxm -"\ "xxx minutes\nmm:ss - mm minutes and ss seconds." Help filesize\ "This is the maximum size the shell allows a file to have\n\n"\ "Format:\nblank - unlimited\nxxxk - xxx kilobytes\nxxxm - xxx"\ "megabytes" Help datasize \ "This is the maximum size a process may occupy in the memory of"\ "the computer.\n\nFormat:\nblank - unlimited\nxxxk - xxx"\ "kilobytes\nxxxm - xxx megabytes" Help stacksize \ "This is the maximum size the stack may occupy in the memory of"\ "the computer. The stack is where variables of a function are"\ "pushed when the function is called\n\nFormat:\nblank -"\ "unlimited\nxxxk - xxx kilobytes\nxxxm - xxx megabytes" Help coredumpsize \ "This is the maximum size of a core dump file allowed. If you"\ "don't use the core dumps for anything, it's a very good idea to"\ "set this to zero, to avoid file system"\ "overflow\n\nFormat:\nblank - unlimited\nxxxk - xxx"\ "kilobytes\nxxxm - xxx megabytes" Help descriptors \ "This is the maximum number of files which may be opened"\ "simultaneously.\n\nFormat:\nblank - unlimited\nxxx - allow xxx"\ "descriptors" ############################## Page End ############################## PageEnd { if {$cputime != "" && ![regexp {^[0-9]+[hm]$} $cputime]} { error "Wrong format for cputime, should be one of:\nblank - unlimited\nxxxh - xxx hours\nxxxm - xxx minutes" } foreach elm {filesize datasize stacksize coredumpsize} { if {[set $elm] != "" && ![regexp {^[0-9]+[km]$} [set $elm]]} { error "wrong format for $elm, should be one of:\nblank - unlimited\nxxxk - xxx kilibytes\nxxxm - xxx megabytes" } } } ################################ Save ################################ Save { foreach elm {cputime filesize datasize stacksize coredumpsize descriptors} { if {[set $elm] != "" || $generateDefault} { if {[set $elm] == ""} { print "unlimit $elm" } else { print "limit $elm [set $elm]" } } } } }