summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-solaris.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/port-solaris.c')
-rw-r--r--openbsd-compat/port-solaris.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/openbsd-compat/port-solaris.c b/openbsd-compat/port-solaris.c
index 2ab64d48..25382f1c 100644
--- a/openbsd-compat/port-solaris.c
+++ b/openbsd-compat/port-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: port-solaris.c,v 1.3 2006/10/31 23:28:49 dtucker Exp $ */
+/* $Id: port-solaris.c,v 1.4 2010/11/05 01:03:05 dtucker Exp $ */
/*
* Copyright (c) 2006 Chad Mynhier.
@@ -197,3 +197,33 @@ solaris_contract_post_fork_parent(pid_t pid)
close(ctl_fd);
}
#endif
+
+#ifdef USE_SOLARIS_PROJECTS
+#include <sys/task.h>
+#include <project.h>
+
+/*
+ * Get/set solaris default project.
+ * If we fail, just run along gracefully.
+ */
+void
+solaris_set_default_project(struct passwd *pw)
+{
+ struct project *defaultproject;
+ struct project tempproject;
+ char buf[1024];
+
+ /* get default project, if we fail just return gracefully */
+ if ((defaultproject = getdefaultproj(pw->pw_name, &tempproject, &buf,
+ sizeof(buf))) > 0) {
+ /* set default project */
+ if (setproject(defaultproject->pj_name, pw->pw_name,
+ TASK_NORMAL) != 0)
+ debug("setproject(%s): %s", defaultproject->pj_name,
+ strerror(errno));
+ } else {
+ /* debug on getdefaultproj() error */
+ debug("getdefaultproj(%s): %s", pw->pw_name, strerror(errno));
+ }
+}
+#endif /* USE_SOLARIS_PROJECTS */