On Tue, Dec 3, 2013 at 1:03 PM, Matthew Dempsky <matt...@dempsky.org> wrote:
> On Tue, Dec 3, 2013 at 12:37 PM, Philip Guenther <guent...@gmail.com> wrote:
>> <string.h> needs to stay until FD_ZERO() and FD_COPY() are changed to
>> not use memset()/memcpy().
>
> Good point.
>
> Would something like this work?
>
> #define FD_COPY(f, t)   (*(fd_set *)(t) = *(const fd_set *)(f))

What problem does the casts solve?
(And actually, as noted in naddy's cite from FreeBSD, FD_COPY() is a
non-standard BSDism, so it can just continue to assume the caller
pulled in <string.h>)


> static const fd_set __fd_zero_set;
> #define FD_ZERO(p)      FD_COPY(&__fd_zero_set, p)

That'll put a __fd_zero_set in each .o that references FD_ZERO(), ick.
 I think I would prefer either the FreeBSD inline bzero() routine
(although zeroing from the end seems an odd choice for caching
reasons, no?), or adding a strong alias to libc, _memset == memset,
and then having sys/select.h say

void *_memset(void *, int, size_t);
#define FD_ZERO(p)      (void )_memset(p, 0, sizeof(*(p)))


> Or we can just declare memset/memcpy in sys/select.h too?

Magic POSIX 8-ball says "no".


Philip Guenther

Reply via email to