Re: [PARPORT] include dirs for user space drivers

From: Crump, Valerie (VCrump@api.com)
Date: Wed Dec 06 2000 - 12:17:55 EST

  • Next message: Crump, Valerie: "Re: [PARPORT] include dirs for user space drivers"

    Philip Blundell wrote:
    >
    > >Which include directories should I use for a user space driver,
    > >/usr/include/{.,sys} or exclusively /usr/include/linux ?
    >
    > The former.
    >
    > >case, including time.h results in preprocessor complaints about
    > >redefinitions. I need the timeval struct for PP{G,S}ETTIME. This is
    >
    > Can you show us the exact messages you get, and an extract of the source code
    > that triggers the problem?
    >
    > p.

    #include <fcntl.h>
    #include <sys/ioctl.h>
    #include <unistd.h>
    #include <linux/parport.h>
    #include <linux/ppdev.h>
    #include <linux/time.h>
     
    [...]
        int fd;
        struct timeval ts;
     
        fd = open("/dev/parport0",O_RDWR | O_NOCTTY);
        if (fd == -1) return 1;
     
    [...]
        ts.tv_sec = 0;
        ts.tv_nsec = 1000;
        if (ioctl(fd,PPGETTIME,&ts)) {
            close(fd);
            return 1;
        }
     
    $ gcc -Wall -o broken broken.c
    In file included from broken.c:7:
    /usr/include/linux/time.h:69: warning: `FD_SET' redefined
    /usr/include/sys/select.h:63: warning: this is the location of the
    previous definition
    [...]
    In file included from broken.c:7:
    /usr/include/linux/time.h:9: redefinition of `struct timespec'
    [...]
    broken.c: In function `main':
    broken.c:12: storage size of `ts' isn't known
    broken.c:28: sizeof applied to an incomplete type
    broken.c:12: warning: unused variable `ts'

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Wed Dec 06 2000 - 12:25:55 EST