8366 remove warlock leftovers from usr/src/cmd and usr/src/lib
[unleashed.git] / usr / src / lib / libtnfctl / prb_proc_int.h
blob8c4d6bf31dc37f9fccd1c72a1cb29106d254e400
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _PRB_PROC_INT_H
28 #define _PRB_PROC_INT_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
35 * Interfaces private to proc layer
38 #include <sys/types.h>
39 #include <sys/syscall.h>
41 #include <tnf/probe.h>
43 #include "prb_proc.h"
46 * size of breakpoint instruction
48 #if defined(__sparc)
49 typedef unsigned int bptsave_t;
50 #elif defined(__i386) || defined(__amd64)
51 typedef unsigned char bptsave_t;
52 #endif
55 * memory shared between parent and child when exec'ing a child.
56 * child spins on "spin" member waiting for parent to set it free
58 typedef struct shmem_msg {
59 boolean_t spin;
60 } shmem_msg_t;
63 * per /proc handle state
65 struct prb_proc_ctl {
66 int procfd;
67 int pid;
68 uintptr_t bptaddr;
69 bptsave_t saveinstr; /* instruction that bpt replaced */
70 boolean_t bpt_inserted; /* is bpt inserted ? */
71 uintptr_t dbgaddr;
75 * Declarations
77 prb_status_t prb_status_map(int);
78 prb_status_t find_executable(const char *name, char *ret_path);
80 /* shared memory lock interfaces */
81 prb_status_t prb_shmem_init(volatile shmem_msg_t **);
82 prb_status_t prb_shmem_wait(volatile shmem_msg_t *);
83 prb_status_t prb_shmem_clear(volatile shmem_msg_t *);
84 prb_status_t prb_shmem_free(volatile shmem_msg_t *smp);
86 /* runs and stops the process to clear it out of system call */
87 prb_status_t prb_proc_prstop(prb_proc_ctl_t *proc_p);
89 /* break point interfaces */
90 prb_status_t prb_proc_tracebpt(prb_proc_ctl_t *proc_p, boolean_t bpt);
91 prb_status_t prb_proc_istepbpt(prb_proc_ctl_t *proc_p);
92 prb_status_t prb_proc_clrbptflt(prb_proc_ctl_t *proc_p);
94 /* read a string from target process */
95 prb_status_t prb_proc_readstr(prb_proc_ctl_t *proc_p, uintptr_t addr,
96 const char **outstr_pp);
98 #ifdef __cplusplus
100 #endif
102 #endif /* _PRB_PROC_INT_H */