summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-11-05 12:03:05 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-11-05 12:03:05 +1100
commit97528353c2b4f27169ea9b81e5c4420c734ceea2 (patch)
tree7f373a0ff2a453fc4b86c3467501c485dd510e44 /openbsd-compat
parent34ee4204c6051f5f48113903750738e8e055a778 (diff)
- (dtucker) [configure.ac platform.{c,h} session.c
openbsd-compat/port-solaris.{c,h}] Bug #1824: Add Solaris Project support. Patch from cory.erickson at csu mnscu edu with a bit of rework from me. ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/port-solaris.c32
-rw-r--r--openbsd-compat/port-solaris.h5
2 files changed, 35 insertions, 2 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 */
209void
210solaris_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 */
diff --git a/openbsd-compat/port-solaris.h b/openbsd-compat/port-solaris.h
index 4c324871e..cd442e78b 100644
--- a/openbsd-compat/port-solaris.h
+++ b/openbsd-compat/port-solaris.h
@@ -1,4 +1,4 @@
1/* $Id: port-solaris.h,v 1.1 2006/08/30 17:24:42 djm Exp $ */ 1/* $Id: port-solaris.h,v 1.2 2010/11/05 01:03:05 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Chad Mynhier. 4 * Copyright (c) 2006 Chad Mynhier.
@@ -20,8 +20,11 @@
20 20
21#include <sys/types.h> 21#include <sys/types.h>
22 22
23#include <pwd.h>
24
23void solaris_contract_pre_fork(void); 25void solaris_contract_pre_fork(void);
24void solaris_contract_post_fork_child(void); 26void solaris_contract_post_fork_child(void);
25void solaris_contract_post_fork_parent(pid_t pid); 27void solaris_contract_post_fork_parent(pid_t pid);
28void solaris_set_default_project(struct passwd *);
26 29
27#endif 30#endif