uipc_socket.c (fb401f1bba30ec7ad9f7611c20576b887a953ac6) uipc_socket.c (f1f93475463891194c453aff5f7c872fa9109b45)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1988, 1990, 1993
5 * The Regents of the University of California.
6 * Copyright (c) 2004 The FreeBSD Foundation
7 * Copyright (c) 2004-2008 Robert N. M. Watson
8 * All rights reserved.

--- 2358 unchanged lines hidden (view full) ---

2367 *controlp = NULL;
2368 if (flags & MSG_OOB)
2369 return (soreceive_rcvoob(so, uio, flags));
2370 if (mp0 != NULL)
2371 *mp0 = NULL;
2372
2373 sb = &so->so_rcv;
2374
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1988, 1990, 1993
5 * The Regents of the University of California.
6 * Copyright (c) 2004 The FreeBSD Foundation
7 * Copyright (c) 2004-2008 Robert N. M. Watson
8 * All rights reserved.

--- 2358 unchanged lines hidden (view full) ---

2367 *controlp = NULL;
2368 if (flags & MSG_OOB)
2369 return (soreceive_rcvoob(so, uio, flags));
2370 if (mp0 != NULL)
2371 *mp0 = NULL;
2372
2373 sb = &so->so_rcv;
2374
2375#ifdef KERN_TLS
2376 /*
2377 * KTLS store TLS records as records with a control message to
2378 * describe the framing.
2379 *
2380 * We check once here before acquiring locks to optimize the
2381 * common case.
2382 */
2383 if (sb->sb_tls_info != NULL)
2384 return (soreceive_generic(so, psa, uio, mp0, controlp,
2385 flagsp));
2386#endif
2387
2375 /* Prevent other readers from entering the socket. */
2376 error = sblock(sb, SBLOCKWAIT(flags));
2377 if (error)
2378 return (error);
2379 SOCKBUF_LOCK(sb);
2380
2388 /* Prevent other readers from entering the socket. */
2389 error = sblock(sb, SBLOCKWAIT(flags));
2390 if (error)
2391 return (error);
2392 SOCKBUF_LOCK(sb);
2393
2394#ifdef KERN_TLS
2395 if (sb->sb_tls_info != NULL) {
2396 SOCKBUF_UNLOCK(sb);
2397 sbunlock(sb);
2398 return (soreceive_generic(so, psa, uio, mp0, controlp,
2399 flagsp));
2400 }
2401#endif
2402
2381 /* Easy one, no space to copyout anything. */
2382 if (uio->uio_resid == 0) {
2383 error = EINVAL;
2384 goto out;
2385 }
2386 oresid = uio->uio_resid;
2387
2388 /* We will never ever get anything unless we are or were connected. */

--- 1961 unchanged lines hidden ---
2403 /* Easy one, no space to copyout anything. */
2404 if (uio->uio_resid == 0) {
2405 error = EINVAL;
2406 goto out;
2407 }
2408 oresid = uio->uio_resid;
2409
2410 /* We will never ever get anything unless we are or were connected. */

--- 1961 unchanged lines hidden ---