uipc_syscalls.c (30d239bc4c510432e65a84fa1c14ed67a3ab1c92) | uipc_syscalls.c (397c19d1753d210247d77eb3ca33d1c7c1eb2fa9) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * sendfile(2) and related extensions: 6 * Copyright (c) 1998, David Greenman. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 166 unchanged lines hidden (view full) --- 175 if (error) 176 return (error); 177 /* An extra reference on `fp' has been held for us by falloc(). */ 178 error = socreate(uap->domain, &so, uap->type, uap->protocol, 179 td->td_ucred, td); 180 if (error) { 181 fdclose(fdp, fp, fd, td); 182 } else { | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * sendfile(2) and related extensions: 6 * Copyright (c) 1998, David Greenman. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 166 unchanged lines hidden (view full) --- 175 if (error) 176 return (error); 177 /* An extra reference on `fp' has been held for us by falloc(). */ 178 error = socreate(uap->domain, &so, uap->type, uap->protocol, 179 td->td_ucred, td); 180 if (error) { 181 fdclose(fdp, fp, fd, td); 182 } else { |
183 FILE_LOCK(fp); 184 fp->f_data = so; /* already has ref count */ 185 fp->f_flag = FREAD|FWRITE; 186 fp->f_type = DTYPE_SOCKET; 187 fp->f_ops = &socketops; 188 FILE_UNLOCK(fp); | 183 finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops); |
189 td->td_retval[0] = fd; 190 } 191 fdrop(fp, td); 192 return (error); 193} 194 195/* ARGSUSED */ 196int --- 221 unchanged lines hidden (view full) --- 418 419 /* connection has been removed from the listen queue */ 420 KNOTE_UNLOCKED(&head->so_rcv.sb_sel.si_note, 0); 421 422 pgid = fgetown(&head->so_sigio); 423 if (pgid != 0) 424 fsetown(pgid, &so->so_sigio); 425 | 184 td->td_retval[0] = fd; 185 } 186 fdrop(fp, td); 187 return (error); 188} 189 190/* ARGSUSED */ 191int --- 221 unchanged lines hidden (view full) --- 413 414 /* connection has been removed from the listen queue */ 415 KNOTE_UNLOCKED(&head->so_rcv.sb_sel.si_note, 0); 416 417 pgid = fgetown(&head->so_sigio); 418 if (pgid != 0) 419 fsetown(pgid, &so->so_sigio); 420 |
426 FILE_LOCK(nfp); 427 nfp->f_data = so; /* nfp has ref count from falloc */ 428 nfp->f_flag = fflag; 429 nfp->f_type = DTYPE_SOCKET; 430 nfp->f_ops = &socketops; 431 FILE_UNLOCK(nfp); | 421 finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); |
432 /* Sync socket nonblocking/async state with file flags */ 433 tmp = fflag & FNONBLOCK; 434 (void) fo_ioctl(nfp, FIONBIO, &tmp, td->td_ucred, td); 435 tmp = fflag & FASYNC; 436 (void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td); 437 sa = 0; 438 error = soaccept(so, &sa); 439 if (error) { --- 195 unchanged lines hidden (view full) --- 635 if (uap->type == SOCK_DGRAM) { 636 /* 637 * Datagram socket connection is asymmetric. 638 */ 639 error = soconnect2(so2, so1); 640 if (error) 641 goto free4; 642 } | 422 /* Sync socket nonblocking/async state with file flags */ 423 tmp = fflag & FNONBLOCK; 424 (void) fo_ioctl(nfp, FIONBIO, &tmp, td->td_ucred, td); 425 tmp = fflag & FASYNC; 426 (void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td); 427 sa = 0; 428 error = soaccept(so, &sa); 429 if (error) { --- 195 unchanged lines hidden (view full) --- 625 if (uap->type == SOCK_DGRAM) { 626 /* 627 * Datagram socket connection is asymmetric. 628 */ 629 error = soconnect2(so2, so1); 630 if (error) 631 goto free4; 632 } |
643 FILE_LOCK(fp1); 644 fp1->f_flag = FREAD|FWRITE; 645 fp1->f_type = DTYPE_SOCKET; 646 fp1->f_ops = &socketops; 647 FILE_UNLOCK(fp1); 648 FILE_LOCK(fp2); 649 fp2->f_flag = FREAD|FWRITE; 650 fp2->f_type = DTYPE_SOCKET; 651 fp2->f_ops = &socketops; 652 FILE_UNLOCK(fp2); | 633 finit(fp1, FREAD | FWRITE, DTYPE_SOCKET, fp1->f_data, &socketops); 634 finit(fp2, FREAD | FWRITE, DTYPE_SOCKET, fp2->f_data, &socketops); |
653 so1 = so2 = NULL; 654 error = copyout(sv, uap->rsv, 2 * sizeof (int)); 655 if (error) 656 goto free4; 657 fdrop(fp1, td); 658 fdrop(fp2, td); 659 return (0); 660free4: --- 1604 unchanged lines hidden (view full) --- 2265 2266 TAILQ_REMOVE(&head->so_comp, so, so_list); 2267 head->so_qlen--; 2268 so->so_state |= (head->so_state & SS_NBIO); 2269 so->so_state &= ~SS_NOFDREF; 2270 so->so_qstate &= ~SQ_COMP; 2271 so->so_head = NULL; 2272 ACCEPT_UNLOCK(); | 635 so1 = so2 = NULL; 636 error = copyout(sv, uap->rsv, 2 * sizeof (int)); 637 if (error) 638 goto free4; 639 fdrop(fp1, td); 640 fdrop(fp2, td); 641 return (0); 642free4: --- 1604 unchanged lines hidden (view full) --- 2247 2248 TAILQ_REMOVE(&head->so_comp, so, so_list); 2249 head->so_qlen--; 2250 so->so_state |= (head->so_state & SS_NBIO); 2251 so->so_state &= ~SS_NOFDREF; 2252 so->so_qstate &= ~SQ_COMP; 2253 so->so_head = NULL; 2254 ACCEPT_UNLOCK(); |
2273 FILE_LOCK(nfp); 2274 nfp->f_data = so; 2275 nfp->f_flag = fflag; 2276 nfp->f_type = DTYPE_SOCKET; 2277 nfp->f_ops = &socketops; 2278 FILE_UNLOCK(nfp); | 2255 finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); |
2279 error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); 2280 if (error) 2281 goto noconnection; 2282 if (head->so_sigio != NULL) 2283 fsetown(fgetown(&head->so_sigio), &so->so_sigio); 2284 2285noconnection: 2286 /* --- 366 unchanged lines hidden --- | 2256 error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); 2257 if (error) 2258 goto noconnection; 2259 if (head->so_sigio != NULL) 2260 fsetown(fgetown(&head->so_sigio), &so->so_sigio); 2261 2262noconnection: 2263 /* --- 366 unchanged lines hidden --- |