I have a code segment which reads:
<..>
char *maps;
<..>
maps = (char *)malloc(65536);
if (maps == NULL)
return -1;
size = read (fd, maps, 65536);
<..>
This code runs on Linux kernel 2.4 with glibc2.3. On certain systems of this platform the value of size is always capped at 4096 bytes. The actual file pointed to by fd is larger than that.
The same code runs without this 4096 appearing as a limit.
What should I be looking at?
I do not have access to the symptomatic systems but I instrumented the program to get some ideas as to whether it is a system-wide limit or some such thing. I got the following:
RLIMIT_AS(cur,max): <-1, -1>
RLIMIT_CORE(cur,max): <-1, -1>
RLIMIT_CPU(cur,max): <-1, -1>
RLIMIT_DATA(cur,max): <-1, -1>
RLIMIT_FSIZE(cur,max): <-1, -1>
RLIMIT_MEMLOCK(cur,max): <4096, 0>
RLIMIT_NOFILE(cur,max): <1024, 0>
RLIMIT_NPROC(cur,max): <4084, 0>
RLIMIT_STACK(cur,max): <10485760, 0>
RLIMIT_RSS(cur,max): <-1, -1>
What else should I be looking at? Is this a malloc related limit or it is related to the read() call?
Help would really be appreciated by this novice.