sys_select

From: Prairie Flower (wildrose@home.com)
Date: Wed May 17 2000 - 14:28:58 EST


Hi,.

 I want to use sys_select from inside the kernel but it is returning
-14. here is the call I am making:

.
.
.

  fd_set set;
  struct timeval tv;
.
.
.
      printk(KERN_ERR "Setting descriptor for connection_in which is
%d\n", connection_in);
      FD_ZERO(&set);
      FD_SET(connection_in, &set);
      printk(KERN_ERR "waiting 5 sec for data...\n");
      /* Wait for some data to arrive. */
      tv.tv_sec = 5;
      tv.tv_usec = 0;
 /* sys_select(connection_in + 1, &set, NULL, NULL, NULL); */
       retval = sys_select(connection_in + 1, &set, NULL, NULL, &tv);

I belive this error is EFAULT and is resulting from the fact that set
has been declared in kernel space. sys_select calls get_fd_set() which
has the comment and offending return value:

/*
 * We do a VERIFY_WRITE here even though we are only reading this time:
 * we'll write to it eventually..
 *
 * Use "unsigned long" accesses to let user-mode fd_set's be
long-aligned.
 */
static inline
int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset)
{
        nr = FDS_BYTES(nr);
        if (ufdset) {
                int error;
                error = verify_area(VERIFY_WRITE, ufdset, nr);
                if (!error && __copy_from_user(fdset, ufdset, nr))
                        error = -EFAULT;
                return error;
        }
       memset(fdset, 0, nr);
        return 0;
}

Any suggestions??

wildrose@home.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:14 EST