/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
splx(s);
return (EWOULDBLOCK);
}
- while (head->so_comp.tqh_first == NULL && head->so_error == 0) {
+ while (TAILQ_EMPTY(&head->so_comp) && head->so_error == 0) {
if (head->so_state & SS_CANTRCVMORE) {
head->so_error = ECONNABORTED;
break;
* block allowing another process to accept the connection
* instead.
*/
- so = head->so_comp.tqh_first;
+ so = TAILQ_FIRST(&head->so_comp);
TAILQ_REMOVE(&head->so_comp, so, so_list);
head->so_qlen--;
struct socket *so;
#if KTRACE
struct iovec *ktriov = NULL;
+ struct uio ktruio;
#endif
KERNEL_DEBUG(DBG_FNC_SENDIT | DBG_FUNC_START, 0,0,0,0,0);
} else
control = 0;
+#if KTRACE
+ if (KTRPOINT(p, KTR_GENIO)) {
+ int iovlen = auio.uio_iovcnt * sizeof (struct iovec);
+
+ MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK);
+ bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen);
+ ktruio = auio;
+ }
+#endif
len = auio.uio_resid;
so = (struct socket *)fp->f_data;
error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control,
if (auio.uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
error = 0;
- if (error == EPIPE)
+ /* Generation of SIGPIPE can be controlled per socket */
+ if (error == EPIPE && !(so->so_flags & SOF_NOSIGPIPE))
psignal(p, SIGPIPE);
}
if (error == 0)
*retsize = len - auio.uio_resid;
#if KTRACE
if (ktriov != NULL) {
- if (error == 0)
- ktrgenio(p->p_tracep, s, UIO_WRITE,
- ktriov, *retsize, error);
+ if (error == 0) {
+ ktruio.uio_iov = ktriov;
+ ktruio.uio_resid = retsize[0];
+ ktrgenio(p->p_tracep, s, UIO_WRITE, &ktruio, error, -1);
+ }
FREE(ktriov, M_TEMP);
}
#endif
struct sockaddr *fromsa = 0;
#if KTRACE
struct iovec *ktriov = NULL;
+ struct uio ktruio;
#endif
KERNEL_DEBUG(DBG_FNC_RECVIT | DBG_FUNC_START, 0,0,0,0,0);
MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK);
bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen);
+ ktruio = auio;
}
#endif
len = auio.uio_resid;
}
#if KTRACE
if (ktriov != NULL) {
- if (error == 0)
- ktrgenio(p->p_tracep, s, UIO_WRITE,
- ktriov, len - auio.uio_resid, error);
+ if (error == 0) {
+ ktruio.uio_iov = ktriov;
+ ktruio.uio_resid = len - auio.uio_resid;
+ ktrgenio(p->p_tracep, s, UIO_WRITE, &ktruio, error, -1);
+ }
FREE(ktriov, M_TEMP);
}
#endif
#ifdef COMPAT_OLDSOCK
+struct orecv_args {
+ int s;
+ caddr_t buf;
+ int len;
+ int flags;
+};
+
int
orecv(p, uap, retval)
struct proc *p;
- register struct orecv_args {
- int s;
- caddr_t buf;
- int len;
- int flags;
- } *uap;
+ struct orecv_args *uap;
register_t *retval;
{
struct msghdr msg;
* overlays the new one, missing only the flags, and with the (old) access
* rights where the control fields are now.
*/
+struct orecvmsg_args {
+ int s;
+ struct omsghdr *msg;
+ int flags;
+};
+
int
orecvmsg(p, uap, retval)
struct proc *p;
- register struct orecvmsg_args {
- int s;
- struct omsghdr *msg;
- int flags;
- } *uap;
+ struct orecvmsg_args *uap;
register_t *retval;
{
struct msghdr msg;
}
#endif
+struct recvmsg_args {
+ int s;
+ struct msghdr *msg;
+ int flags;
+};
+
int
recvmsg(p, uap, retval)
struct proc *p;
- register struct recvmsg_args {
- int s;
- struct msghdr *msg;
- int flags;
- } *uap;
+ struct recvmsg_args *uap;
register_t *retval;
{
struct msghdr msg;
}
/* ARGSUSED */
+struct shutdown_args {
+ int s;
+ int how;
+};
+
int
shutdown(p, uap, retval)
struct proc *p;
- register struct shutdown_args {
- int s;
- int how;
- } *uap;
+ struct shutdown_args *uap;
register_t *retval;
{
struct file *fp;
/* ARGSUSED */
+struct setsockopt_args {
+ int s;
+ int level;
+ int name;
+ caddr_t val;
+ int valsize;
+};
+
int
setsockopt(p, uap, retval)
struct proc *p;
- register struct setsockopt_args {
- int s;
- int level;
- int name;
- caddr_t val;
- int valsize;
- } *uap;
+ struct setsockopt_args *uap;
register_t *retval;
{
struct file *fp;