diff options
-rw-r--r-- | sys/kern/sys_socket.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index cbaa587..f40d230 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -126,7 +126,8 @@ soo_ioctl(fp, cmd, data, active_cred, td) struct ucred *active_cred; struct thread *td; { - register struct socket *so = fp->f_data; + struct socket *so = fp->f_data; + int error = 0; switch (cmd) { @@ -137,7 +138,7 @@ soo_ioctl(fp, cmd, data, active_cred, td) else so->so_state &= ~SS_NBIO; SOCK_UNLOCK(so); - return (0); + break; case FIOASYNC: /* @@ -167,42 +168,49 @@ soo_ioctl(fp, cmd, data, active_cred, td) so->so_snd.sb_flags &= ~SB_ASYNC; SOCKBUF_UNLOCK(&so->so_snd); } - return (0); + break; case FIONREAD: /* Unlocked read. */ *(int *)data = so->so_rcv.sb_cc; - return (0); + break; case FIOSETOWN: - return (fsetown(*(int *)data, &so->so_sigio)); + error = fsetown(*(int *)data, &so->so_sigio); + break; case FIOGETOWN: *(int *)data = fgetown(&so->so_sigio); - return (0); + break; case SIOCSPGRP: - return (fsetown(-(*(int *)data), &so->so_sigio)); + error = fsetown(-(*(int *)data), &so->so_sigio); + break; case SIOCGPGRP: *(int *)data = -fgetown(&so->so_sigio); - return (0); + break; case SIOCATMARK: /* Unlocked read. */ *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0; - return (0); + break; + default: + /* + * Interface/routing/protocol specific ioctls: + * interface and routing ioctls should have a + * different entry since a socket's unnecessary + */ + if (IOCGROUP(cmd) == 'i') + error = ifioctl(so, cmd, data, td); + else if (IOCGROUP(cmd) == 'r') + error = rtioctl(cmd, data); + else + error = ((*so->so_proto->pr_usrreqs->pru_control) + (so, cmd, data, 0, td)); + break; } - /* - * Interface/routing/protocol specific ioctls: - * interface and routing ioctls should have a - * different entry since a socket's unnecessary - */ - if (IOCGROUP(cmd) == 'i') - return (ifioctl(so, cmd, data, td)); - if (IOCGROUP(cmd) == 'r') - return (rtioctl(cmd, data)); - return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, 0, td)); + return(error); } int @@ -213,8 +221,12 @@ soo_poll(fp, events, active_cred, td) struct thread *td; { struct socket *so = fp->f_data; - return so->so_proto->pr_usrreqs->pru_sopoll(so, events, - fp->f_cred, td); + int error; + + error = (so->so_proto->pr_usrreqs->pru_sopoll) + (so, events, fp->f_cred, td); + + return (error); } int |