139198Sjdp/*-
239198Sjdp * Copyright (c) 1998 John D. Polstra.
339198Sjdp * All rights reserved.
439198Sjdp *
539198Sjdp * Redistribution and use in source and binary forms, with or without
639198Sjdp * modification, are permitted provided that the following conditions
739198Sjdp * are met:
839198Sjdp * 1. Redistributions of source code must retain the above copyright
939198Sjdp *    notice, this list of conditions and the following disclaimer.
1039198Sjdp * 2. Redistributions in binary form must reproduce the above copyright
1139198Sjdp *    notice, this list of conditions and the following disclaimer in the
1239198Sjdp *    documentation and/or other materials provided with the distribution.
1339198Sjdp *
1439198Sjdp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1539198Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1639198Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1739198Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1839198Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1939198Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2039198Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2139198Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2239198Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2339198Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2439198Sjdp * SUCH DAMAGE.
2539198Sjdp *
2650477Speter * $FreeBSD: stable/10/sys/sys/procfs.h 308009 2016-10-28 03:54:19Z jhb $
2739198Sjdp */
2839198Sjdp
2939198Sjdp#ifndef _SYS_PROCFS_H_
3039198Sjdp#define _SYS_PROCFS_H_
3139198Sjdp
3239198Sjdp#include <sys/param.h>
3339198Sjdp#include <machine/reg.h>
3439198Sjdp
3539198Sjdptypedef struct reg gregset_t;
3639198Sjdptypedef struct fpreg fpregset_t;
3739198Sjdp
3839198Sjdp/*
3939198Sjdp * These structures define an interface between core files and the debugger.
4039198Sjdp * Never change or delete any elements.  If you add elements, add them to
4139198Sjdp * the end of the structure, and increment the value of its version field.
4239198Sjdp * This will help to ensure that today's core dump will still be usable
4339198Sjdp * with next year's debugger.
4439198Sjdp *
4539198Sjdp * A lot more things should be added to these structures.  At present,
4639198Sjdp * they contain the absolute bare minimum required to allow GDB to work
4739198Sjdp * with ELF core dumps.
4839198Sjdp */
4939198Sjdp
5039198Sjdp/*
5139198Sjdp * The parenthsized numbers like (1) indicate the minimum version number
52308009Sjhb * for which each element exists in the structure.  The version number is
53308009Sjhb * not bumped when adding new fields to the end, only if the meaning of
54308009Sjhb * an existing field changes.  Additional fields are annotated as (1a),
55308009Sjhb * (1b), etc. to indicate the groupings of additions.
5639198Sjdp */
5739198Sjdp
5839198Sjdp#define PRSTATUS_VERSION	1	/* Current version of prstatus_t */
5939198Sjdp
6039198Sjdptypedef struct prstatus {
6139198Sjdp    int		pr_version;	/* Version number of struct (1) */
6239198Sjdp    size_t	pr_statussz;	/* sizeof(prstatus_t) (1) */
6339198Sjdp    size_t	pr_gregsetsz;	/* sizeof(gregset_t) (1) */
6439198Sjdp    size_t	pr_fpregsetsz;	/* sizeof(fpregset_t) (1) */
6539198Sjdp    int		pr_osreldate;	/* Kernel version (1) */
6639198Sjdp    int		pr_cursig;	/* Current signal (1) */
67308009Sjhb    pid_t	pr_pid;		/* LWP (Thread) ID (1) */
6839198Sjdp    gregset_t	pr_reg;		/* General purpose registers (1) */
6939198Sjdp} prstatus_t;
7039198Sjdp
71132175Sdavidxutypedef gregset_t prgregset_t[1];
7239198Sjdptypedef fpregset_t prfpregset_t;
7339198Sjdp
7481757Speter#define PRFNAMESZ	16	/* Maximum command length saved */
7539198Sjdp#define PRARGSZ		80	/* Maximum argument bytes saved */
7639198Sjdp
7739198Sjdp#define PRPSINFO_VERSION	1	/* Current version of prpsinfo_t */
7839198Sjdp
7939198Sjdptypedef struct prpsinfo {
8039198Sjdp    int		pr_version;	/* Version number of struct (1) */
8139198Sjdp    size_t	pr_psinfosz;	/* sizeof(prpsinfo_t) (1) */
8281757Speter    char	pr_fname[PRFNAMESZ+1];	/* Command name, null terminated (1) */
8339198Sjdp    char	pr_psargs[PRARGSZ+1];	/* Arguments, null terminated (1) */
84308009Sjhb    pid_t	pr_pid;		/* Process ID (1a) */
8539198Sjdp} prpsinfo_t;
8639198Sjdp
87215679Sattiliotypedef struct thrmisc {
88215679Sattilio    char	pr_tname[MAXCOMLEN+1];	/* Thread name, null terminated (1) */
89215679Sattilio    u_int	_pad;			/* Convenience pad, 0-filled (1) */
90215679Sattilio} thrmisc_t;
91215679Sattilio
92183023Smarceltypedef uint64_t psaddr_t;	/* An address in the target process. */
93131119Smarcel
94283910Sjhb#ifdef __HAVE_REG32
95283910Sjhbtypedef struct prstatus32 {
96283910Sjhb	int32_t	pr_version;
97283910Sjhb	uint32_t pr_statussz;
98283910Sjhb	uint32_t pr_gregsetsz;
99283910Sjhb	uint32_t pr_fpregsetsz;
100283910Sjhb	int32_t	pr_osreldate;
101283910Sjhb	int32_t	pr_cursig;
102283910Sjhb	int32_t	pr_pid;
103283910Sjhb	struct reg32 pr_reg;
104283910Sjhb} prstatus32_t;
105283910Sjhb
106283910Sjhbtypedef struct prpsinfo32 {
107283910Sjhb	int32_t	pr_version;
108283910Sjhb	uint32_t pr_psinfosz;
109283910Sjhb	char	pr_fname[PRFNAMESZ+1];
110283910Sjhb	char	pr_psargs[PRARGSZ+1];
111308009Sjhb	int32_t	pr_pid;
112283910Sjhb} prpsinfo32_t;
113283910Sjhb
114283910Sjhbstruct thrmisc32 {
115283910Sjhb	char	pr_tname[MAXCOMLEN+1];
116283910Sjhb	uint32_t _pad;
117283910Sjhb};
118283910Sjhb#endif /* __HAVE_REG32 */
119283910Sjhb
12039198Sjdp#endif /* _SYS_PROCFS_H_ */
121