Deleted Added
full compact
kern_proc.c (96122) kern_proc.c (96886)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 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 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 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 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
34 * $FreeBSD: head/sys/kern/kern_proc.c 96122 2002-05-06 19:31:28Z alfred $
34 * $FreeBSD: head/sys/kern/kern_proc.c 96886 2002-05-19 00:14:50Z jhb $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/lock.h>
41#include <sys/malloc.h>
42#include <sys/mutex.h>

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

825 int error = 0;
826
827 if (oidp->oid_number == KERN_PROC_PID) {
828 if (namelen != 1)
829 return (EINVAL);
830 p = pfind((pid_t)name[0]);
831 if (!p)
832 return (0);
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/lock.h>
41#include <sys/malloc.h>
42#include <sys/mutex.h>

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

825 int error = 0;
826
827 if (oidp->oid_number == KERN_PROC_PID) {
828 if (namelen != 1)
829 return (EINVAL);
830 p = pfind((pid_t)name[0]);
831 if (!p)
832 return (0);
833 if (p_cansee(curproc, p)) {
833 if (p_cansee(curthread, p)) {
834 PROC_UNLOCK(p);
835 return (0);
836 }
837 error = sysctl_out_proc(p, req, 0);
838 return (error);
839 }
840 if (oidp->oid_number == KERN_PROC_ALL && !namelen)
841 ;

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

856 p = LIST_FIRST(&allproc);
857 else
858 p = LIST_FIRST(&zombproc);
859 for (; p != 0; p = LIST_NEXT(p, p_list)) {
860 PROC_LOCK(p);
861 /*
862 * Show a user only appropriate processes.
863 */
834 PROC_UNLOCK(p);
835 return (0);
836 }
837 error = sysctl_out_proc(p, req, 0);
838 return (error);
839 }
840 if (oidp->oid_number == KERN_PROC_ALL && !namelen)
841 ;

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

856 p = LIST_FIRST(&allproc);
857 else
858 p = LIST_FIRST(&zombproc);
859 for (; p != 0; p = LIST_NEXT(p, p_list)) {
860 PROC_LOCK(p);
861 /*
862 * Show a user only appropriate processes.
863 */
864 if (p_cansee(curproc, p)) {
864 if (p_cansee(curthread, p)) {
865 PROC_UNLOCK(p);
866 continue;
867 }
868 /*
869 * Skip embryonic processes.
870 */
871 if (p->p_stat == SIDL) {
872 PROC_UNLOCK(p);

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

993
994 if (namelen != 1)
995 return (EINVAL);
996
997 p = pfind((pid_t)name[0]);
998 if (!p)
999 return (0);
1000
865 PROC_UNLOCK(p);
866 continue;
867 }
868 /*
869 * Skip embryonic processes.
870 */
871 if (p->p_stat == SIDL) {
872 PROC_UNLOCK(p);

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

993
994 if (namelen != 1)
995 return (EINVAL);
996
997 p = pfind((pid_t)name[0]);
998 if (!p)
999 return (0);
1000
1001 if ((!ps_argsopen) && p_cansee(curproc, p)) {
1001 if ((!ps_argsopen) && p_cansee(curthread, p)) {
1002 PROC_UNLOCK(p);
1003 return (0);
1004 }
1005 PROC_UNLOCK(p);
1006
1007 if (req->newptr && curproc != p)
1008 return (EPERM);
1009

--- 54 unchanged lines hidden ---
1002 PROC_UNLOCK(p);
1003 return (0);
1004 }
1005 PROC_UNLOCK(p);
1006
1007 if (req->newptr && curproc != p)
1008 return (EPERM);
1009

--- 54 unchanged lines hidden ---