#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
-
-/* Get definitions for both O_NONBLOCK and O_NDELAY. */
-
-#ifndef O_NDELAY
-#ifdef FNDELAY
-#define O_NDELAY FNDELAY
-#else /* ! defined (FNDELAY) */
-#define O_NDELAY 0
-#endif /* ! defined (FNDELAY) */
-#endif /* ! defined (O_NDELAY) */
-
-#ifndef O_NONBLOCK
-#ifdef FNBLOCK
-#define O_NONBLOCK FNBLOCK
-#else /* ! defined (FNBLOCK) */
-#define O_NONBLOCK 0
-#endif /* ! defined (FNBLOCK) */
-#endif /* ! defined (O_NONBLOCK) */
\f
/* Compromise between eating cpu and properly busy-waiting.
return 0;
/* Set non-blocking i/o. */
-#ifdef F_GETFL
+#if defined(F_GETFL) && defined(O_NONBLOCK)
flags = fcntl (sockser_fd, F_GETFL);
- flags |= O_NONBLOCK | O_NDELAY;
+ flags |= O_NONBLOCK;
if (fcntl (sockser_fd, F_SETFL, flags) == -1)
{
sim_io_eprintf (sd, "unable to set nonblocking i/o");
char *buf,
int sizeof_buf)
{
-#if defined(O_NDELAY) && defined(F_GETFL) && defined(F_SETFL)
+#if defined(O_NONBLOCK) && defined(F_GETFL) && defined(F_SETFL)
int fd = STATE_CALLBACK (sd)->fdmap[sim_io_fd];
int flags;
int status;
return 0;
}
/* temp, disable blocking IO */
- status = fcntl (fd, F_SETFL, flags | O_NDELAY);
+ status = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
if (status == -1)
{
perror ("sim_io_read_stdin");
#include <string.h>
#include <errno.h>
-#if !defined(O_NDELAY) || !defined(F_GETFL) || !defined(F_SETFL)
+#if !defined(O_NONBLOCK) || !defined(F_GETFL) || !defined(F_SETFL)
#undef WITH_STDIO
#define WITH_STDIO DO_USE_STDIO
#endif
return sim_io_eof;
break;
case DONT_USE_STDIO:
-#if defined(O_NDELAY) && defined(F_GETFL) && defined(F_SETFL)
+#if defined(O_NONBLOCK) && defined(F_GETFL) && defined(F_SETFL)
{
/* check for input */
int flags;
return sim_io_eof;
}
/* temp, disable blocking IO */
- status = fcntl(0, F_SETFL, flags | O_NDELAY);
+ status = fcntl(0, F_SETFL, flags | O_NONBLOCK);
if (status == -1) {
perror("sim_io_read_stdin");
return sim_io_eof;