bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: declare sethostname if unistd.h doesn't


From: Ben Walton
Subject: Re: declare sethostname if unistd.h doesn't
Date: Tue, 29 Nov 2011 13:32:06 -0500
User-agent: Sup/git

Excerpts from Simon Josefsson's message of Mon Nov 21 05:00:04 -0500 2011:

> My point was that the POSIX prototype uses size_t and Solaris seems
> to use int, and as Paul pointed out, on 64-bit Solaris systems just
> providing the prototype will break -- there needs to be a wrapper
> function or a #define that casts the second parameter, or something
> similar.  The POSIX prototype has const as well, so you would get
> warnings passing a const string to the Solaris function if there is
> no casting or wrapper function.

Sorry to be so long getting back to this.  Last week got busier than
I'd anticipated and it also took me longer to work my way through the
integration of a new module than I'd expected.

I'm at the point where I have a module that works to allow inetutils
(from bootstrap) to build hostname on Solaris (with the mismatched
types in the declaration).  This uses only the declaration from gnulib
unistd.h.  On cygwin, the sethostname function is included in libgnu.a
although I don't currently have a usable SetComputerNameEx handler and
rely on -1/ENOSYS there still.  This is on my todo list still.

What I'm not sure about now is the gnulib way to provide a declaration
that will be valid for Solaris.  Is it better to simply ifdef the
declaration in unistd.h to be Solaris specific or is an alternate
wrapper function the way to go?  If an alternate function is better,
what's the best mechanism to handle this?  Is this a case where
REPLACE_SETHOSTNAME would be warranted?

If it would help and people wouldn't mind, I'll post the current patch
series for review so that if I'm off track I can correct before
implementing the remaining bits (including the tests).

Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302




reply via email to

[Prev in Thread] Current Thread [Next in Thread]