| Re .1,
> Well, sorry to say, but that's what PIOCGETU returns. It's simply
> not implemented before our "Steel" release.
As an alternative the customer has been using the 'table(TBL_UAREA..)'
interface. However, the 'u_rlimit[RLIM_NLIMITS]' field of user structure
does not seem to contain any relevant data on resource limits. For example
the following program always returns DataLimCur and DataLimMAX as zero. Is this
correct?
Richard
-------------------------------- example.c ------------------------------
#include <stdio.h>
#include <sys/time.h>
#include <sys/table.h>
#include <sys/user.h>
#include <signal.h>
#include <sys/errno.h>
#include <sys/resource.h>
main()
{
int tblid, index, retvalue;
long cur_proc;
struct rlimit stddata;
struct user userinfo;
fprintf(stdout, "PLEASE REMEMBER TO RUN THIS PROGRAM AS SUPER-USER\n\n");
/* Get Current Process ID */
cur_proc = getpid();
/* Get UAREA for Current Process */
retvalue = table(TBL_UAREA, cur_proc, &userinfo, 1, sizeof(userinfo));
if (retvalue < 0)
{
fprintf(stderr, "UAREA interface failed: Error = %d\n", errno);
return ;
}
fprintf(stdout, "\n TBL_UAREA Sucess:Current PID: %ld\n", cur_proc);
fprintf(stdout, "\t u_logname = %s\n", userinfo.u_logname);
fprintf(stdout, "\t u_ssize = %d\n", userinfo.u_ssize);
fprintf(stdout, "\t u_tsize = %d\n", userinfo.u_tsize);
fprintf(stdout, "\t u_dsize = %d\n", userinfo.u_dsize);
fprintf(stdout, "\t u_outime = %d\n", userinfo.u_outime);
fprintf(stdout, "\t r_usage vol ctx = %d\n", userinfo.u_ru.ru_nvcsw);
fprintf(stdout, " Limits Using TBL_UAREA For current Process\n");
fprintf(stdout, "\t DataLimCur = %ld", userinfo.u_rlimit[RLIMIT_DATA].rlim_cur);
fprintf(stdout, "\t DataLimMAX = %ld\n", userinfo.u_rlimit[RLIMIT_DATA].rlim_max);
/* Limits Using getrlimit */
if (getrlimit(RLIMIT_DATA, &stddata) < 0)
{
fprintf(stdout, "\n getrlimit fails: Error is %d\n", errno);
return;
}
fprintf(stdout, "\n Limits Using getrlimit For current Process\n");
fprintf(stdout, "\t Cur = %lu, Max = %lu\n", stddata.rlim_cur,stddata.rlim_max);
} /* end of main() */
|