Deleted Added
full compact
procfs_ioctl.c (170587) procfs_ioctl.c (205014)
1/*-
2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav
3 * 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

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav
3 * 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

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/fs/procfs/procfs_ioctl.c 170587 2007-06-12 00:12:01Z rwatson $
28 * $FreeBSD: head/sys/fs/procfs/procfs_ioctl.c 205014 2010-03-11 14:49:06Z nwhitehorn $
29 */
30
31#include "opt_compat.h"
32
33#include <sys/param.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/pioctl.h>
37#include <sys/priv.h>
38#include <sys/proc.h>
39#include <sys/signalvar.h>
40#include <sys/systm.h>
41
42#include <fs/pseudofs/pseudofs.h>
43#include <fs/procfs/procfs.h>
44
29 */
30
31#include "opt_compat.h"
32
33#include <sys/param.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/pioctl.h>
37#include <sys/priv.h>
38#include <sys/proc.h>
39#include <sys/signalvar.h>
40#include <sys/systm.h>
41
42#include <fs/pseudofs/pseudofs.h>
43#include <fs/procfs/procfs.h>
44
45#ifdef COMPAT_IA32
45#ifdef COMPAT_FREEBSD32
46struct procfs_status32 {
47 int state; /* Running, stopped, something else? */
48 int flags; /* Any flags */
49 unsigned int events; /* Events to stop on */
50 int why; /* What event, if any, proc stopped on */
51 unsigned int val; /* Any extra data */
52};
53
54#define PIOCWAIT32 _IOR('p', 4, struct procfs_status32)
55#define PIOCSTATUS32 _IOR('p', 6, struct procfs_status32)
56#endif
57
58/*
59 * Process ioctls
60 */
61int
62procfs_ioctl(PFS_IOCTL_ARGS)
63{
64 struct procfs_status *ps;
46struct procfs_status32 {
47 int state; /* Running, stopped, something else? */
48 int flags; /* Any flags */
49 unsigned int events; /* Events to stop on */
50 int why; /* What event, if any, proc stopped on */
51 unsigned int val; /* Any extra data */
52};
53
54#define PIOCWAIT32 _IOR('p', 4, struct procfs_status32)
55#define PIOCSTATUS32 _IOR('p', 6, struct procfs_status32)
56#endif
57
58/*
59 * Process ioctls
60 */
61int
62procfs_ioctl(PFS_IOCTL_ARGS)
63{
64 struct procfs_status *ps;
65#ifdef COMPAT_IA32
65#ifdef COMPAT_FREEBSD32
66 struct procfs_status32 *ps32;
67#endif
68 int error, flags, sig;
69#ifdef COMPAT_FREEBSD6
70 int ival;
71#endif
72
73 KASSERT(p != NULL,

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

137 case PIOCSTATUS:
138 ps = (struct procfs_status *)data;
139 ps->state = (p->p_step == 0);
140 ps->flags = 0; /* nope */
141 ps->events = p->p_stops;
142 ps->why = p->p_step ? p->p_stype : 0;
143 ps->val = p->p_step ? p->p_xstat : 0;
144 break;
66 struct procfs_status32 *ps32;
67#endif
68 int error, flags, sig;
69#ifdef COMPAT_FREEBSD6
70 int ival;
71#endif
72
73 KASSERT(p != NULL,

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

137 case PIOCSTATUS:
138 ps = (struct procfs_status *)data;
139 ps->state = (p->p_step == 0);
140 ps->flags = 0; /* nope */
141 ps->events = p->p_stops;
142 ps->why = p->p_step ? p->p_stype : 0;
143 ps->val = p->p_step ? p->p_xstat : 0;
144 break;
145#ifdef COMPAT_IA32
145#ifdef COMPAT_FREEBSD32
146 case PIOCWAIT32:
147 while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
148 /* sleep until p stops */
149 _PHOLD(p);
150 error = msleep(&p->p_stype, &p->p_mtx,
151 PWAIT|PCATCH, "pioctl", 0);
152 _PRELE(p);
153 if (error != 0)

--- 67 unchanged lines hidden ---
146 case PIOCWAIT32:
147 while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
148 /* sleep until p stops */
149 _PHOLD(p);
150 error = msleep(&p->p_stype, &p->p_mtx,
151 PWAIT|PCATCH, "pioctl", 0);
152 _PRELE(p);
153 if (error != 0)

--- 67 unchanged lines hidden ---