[PATCH] Hide sethostname() in unistd.h

Christian Franke Christian.Franke@t-online.de
Wed Jun 17 20:25:00 GMT 2015

Corinna Vinschen wrote:
> On Jun 17 07:38, Christian Franke wrote:
>> Corinna Vinschen wrote:
>>> On Jun 16 18:27, Christian Franke wrote:
>>>> Found during an experimental build of busybox:
>>>> The sethostname() prototype in /usr/include/sys/unistd.h is enabled also on
>>>> Cygwin.
>>>> It should be disabled because Cygwin does not provide this function.
>>>> Christian
>>> What about implementing sethostname instead?
>>>    extern "C" int
>>>    sethostname (const char *name, size_t len)
>>> ...
>> I didn't consider this as an alternative because I guessed that it is
>> intentional that sethostname is missing.
>> (it is not a typical that someone wants to use Cygwin to change the name of
>> a Windows machine)
> You're right there.  But, we have a lot of interfaces defined in newlib
> headers which are not available on all platforms, but we're not
> explicitely filtering them per platform.

I see. Then let's forget the patch.

> Afaics, the problem is the configuration of busybox, not unistd.h.
> Checking for prototypes in headers is not sufficient to check for the
> availablility of functions, only for the availability of the prototype.
> The configuration should also try a link check on the function with
> AC_CHECK_FUNC or something like that.

Busybox does not use autoconf or similar. It requires manual platform 
specific configuration which does not yet support a missing 
sethostname(). After adding HAVE_SETHOSTNAME manually and some other 
minor additions, busybox (which many commands enabled) compiles and 
works reasonably.
Would ITP make sense ?


More information about the Cygwin-patches mailing list