Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
setproject(3PROJECTProject Database Access Library Functiosetproject(3PROJECT)

NAME
       setproject  - place process in new project with attendant resource con-
       trols, resource pools, and attributes

SYNOPSIS
       cc [ flag ... ] file... -lproject [ library ... ]
       #include	<project.h>

       int setproject(const char *project_name,	const char *user_name,	uint_t
       flags);

DESCRIPTION
       The setproject()	function provides a simplified method for the associa-
       tion of a user process with a project and its various resource  manage-
       ment  attributes,  as  stored  in the project(4)	name service database.
       These attributes	include	resource control settings, resource pool  mem-
       bership,	 and  third  party  attributes	(which	are ignored by setpro-
       ject().)

       If  user_name  is  a  valid  member  of	the   project	specified   by
       project_name, as	determined by inproj(3PROJECT),	setproject() will cre-
       ate a new task with settaskid(2)	using task flags specified  by	flags,
       use setrctl(2) to associate various resource controls with the process,
       task, and project, and bind the calling process to the appropriate  re-
       source  pool  with  pool_set_binding(3POOL).  Resource controls not ex-
       plicity specified in the	project	entry will be preserved. If  user_name
       is a name of the	superuser (user	with UID equal to 0), the setproject()
       function	skips the inproj(3PROJECT) check described  above  and	allows
       the superuser to	join any project.

       The  current  process  will  not	be bound to a resource pool if the re-
       source pools facility (see pooladm(1M)) is inactive.  The  setproject()
       function	  will	succeed	 whether  or  not  the	project	 specified  by
       project_name specifies a	project.pool attribute.	If the resource	 pools
       facility	 is  active,  setproject()  will  fail if the project does not
       specify a project.pool attribute	and there is no	 designated  pool  ac-
       cepting	default	 assignments. The setproject() function	will also fail
       if there	is a specified project.pool attribute for a nonexistent	pool.

RETURN VALUES
       Upon successful completion, setproject()	returns	0. If any of  the  re-
       source  control	assignments  failed  but  the project assignment, pool
       binding,	and task creation succeeded, an	integer	value corresponding to
       the offset into the key-value pair list of the failed attribute assign-
       ment is returned. If the	project	assignment or task  creation  was  not
       successful, setproject()	returns	SETPROJ_ERR_TASK and sets errno	to in-
       dicate the error. In the	event of a pool	binding	failure,  setproject()
       returns	SETPROJ_ERR_POOL  and  sets errno to indicate the error. Addi-
       tional error information	can be retrieved from pool_error(3POOL).

ERRORS
       The setproject()	function will fail during project assignment  or  task
       creation	if:

       EACCES
	     The invoking task was created with	the TASK_FINAL flag.

       EINVAL
	     The  project  ID  associated with the given project is not	within
	     the range of valid	project	IDs, invalid flags were	specified,  or
	     user_name is NULL.

       EPERM The effective user	of the calling process is not superuser.

       ESRCH The  specified  user  is  not  a valid user of the	given project,
	     user_name is not valid user name, or project_name	is  not	 valid
	     project name.

       The setproject()	function will fail during pool binding if:

       EACCES
	     No	resource pool accepting	default	bindings exists.

       EPERM The effective user	of the calling process is not superuser.

       ESRCH The specified resource pool is unknown

       If setproject() returns an offset into the key-value pair list, the re-
       turned error value is associated	with setrctl(2)	for  resource  control
       attributes.

USAGE
       The  setproject()  function recognizes a	name-structured	value pair for
       the attributes in the project(4)	database with the following format:

       entity.control=(privilege,value,action,action,...),...

       where privilege is one of BASIC or PRIVILEGED, value is a numeric value
       with optional units, and	action is one of none, deny, and signal=signum
       or signal=SIGNAME. For instance,	to set a series	of progressively  more
       assertive control values	on a project's per-process CPU time, specify

       process.max-cpu-time=(PRIVILEGED,1000s,signal=SIGXRES), \
       (PRIVILEGED,1250, signal=SIGTERM),(PRIVILEGED,1500,signal=SIGKILL)

       To  prevent  a  task  from exceeding a total of 128 LWPs, specify a re-
       source control with

       task.max-lwps=(PRIVILEGED,128,deny)

       The project attribute, project.pool, specifies the pool to  which  pro-
       cesses  associated  with	 the project entry should be bound. Its	format
       is:

       project.pool=pool_name

       where pool_name is a valid resource pool	within the  active  configura-
       tion enabled with pooladm(1M).

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       +-----------------------------+-----------------------------+
       |      ATTRIBUTE	TYPE	     |	    ATTRIBUTE VALUE	   |
       +-----------------------------+-----------------------------+
       |Interface Stability	     |Evolving			   |
       +-----------------------------+-----------------------------+
       |MT-Level		     |MT-Safe			   |
       +-----------------------------+-----------------------------+

SEE ALSO
       pooladm(1M),   setrctl(2),   settaskid(2),  inproj(3PROJECT),  pool_er-
       ror(3POOL),   pool_set_binding(3POOL),	passwd(4),   project(4),   at-
       tributes(5)

SunOS 5.9			  14 Jan 2002		  setproject(3PROJECT)

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | USAGE | ATTRIBUTES | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=setproject&sektion=3project&manpath=SunOS+5.9>

home | help