From 3cb06349962a2f2646cb1ebae052da4298764a40 Mon Sep 17 00:00:00 2001 From: kbyanc Date: Fri, 1 Nov 2002 21:31:13 +0000 Subject: Update the st_size reported via stat(2) to accurately reflect the amount of data available to read for non-TCP sockets. Reviewed by: -net, -arch Sponsored by: NTT Multimedia Communications Labs MFC after: 2 weeks --- sys/kern/sys_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/kern/sys_socket.c') diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index e41821c..328ff51 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -206,7 +206,7 @@ soo_stat(fp, ub, active_cred, td) ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH; if ((so->so_state & SS_CANTSENDMORE) == 0) ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH; - ub->st_size = so->so_rcv.sb_cc; + ub->st_size = so->so_rcv.sb_cc - so->so_rcv.sb_ctl; ub->st_uid = so->so_cred->cr_uid; ub->st_gid = so->so_cred->cr_gid; return ((*so->so_proto->pr_usrreqs->pru_sense)(so, ub)); -- cgit v1.1