Showing posts with label ioctl(). Show all posts
Showing posts with label ioctl(). Show all posts

Thursday, November 22, 2012

ioctl() function








    102       size_t retries = 0;
    103       int err;
    104    
    105       // (mismatch ==> unrecognized ioctl ==> errno = ENOTTY).
    106       do
    107       {
    108          //
    109          // EAGAIN, and should retry. Eventually, give up.
    110          do
    111          {
    112             // If someone kill(), you have problems
    113             // anyway. So there's no point in keeping count and giving
    114             // up.
    115             err = ioctl(fd, IOCMD, &p);
    116          } while(err && errno == EINTR);
    117          if(++retries == MaxRetries)
    118          {
    119             break;
    120          }
    121       } while(err && errno == EAGAIN);

Labels