[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9738.0. "table(TBL_UAREA,...) returns zero values in user.u_rlimit data structure" by RDGENG::READINGS_R (Richard Readings) Wed May 07 1997 09:49

Is there a reason why table(TBL_UAREA,...) should return zero values in the
user.u_rlimit data structure (see example below).

getrlimit returns the correct values.

-------------------------------- example.c ---------------------------------

#include <stdio.h>
#include <sys/table.h>
#include <sys/user.h>

main()
{
	int retvalue;
	long  cur_proc;
	struct rlimit  stddata; 
	struct user userinfo;

	/* 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 ;
	}

	/* Limits using TBL_UAREA */
	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() */
T.RTitleUserPersonal
Name
DateLines
9738.1QAR it.SMURF::WOODWARDWed May 07 1997 13:5812
    QAR it.... looked at the kernel side and the "fake_u" routine
    just doesn't copy it in.  
    
    Note the the "user" structure doesn't really exist in the kernel.  It
    is really spread over 3 different structures, uthread, utask and
    np_uthread.  The routine that pieces this together the create the 
    "user" structure isn't filling the structure out completely.  Looks
    like a bug to me.
    
    /jim