uipc_sockbuf.c (88633) | uipc_sockbuf.c (88949) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 |
34 * $FreeBSD: head/sys/kern/uipc_sockbuf.c 88633 2001-12-29 07:13:47Z alfred $ | 34 * $FreeBSD: head/sys/kern/uipc_sockbuf.c 88949 2002-01-06 06:50:54Z silby $ |
35 */ 36 37#include "opt_param.h" 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/domain.h> 41#include <sys/file.h> /* for maxfiles */ 42#include <sys/kernel.h> --- 374 unchanged lines hidden (view full) --- 417 struct socket *so; 418 struct thread *td; 419{ 420 421 /* 422 * td will only be NULL when we're in an interrupt 423 * (e.g. in tcp_input()) 424 */ | 35 */ 36 37#include "opt_param.h" 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/domain.h> 41#include <sys/file.h> /* for maxfiles */ 42#include <sys/kernel.h> --- 374 unchanged lines hidden (view full) --- 417 struct socket *so; 418 struct thread *td; 419{ 420 421 /* 422 * td will only be NULL when we're in an interrupt 423 * (e.g. in tcp_input()) 424 */ |
425 if ((u_quad_t)cc > (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES)) | 425 if (sb_max < MSIZE + MCLBYTES) 426 sb_max = MSIZE + MCLBYTES; 427 if ((u_quad_t)cc > (u_quad_t)(MCLBYTES * (sb_max / (MSIZE + MCLBYTES)))) |
426 return (0); 427 if (!chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, cc, 428 td ? td->td_proc->p_rlimit[RLIMIT_SBSIZE].rlim_cur : RLIM_INFINITY)) { 429 return (0); 430 } 431 sb->sb_mbmax = min(cc * sb_efficiency, sb_max); 432 if (sb->sb_lowat > sb->sb_hiwat) 433 sb->sb_lowat = sb->sb_hiwat; --- 590 unchanged lines hidden --- | 428 return (0); 429 if (!chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, cc, 430 td ? td->td_proc->p_rlimit[RLIMIT_SBSIZE].rlim_cur : RLIM_INFINITY)) { 431 return (0); 432 } 433 sb->sb_mbmax = min(cc * sb_efficiency, sb_max); 434 if (sb->sb_lowat > sb->sb_hiwat) 435 sb->sb_lowat = sb->sb_hiwat; --- 590 unchanged lines hidden --- |