xref: /freebsd/sys/sys/procfs.h (revision dbee5c671aa8cf7673e92ca7ce6d227f52cb185c)
18c64af4fSJohn Polstra /*-
28c64af4fSJohn Polstra  * Copyright (c) 1998 John D. Polstra.
38c64af4fSJohn Polstra  * All rights reserved.
48c64af4fSJohn Polstra  *
58c64af4fSJohn Polstra  * Redistribution and use in source and binary forms, with or without
68c64af4fSJohn Polstra  * modification, are permitted provided that the following conditions
78c64af4fSJohn Polstra  * are met:
88c64af4fSJohn Polstra  * 1. Redistributions of source code must retain the above copyright
98c64af4fSJohn Polstra  *    notice, this list of conditions and the following disclaimer.
108c64af4fSJohn Polstra  * 2. Redistributions in binary form must reproduce the above copyright
118c64af4fSJohn Polstra  *    notice, this list of conditions and the following disclaimer in the
128c64af4fSJohn Polstra  *    documentation and/or other materials provided with the distribution.
138c64af4fSJohn Polstra  *
148c64af4fSJohn Polstra  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
158c64af4fSJohn Polstra  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
168c64af4fSJohn Polstra  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
178c64af4fSJohn Polstra  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
188c64af4fSJohn Polstra  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
198c64af4fSJohn Polstra  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
208c64af4fSJohn Polstra  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
218c64af4fSJohn Polstra  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
228c64af4fSJohn Polstra  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
238c64af4fSJohn Polstra  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
248c64af4fSJohn Polstra  * SUCH DAMAGE.
258c64af4fSJohn Polstra  *
26c3aac50fSPeter Wemm  * $FreeBSD$
278c64af4fSJohn Polstra  */
288c64af4fSJohn Polstra 
298c64af4fSJohn Polstra #ifndef _SYS_PROCFS_H_
308c64af4fSJohn Polstra #define _SYS_PROCFS_H_
318c64af4fSJohn Polstra 
328c64af4fSJohn Polstra #include <sys/param.h>
338c64af4fSJohn Polstra #include <machine/reg.h>
348c64af4fSJohn Polstra 
358c64af4fSJohn Polstra typedef struct reg gregset_t;
368c64af4fSJohn Polstra typedef struct fpreg fpregset_t;
378c64af4fSJohn Polstra 
388c64af4fSJohn Polstra /*
398c64af4fSJohn Polstra  * These structures define an interface between core files and the debugger.
408c64af4fSJohn Polstra  * Never change or delete any elements.  If you add elements, add them to
418c64af4fSJohn Polstra  * the end of the structure, and increment the value of its version field.
428c64af4fSJohn Polstra  * This will help to ensure that today's core dump will still be usable
438c64af4fSJohn Polstra  * with next year's debugger.
448c64af4fSJohn Polstra  *
458c64af4fSJohn Polstra  * A lot more things should be added to these structures.  At present,
468c64af4fSJohn Polstra  * they contain the absolute bare minimum required to allow GDB to work
478c64af4fSJohn Polstra  * with ELF core dumps.
488c64af4fSJohn Polstra  */
498c64af4fSJohn Polstra 
508c64af4fSJohn Polstra /*
518c64af4fSJohn Polstra  * The parenthsized numbers like (1) indicate the minimum version number
528c64af4fSJohn Polstra  * for which each element exists in the structure.
538c64af4fSJohn Polstra  */
548c64af4fSJohn Polstra 
558c64af4fSJohn Polstra #define PRSTATUS_VERSION	1	/* Current version of prstatus_t */
568c64af4fSJohn Polstra 
578c64af4fSJohn Polstra typedef struct prstatus {
588c64af4fSJohn Polstra     int		pr_version;	/* Version number of struct (1) */
598c64af4fSJohn Polstra     size_t	pr_statussz;	/* sizeof(prstatus_t) (1) */
608c64af4fSJohn Polstra     size_t	pr_gregsetsz;	/* sizeof(gregset_t) (1) */
618c64af4fSJohn Polstra     size_t	pr_fpregsetsz;	/* sizeof(fpregset_t) (1) */
628c64af4fSJohn Polstra     int		pr_osreldate;	/* Kernel version (1) */
638c64af4fSJohn Polstra     int		pr_cursig;	/* Current signal (1) */
648c64af4fSJohn Polstra     pid_t	pr_pid;		/* Process ID (1) */
658c64af4fSJohn Polstra     gregset_t	pr_reg;		/* General purpose registers (1) */
668c64af4fSJohn Polstra } prstatus_t;
678c64af4fSJohn Polstra 
68b8732336SDavid Xu typedef gregset_t prgregset_t[1];
698c64af4fSJohn Polstra typedef fpregset_t prfpregset_t;
708c64af4fSJohn Polstra 
716eef6816SPeter Wemm #define PRFNAMESZ	16	/* Maximum command length saved */
728c64af4fSJohn Polstra #define PRARGSZ		80	/* Maximum argument bytes saved */
738c64af4fSJohn Polstra 
748c64af4fSJohn Polstra #define PRPSINFO_VERSION	1	/* Current version of prpsinfo_t */
758c64af4fSJohn Polstra 
768c64af4fSJohn Polstra typedef struct prpsinfo {
778c64af4fSJohn Polstra     int		pr_version;	/* Version number of struct (1) */
788c64af4fSJohn Polstra     size_t	pr_psinfosz;	/* sizeof(prpsinfo_t) (1) */
796eef6816SPeter Wemm     char	pr_fname[PRFNAMESZ+1];	/* Command name, null terminated (1) */
808c64af4fSJohn Polstra     char	pr_psargs[PRARGSZ+1];	/* Arguments, null terminated (1) */
818c64af4fSJohn Polstra } prpsinfo_t;
828c64af4fSJohn Polstra 
837f08176eSAttilio Rao #define THRMISC_VERSION		1	/* Current version of thrmisc_t */
847f08176eSAttilio Rao 
857f08176eSAttilio Rao typedef struct thrmisc {
867f08176eSAttilio Rao     char	pr_tname[MAXCOMLEN+1];	/* Thread name, null terminated (1) */
877f08176eSAttilio Rao     u_int	_pad;			/* Convenience pad, 0-filled (1) */
887f08176eSAttilio Rao } thrmisc_t;
897f08176eSAttilio Rao 
9093898f2bSMarcel Moolenaar typedef uint64_t psaddr_t;	/* An address in the target process. */
91cfdb160eSMarcel Moolenaar 
92*dbee5c67SJohn Baldwin #ifdef __HAVE_REG32
93*dbee5c67SJohn Baldwin typedef struct prstatus32 {
94*dbee5c67SJohn Baldwin 	int32_t	pr_version;
95*dbee5c67SJohn Baldwin 	uint32_t pr_statussz;
96*dbee5c67SJohn Baldwin 	uint32_t pr_gregsetsz;
97*dbee5c67SJohn Baldwin 	uint32_t pr_fpregsetsz;
98*dbee5c67SJohn Baldwin 	int32_t	pr_osreldate;
99*dbee5c67SJohn Baldwin 	int32_t	pr_cursig;
100*dbee5c67SJohn Baldwin 	int32_t	pr_pid;
101*dbee5c67SJohn Baldwin 	struct reg32 pr_reg;
102*dbee5c67SJohn Baldwin } prstatus32_t;
103*dbee5c67SJohn Baldwin 
104*dbee5c67SJohn Baldwin typedef struct prpsinfo32 {
105*dbee5c67SJohn Baldwin 	int32_t	pr_version;
106*dbee5c67SJohn Baldwin 	uint32_t pr_psinfosz;
107*dbee5c67SJohn Baldwin 	char	pr_fname[PRFNAMESZ+1];
108*dbee5c67SJohn Baldwin 	char	pr_psargs[PRARGSZ+1];
109*dbee5c67SJohn Baldwin } prpsinfo32_t;
110*dbee5c67SJohn Baldwin 
111*dbee5c67SJohn Baldwin struct thrmisc32 {
112*dbee5c67SJohn Baldwin 	char	pr_tname[MAXCOMLEN+1];
113*dbee5c67SJohn Baldwin 	uint32_t _pad;
114*dbee5c67SJohn Baldwin };
115*dbee5c67SJohn Baldwin #endif /* __HAVE_REG32 */
116*dbee5c67SJohn Baldwin 
1178c64af4fSJohn Polstra #endif /* _SYS_PROCFS_H_ */
118