01-28-2013
169,
28
Join Date: Feb 2008
Last Activity: 19 May 2020, 5:17 AM EDT
Location: Linux Machines @Mumbai & Bangalore
Posts: 169
Thanks Given: 10
Thanked 28 Times in 26 Posts
Small query regarding function "char * strerror(int errnum)"
As this function returns the address of the string corressponding to the errno value provided to it. Can someone please let me know where, in the memory, it could be (on freeBSD).
The MAN page tells under the BUG section that "For unknown error numbers, the strerror() function will return its result in a static buffer which may be overwritten by subsequent calls."
But it doesn't explictly mentions of anything, under normal conditions, of the storage location of the string that whether its the 'heap' area or some system array which holds the 'string object' whose address is returned by the function strerror().
Additionally what is sys_errlist in freeBSD and how to access it directly? Is it the array/table which holds the strings corressponding to the errno whose address is returned by the function strerror() (the MAN pages didn't tell this explictly); if yes then I have the following further questions:
1) How it is instantialized? Is it unique for every process? When it is instantialized/initialized ?
2) Can it be edited from a program (If not under RO data section) ?
Last edited by Praveen_218; 01-28-2013 at 07:42 AM..