1setproject(3PROJECT)Project Database Access Library Functionssetproject(3PROJECT)
2
3
4

NAME

6       setproject - associate a user process with a project
7

SYNOPSIS

9       cc [ flag ... ] file... -lproject [ library ... ]
10       #include <project.h>
11
12       int setproject(const char *project_name, const char *user_name,
13            uint_t flags);
14
15

DESCRIPTION

17       The setproject() function provides a simplified method for the associa‐
18       tion of a user process with a project and its various resource  manage‐
19       ment  attributes,  as  stored  in the project(4) name service database.
20       These attributes include resource control settings, resource pool  mem‐
21       bership,  and  third  party  attributes  (which  are ignored by setpro‐
22       ject().)
23
24
25       If  user_name  is  a  valid  member  of  the   project   specified   by
26       project_name, as determined by inproj(3PROJECT), setproject() will cre‐
27       ate a new task with settaskid(2) using task flags specified  by  flags,
28       use setrctl(2) to associate various resource controls with the process,
29       task, and project, and bind the  calling  process  to  the  appropriate
30       resource  pool  with  pool_set_binding(3POOL).   Resource  controls not
31       explicitly specified  in  the  project  entry  will  be  preserved.  If
32       user_name  is  a  name of the superuser (user with UID equal to 0), the
33       setproject() function skips the inproj(3PROJECT) check described  above
34       and allows the superuser to join any project.
35
36
37       The  current  process  will  not  be  bound  to  a resource pool if the
38       resource pools facility (see pooladm(1M)) is inactive. The setproject()
39       function   will  succeed  whether  or  not  the  project  specified  by
40       project_name specifies a project.pool attribute. If the resource  pools
41       facility  is  active,  setproject()  will  fail if the project does not
42       specify a project.pool  attribute  and  there  is  no  designated  pool
43       accepting default assignments. The setproject() function will also fail
44       if there is a specified project.pool attribute for a nonexistent pool.
45

RETURN VALUES

47       Upon successful completion, setproject()  returns  0.  If  any  of  the
48       resource  control  assignments  failed but the project assignment, pool
49       binding, and task creation succeeded, an integer value corresponding to
50       the offset into the key-value pair list of the failed attribute assign‐
51       ment is returned. If the project assignment or task  creation  was  not
52       successful,  setproject()  returns  SETPROJ_ERR_TASK  and sets errno to
53       indicate the error. In the event of a  pool  binding  failure,  setpro‐
54       ject()  returns  SETPROJ_ERR_POOL and sets errno to indicate the error.
55       Additional error information can be retrieved from pool_error(3POOL).
56

ERRORS

58       The setproject() function will fail during project assignment  or  task
59       creation if:
60
61       EACCES    The invoking task was created with the TASK_FINAL flag.
62
63
64       EAGAIN    A  resource  control  limiting the number of LWPs or tasks in
65                 the target project or zone has been exceeded.
66
67                 A resource control on the given project would be exceeded.
68
69
70       EINVAL    The project ID associated  with  the  given  project  is  not
71                 within  the  range  of  valid project IDs, invalid flags were
72                 specified, or user_name is NULL.
73
74
75       EPERM     The effective user of the calling process is not superuser.
76
77
78       ESRCH     The specified user is not a valid user of the given  project,
79                 user_name  is  not  valid  user  name, or project_name is not
80                 valid project name.
81
82
83
84       The setproject() function will fail during pool binding if:
85
86       EACCES    No resource pool accepting default bindings exists.
87
88
89       EPERM     The effective user of the calling process is not superuser.
90
91
92       ESRCH     The specified resource pool is unknown
93
94
95
96       If setproject() returns an offset into the  key-value  pair  list,  the
97       returned error value is associated with setrctl(2) for resource control
98       attributes.
99

USAGE

101       The setproject() function recognizes a name-structured value  pair  for
102       the attributes in the project(4) database with the following format:
103
104         entity.control=(privilege,value,action,action,...),...
105
106
107
108       where privilege is one of BASIC or PRIVILEGED, value is a numeric value
109       with optional units, and action is one of none, deny, and signal=signum
110       or  signal=SIGNAME. For instance, to set a series of progressively more
111       assertive control values on a project's per-process CPU time, specify
112
113         process.max-cpu-time=(PRIVILEGED,1000s,signal=SIGXRES), \
114         (PRIVILEGED,1250, signal=SIGTERM),(PRIVILEGED,1500,
115              signal=SIGKILL)
116
117
118
119       To prevent a task from  exceeding  a  total  of  128  LWPs,  specify  a
120       resource control with
121
122         task.max-lwps=(PRIVILEGED,128,deny)
123
124
125
126       Specifying  a  resource control name with no values causes all resource
127       control values for that name to be cleared on the given project,  leav‐
128       ing  only  the  system resource control value on the specified resource
129       control name.
130
131
132       For example, to remove all resource control values  on  shared  memory,
133       specify:
134
135         project.max-shm-memory
136
137
138
139       The  project  attribute, project.pool, specifies the pool to which pro‐
140       cesses associated with the project entry should be  bound.  Its  format
141       is:
142
143         project.pool=pool_name
144
145
146
147       where  pool_name  is a valid resource pool within the active configura‐
148       tion enabled with pooladm(1M).
149
150
151       The final attribute is used to finalize the  task  created  by  setpro‐
152       ject(). Seesettaskid(2).
153
154         task.final
155
156
157
158       All  further attempts to create new tasks, such as using newtask(1) and
159       su(1M), will fail.
160

ATTRIBUTES

162       See attributes(5) for descriptions of the following attributes:
163
164
165
166
167       ┌─────────────────────────────┬─────────────────────────────┐
168       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
169       ├─────────────────────────────┼─────────────────────────────┤
170       │Interface Stability          │Evolving                     │
171       ├─────────────────────────────┼─────────────────────────────┤
172       │MT-Level                     │MT-Safe                      │
173       └─────────────────────────────┴─────────────────────────────┘
174

SEE ALSO

176       pooladm(1M),  setrctl(2),   settaskid(2),   inproj(3PROJECT),   libpro‐
177       ject(3LIB),   pool_error(3POOL),   pool_set_binding(3POOL),  passwd(4),
178       project(4), attributes(5)
179
180
181
182SunOS 5.11                        10 Apr 2007             setproject(3PROJECT)
Impressum