Discussion:
fcntl with O_NDELAY
(too old to reply)
Falessi D.
2004-02-24 16:47:22 UTC
Permalink
Hi, I've two questions:
1)I've this code in Linux

int i;
i = fcntl(pcbp->tt_fd, F_GETFL, 0)) == -1);
i |= O_NDELAY;
(void)fcntl(pcbp->tt_fd, F_SETFL, i);

In order to operate in VxWorks must be converted in:
int setting=1;
ioctl(pcbp->tt_fd, FIONBIO, &setting);

//pcbp->tt_fd is a socket descriptor(no a file descriptor)

Is it ok?


2)But in this case (no a socket no a file descriptor but the standard input)
flags = fcntl( 0, F_GETFL, 0 );
fcntl( 0, F_SETFL, flags | O_NDELAY );

What I've to write?

Eng D. Falessi
joe durusau
2004-02-27 11:59:30 UTC
Permalink
Post by Falessi D.
1)I've this code in Linux
int i;
i = fcntl(pcbp->tt_fd, F_GETFL, 0)) == -1);
i |= O_NDELAY;
(void)fcntl(pcbp->tt_fd, F_SETFL, i);
int setting=1;
ioctl(pcbp->tt_fd, FIONBIO, &setting);
//pcbp->tt_fd is a socket descriptor(no a file descriptor)
Is it ok?
2)But in this case (no a socket no a file descriptor but the standard input)
flags = fcntl( 0, F_GETFL, 0 );
fcntl( 0, F_SETFL, flags | O_NDELAY );
What I've to write?
Eng D. Falessi
I don't believe that there is a general answer to your question,
because in vxWorks, sometimes stdin is a serial connection,
sometimes it is a socket connected from another host, sometimes
something else.

If you are working with a target shell and stdin is
a serial port, the serial driver has some options that might help you.

If you are using a host shell, I don't think you can do this sort
of thing.

Speaking only for myself,

Joe Durusau

Loading...