[lcdproc] Again FreeBSD and 0.4.1

Philip Pokorny ppokorny@penguincomputing.com
Tue, 05 Jun 2001 15:43:49 -0700


Guillaume Filion wrote:
> 
> >Age Kamminga wrote:
> >>
> >>  After the modifications made in 0.4.1 it compiles fine except for one
> >>  warning:
> >>
> >>  gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -Wall -Wno-unused -O6 -c sock.c
> >>  sock.c: In function `sock_create_server':
> >>  sock.c:87: warning: implicit declaration of function `bzero'
> >
> >Well, that's strange...  Funny, are you running FreeBSD?  bzero was a
> >BSD'ism...  Maybe we didn't get an include file someplace that caused
> >that warning...  Line 87 is the FD_ZERO macro.  FD_ZERO must be declared
> >in terms of bzero...
> >
> 
> http://support.qnx.com/support/docs/qnx_neutrino/lib_ref/b/bzero.html says:
> -----
> #include <strings.h>
> 
> void bzero( void *dst, size_t n );
> -----
> and sock.c does not include <strings.h>, so I guess it's the problem.
> Adding #include <strings.h> on the top of sock.c removes the warning
> on FreeBSD 4.0. Is strings.h present on every POSIX compliant system?
> If not we should include an autoconf test for it.

strings.h is NOT part of the standard C library header files.  It exists
on Linux and has some of the BSD stuff (like bzero) in it and some other
misc functions that aren't standard.

I would think this is a case where BSD is broke (or perhaps just rude)
in defining FD_ZERO in terms of bzero and not including the definition
of bzero by including the apropriate header file.

If you read "info autoconf" and search for 'strings',  you'll find that
the autoconf folks threw up their hands at this problem.

Given that bzero is a BSD specific thing and generally not "standard",
I'd recommend avoiding bzero in LCDproc (use memset which is
"standard"), and ask the BSD folks why FD_ZERO doesn't provide a
prototype for bzero?

Interestingly, the GNU header comments in bits/select.h that define
FD_ZERO say:

   /* We don't use `memset' because this would require a prototype and
      the array isn't too big.  */

Anyway, as I recall, the initial problem was that the lcdproc client was
dying.  This warning isn't the cause of that since the implicit
prototype for bzero would work just fine.

:v)

-- 
Philip Pokorny, Senior Engineer
http://www.penguincomputing.com

Penguin Computing - The World's Most Reliable Linux Systems


-----------------------------------------------------------
To unsubscribe from this list send a blank message to
lcdproc-unsubscribe@lists.omnipotent.net