summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-20 17:35:50 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-20 17:35:50 +0000
commitc2c08bfea9f0b67e5dc6d1bfb4965653311fefe3 (patch)
tree69417ad2898a3a7f4c7c47d9ad7e7a8bdb849fc3
parent2dca765b97537157da7a9ca3a74a422ad3bdf595 (diff)
downloadFreeBSD-src-c2c08bfea9f0b67e5dc6d1bfb4965653311fefe3.zip
FreeBSD-src-c2c08bfea9f0b67e5dc6d1bfb4965653311fefe3.tar.gz
Annotate two intentionally unlocked reads with comments.
Annotate a potentially inconsistent result returned to user space when performing fstaT() on a socket due to not using socket buffer locking.
-rw-r--r--sys/kern/sys_socket.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 986edf7..e59823c 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -170,6 +170,7 @@ soo_ioctl(fp, cmd, data, active_cred, td)
return (0);
case FIONREAD:
+ /* Unlocked read. */
*(int *)data = so->so_rcv.sb_cc;
return (0);
@@ -188,6 +189,7 @@ soo_ioctl(fp, cmd, data, active_cred, td)
return (0);
case SIOCATMARK:
+ /* Unlocked read. */
*(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0;
return (0);
}
@@ -229,7 +231,11 @@ soo_stat(fp, ub, active_cred, td)
/*
* If SBS_CANTRCVMORE is set, but there's still data left in the
* receive buffer, the socket is still readable.
+ *
+ * XXXRW: perhaps should lock socket buffer so st_size result
+ * is consistent.
*/
+ /* Unlocked read. */
if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 ||
so->so_rcv.sb_cc != 0)
ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
OpenPOWER on IntegriCloud