Configurable buffer sizes for PWD/GRP_BUFFER_SIZE

Ricard Wanderlof ricard.wanderlof at axis.com
Fri Nov 17 08:38:34 UTC 2006


In libc/pwd_grp/pwd_grp.c, the following macros set the corresponding 
buffer sizes to a fixed size of 256. For reference, the corresponding 
sizes for glibc seems to be 1024 (checked at a glance, albeit with an 
older glibc I happened to have lying around). The parameters are among 
other things related to the length of a single line in the /etc/group 
file, which in turn is related to the number of users (and the length 
of their usernames) for a given group.

In a run-of-the-mill embedded system with few users there would be no 
point in extending the buffers (there seem to be 13 of them statically 
allocated throughout the file, so there is multiplicative penalty for 
increasing the size), on the other hand, in our application the default 
size turns out to be a limit.

Would there be a point in having the buffer sizes configurable via the 
uClibc config instead of fixed at 256 ? Comments?

/Ricard


-- snippet from libc/pwd_grp/pwd_grp.c

/**********************************************************************/
/* Sizes for statically allocated buffers. */

/* If you change these values, also change _SC_GETPW_R_SIZE_MAX and
  * _SC_GETGR_R_SIZE_MAX in libc/unistd/sysconf.c to match */
#define PWD_BUFFER_SIZE 256
#define GRP_BUFFER_SIZE 256


--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the uClibc mailing list