Lines Matching defs:error
173 int fd, error;
177 if ((error = mac_socket_check_create(kauth_cred_get(), uap->domain,
179 return (error);
182 error = falloc(p, &fp, &fd, vfs_context_current());
183 if (error) {
184 return (error);
190 error = socreate(uap->domain, &so, uap->type, uap->protocol);
191 if (error) {
215 return (error);
239 int error;
242 error = file_socket(uap->s, &so);
243 if (error != 0)
244 return (error);
246 error = EBADF;
250 error = EDESTADDRREQ;
254 error = getsockaddr(so, &sa, uap->name, uap->namelen, TRUE);
256 error = getsockaddr_s(so, &ss, uap->name, uap->namelen, TRUE);
257 if (error == 0) {
262 if (error != 0)
266 if ((error = mac_socket_check_bind(kauth_cred_get(), so, sa)) == 0)
267 error = sobind(so, sa);
269 error = sobind(so, sa);
275 return (error);
292 int error;
296 error = file_socket(uap->s, &so);
297 if (error)
298 return (error);
302 error = mac_socket_check_listen(kauth_cred_get(), so);
303 if (error == 0)
304 error = solisten(so, uap->backlog);
307 error = solisten(so, uap->backlog);
310 error = EBADF;
313 return (error);
340 int error;
353 error = copyin(uap->anamelen, (caddr_t)&namelen,
355 if (error)
356 return (error);
358 error = fp_getfsock(p, fd, &fp, &head);
359 if (error) {
360 if (error == EOPNOTSUPP)
361 error = ENOTSOCK;
362 return (error);
365 error = EBADF;
369 if ((error = mac_socket_check_accept(kauth_cred_get(), head)) != 0)
385 error = EOPNOTSUPP;
388 error = EINVAL;
395 error = EWOULDBLOCK;
406 error = msleep((caddr_t)&head->so_timeo, mutex_held,
412 error = ECONNABORTED;
414 if (error) {
420 error = head->so_error;
448 if ((error = mac_socket_check_accepted(kauth_cred_get(), so)) != 0) {
462 if (so->so_filt != NULL && (error = soacceptfilter(so)) != 0) {
465 /* Propagate socket filter's error code to the caller */
470 error = falloc(p, &fp, &newfd, vfs_context_current());
471 if (error) {
503 error = 0;
514 error = copyout(sa, uap->name, namelen);
515 if (!error)
519 error = copyout((caddr_t)&namelen, uap->anamelen,
548 return (error);
577 * Imputed: so_error error may be set from so_error, which
596 int error;
601 error = file_socket(fd, &so);
602 if (error != 0)
603 return (error);
605 error = EBADF;
617 error = getsockaddr(so, &sa, uap->name, uap->namelen, !dgram);
619 error = getsockaddr_s(so, &ss, uap->name, uap->namelen, !dgram);
620 if (error == 0) {
625 if (error != 0)
630 if ((error = mac_socket_check_connect(kauth_cred_get(), so, sa)) != 0) {
642 error = EALREADY;
645 error = soconnectlock(so, sa, 0);
646 if (error)
652 error = EINPROGRESS;
660 error = msleep((caddr_t)&so->so_timeo, mutex_held,
663 error = ECONNABORTED;
665 if (error)
668 if (error == 0) {
669 error = so->so_error;
677 if (error == ERESTART)
678 error = EINTR;
681 return (error);
707 int fd, error, sv[2];
710 error = socreate(uap->domain, &so1, uap->type, uap->protocol);
711 if (error)
712 return (error);
713 error = socreate(uap->domain, &so2, uap->type, uap->protocol);
714 if (error)
717 error = falloc(p, &fp1, &fd, vfs_context_current());
718 if (error) {
727 error = falloc(p, &fp2, &fd, vfs_context_current());
728 if (error) {
737 error = soconnect2(so1, so2);
738 if (error) {
745 error = soconnect2(so2, so1);
746 if (error) {
758 error = copyout((caddr_t)sv, uap->rsv, 2 * sizeof (int));
759 return (error);
768 return (error);
819 int error;
825 error = file_socket(s, &so);
826 if (error) {
827 KERNEL_DEBUG(DBG_FNC_SENDIT | DBG_FUNC_END, error, 0, 0, 0, 0);
828 return (error);
831 error = EBADF;
836 error = getsockaddr(so, &to, mp->msg_name,
839 error = getsockaddr_s(so, &ss, mp->msg_name,
841 if (error == 0) {
846 if (error != 0)
852 error = EINVAL;
855 error = sockargs(&control, mp->msg_control,
857 if (error != 0)
868 (error = mac_socket_check_send(kauth_cred_get(), so, to)) != 0)
873 error = so->so_proto->pr_usrreqs->pru_sosend(so, to, uiop, 0, control,
875 if (error != 0) {
876 if (uio_resid(uiop) != len && (error == ERESTART ||
877 error == EINTR || error == EWOULDBLOCK))
878 error = 0;
880 if (error == EPIPE && !(so->so_flags & SOF_NOSIGPIPE))
883 if (error == 0)
889 KERNEL_DEBUG(DBG_FNC_SENDIT | DBG_FUNC_END, error, 0, 0, 0, 0);
891 return (error);
911 int error;
933 error = sendit(p, uap->s, &msg, auio, uap->flags, retval);
946 if (error == ENOTSOCK) {
968 error = write(p, &write_uap, &write_retval);
975 KERNEL_DEBUG(DBG_FNC_SENDTO | DBG_FUNC_END, error, *retval, 0, 0, 0);
977 return (error);
1000 int error;
1016 error = copyin(uap->msg, msghdrp, size_of_msghdr);
1017 if (error) {
1018 KERNEL_DEBUG(DBG_FNC_SENDMSG | DBG_FUNC_END, error, 0, 0, 0, 0);
1019 return (error);
1044 error = ENOBUFS;
1055 error = ENOBUFS;
1058 error = copyin(user_msg.msg_iov, (caddr_t)iovp,
1060 if (error)
1073 error = sendit(p, uap->s, &user_msg, auio, uap->flags, retval);
1078 KERNEL_DEBUG(DBG_FNC_SENDMSG | DBG_FUNC_END, error, 0, 0, 0, 0);
1080 return (error);
1109 int len, error;
1118 if ((error = fp_lookup(p, s, &fp, 1))) {
1119 KERNEL_DEBUG(DBG_FNC_RECVIT | DBG_FUNC_END, error, 0, 0, 0, 0);
1121 return (error);
1145 (error = mac_socket_check_receive(kauth_cred_get(), so)) != 0)
1150 error = EINVAL;
1155 error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, uiop,
1159 if (error) {
1160 if (uio_resid(uiop) != len && (error == ERESTART ||
1161 error == EINTR || error == EWOULDBLOCK))
1162 error = 0;
1165 if (error)
1181 error = copyout(fromsa, mp->msg_name, (unsigned)len);
1182 if (error)
1188 (error = copyout((caddr_t)&sa_len, namelenp,
1209 error = copyout((caddr_t)mtod(m, caddr_t), ctlbuf,
1211 if (error)
1225 KERNEL_DEBUG(DBG_FNC_RECVIT | DBG_FUNC_END, error, 0, 0, 0, 0);
1228 return (error);
1258 int error;
1265 error = copyin(uap->fromlenaddr,
1267 if (error)
1268 return (error);
1287 error = recvit(p, uap->s, &msg, auio, uap->fromlenaddr, retval);
1299 if (error == ENOTSOCK && proc_is64bit(p) == 0) {
1321 error = read(p, &read_uap, &read_retval);
1328 KERNEL_DEBUG(DBG_FNC_RECVFROM | DBG_FUNC_END, error, 0, 0, 0, 0);
1330 return (error);
1359 int error;
1375 error = copyin(uap->msg, msghdrp, size_of_msghdr);
1376 if (error) {
1377 KERNEL_DEBUG(DBG_FNC_RECVMSG | DBG_FUNC_END, error, 0, 0, 0, 0);
1378 return (error);
1405 error = ENOMEM;
1415 error = ENOMEM;
1420 error = copyin(uiov, (caddr_t)iovp,
1422 if (error)
1428 error = recvit(p, uap->s, &user_msg, auio, 0, retval);
1429 if (!error) {
1444 error = copyout(msghdrp, uap->msg, size_of_msghdr);
1450 KERNEL_DEBUG(DBG_FNC_RECVMSG | DBG_FUNC_END, error, 0, 0, 0, 0);
1451 return (error);
1480 int error;
1483 error = file_socket(uap->s, &so);
1484 if (error)
1485 return (error);
1487 error = EBADF;
1490 error = soshutdown((struct socket *)so, uap->how);
1493 return (error);
1518 int error;
1525 error = file_socket(uap->s, &so);
1526 if (error)
1527 return (error);
1537 error = EINVAL;
1541 if ((error = mac_socket_check_setsockopt(kauth_cred_get(), so,
1545 error = sosetopt(so, &sopt);
1548 return (error);
1568 int error;
1573 error = file_socket(uap->s, &so);
1574 if (error)
1575 return (error);
1577 error = copyin(uap->avalsize, (caddr_t)&valsize,
1579 if (error)
1593 error = EBADF;
1597 if ((error = mac_socket_check_getsockopt(kauth_cred_get(), so,
1601 error = sogetopt((struct socket *)so, &sopt);
1602 if (error == 0) {
1604 error = copyout((caddr_t)&valsize, uap->avalsize,
1609 return (error);
1636 int error;
1638 error = file_socket(uap->fdes, &so);
1639 if (error)
1640 return (error);
1641 error = copyin(uap->alen, (caddr_t)&len, sizeof (socklen_t));
1642 if (error)
1645 error = EBADF;
1650 error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &sa);
1651 if (error == 0) {
1654 for (filter = so->so_filt; filter && error == 0;
1662 error = filter->sfe_filter->sf_filter.
1667 if (error == EJUSTRETURN)
1668 error = 0;
1676 if (error)
1685 error = copyout((caddr_t)sa, uap->asa, len);
1686 if (error)
1691 error = copyout((caddr_t)&len, uap->alen, sizeof (socklen_t));
1697 return (error);
1723 int error;
1725 error = file_socket(uap->fdes, &so);
1726 if (error)
1727 return (error);
1729 error = EBADF;
1739 error = EINVAL;
1745 error = ENOTCONN;
1748 error = copyin(uap->alen, (caddr_t)&len, sizeof (socklen_t));
1749 if (error) {
1754 error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &sa);
1755 if (error == 0) {
1758 for (filter = so->so_filt; filter && error == 0;
1766 error = filter->sfe_filter->sf_filter.
1771 if (error == EJUSTRETURN)
1772 error = 0;
1780 if (error)
1788 error = copyout(sa, uap->asa, len);
1789 if (error)
1794 error = copyout((caddr_t)&len, uap->alen, sizeof (socklen_t));
1799 return (error);
1807 int error;
1826 error = copyin(data, mtod(m, caddr_t), (u_int)buflen);
1827 if (error) {
1836 return (error);
1853 int error;
1865 error = copyin(uaddr, (caddr_t)sa, len);
1866 if (error) {
1883 return (error);
1890 int error;
1904 error = copyin(uaddr, (caddr_t)ss, len);
1905 if (error == 0) {
1919 return (error);
2018 int error = 0;
2030 if ((error = fp_getfvp(p, uap->fd, &fp, &vp))) {
2034 error = EBADF;
2038 error = ENOTSUP;
2041 error = file_socket(uap->s, &so);
2042 if (error) {
2046 error = EBADF;
2050 error = EINVAL;
2054 error = ENOTCONN;
2058 error = EINVAL;
2062 error = EINVAL;
2066 error = EINVAL;
2074 error = mac_socket_check_send(context.vc_ucred, so, NULL);
2075 if (error)
2082 * JMM - error handling?
2103 error = copyin(uap->hdtr, hdtrp, sizeof_hdtr);
2104 if (error)
2122 error = writev_nocancel(p, &nuap, &writev_retval);
2123 if (error)
2134 if ((error = vnode_size(vp, &file_size, vfs_context_current())) != 0)
2143 error = sblock(&so->so_snd, M_WAIT);
2144 if (error) {
2169 error = EPIPE;
2172 error = EAGAIN;
2214 error = ENXIO;
2239 error = fo_read(fp, auio, FOF_OFFSET, &context);
2241 if (error != 0) {
2242 if (uio_resid(auio) != xfsize && (error == ERESTART ||
2243 error == EINTR || error == EWOULDBLOCK)) {
2244 error = 0;
2279 * was closed. so_error is true when an error was sensed after
2289 error = EPIPE;
2291 error = so->so_error;
2305 error = EAGAIN;
2310 error = sbwait(&so->so_snd);
2314 * An error from sbwait usually indicates that we've
2316 * then return bytes sent, otherwise return the error.
2318 if (error) {
2333 error = 0;
2334 for (filter = so->so_filt; filter && (error == 0);
2344 error = filter->sfe_filter->sf_filter.
2364 if (error) {
2365 if (error == EJUSTRETURN) {
2366 error = 0;
2378 error = (*so->so_proto->pr_usrreqs->pru_send)(so, 0, m0,
2382 if (error) {
2396 error = writev_nocancel(p, &nuap, &writev_retval);
2397 if (error)
2412 (unsigned int)(sbytes & 0x0ffffffff), error, 0);
2413 return (error);