Lines Matching full:error

92 	int error;
94 error = fget_cap(td, fd, rightsp, &fp, havecapsp);
95 if (__predict_false(error != 0))
96 return (error);
111 int error;
113 error = fget_unlocked(td, fd, rightsp, &fp);
114 if (__predict_false(error != 0))
115 return (error);
143 int fd, error, oflag, fflag;
159 error = mac_socket_check_create(td->td_ucred, domain, type, protocol);
160 if (error != 0)
161 return (error);
163 error = falloc(td, &fp, &fd, oflag);
164 if (error != 0)
165 return (error);
167 error = socreate(domain, &so, type, protocol, td->td_ucred, td);
168 if (error != 0) {
177 return (error);
184 int error;
186 error = getsockaddr(&sa, uap->name, uap->namelen);
187 if (error == 0) {
188 error = kern_bindat(td, AT_FDCWD, uap->s, sa);
191 return (error);
199 int error;
212 error = getsock(td, fd, &cap_bind_rights, &fp);
213 if (error != 0)
214 return (error);
221 error = mac_socket_check_bind(td->td_ucred, so, sa);
222 if (error == 0) {
225 error = sobind(so, sa, td);
227 error = sobindat(dirfd, so, sa, td);
232 return (error);
239 int error;
241 error = getsockaddr(&sa, uap->name, uap->namelen);
242 if (error == 0) {
243 error = kern_bindat(td, uap->fd, uap->s, sa);
246 return (error);
261 int error;
264 error = getsock(td, s, &cap_listen_rights, &fp);
265 if (error == 0) {
268 error = mac_socket_check_listen(td->td_ucred, so);
269 if (error == 0)
271 error = solisten(so, backlog, td);
274 return (error);
287 int error;
290 error = copyin(anamelen, &addrlen, sizeof(addrlen));
291 if (error != 0)
292 return (error);
295 error = kern_accept4(td, s, (struct sockaddr *)&ss, flags, &fp);
297 if (error != 0)
298 return (error);
307 error = copyout(&ss, uname, addrlen);
308 if (error == 0) {
310 error = copyout(&addrlen, anamelen, sizeof(addrlen));
313 if (error != 0)
317 return (error);
335 int error, fd, tmp;
338 error = getsock_cap(td, s, &cap_accept_rights,
340 if (error != 0)
341 return (error);
345 error = EINVAL;
349 error = mac_socket_check_accept(td->td_ucred, head);
350 if (error != 0)
353 error = falloc_caps(td, &nfp, &fd,
355 if (error != 0)
360 error = EINVAL;
364 error = solisten_dequeue(head, &so, flags);
365 if (error != 0)
391 if ((error = soaccept(so, sa)) == 0) {
403 if (error != 0)
414 if (error == 0) {
423 return (error);
457 int error;
459 error = getsockaddr(&sa, uap->name, uap->namelen);
460 if (error == 0) {
461 error = kern_connectat(td, AT_FDCWD, uap->s, sa);
464 return (error);
472 int error;
485 error = getsock(td, fd, &cap_connect_rights, &fp);
486 if (error != 0)
487 return (error);
490 error = EALREADY;
498 error = mac_socket_check_connect(td->td_ucred, so, sa);
499 if (error != 0)
502 error = soconnectat(dirfd, so, sa, td);
503 if (error != 0)
506 error = EINPROGRESS;
511 error = msleep(&so->so_timeo, &so->so_lock, PSOCK | PCATCH,
513 if (error != 0)
516 if (error == 0) {
517 error = so->so_error;
522 if (error == ERESTART)
523 error = EINTR;
526 return (error);
533 int error;
535 error = getsockaddr(&sa, uap->name, uap->namelen);
536 if (error == 0) {
537 error = kern_connectat(td, uap->fd, uap->s, sa);
540 return (error);
549 int fd, error, oflag, fflag;
565 error = mac_socket_check_create(td->td_ucred, domain, type,
567 if (error != 0)
568 return (error);
570 error = socreate(domain, &so1, type, protocol, td->td_ucred, td);
571 if (error != 0)
572 return (error);
573 error = socreate(domain, &so2, type, protocol, td->td_ucred, td);
574 if (error != 0)
577 error = falloc(td, &fp1, &fd, oflag);
578 if (error != 0)
582 error = falloc(td, &fp2, &fd, oflag);
583 if (error != 0)
587 error = soconnect2(so1, so2);
588 if (error != 0)
594 error = soconnect2(so2, so1);
595 if (error != 0)
630 return (error);
636 int error, sv[2];
638 error = kern_socketpair(td, uap->domain, uap->type,
640 if (error != 0)
641 return (error);
642 error = copyout(sv, uap->rsv, 2 * sizeof(int));
643 if (error != 0) {
647 return (error);
655 int error;
658 error = getsockaddr(&to, mp->msg_name, mp->msg_namelen);
659 if (error != 0) {
668 error = ECAPMODE;
683 error = EINVAL;
686 error = sockargs(&control, mp->msg_control,
688 if (error != 0)
706 error = kern_sendit(td, s, mp, flags, control, UIO_USERSPACE);
710 return (error);
726 int i, error;
734 error = getsock(td, s, rights, &fp);
735 if (error != 0) {
737 return (error);
747 error = mac_socket_check_connect(td->td_ucred, so,
749 if (error != 0) {
754 error = mac_socket_check_send(td->td_ucred, so);
755 if (error != 0) {
771 error = EINVAL;
781 error = sousrsend(so, mp->msg_name, &auio, control, flags, NULL);
782 if (error == 0)
786 if (error == 0)
788 ktrgenio(s, UIO_WRITE, ktruio, error);
793 return (error);
839 int error;
841 error = copyin(uap->msg, &msg, sizeof (struct omsghdr));
842 if (error != 0)
843 return (error);
844 error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
845 if (error != 0)
846 return (error);
849 error = sendit(td, uap->s, &msg, uap->flags);
851 return (error);
860 int error;
862 error = copyin(uap->msg, &msg, sizeof (msg));
863 if (error != 0)
864 return (error);
865 error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
866 if (error != 0)
867 return (error);
873 error = sendit(td, uap->s, &msg, uap->flags);
875 return (error);
893 int error, i;
899 error = getsock(td, s, &cap_recv_rights, &fp);
900 if (error != 0)
901 return (error);
905 error = mac_socket_check_receive(td->td_ucred, so);
906 if (error != 0) {
908 return (error);
932 error = soreceive(so, &fromsa, &auio, NULL,
935 if (error != 0) {
936 if (auio.uio_resid != len && (error == ERESTART ||
937 error == EINTR || error == EWOULDBLOCK))
938 error = 0;
946 ktrgenio(s, UIO_READ, ktruio, error);
949 if (error != 0)
966 error = copyout(fromsa, mp->msg_name,
968 if (error != 0)
1001 if ((error = copyout(mtod(m, caddr_t), ctlbuf,
1022 if (error == 0 && controlp != NULL)
1025 if (error != 0)
1030 return (error);
1036 int error;
1038 error = kern_recvit(td, s, mp, UIO_USERSPACE, NULL);
1039 if (error != 0)
1040 return (error);
1042 error = copyout(&mp->msg_namelen, namelenp, sizeof (socklen_t));
1046 error = 0; /* old recvfrom didn't check */
1049 return (error);
1058 int error;
1061 error = copyin(fromlenaddr, &msg.msg_namelen,
1063 if (error != 0)
1075 error = recvit(td, s, &msg, fromlenaddr);
1077 return (error);
1125 int error;
1127 error = copyin(uap->msg, &msg, sizeof (struct omsghdr));
1128 if (error != 0)
1129 return (error);
1130 error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
1131 if (error != 0)
1132 return (error);
1135 error = recvit(td, uap->s, &msg, &uap->msg->msg_namelen);
1136 if (msg.msg_controllen && error == 0)
1137 error = copyout(&msg.msg_controllen,
1140 return (error);
1149 int error;
1151 error = copyin(uap->msg, &msg, sizeof (msg));
1152 if (error != 0)
1153 return (error);
1154 error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
1155 if (error != 0)
1156 return (error);
1164 error = recvit(td, uap->s, &msg, NULL);
1165 if (error == 0) {
1167 error = copyout(&msg, uap->msg, sizeof(msg));
1170 return (error);
1185 int error;
1191 error = getsock(td, s, &cap_shutdown_rights, &fp);
1192 if (error == 0) {
1194 error = soshutdown(so, how);
1201 if (error == ENOTCONN &&
1203 error = 0;
1206 return (error);
1225 int error;
1249 error = getsock_cap(td, s, &cap_setsockopt_rights, &fp,
1251 if (error == 0) {
1254 error = sosetopt(so, &sopt);
1257 return(error);
1264 int error;
1267 error = copyin(uap->avalsize, &valsize, sizeof (valsize));
1268 if (error != 0)
1269 return (error);
1272 error = kern_getsockopt(td, uap->s, uap->level, uap->name,
1275 if (error == 0)
1276 error = copyout(&valsize, uap->avalsize, sizeof (valsize));
1277 return (error);
1292 int error;
1316 error = getsock_cap(td, s, &cap_getsockopt_rights, &fp, &fcaps);
1317 if (error == 0) {
1320 error = sogetopt(so, &sopt);
1324 return (error);
1333 int error;
1335 error = copyin(alen, &len, sizeof(len));
1336 if (error != 0)
1337 return (error);
1339 error = kern_getsockname(td, fdes, (struct sockaddr *)&ss);
1340 if (error != 0)
1341 return (error);
1348 error = copyout(&ss, asa, len);
1349 if (error == 0) {
1351 error = copyout(&len, alen, sizeof(len));
1353 return (error);
1361 int error;
1364 error = getsock(td, fd, &cap_getsockname_rights, &fp);
1365 if (error != 0)
1366 return (error);
1368 error = sosockaddr(so, sa);
1370 if (error == 0 && KTRPOINT(td, KTR_STRUCT))
1374 return (error);
1397 int error;
1399 error = copyin(alen, &len, sizeof (len));
1400 if (error != 0)
1401 return (error);
1403 error = kern_getpeername(td, fdes, (struct sockaddr *)&ss);
1404 if (error != 0)
1405 return (error);
1412 error = copyout(&ss, asa, len);
1413 if (error == 0) {
1415 error = copyout(&len, alen, sizeof(len));
1417 return (error);
1425 int error;
1428 error = getsock(td, fd, &cap_getpeername_rights, &fp);
1429 if (error != 0)
1430 return (error);
1433 error = ENOTCONN;
1436 error = sopeeraddr(so, sa);
1438 if (error == 0 && KTRPOINT(td, KTR_STRUCT))
1443 return (error);
1465 int error;
1479 error = copyin(buf, mtod(m, void *), buflen);
1480 if (error != 0)
1495 return (error);
1502 int error;
1509 error = copyin(uaddr, sa, len);
1510 if (error != 0) {
1521 return (error);
1526 * should be used in error or truncation cases to avoid leaking file descriptors
1536 int error, fd, *fds, nfd;
1559 error = fget(td, fd, &cap_no_rights,
1561 if (error == 0) {