diff options
Diffstat (limited to 'openbsd-compat/port-solaris.c')
-rw-r--r-- | openbsd-compat/port-solaris.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/openbsd-compat/port-solaris.c b/openbsd-compat/port-solaris.c index 2ab64d487..25382f1c9 100644 --- a/openbsd-compat/port-solaris.c +++ b/openbsd-compat/port-solaris.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: port-solaris.c,v 1.3 2006/10/31 23:28:49 dtucker Exp $ */ | 1 | /* $Id: port-solaris.c,v 1.4 2010/11/05 01:03:05 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2006 Chad Mynhier. | 4 | * Copyright (c) 2006 Chad Mynhier. |
@@ -197,3 +197,33 @@ solaris_contract_post_fork_parent(pid_t pid) | |||
197 | close(ctl_fd); | 197 | close(ctl_fd); |
198 | } | 198 | } |
199 | #endif | 199 | #endif |
200 | |||
201 | #ifdef USE_SOLARIS_PROJECTS | ||
202 | #include <sys/task.h> | ||
203 | #include <project.h> | ||
204 | |||
205 | /* | ||
206 | * Get/set solaris default project. | ||
207 | * If we fail, just run along gracefully. | ||
208 | */ | ||
209 | void | ||
210 | solaris_set_default_project(struct passwd *pw) | ||
211 | { | ||
212 | struct project *defaultproject; | ||
213 | struct project tempproject; | ||
214 | char buf[1024]; | ||
215 | |||
216 | /* get default project, if we fail just return gracefully */ | ||
217 | if ((defaultproject = getdefaultproj(pw->pw_name, &tempproject, &buf, | ||
218 | sizeof(buf))) > 0) { | ||
219 | /* set default project */ | ||
220 | if (setproject(defaultproject->pj_name, pw->pw_name, | ||
221 | TASK_NORMAL) != 0) | ||
222 | debug("setproject(%s): %s", defaultproject->pj_name, | ||
223 | strerror(errno)); | ||
224 | } else { | ||
225 | /* debug on getdefaultproj() error */ | ||
226 | debug("getdefaultproj(%s): %s", pw->pw_name, strerror(errno)); | ||
227 | } | ||
228 | } | ||
229 | #endif /* USE_SOLARIS_PROJECTS */ | ||