summaryrefslogtreecommitdiff
path: root/pflocal/io.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-09-19 18:28:15 +0000
committerMiles Bader <miles@gnu.org>1995-09-19 18:28:15 +0000
commit37f4d9abb7accfaceac4f2db4cf871d8ea570f8b (patch)
treee24568f4d2727b5787ac6be30525a1e4029a10c1 /pflocal/io.c
parent9f95554e24f24a5a545f6811b10a749bfbd8b645 (diff)
(S_io_set_all_openmodes, S_io_set_some_openmodes, S_io_clear_some_openmodes):
The user specifies O_NONBLOCK, not SOCK_NONBLOCK. (S_io_get_openmodes): Always return O_APPEND.
Diffstat (limited to 'pflocal/io.c')
-rw-r--r--pflocal/io.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/pflocal/io.c b/pflocal/io.c
index faf47c58..73588a1e 100644
--- a/pflocal/io.c
+++ b/pflocal/io.c
@@ -308,7 +308,8 @@ S_io_get_openmodes (struct sock_user *user, int *bits)
return EOPNOTSUPP;
flags = user->sock->flags;
*bits =
- (flags & SOCK_NONBLOCK ? O_NONBLOCK : 0)
+ O_APPEND /* pipes always append */
+ | (flags & SOCK_NONBLOCK ? O_NONBLOCK : 0)
| (flags & SOCK_SHUTDOWN_READ ? 0 : O_READ)
| (flags & SOCK_SHUTDOWN_WRITE ? 0 : O_WRITE);
return 0;
@@ -319,14 +320,14 @@ S_io_set_all_openmodes (struct sock_user *user, int bits)
{
if (!user)
return EOPNOTSUPP;
-debug (user->sock, "lock");
+
mutex_lock (&user->sock->lock);
- if (bits & SOCK_NONBLOCK)
+ if (bits & O_NONBLOCK)
user->sock->flags |= SOCK_NONBLOCK;
else
user->sock->flags &= ~SOCK_NONBLOCK;
-debug (user->sock, "unlock");
mutex_unlock (&user->sock->lock);
+
return 0;
}
@@ -335,12 +336,12 @@ S_io_set_some_openmodes (struct sock_user *user, int bits)
{
if (!user)
return EOPNOTSUPP;
-debug (user->sock, "lock");
+
mutex_lock (&user->sock->lock);
- if (bits & SOCK_NONBLOCK)
+ if (bits & O_NONBLOCK)
user->sock->flags |= SOCK_NONBLOCK;
-debug (user->sock, "unlock");
mutex_unlock (&user->sock->lock);
+
return 0;
}
@@ -349,12 +350,12 @@ S_io_clear_some_openmodes (struct sock_user *user, int bits)
{
if (!user)
return EOPNOTSUPP;
-debug (user->sock, "lock");
+
mutex_lock (&user->sock->lock);
- if (bits & SOCK_NONBLOCK)
+ if (bits & O_NONBLOCK)
user->sock->flags &= ~SOCK_NONBLOCK;
-debug (user->sock, "unlock");
mutex_unlock (&user->sock->lock);
+
return 0;
}