Open System Services Programmer's Guide

srch_option, /* search for OSS process */
, /* attribute codes used in search */
, /* number of attributes used */
, /* match values found */
, /* length of list returned */
osspid /* OSS process ID */
);
/* If unsuccessful, print error message and exit. */
if (retcode != 0) {
fprintf(stderr, "retcode = %d\n", retcode);
fprintf(stderr, "Failure details = %d\n",errordetail);
exit(1);
}
printf("Printing selected process attributes:\n\n");
i = 0; /* start at beginning of the buffer printing out
the values of process attributes returned */
printf("Real group ID = %d\n", (*(gid_t*)(&values_list[i])));
i += (sizeof(gid_t)/sizeof(short));
printf("Real user ID = %d\n", (*(uid_t*)(&values_list[i])));
i += (sizeof(uid_t)/sizeof(short));
printf("Effective group ID = %d\n", (*(gid_t*)(&values_list[i])));
i += (sizeof(gid_t)/sizeof(short));
printf("Effective user ID = %d\n", (*(uid_t*)(&values_list[i])));
i += (sizeof(uid_t)/sizeof(short));
printf("OSS process ID = %d\n", (*(pid_t*)(&values_list[i])));
i += (sizeof(pid_t)/sizeof(short));
printf("Parent process ID = %d\n", (*(pid_t*)(&values_list[i])));
i += (sizeof(pid_t)/sizeof(short));
printf("Session leader = %d\n", (*(pid_t*)(&values_list[i])));
i += (sizeof(pid_t)/sizeof(short));
printf("Group leader = %d\n", (*(pid_t*)(&values_list[i])));
i += (sizeof(pid_t)/sizeof(short));
nbytes = values_list[i++];
strncpy(ctty, (char *)&values_list[i], nbytes);
printf("Control tty = %s\n", ctty);
i += (nbytes+1)/(sizeof(short));
printf("Current size of native heap area = %d bytes\n", values_list[i]);
i += 2; /* 2 short's */
printf("Maximum size of native heap area = %d bytes\n", values_list[i]);
i += 2; /* 2 short's */
printf("Process wait state = %o\n", values_list[i++]);
printf("Process state = %o\n", values_list[i++]);
printf("Process handle = %o,%o,%o,%o,%o\n",
values_list[i],
values_list[i+1],
values_list[i+2],
values_list[i+3],
values_list[i+4]);
exit(0);
}
Modifying the Process Environment
The OSS API and the Guardian API both allow you to modify characteristics about both OSS and
Guardian processes and their environments.
Using the OSS API
OSS functions can change information about process environment variables (putenv()), user IDs
(setuid()), and group IDs (setgid()) for OSS and Guardian processes. Because Guardian
Modifying the Process Environment 135