1sysevent_get_class_name(3SSyYsStEeVmENETv)ent LibrarysFyusnecvteinotn_sget_class_name(3SYSEVENT)
2
3
4

NAME

6       sysevent_get_class_name, sysevent_get_subclass_name, sysevent_get_size,
7       sysevent_get_seq, sysevent_get_time - get class name, subclass name, ID
8       or buffer size of event
9

SYNOPSIS

11       cc [flag...]  file... -lsysevent [library...]
12       #include <libsysevent.h>
13
14       char *sysevent_get_class_name(sysevent_t *ev);
15
16
17       char *sysevent_get_subclass_name(sysevent_t *ev);
18
19
20       int sysevent_get_size(sysevent_t *ev);
21
22
23       uint64_t sysevent_get_seq(sysevent_t *ev);
24
25
26       void sysevent_get_time(sysevent_t *ev, hrtime_t *etimep);
27
28

PARAMETERS

30       ev        handle to event
31
32
33       etimep    pointer to high resolution event time variable
34
35

DESCRIPTION

37       The  sysevent_get_class_name()  and  sysevent_get_subclass_name() func‐
38       tions return, respectively, the class and subclass names for  the  pro‐
39       vided event ev.
40
41
42       The  sysevent_get_size() function returns the size of the event buffer,
43       ev.
44
45
46       The sysevent_get_seq() function returns a unique event sequence  number
47       of event ev. The sequence number is reset on every system boot.
48
49
50       The  sysevent_get_time()  function  writes  the time the event was pub‐
51       lished into the variable pointed to by etimep. The event time is  added
52       to  the  event  just  before  it  is put into the kernel internal event
53       queue.
54

EXAMPLES

56       Example 1 Parse sysevent header information.
57
58
59       The following example parses sysevent header information from an appli‐
60       cation's event handler.
61
62
63         hrtime_t last_ev_time;
64         unit64_t last_ev_seq;
65
66         void
67         event_handler(sysevent_t *ev)
68         {
69                  sysevent_t *new_ev;
70                  int ev_sz;
71                  hrtime_t ev_time;
72                  uint64_t ev_seq;
73
74
75                  /* Filter on class and subclass */
76                  if (strcmp(EC_PRIV, sysevent_get_class_name(ev)) != 0) {
77                          return;
78                  } else if (strcmp("ESC_MYSUBCLASS,
79                      sysevent_get_subclass_name(ev)) != 0) {
80                          return;
81                  }
82
83                  /*
84                   * Check for replayed sysevent, time must
85                   * be greater than previously recorded.
86                   */
87                  sysevent_get_event_time(ev, &ev_time);
88                  ev_seq = sysevent_get_seq(ev);
89                  if (ev_time < last_ev_time ||
90                      (ev_time == last_ev_time && ev_seq <=
91                      last_ev_seq)) {
92                          return;
93                  }
94
95                  last_ev_time = ev_time;
96                  last_ev_seq = ev_seq;
97
98                  /* Store event for later processing */
99                  ev_sz = sysevent_get_size(ev):
100                  new_ev (sysevent_t *)malloc(ev_sz);
101                  bcopy(ev, new_ev, ev_sz);
102                  queue_event(new_ev);
103         }
104
105

ATTRIBUTES

107       See attributes(5) for descriptions of the following attributes:
108
109
110
111
112       ┌─────────────────────────────┬─────────────────────────────┐
113       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
114       ├─────────────────────────────┼─────────────────────────────┤
115       │Interface Stability          │Committed                    │
116       ├─────────────────────────────┼─────────────────────────────┤
117       │MT-Level                     │MT-Safe                      │
118       └─────────────────────────────┴─────────────────────────────┘
119

SEE ALSO

121       attributes(5)
122

NOTES

124       The libsysevent interfaces do not work at all in non-global zones.
125
126
127
128SunOS 5.11                        24 Jul 2009sysevent_get_class_name(3SYSEVENT)
Impressum