Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Oct 2002 17:00:12 -0700 (PDT)
From:      Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/43270
Message-ID:  <200210060000.g9600C5e070851@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/43270; it has been noted by GNATS.

From: Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: kern/43270
Date: Sat, 05 Oct 2002 17:53:06 -0600

 The types(5) manpage also mentions FD_ZERO (and FD_COPY) without
 referencing <string.h>. The underlying bug is in sys/types.h, which
 needs a conditional declaration of bzero and bcopy. The attached patch
 (against 4.7-RC) solves the problem:
 
 Index: include/string.h
 ===================================================================
 RCS file: /home/ncvs/src/include/string.h,v
 retrieving revision 1.6.2.3
 diff -u -r1.6.2.3 string.h
 --- include/string.h	2001/12/25 00:36:57	1.6.2.3
 +++ include/string.h	2002/10/05 23:50:08
 @@ -76,8 +76,15 @@
  /* Nonstandard routines */
  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  int	 bcmp __P((const void *, const void *, size_t));
 +/* bcopy and bzero can also be declared by sys/types.h */
 +#ifndef _BCOPY_DECLARED
 +#define _BCOPY_DECLARED
  void	 bcopy __P((const void *, void *, size_t));
 +#endif
 +#ifndef _BZERO_DECLARED
 +#define _BZERO_DECLARED
  void	 bzero __P((void *, size_t));
 +#endif
  int	 ffs __P((int));
  char	*index __P((const char *, int));
  void	*memccpy __P((void *, const void *, int, size_t));
 Index: sys/sys/types.h
 ===================================================================
 RCS file: /home/ncvs/src/sys/sys/types.h,v
 retrieving revision 1.40.2.2
 diff -u -r1.40.2.2 types.h
 --- sys/sys/types.h	2001/04/21 14:53:06	1.40.2.2
 +++ sys/sys/types.h	2002/10/05 23:50:09
 @@ -179,6 +179,20 @@
  	fd_mask	fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  } fd_set;
  
 +/* 
 + * bcopy and bzero are properly declared in <string.h>, but
 + * are included here to satisfy FD_ZERO and FD_COPY for select(2),
 + * which doesn't specify <string.h> as a pre-requisite header.
 + */
 +#ifndef _BCOPY_DECLARED
 +#define _BCOPY_DECLARED
 +void     bcopy __P((const void *, void *, size_t));
 +#endif
 +#ifndef _BZERO_DECLARED
 +#define _BZERO_DECLARED
 +void     bzero __P((void *, size_t));
 +#endif
 +
  #define	_fdset_mask(n)	((fd_mask)1 << ((n) % NFDBITS))
  #define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= _fdset_mask(n))
  #define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~_fdset_mask(n))

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




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