xref: /freebsd/include/proc_service.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1e58eb3c4SPedro F. Giffuni /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3e58eb3c4SPedro F. Giffuni  *
4a3d4136aSDavid Xu  * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
5a8028b26SMarcel Moolenaar  * Copyright (c) 2004 Marcel Moolenaar
6a3d4136aSDavid Xu  * All rights reserved.
7a3d4136aSDavid Xu  *
8a3d4136aSDavid Xu  * Redistribution and use in source and binary forms, with or without
9a3d4136aSDavid Xu  * modification, are permitted provided that the following conditions
10a3d4136aSDavid Xu  * are met:
11a3d4136aSDavid Xu  * 1. Redistributions of source code must retain the above copyright
12a3d4136aSDavid Xu  *    notice, this list of conditions and the following disclaimer.
13a3d4136aSDavid Xu  * 2. Redistributions in binary form must reproduce the above copyright
14a3d4136aSDavid Xu  *    notice, this list of conditions and the following disclaimer in the
15a3d4136aSDavid Xu  *    documentation and/or other materials provided with the distribution.
16a3d4136aSDavid Xu  *
17a8028b26SMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18a3d4136aSDavid Xu  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19a3d4136aSDavid Xu  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20a8028b26SMarcel Moolenaar  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21a3d4136aSDavid Xu  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22a3d4136aSDavid Xu  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23a3d4136aSDavid Xu  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24a3d4136aSDavid Xu  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25a3d4136aSDavid Xu  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26a3d4136aSDavid Xu  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27a3d4136aSDavid Xu  * SUCH DAMAGE.
28a3d4136aSDavid Xu  */
29a3d4136aSDavid Xu 
30a3d4136aSDavid Xu #ifndef _PROC_SERVICE_H_
31a3d4136aSDavid Xu #define	_PROC_SERVICE_H_
32a3d4136aSDavid Xu 
33a3d4136aSDavid Xu #include <sys/types.h>
34a3d4136aSDavid Xu #include <sys/procfs.h>
35a3d4136aSDavid Xu 
36a8028b26SMarcel Moolenaar typedef enum {
37a8028b26SMarcel Moolenaar 	PS_OK = 0,		/* No errors. */
38a8028b26SMarcel Moolenaar 	PS_ERR,			/* Generic error. */
39a8028b26SMarcel Moolenaar 	PS_BADADDR,		/* Bad address. */
40a8028b26SMarcel Moolenaar 	PS_BADLID,		/* Bad LWP Id. */
41a8028b26SMarcel Moolenaar 	PS_BADPID,		/* Bad process Id. */
42a8028b26SMarcel Moolenaar 	PS_NOFREGS,		/* FPU register set not available. */
43a8028b26SMarcel Moolenaar 	PS_NOSYM		/* Symbol not found. */
44a3d4136aSDavid Xu } ps_err_e;
45a3d4136aSDavid Xu 
46a8028b26SMarcel Moolenaar struct ps_prochandle;		/* Opaque type. Defined by the implementor. */
47a3d4136aSDavid Xu 
48a8028b26SMarcel Moolenaar __BEGIN_DECLS
49a8028b26SMarcel Moolenaar ps_err_e ps_lcontinue(struct ps_prochandle *, lwpid_t);
50a8028b26SMarcel Moolenaar ps_err_e ps_lgetfpregs(struct ps_prochandle *, lwpid_t, prfpregset_t *);
51a8028b26SMarcel Moolenaar ps_err_e ps_lgetregs(struct ps_prochandle *, lwpid_t, prgregset_t);
52a8028b26SMarcel Moolenaar ps_err_e ps_lsetfpregs(struct ps_prochandle *, lwpid_t, const prfpregset_t *);
53a8028b26SMarcel Moolenaar ps_err_e ps_lsetregs(struct ps_prochandle *, lwpid_t, const prgregset_t);
548d7681bbSDoug Rabson #ifdef __i386__
558d7681bbSDoug Rabson ps_err_e ps_lgetxmmregs (struct ps_prochandle *, lwpid_t, char *);
568d7681bbSDoug Rabson ps_err_e ps_lsetxmmregs (struct ps_prochandle *, lwpid_t, const char *);
578d7681bbSDoug Rabson #endif
58a8028b26SMarcel Moolenaar ps_err_e ps_lstop(struct ps_prochandle *, lwpid_t);
59d56a014bSDavid Xu ps_err_e ps_linfo(struct ps_prochandle *, lwpid_t, void *);
60a8028b26SMarcel Moolenaar ps_err_e ps_pcontinue(struct ps_prochandle *);
61a8028b26SMarcel Moolenaar ps_err_e ps_pdmodel(struct ps_prochandle *, int *);
62a8028b26SMarcel Moolenaar ps_err_e ps_pglobal_lookup(struct ps_prochandle *, const char *, const char *,
63a8028b26SMarcel Moolenaar     psaddr_t *);
64a8028b26SMarcel Moolenaar void	 ps_plog(const char *, ...);
65a8028b26SMarcel Moolenaar ps_err_e ps_pread(struct ps_prochandle *, psaddr_t, void *, size_t);
66a8028b26SMarcel Moolenaar ps_err_e ps_pstop(struct ps_prochandle *);
67a8028b26SMarcel Moolenaar ps_err_e ps_pwrite(struct ps_prochandle *, psaddr_t, const void *, size_t);
68a8028b26SMarcel Moolenaar __END_DECLS
69a3d4136aSDavid Xu 
70a8028b26SMarcel Moolenaar #endif /* _PROC_SERVICE_H_ */
71