Deleted Added
full compact
kern_resource.c (91066) kern_resource.c (91140)
1/*-
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
39 * $FreeBSD: head/sys/kern/kern_resource.c 91066 2002-02-22 13:32:01Z phk $
39 * $FreeBSD: head/sys/kern/kern_resource.c 91140 2002-02-23 11:12:57Z tanimura $
40 */
41
42#include "opt_compat.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/sysproto.h>
47#include <sys/file.h>

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

106 low = p->p_ksegrp.kg_nice /* XXXKSE */ ;
107 PROC_UNLOCK(p);
108 }
109 break;
110
111 case PRIO_PGRP: {
112 register struct pgrp *pg;
113
40 */
41
42#include "opt_compat.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/sysproto.h>
47#include <sys/file.h>

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

106 low = p->p_ksegrp.kg_nice /* XXXKSE */ ;
107 PROC_UNLOCK(p);
108 }
109 break;
110
111 case PRIO_PGRP: {
112 register struct pgrp *pg;
113
114 if (uap->who == 0)
114 PGRPSESS_SLOCK();
115 if (uap->who == 0) {
115 pg = curp->p_pgrp;
116 pg = curp->p_pgrp;
116 else if ((pg = pgfind(uap->who)) == NULL)
117 break;
117 PGRP_LOCK(pg);
118 } else {
119 pg = pgfind(uap->who);
120 if (pg == NULL) {
121 PGRPSESS_SUNLOCK();
122 break;
123 }
124 }
125 PGRPSESS_SUNLOCK();
118 LIST_FOREACH(p, &pg->pg_members, p_pglist) {
126 LIST_FOREACH(p, &pg->pg_members, p_pglist) {
127 PROC_LOCK(p);
119 if (!p_cansee(curp, p) && p->p_ksegrp.kg_nice /* XXXKSE */ < low)
120 low = p->p_ksegrp.kg_nice /* XXXKSE */ ;
128 if (!p_cansee(curp, p) && p->p_ksegrp.kg_nice /* XXXKSE */ < low)
129 low = p->p_ksegrp.kg_nice /* XXXKSE */ ;
130 PROC_UNLOCK(p);
121 }
131 }
132 PGRP_UNLOCK(pg);
122 break;
123 }
124
125 case PRIO_USER:
126 if (uap->who == 0)
127 uap->who = curp->p_ucred->cr_uid;
128 sx_slock(&allproc_lock);
129 LIST_FOREACH(p, &allproc, p_list)

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

180 PROC_UNLOCK(p);
181 }
182 found++;
183 break;
184
185 case PRIO_PGRP: {
186 register struct pgrp *pg;
187
133 break;
134 }
135
136 case PRIO_USER:
137 if (uap->who == 0)
138 uap->who = curp->p_ucred->cr_uid;
139 sx_slock(&allproc_lock);
140 LIST_FOREACH(p, &allproc, p_list)

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

191 PROC_UNLOCK(p);
192 }
193 found++;
194 break;
195
196 case PRIO_PGRP: {
197 register struct pgrp *pg;
198
188 if (uap->who == 0)
199 PGRPSESS_SLOCK();
200 if (uap->who == 0) {
189 pg = curp->p_pgrp;
201 pg = curp->p_pgrp;
190 else if ((pg = pgfind(uap->who)) == NULL)
191 break;
202 PGRP_LOCK(pg);
203 } else {
204 pg = pgfind(uap->who);
205 if (pg == NULL) {
206 PGRPSESS_SUNLOCK();
207 break;
208 }
209 }
210 PGRPSESS_SUNLOCK();
192 LIST_FOREACH(p, &pg->pg_members, p_pglist) {
211 LIST_FOREACH(p, &pg->pg_members, p_pglist) {
212 PROC_LOCK(p);
193 if (!p_cansee(curp, p)) {
194 error = donice(curp, p, uap->prio);
195 found++;
196 }
213 if (!p_cansee(curp, p)) {
214 error = donice(curp, p, uap->prio);
215 found++;
216 }
217 PROC_UNLOCK(p);
197 }
218 }
219 PGRP_UNLOCK(pg);
198 break;
199 }
200
201 case PRIO_USER:
202 if (uap->who == 0)
203 uap->who = curp->p_ucred->cr_uid;
204 sx_slock(&allproc_lock);
205 FOREACH_PROC_IN_SYSTEM(p) {

--- 790 unchanged lines hidden ---
220 break;
221 }
222
223 case PRIO_USER:
224 if (uap->who == 0)
225 uap->who = curp->p_ucred->cr_uid;
226 sx_slock(&allproc_lock);
227 FOREACH_PROC_IN_SYSTEM(p) {

--- 790 unchanged lines hidden ---