Roland Mainz wrote:
[EMAIL PROTECTED] wrote:
Is it safe to call setrlimit(RLIMIT_NOFILE, ..) from a library?
The code does
       if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
               rl.rlim_cur = rl.rlim_max;
               (void) setrlimit(RLIMIT_NOFILE, &rl);
       }
No.  Libraries should not have side effects like this.

Erm... depends on the type of library. libshell (which is ksh93 provided
as a shell) can generate such side-effects if someone uses the "ulimit"
builtin command.

If you invoke a "ulimit" command, then changing RLIMITs is not a side-effect. Instead it's the main intended result. Cases with side-effects are different, IMHO at least.

Hugh.

PS: Provided libshell only changes the intended limit, of course.

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to