2 * Copyright (c) 2005-2006 Joseph Koshy
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/pmclog.h>
41 struct pmclog_ev_dropnotify {
44 struct pmclog_ev_closelog {
47 struct pmclog_ev_initialize {
52 struct pmclog_ev_map_in {
55 char pl_pathname[PATH_MAX];
58 struct pmclog_ev_map_out {
64 struct pmclog_ev_pcsample {
71 struct pmclog_ev_pmcallocate {
73 const char * pl_evname;
78 struct pmclog_ev_pmcattach {
81 char pl_pathname[PATH_MAX];
84 struct pmclog_ev_pmcdetach {
89 struct pmclog_ev_proccsw {
95 struct pmclog_ev_procexec {
98 uintfptr_t pl_entryaddr;
99 char pl_pathname[PATH_MAX];
102 struct pmclog_ev_procexit {
105 pmc_value_t pl_value;
108 struct pmclog_ev_procfork {
113 struct pmclog_ev_sysexit {
117 struct pmclog_ev_userdata {
118 uint32_t pl_userdata;
122 enum pmclog_state pl_state; /* state after 'get_event()' */
123 off_t pl_offset; /* byte offset in stream */
124 size_t pl_count; /* count of records so far */
125 struct timespec pl_ts; /* log entry timestamp */
126 enum pmclog_type pl_type; /* type of log entry */
127 union { /* log entry data */
128 struct pmclog_ev_closelog pl_cl;
129 struct pmclog_ev_dropnotify pl_dn;
130 struct pmclog_ev_initialize pl_i;
131 struct pmclog_ev_map_in pl_mi;
132 struct pmclog_ev_map_out pl_mo;
133 struct pmclog_ev_pcsample pl_s;
134 struct pmclog_ev_pmcallocate pl_a;
135 struct pmclog_ev_pmcattach pl_t;
136 struct pmclog_ev_pmcdetach pl_d;
137 struct pmclog_ev_proccsw pl_c;
138 struct pmclog_ev_procexec pl_x;
139 struct pmclog_ev_procexit pl_e;
140 struct pmclog_ev_procfork pl_f;
141 struct pmclog_ev_sysexit pl_se;
142 struct pmclog_ev_userdata pl_u;
146 #define PMCLOG_FD_NONE (-1)
148 void *pmclog_open(int _fd);
149 int pmclog_feed(void *_cookie, char *_data, int _len);
150 int pmclog_read(void *_cookie, struct pmclog_ev *_ev);
151 void pmclog_close(void *_cookie);