This procedure adds a project named x-files to the /etc/project file and sets a maximum number of LWPs for a task created in the project.
For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.
$ projadd -K 'task.max-lwps=(privileged,3,deny)' x-files
$ projects -l system projid : 0 comment: "" users : (none) groups : (none) attribs: … x-files projid : 100 comment: "" users : (none) groups : (none) attribs: task.max-lwps=(privileged,3,deny)
$ cat /etc/project system:0:System::: … x-files:100::::task.max-lwps=(privileged,3,deny)
After implementing the steps in this procedure, when the user creates a new task in project x-files by joining the project with newtask, the user will not be able to create more than three LWPs while running in this task. This is shown in the following annotated sample session.
$ newtask -p x-files csh $ prctl -n task.max-lwps $$ process: 111107: csh NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT task.max-lwps usage 3 privileged 3 - deny - system 2.15G max deny - $ id -p uid=0(root) gid=1(other) projid=100(x-files) $ ps -o project,taskid -p $$ PROJECT TASKID x-files 73 $ csh /* creates second LWP */ $ csh /* creates third LWP */ $ csh /* cannot create more LWPs */ Vfork failed $