Roland Mainz wrote:
> IMO using projects(4), rctl etc. is an _overkill_. The idea is just to
> lower the limit as "safeguard" without requiring "root" access (which
> means projects(4) and SMF won't work... nor is it intended that the user
> has to do some administrative stuff first).
I was showing that the Solaris resource control framework can do so much
more than a simple ulimit.
prctl doesn't require you have "root" privilege to set the basic limits
(which is all you would be able to do via ulimit as an unprivileged user
anyay). You don't have to use projects or SMF I was just pointing out
how integrated this actually is with the rest of Solaris compared to a
simple ulimit call.
> Simple example:
> -- snip --
> function mythr
> {
> sleep 100
> }
>
> # main
> builtin pthread_create
>
> intefer i
> integer -a tid
>
> # set thread limit to 256
> ulimit -T 256
newtask
prctl -n task.max-lwps -v 256 $$
> for (( i=0 ; i < (Inf/10000.) ; i++ )) ; do
> pthread_create -L -f mythr -t tid[i] || break
> done
>
> print -u2 "# waiting for children..."
> wait -T "[EMAIL PROTECTED]"
>
> print -u2 "# done."
> exit 0
> -- snip --
So replace that single ulimit call with a call to newtask (which can
easily be written as a shell builtin if you desire) and set the
task.max-lwps value using prctl. The prctl call can be done using the
setrctl(2) syscall if you want to make that a shell built in as well.
--
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code