Solved unknown type name 'fd_set'

Can anyone suggest what is causing the error unknown type name 'fd_set' ?

This doesn't occur in FreeBSD, but I'm just wondering where it gets resolved in FreeBSD.
 
Code:
wget ftp://ftp.denx.de/pub/u-boot/u-boot-2013.10.tar.bz2
tar jxf u-boot-2013.10.tar.bz2
cd u-boot-2013.10/tools/
gcc -o kwboot kwboot.c

This is part of kwboot.c:-

Code:
static int
kwboot_tty_recv(int fd, void *buf, size_t len, int timeo)
{
        int rc, nfds;
        fd_set rfds;
        struct timeval tv;
        ssize_t n;

        rc = -1;

        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
 
        tv.tv_sec = 0;
        tv.tv_usec = timeo * 1000;
        if (tv.tv_usec > 1000000) {
                tv.tv_sec += tv.tv_usec / 1000000;
                tv.tv_usec %= 1000000;
        }
        
        do {
                nfds = select(fd + 1, &rfds, NULL, NULL, &tv);
                if (nfds < 0)
                        goto out;
                if (!nfds) {
                        errno = ETIMEDOUT;
                        goto out;
                }
                
                n = read(fd, buf, len);
                if (n < 0)
                        goto out;

                buf = (char *)buf + n;
                len -= n;
        } while (len > 0);

        rc = 0;
out:
        return rc;
}
 
Back
Top