Back to index

glibc  2.9
select.c File Reference
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>

Go to the source code of this file.


int input_timeout (int filedes, unsigned int seconds)
int main (void)

Function Documentation

int input_timeout ( int  filedes,
unsigned int  seconds 

Definition at line 11 of file select.c.

  fd_set set;
  struct timeval timeout;
/*@end group*/

  /* Initialize the file descriptor set. */
  FD_ZERO (&set);
  FD_SET (filedes, &set);

  /* Initialize the timeout data structure. */
  timeout.tv_sec = seconds;
  timeout.tv_usec = 0;

  /* @code{select} returns 0 if timeout, 1 if input available, -1 if error. */
                                 &set, NULL, NULL,

Here is the caller graph for this function:

int main ( void  )

Definition at line 35 of file select.c.

  fprintf (stderr, "select returned %d.\n",
          input_timeout (STDIN_FILENO, 5));
  return 0;

Here is the call graph for this function: