1139825Simp/*-
2204976Simp * Copyright 1997 Sean Eric Fagan
331898Ssef *
431898Ssef * Redistribution and use in source and binary forms, with or without
531898Ssef * modification, are permitted provided that the following conditions
631898Ssef * are met:
731898Ssef * 1. Redistributions of source code must retain the above copyright
831898Ssef *    notice, this list of conditions and the following disclaimer.
931898Ssef * 2. Redistributions in binary form must reproduce the above copyright
1031898Ssef *    notice, this list of conditions and the following disclaimer in the
1131898Ssef *    documentation and/or other materials provided with the distribution.
1231898Ssef * 3. All advertising materials mentioning features or use of this software
1331898Ssef *    must display the following acknowledgement:
1431898Ssef *	This product includes software developed by Sean Eric Fagan
1531898Ssef * 4. Neither the name of the author may be used to endorse or promote
1631898Ssef *    products derived from this software without specific prior written
1731898Ssef *    permission.
1831898Ssef *
1931898Ssef * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2031898Ssef * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2131898Ssef * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2231898Ssef * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2331898Ssef * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2431898Ssef * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2531898Ssef * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2631898Ssef * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2731898Ssef * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2831898Ssef * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2931898Ssef * SUCH DAMAGE.
3031898Ssef *
3131898Ssef */
3231898Ssef
3331898Ssef/*
3431564Ssef * procfs ioctl definitions.
3531564Ssef *
3650477Speter * $FreeBSD$
3731564Ssef */
3831564Ssef
3931564Ssef#ifndef _SYS_PIOCTL_H
4031564Ssef# define _SYS_PIOCTL_H
4131564Ssef
4231564Ssef# include <sys/ioccom.h>
4331564Ssef
4431564Ssefstruct procfs_status {
4531564Ssef	int	state;	/* Running, stopped, something else? */
4631564Ssef	int	flags;	/* Any flags */
4731564Ssef	unsigned long	events;	/* Events to stop on */
4831564Ssef	int	why;	/* What event, if any, proc stopped on */
4931564Ssef	unsigned long	val;	/* Any extra data */
5031564Ssef};
5131564Ssef
52162711Sru# define	PIOCBIS	_IOWINT('p', 1)	/* Set event flag */
53162711Sru# define	PIOCBIC	_IOWINT('p', 2)	/* Clear event flag */
54162711Sru# define	PIOCSFL	_IOWINT('p', 3)	/* Set flags */
5531564Ssef			/* wait for proc to stop */
5631564Ssef# define	PIOCWAIT	_IOR('p', 4, struct procfs_status)
57162711Sru# define	PIOCCONT	_IOWINT('p', 5)	/* Continue a process */
5831564Ssef			/* Get proc status */
5931691Ssef# define	PIOCSTATUS	_IOR('p', 6, struct procfs_status)
6031691Ssef# define	PIOCGFL	_IOR('p', 7, unsigned int)	/* Get flags */
6131564Ssef
6285316Sdes# define	S_EXEC	0x00000001	/* stop-on-exec */
6385316Sdes# define	S_SIG	0x00000002	/* stop-on-signal */
6485316Sdes# define	S_SCE	0x00000004	/* stop on syscall entry */
6585316Sdes# define	S_SCX	0x00000008	/* stop on syscall exit */
6685316Sdes# define	S_CORE	0x00000010	/* stop on coredump */
6785316Sdes# define	S_EXIT	0x00000020	/* stop on exit */
6885917Sdes# define	S_ALLSTOPS  0x003f	/* stop on all events */
6985316Sdes
7031594Ssef/*
7131594Ssef * If PF_LINGER is set in procp->p_pfsflags, then the last close
72217747Skib * of a /proc/<pid>/mem file will not clear out the stops and continue
7331594Ssef * the process.
7431594Ssef */
7531594Ssef
7631594Ssef# define PF_LINGER	0x01	/* Keep stops around after last close */
7731891Ssef# define PF_ISUGID	0x02	/* Ignore UID/GID changes */
78101284Smdodd# define PF_FORK	0x04	/* Retain settings on fork() */
7931564Ssef#endif
80