summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-01-26 13:58:18 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-01-26 13:58:18 +0000
commit6fd254a478c7f8019c24fcc4c32de680d740e450 (patch)
tree51e5e350ae6d7df374169ba593d698210bd5eb02 /ext
parentb5db9eb702378f2c90dfe7971e188db541df3456 (diff)
downloadperl-6fd254a478c7f8019c24fcc4c32de680d740e450.tar.gz
In UNICOS and UNICOS/mk after a successful fcntl F_SETFL
of O_NONBLOCK a subsequent fcntl F_GETFL will return O_NDELAY. p4raw-id: //depot/cfgperl@4904
Diffstat (limited to 'ext')
-rw-r--r--ext/IO/IO.xs39
1 files changed, 22 insertions, 17 deletions
diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs
index e5ce83d948..be84f73268 100644
--- a/ext/IO/IO.xs
+++ b/ext/IO/IO.xs
@@ -62,23 +62,28 @@ io_blocking(InputStream f, int block)
/* POSIX style */
#if defined(O_NDELAY) && O_NDELAY != O_NONBLOCK
/* Ooops has O_NDELAY too - make sure we don't
- * get SysV behaviour by mistake
- */
- RETVAL = RETVAL & O_NONBLOCK ? 0 : 1;
-
- if ((mode & O_NDELAY) || ((block == 0) && !(mode & O_NONBLOCK))) {
- int ret;
- mode = (mode & ~O_NDELAY) | O_NONBLOCK;
- ret = fcntl(PerlIO_fileno(f),F_SETFL,mode);
- if(ret < 0)
- RETVAL = ret;
- }
- else if ((mode & O_NDELAY) || ((block > 0) && (mode & O_NONBLOCK))) {
- int ret;
- mode &= ~(O_NONBLOCK | O_NDELAY);
- ret = fcntl(PerlIO_fileno(f),F_SETFL,mode);
- if(ret < 0)
- RETVAL = ret;
+ * get SysV behaviour by mistake. */
+
+ /* E.g. In UNICOS and UNICOS/mk a F_GETFL returns an O_NDELAY
+ * after a successful F_SETFL of an O_NONBLOCK. */
+ RETVAL = RETVAL & (O_NONBLOCK | O_NDELAY) ? 0 : 1;
+
+ if (block >= 0) {
+ if ((mode & O_NDELAY) || ((block == 0) && !(mode & O_NONBLOCK))) {
+ int ret;
+ mode = (mode & ~O_NDELAY) | O_NONBLOCK;
+ ret = fcntl(PerlIO_fileno(f),F_SETFL,mode);
+ if(ret < 0)
+ RETVAL = ret;
+ }
+ else
+ if ((mode & O_NDELAY) || ((block > 0) && (mode & O_NONBLOCK))) {
+ int ret;
+ mode &= ~(O_NONBLOCK | O_NDELAY);
+ ret = fcntl(PerlIO_fileno(f),F_SETFL,mode);
+ if(ret < 0)
+ RETVAL = ret;
+ }
}
#else
/* Standard POSIX */