Regarding select() on PPC

3 messages, 2 authors, 2008-09-19 · open the first message on its own page

Regarding select() on PPC

From: Sadashiiv, Halesh <hidden>
Date: 2008-09-19 11:50:54

Hi all,

Please find the below testcase.

#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <stdlib.h>

int main()
{

 int fd;
 fd_set rfds;
 struct timeval tv;
 int ret_val;

 if ((fd =3D open("test_file", O_RDWR|O_CREAT, 0664)) < 0)
  {
    printf("Open failed\n");
  }

  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);

  /* Wait up to five seconds. */
  tv.tv_sec =3D 1;
  tv.tv_usec =3D 0;

  if ( (ret_val =3D select(-1, &rfds, NULL, NULL, &tv)) < 0)
  {
    if ( ret_val =3D=3D EINVAL)
      printf("OK\n");
    else

33 more lines

Re: Regarding select() on PPC

From: Dale Farnsworth <hidden>
Date: 2008-09-19 14:53:29

For negetive value of n (first argument to select) select fails with
EINVAL error,

But for the same when I tested for PowerPC it was giving EFAULT, 
Its on 2.6.16 kernel.

Please let me know, If this is fixed or it's a issue in PPC.
For other archs its working fine.
Interesting.  The man page for select says that select should return
EINVAL when the first argument is negative.  By that, only ppc32 is
correct.  :)

-Dale

Re: Regarding select() on PPC

From: Dale Farnsworth <hidden>
Date: 2008-09-19 16:53:37

I wrote:
Interesting.  The man page for select says that select should return
EINVAL when the first argument is negative.  By that, only ppc32 is
correct.  :)
Sorry.  I should read before posting.  Please ignore my extraneous
comment above.

-Dale
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help