cvs commit: src/sys/sys syslimits.h src/lib/libc/gen ttyname.c
Joerg Sonnenberger
joerg at britannica.bec.de
Tue Aug 23 14:04:48 PDT 2005
On Tue, Aug 23, 2005 at 01:30:40PM -0700, Matthew Dillon wrote:
>
> :
> :On Tue, Aug 23, 2005 at 10:44:24AM -0700, Matthew Dillon wrote:
> :> Add a TTY_PATH_MAX limit, set to 256, and reduce the size of the ttyname
> :> static buffer from 1024 to a more reasonable TTY_PATH_MAX.
> :
> :What do you worry about? A few bytes in statically linked program? A few
> :bytes for dynamically linked programs? In both cases, the change should
> :be initialisation of static_buf at the time of first use, making it go
> :to BSS by default.
> :
> :The change just adds/keeps an undocumented, arbitrary limit in libc.
> :This is a *path name*, so it should be limited by the name of path names
> :and nothing else.
> :
> :Joerg
>
> This isn't a few bytes, this is 768 unnecessary extra bytes. We are
> not reserving a kilobyte just for a tty name buffer. It's a ridiculous
> and unnecessary waste of memory.
It is not ridiculous, because that is something an administrator might
want to do. Reserving the memory doesn't hurt as long as it is not
initialiased. So if you worry about that, don't initialise the variable
at all, which would save ~200 bytes anyway.
Joerg
More information about the Commits
mailing list