portability improvements for non-Linux systems

Denys Vlasenko vda.linux at googlemail.com
Fri Mar 26 18:09:52 UTC 2010


2010/3/24 Jérémie Koenig <jk at jk.fr.eu.org>:
> Hello,
>
> As part of my preparation for porting debian-installer to the Hurd (as
> a Debian GSoC project), I have done some preliminary work on busybox
> (more is to come), namely:
>
> 0c3df06 kconfig: fix #include ordering in the bison grammar
> 40293cf kconfig: drop PATH_MAX

I think Hurd is much better off introducing PATH_MAX and stop
trying to steer all Unix world their way. That won't work.

> 83ce04d libbb: reenable xmalloc_realpath()
> 0fcba35 realpath: use xmalloc_realpath() and drop PATH_MAX
> 1b81c60 start-stop-daemon: drop PATH_MAX

+       ssize_t bytes = MAX(strlen("/proc//cmdline") + sizeof(int)*3,
+                           strlen(execname) + 1);
+       char *buf = alloca(bytes + 1);

(1) You should use sizeof() on constant string, not strlen.
(2) strlen(execname) on every check? I don't like it.

> fb34704 libbb: use sysconf() to query the page size

What was wrong with defaulting to 4k?

> e8f57a6 libbb: utsname.dommainname is linux-only

So, how Hurd reports domain name of the machine?

> 88782c4 libbb: setsockopt_bindtodevice() portability stub
> 5a913d8 umount: use xmalloc_realpath() and drop PATH_MAX

GETMNTENT_BUFSIZE of "only" 16k? 80x25 screen is 2k.
16k is 8 screenfuls of text, filled edge to edge.
Do you really think this is such a pressing issue
to support mnt entries THAT big?

I prefer instead:

#ifndef PATH_MAX
# define PATH_MAX (4*1024)
#endif


+               if (path) free(path);

free(NULL) is ok, no need to check.

> (the patches are attached)

Applied with some changes. Please try current git.
--
vda


More information about the busybox mailing list