Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2002 01:32:17 +1100
From:      Tim Robbins <tjr@FreeBSD.ORG>
To:        Nate Lawson <nate@root.org>
Cc:        current@FreeBSD.ORG
Subject:   Re: libc size
Message-ID:  <20021101013217.A36373@dilbert.robbins.dropbear.id.au>
In-Reply-To: <Pine.BSF.4.21.0210301233500.91624-100000@root.org>; from nate@root.org on Wed, Oct 30, 2002 at 12:46:15PM -0800
References:  <Pine.BSF.4.21.0210301233500.91624-100000@root.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 30, 2002 at 12:46:15PM -0800, Nate Lawson wrote:

> After a discussion on cvs-all regarding size of our libc, I wrote a quick
> script to see where the problems are.  A cursory glance at its output
> shows there are numerous things we can improve, including:
> 
>   * setproctitle(3) uses 4k of static scratch buffers when it could
>     allocate these on the stack (let alone reducing the length of the
>     proc title to something more reasonable than 2k).
> 
>   * vfwprintf and vfprintf are near duplicates of each other (in fact,
>     the former is derived from the latter).  Each uses 14k of text so
>     this could be split in half by combining them and selecting different
>     behavior with a flag.

They are similar enough at the C source level to be merged into a single
source file (in fact, Microsoft's C library does this), but they are
probably not similar enough at the machine code level to merge and save
text space. I have no idea how you could merge them in C to save a
significant amount of text space given that sizeof(char) != sizeof(wchar_t).

Basically, if you don't want wide character printf/scanf support in libc
for some kind of embedded system, remove them from stdio/Makefile.inc.
Nothing in the base system uses them, and few programs in the ports
collection do either. You could also replace the locale stuff with the
dummy versions from 4.4BSD if you don't want it (see OpenBSD's
src/lib/libc/stdlib/multibyte.c, etc.).



Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021101013217.A36373>