beihl@sunburn (01/03/90)
Can anyone explain the following? Sbrk() seems to be returning a value
far larger than getrlimit or `limit` (from the shell). Who's right?
I've looked at the man pages for getrlimit, csh and sbrk and am still
clueless...
% cat > test.c
#include <sys/time.h>
#include <sys/resource.h>
extern int etext;
main() {
struct rlimit rlimit_ptr;
printf("sbrk(0): 0x%x\n",sbrk(0));
getrlimit(RLIMIT_DATA,&rlimit_ptr);
printf("rlimit: 0x%x\n",(unsigned int)&etext + rlimit_ptr.rlim_max);
}
^D
% cc test.c
% a.out
sbrk(0): 0x10001460
rlimit: 0x57fbe10
% limit
cputime unlimited
filesize unlimited
datasize 85988 kbytes
stacksize 512 kbytes
coredumpsize unlimited
memoryuse 12748 kbytes
%
Gary Beihl (beihl@mcc.com)
grr@cbmvax.commodore.com (George Robbins) (01/04/90)
In article <5040@cadillac.CAD.MCC.COM> beihl@sunburn () writes: > > Can anyone explain the following? Sbrk() seems to be returning a value > far larger than getrlimit or `limit` (from the shell). Who's right? > I've looked at the man pages for getrlimit, csh and sbrk and am still > clueless... The data segment is not contiguous with the text segmnent, presumably it starts at 0x10000000. So sbrk is returning and address, limit is defining an amount... This is documented somewhere, though I forgets exactly where... -- George Robbins - now working for, uucp: {uunet|pyramid|rutgers}!cbmvax!grr but no way officially representing arpa: cbmvax!grr@uunet.uu.net Commodore, Engineering Department fone: 215-431-9255 (only by moonlite)