Xenomai  3.0.8
cobalt-posix.h
1 /*
2  * Copyright (C) 2014 Jan Kiszka <jan.kiszka@siemens.com>.
3  * Copyright (C) 2014 Philippe Gerum <rpm@xenomai.org>.
4  *
5  * Xenomai is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 2 of the License,
8  * or (at your option) any later version.
9  *
10  * Xenomai is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Xenomai; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18  * 02111-1307, USA.
19  */
20 #undef TRACE_SYSTEM
21 #define TRACE_SYSTEM cobalt_posix
22 
23 #if !defined(_TRACE_COBALT_POSIX_H) || defined(TRACE_HEADER_MULTI_READ)
24 #define _TRACE_COBALT_POSIX_H
25 
26 #include <linux/tracepoint.h>
27 #include <xenomai/posix/cond.h>
28 #include <xenomai/posix/mqueue.h>
29 #include <xenomai/posix/event.h>
30 
31 #define __timespec_fields(__name) \
32  __field(__kernel_time_t, tv_sec_##__name) \
33  __field(long, tv_nsec_##__name)
34 
35 #define __assign_timespec(__to, __from) \
36  do { \
37  __entry->tv_sec_##__to = (__from)->tv_sec; \
38  __entry->tv_nsec_##__to = (__from)->tv_nsec; \
39  } while (0)
40 
41 #define __timespec_args(__name) \
42  __entry->tv_sec_##__name, __entry->tv_nsec_##__name
43 
44 DECLARE_EVENT_CLASS(syscall_entry,
45  TP_PROTO(struct xnthread *thread, unsigned int nr),
46  TP_ARGS(thread, nr),
47 
48  TP_STRUCT__entry(
49  __field(struct xnthread *, thread)
50  __string(name, thread ? thread->name : "(anon)")
51  __field(unsigned int, nr)
52  ),
53 
54  TP_fast_assign(
55  __entry->thread = thread;
56  __assign_str(name, thread ? thread->name : "(anon)");
57  __entry->nr = nr;
58  ),
59 
60  TP_printk("thread=%p(%s) syscall=%u",
61  __entry->thread, __get_str(name), __entry->nr)
62 );
63 
64 DECLARE_EVENT_CLASS(syscall_exit,
65  TP_PROTO(struct xnthread *thread, long result),
66  TP_ARGS(thread, result),
67 
68  TP_STRUCT__entry(
69  __field(struct xnthread *, thread)
70  __field(long, result)
71  ),
72 
73  TP_fast_assign(
74  __entry->thread = thread;
75  __entry->result = result;
76  ),
77 
78  TP_printk("thread=%p result=%ld",
79  __entry->thread, __entry->result)
80 );
81 
82 #define cobalt_print_sched_policy(__policy) \
83  __print_symbolic(__policy, \
84  {SCHED_NORMAL, "normal"}, \
85  {SCHED_FIFO, "fifo"}, \
86  {SCHED_RR, "rr"}, \
87  {SCHED_TP, "tp"}, \
88  {SCHED_QUOTA, "quota"}, \
89  {SCHED_SPORADIC, "sporadic"}, \
90  {SCHED_COBALT, "cobalt"}, \
91  {SCHED_WEAK, "weak"})
92 
93 #define cobalt_print_sched_params(__policy, __p_ex) \
94 ({ \
95  const unsigned char *__ret = trace_seq_buffer_ptr(p); \
96  switch (__policy) { \
97  case SCHED_QUOTA: \
98  trace_seq_printf(p, "priority=%d, group=%d", \
99  (__p_ex)->sched_priority, \
100  (__p_ex)->sched_quota_group); \
101  break; \
102  case SCHED_TP: \
103  trace_seq_printf(p, "priority=%d, partition=%d", \
104  (__p_ex)->sched_priority, \
105  (__p_ex)->sched_tp_partition); \
106  break; \
107  case SCHED_NORMAL: \
108  break; \
109  case SCHED_SPORADIC: \
110  trace_seq_printf(p, "priority=%d, low_priority=%d, " \
111  "budget=(%ld.%09ld), period=(%ld.%09ld), "\
112  "maxrepl=%d", \
113  (__p_ex)->sched_priority, \
114  (__p_ex)->sched_ss_low_priority, \
115  (__p_ex)->sched_ss_init_budget.tv_sec, \
116  (__p_ex)->sched_ss_init_budget.tv_nsec, \
117  (__p_ex)->sched_ss_repl_period.tv_sec, \
118  (__p_ex)->sched_ss_repl_period.tv_nsec, \
119  (__p_ex)->sched_ss_max_repl); \
120  break; \
121  case SCHED_RR: \
122  case SCHED_FIFO: \
123  case SCHED_COBALT: \
124  case SCHED_WEAK: \
125  default: \
126  trace_seq_printf(p, "priority=%d", \
127  (__p_ex)->sched_priority); \
128  break; \
129  } \
130  trace_seq_putc(p, '\0'); \
131  __ret; \
132 })
133 
134 DECLARE_EVENT_CLASS(cobalt_posix_schedparam,
135  TP_PROTO(unsigned long pth, int policy,
136  const struct sched_param_ex *param_ex),
137  TP_ARGS(pth, policy, param_ex),
138 
139  TP_STRUCT__entry(
140  __field(unsigned long, pth)
141  __field(int, policy)
142  __dynamic_array(char, param_ex, sizeof(struct sched_param_ex))
143  ),
144 
145  TP_fast_assign(
146  __entry->pth = pth;
147  __entry->policy = policy;
148  memcpy(__get_dynamic_array(param_ex), param_ex, sizeof(*param_ex));
149  ),
150 
151  TP_printk("pth=%p policy=%d(%s) param={ %s }",
152  (void *)__entry->pth, __entry->policy,
153  cobalt_print_sched_policy(__entry->policy),
154  cobalt_print_sched_params(__entry->policy,
155  (struct sched_param_ex *)
156  __get_dynamic_array(param_ex))
157  )
158 );
159 
160 DECLARE_EVENT_CLASS(cobalt_posix_scheduler,
161  TP_PROTO(pid_t pid, int policy,
162  const struct sched_param_ex *param_ex),
163  TP_ARGS(pid, policy, param_ex),
164 
165  TP_STRUCT__entry(
166  __field(pid_t, pid)
167  __field(int, policy)
168  __dynamic_array(char, param_ex, sizeof(struct sched_param_ex))
169  ),
170 
171  TP_fast_assign(
172  __entry->pid = pid;
173  __entry->policy = policy;
174  memcpy(__get_dynamic_array(param_ex), param_ex, sizeof(*param_ex));
175  ),
176 
177  TP_printk("pid=%d policy=%d(%s) param={ %s }",
178  __entry->pid, __entry->policy,
179  cobalt_print_sched_policy(__entry->policy),
180  cobalt_print_sched_params(__entry->policy,
181  (struct sched_param_ex *)
182  __get_dynamic_array(param_ex))
183  )
184 );
185 
186 DECLARE_EVENT_CLASS(cobalt_void,
187  TP_PROTO(int dummy),
188  TP_ARGS(dummy),
189  TP_STRUCT__entry(
190  __array(char, dummy, 0)
191  ),
192  TP_fast_assign(
193  (void)dummy;
194  ),
195  TP_printk("%s", "")
196 );
197 
198 DEFINE_EVENT(syscall_entry, cobalt_head_sysentry,
199  TP_PROTO(struct xnthread *thread, unsigned int nr),
200  TP_ARGS(thread, nr)
201 );
202 
203 DEFINE_EVENT(syscall_exit, cobalt_head_sysexit,
204  TP_PROTO(struct xnthread *thread, long result),
205  TP_ARGS(thread, result)
206 );
207 
208 DEFINE_EVENT(syscall_entry, cobalt_root_sysentry,
209  TP_PROTO(struct xnthread *thread, unsigned int nr),
210  TP_ARGS(thread, nr)
211 );
212 
213 DEFINE_EVENT(syscall_exit, cobalt_root_sysexit,
214  TP_PROTO(struct xnthread *thread, long result),
215  TP_ARGS(thread, result)
216 );
217 
218 DEFINE_EVENT(cobalt_posix_schedparam, cobalt_pthread_create,
219  TP_PROTO(unsigned long pth, int policy,
220  const struct sched_param_ex *param_ex),
221  TP_ARGS(pth, policy, param_ex)
222 );
223 
224 DEFINE_EVENT(cobalt_posix_schedparam, cobalt_pthread_setschedparam,
225  TP_PROTO(unsigned long pth, int policy,
226  const struct sched_param_ex *param_ex),
227  TP_ARGS(pth, policy, param_ex)
228 );
229 
230 DEFINE_EVENT(cobalt_posix_schedparam, cobalt_pthread_getschedparam,
231  TP_PROTO(unsigned long pth, int policy,
232  const struct sched_param_ex *param_ex),
233  TP_ARGS(pth, policy, param_ex)
234 );
235 
236 #define cobalt_print_thread_mode(__mode) \
237  __print_flags(__mode, "|", \
238  {PTHREAD_WARNSW, "warnsw"}, \
239  {PTHREAD_LOCK_SCHED, "lock"}, \
240  {PTHREAD_DISABLE_LOCKBREAK, "nolockbreak"})
241 
242 TRACE_EVENT(cobalt_pthread_setmode,
243  TP_PROTO(int clrmask, int setmask),
244  TP_ARGS(clrmask, setmask),
245  TP_STRUCT__entry(
246  __field(int, clrmask)
247  __field(int, setmask)
248  ),
249  TP_fast_assign(
250  __entry->clrmask = clrmask;
251  __entry->setmask = setmask;
252  ),
253  TP_printk("clrmask=%#x(%s) setmask=%#x(%s)",
254  __entry->clrmask, cobalt_print_thread_mode(__entry->clrmask),
255  __entry->setmask, cobalt_print_thread_mode(__entry->setmask))
256 );
257 
258 TRACE_EVENT(cobalt_pthread_setname,
259  TP_PROTO(unsigned long pth, const char *name),
260  TP_ARGS(pth, name),
261  TP_STRUCT__entry(
262  __field(unsigned long, pth)
263  __string(name, name)
264  ),
265  TP_fast_assign(
266  __entry->pth = pth;
267  __assign_str(name, name);
268  ),
269  TP_printk("pth=%p name=%s", (void *)__entry->pth, __get_str(name))
270 );
271 
272 DECLARE_EVENT_CLASS(cobalt_posix_pid,
273  TP_PROTO(pid_t pid),
274  TP_ARGS(pid),
275  TP_STRUCT__entry(
276  __field(pid_t, pid)
277  ),
278  TP_fast_assign(
279  __entry->pid = pid;
280  ),
281  TP_printk("pid=%d", __entry->pid)
282 );
283 
284 DEFINE_EVENT(cobalt_posix_pid, cobalt_pthread_stat,
285  TP_PROTO(pid_t pid),
286  TP_ARGS(pid)
287 );
288 
289 TRACE_EVENT(cobalt_pthread_kill,
290  TP_PROTO(unsigned long pth, int sig),
291  TP_ARGS(pth, sig),
292  TP_STRUCT__entry(
293  __field(unsigned long, pth)
294  __field(int, sig)
295  ),
296  TP_fast_assign(
297  __entry->pth = pth;
298  __entry->sig = sig;
299  ),
300  TP_printk("pth=%p sig=%d", (void *)__entry->pth, __entry->sig)
301 );
302 
303 TRACE_EVENT(cobalt_pthread_join,
304  TP_PROTO(unsigned long pth),
305  TP_ARGS(pth),
306  TP_STRUCT__entry(
307  __field(unsigned long, pth)
308  ),
309  TP_fast_assign(
310  __entry->pth = pth;
311  ),
312  TP_printk("pth=%p", (void *)__entry->pth)
313 );
314 
315 TRACE_EVENT(cobalt_pthread_pid,
316  TP_PROTO(unsigned long pth),
317  TP_ARGS(pth),
318  TP_STRUCT__entry(
319  __field(unsigned long, pth)
320  ),
321  TP_fast_assign(
322  __entry->pth = pth;
323  ),
324  TP_printk("pth=%p", (void *)__entry->pth)
325 );
326 
327 TRACE_EVENT(cobalt_pthread_extend,
328  TP_PROTO(unsigned long pth, const char *name),
329  TP_ARGS(pth, name),
330  TP_STRUCT__entry(
331  __field(unsigned long, pth)
332  __string(name, name)
333  ),
334  TP_fast_assign(
335  __entry->pth = pth;
336  __assign_str(name, name);
337  ),
338  TP_printk("pth=%p +personality=%s", (void *)__entry->pth, __get_str(name))
339 );
340 
341 TRACE_EVENT(cobalt_pthread_restrict,
342  TP_PROTO(unsigned long pth, const char *name),
343  TP_ARGS(pth, name),
344  TP_STRUCT__entry(
345  __field(unsigned long, pth)
346  __string(name, name)
347  ),
348  TP_fast_assign(
349  __entry->pth = pth;
350  __assign_str(name, name);
351  ),
352  TP_printk("pth=%p -personality=%s", (void *)__entry->pth, __get_str(name))
353 );
354 
355 DEFINE_EVENT(cobalt_void, cobalt_pthread_yield,
356  TP_PROTO(int dummy),
357  TP_ARGS(dummy)
358 );
359 
360 TRACE_EVENT(cobalt_sched_setconfig,
361  TP_PROTO(int cpu, int policy, size_t len),
362  TP_ARGS(cpu, policy, len),
363  TP_STRUCT__entry(
364  __field(int, cpu)
365  __field(int, policy)
366  __field(size_t, len)
367  ),
368  TP_fast_assign(
369  __entry->cpu = cpu;
370  __entry->policy = policy;
371  __entry->len = len;
372  ),
373  TP_printk("cpu=%d policy=%d(%s) len=%zu",
374  __entry->cpu, __entry->policy,
375  cobalt_print_sched_policy(__entry->policy),
376  __entry->len)
377 );
378 
379 TRACE_EVENT(cobalt_sched_get_config,
380  TP_PROTO(int cpu, int policy, size_t rlen),
381  TP_ARGS(cpu, policy, rlen),
382  TP_STRUCT__entry(
383  __field(int, cpu)
384  __field(int, policy)
385  __field(ssize_t, rlen)
386  ),
387  TP_fast_assign(
388  __entry->cpu = cpu;
389  __entry->policy = policy;
390  __entry->rlen = rlen;
391  ),
392  TP_printk("cpu=%d policy=%d(%s) rlen=%Zd",
393  __entry->cpu, __entry->policy,
394  cobalt_print_sched_policy(__entry->policy),
395  __entry->rlen)
396 );
397 
398 DEFINE_EVENT(cobalt_posix_scheduler, cobalt_sched_setscheduler,
399  TP_PROTO(pid_t pid, int policy,
400  const struct sched_param_ex *param_ex),
401  TP_ARGS(pid, policy, param_ex)
402 );
403 
404 DEFINE_EVENT(cobalt_posix_pid, cobalt_sched_getscheduler,
405  TP_PROTO(pid_t pid),
406  TP_ARGS(pid)
407 );
408 
409 DECLARE_EVENT_CLASS(cobalt_posix_prio_bound,
410  TP_PROTO(int policy, int prio),
411  TP_ARGS(policy, prio),
412  TP_STRUCT__entry(
413  __field(int, policy)
414  __field(int, prio)
415  ),
416  TP_fast_assign(
417  __entry->policy = policy;
418  __entry->prio = prio;
419  ),
420  TP_printk("policy=%d(%s) prio=%d",
421  __entry->policy,
422  cobalt_print_sched_policy(__entry->policy),
423  __entry->prio)
424 );
425 
426 DEFINE_EVENT(cobalt_posix_prio_bound, cobalt_sched_min_prio,
427  TP_PROTO(int policy, int prio),
428  TP_ARGS(policy, prio)
429 );
430 
431 DEFINE_EVENT(cobalt_posix_prio_bound, cobalt_sched_max_prio,
432  TP_PROTO(int policy, int prio),
433  TP_ARGS(policy, prio)
434 );
435 
436 DECLARE_EVENT_CLASS(cobalt_posix_sem,
437  TP_PROTO(xnhandle_t handle),
438  TP_ARGS(handle),
439  TP_STRUCT__entry(
440  __field(xnhandle_t, handle)
441  ),
442  TP_fast_assign(
443  __entry->handle = handle;
444  ),
445  TP_printk("sem=%#x", __entry->handle)
446 );
447 
448 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_wait,
449  TP_PROTO(xnhandle_t handle),
450  TP_ARGS(handle)
451 );
452 
453 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_trywait,
454  TP_PROTO(xnhandle_t handle),
455  TP_ARGS(handle)
456 );
457 
458 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_timedwait,
459  TP_PROTO(xnhandle_t handle),
460  TP_ARGS(handle)
461 );
462 
463 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_post,
464  TP_PROTO(xnhandle_t handle),
465  TP_ARGS(handle)
466 );
467 
468 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_destroy,
469  TP_PROTO(xnhandle_t handle),
470  TP_ARGS(handle)
471 );
472 
473 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_broadcast,
474  TP_PROTO(xnhandle_t handle),
475  TP_ARGS(handle)
476 );
477 
478 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_inquire,
479  TP_PROTO(xnhandle_t handle),
480  TP_ARGS(handle)
481 );
482 
483 TRACE_EVENT(cobalt_psem_getvalue,
484  TP_PROTO(xnhandle_t handle, int value),
485  TP_ARGS(handle, value),
486  TP_STRUCT__entry(
487  __field(xnhandle_t, handle)
488  __field(int, value)
489  ),
490  TP_fast_assign(
491  __entry->handle = handle;
492  __entry->value = value;
493  ),
494  TP_printk("sem=%#x value=%d", __entry->handle, __entry->value)
495 );
496 
497 #define cobalt_print_sem_flags(__flags) \
498  __print_flags(__flags, "|", \
499  {SEM_FIFO, "fifo"}, \
500  {SEM_PULSE, "pulse"}, \
501  {SEM_PSHARED, "pshared"}, \
502  {SEM_REPORT, "report"}, \
503  {SEM_WARNDEL, "warndel"}, \
504  {SEM_RAWCLOCK, "rawclock"}, \
505  {SEM_NOBUSYDEL, "nobusydel"})
506 
507 TRACE_EVENT(cobalt_psem_init,
508  TP_PROTO(const char *name, xnhandle_t handle,
509  int flags, unsigned int value),
510  TP_ARGS(name, handle, flags, value),
511  TP_STRUCT__entry(
512  __string(name, name)
513  __field(xnhandle_t, handle)
514  __field(int, flags)
515  __field(unsigned int, value)
516  ),
517  TP_fast_assign(
518  __assign_str(name, name);
519  __entry->handle = handle;
520  __entry->flags = flags;
521  __entry->value = value;
522  ),
523  TP_printk("sem=%#x(%s) flags=%#x(%s) value=%u",
524  __entry->handle,
525  __get_str(name),
526  __entry->flags,
527  cobalt_print_sem_flags(__entry->flags),
528  __entry->value)
529 );
530 
531 TRACE_EVENT(cobalt_psem_init_failed,
532  TP_PROTO(const char *name, int flags, unsigned int value, int status),
533  TP_ARGS(name, flags, value, status),
534  TP_STRUCT__entry(
535  __string(name, name)
536  __field(int, flags)
537  __field(unsigned int, value)
538  __field(int, status)
539  ),
540  TP_fast_assign(
541  __assign_str(name, name);
542  __entry->flags = flags;
543  __entry->value = value;
544  __entry->status = status;
545  ),
546  TP_printk("name=%s flags=%#x(%s) value=%u error=%d",
547  __get_str(name),
548  __entry->flags,
549  cobalt_print_sem_flags(__entry->flags),
550  __entry->value, __entry->status)
551 );
552 
553 #define cobalt_print_oflags(__flags) \
554  __print_flags(__flags, "|", \
555  {O_RDONLY, "rdonly"}, \
556  {O_WRONLY, "wronly"}, \
557  {O_RDWR, "rdwr"}, \
558  {O_CREAT, "creat"}, \
559  {O_EXCL, "excl"}, \
560  {O_DIRECT, "direct"}, \
561  {O_NONBLOCK, "nonblock"}, \
562  {O_TRUNC, "trunc"})
563 
564 TRACE_EVENT(cobalt_psem_open,
565  TP_PROTO(const char *name, xnhandle_t handle,
566  int oflags, mode_t mode, unsigned int value),
567  TP_ARGS(name, handle, oflags, mode, value),
568  TP_STRUCT__entry(
569  __string(name, name)
570  __field(xnhandle_t, handle)
571  __field(int, oflags)
572  __field(mode_t, mode)
573  __field(unsigned int, value)
574  ),
575  TP_fast_assign(
576  __assign_str(name, name);
577  __entry->handle = handle;
578  __entry->oflags = oflags;
579  if (oflags & O_CREAT) {
580  __entry->mode = mode;
581  __entry->value = value;
582  } else {
583  __entry->mode = 0;
584  __entry->value = 0;
585  }
586  ),
587  TP_printk("named_sem=%#x=(%s) oflags=%#x(%s) mode=%o value=%u",
588  __entry->handle, __get_str(name),
589  __entry->oflags, cobalt_print_oflags(__entry->oflags),
590  __entry->mode, __entry->value)
591 );
592 
593 TRACE_EVENT(cobalt_psem_open_failed,
594  TP_PROTO(const char *name, int oflags, mode_t mode,
595  unsigned int value, int status),
596  TP_ARGS(name, oflags, mode, value, status),
597  TP_STRUCT__entry(
598  __string(name, name)
599  __field(int, oflags)
600  __field(mode_t, mode)
601  __field(unsigned int, value)
602  __field(int, status)
603  ),
604  TP_fast_assign(
605  __assign_str(name, name);
606  __entry->oflags = oflags;
607  __entry->status = status;
608  if (oflags & O_CREAT) {
609  __entry->mode = mode;
610  __entry->value = value;
611  } else {
612  __entry->mode = 0;
613  __entry->value = 0;
614  }
615  ),
616  TP_printk("named_sem=%s oflags=%#x(%s) mode=%o value=%u error=%d",
617  __get_str(name),
618  __entry->oflags, cobalt_print_oflags(__entry->oflags),
619  __entry->mode, __entry->value, __entry->status)
620 );
621 
622 DEFINE_EVENT(cobalt_posix_sem, cobalt_psem_close,
623  TP_PROTO(xnhandle_t handle),
624  TP_ARGS(handle)
625 );
626 
627 TRACE_EVENT(cobalt_psem_unlink,
628  TP_PROTO(const char *name),
629  TP_ARGS(name),
630  TP_STRUCT__entry(
631  __string(name, name)
632  ),
633  TP_fast_assign(
634  __assign_str(name, name);
635  ),
636  TP_printk("name=%s", __get_str(name))
637 );
638 
639 DECLARE_EVENT_CLASS(cobalt_clock_timespec,
640  TP_PROTO(clockid_t clk_id, const struct timespec *val),
641  TP_ARGS(clk_id, val),
642 
643  TP_STRUCT__entry(
644  __field(clockid_t, clk_id)
645  __timespec_fields(val)
646  ),
647 
648  TP_fast_assign(
649  __entry->clk_id = clk_id;
650  __assign_timespec(val, val);
651  ),
652 
653  TP_printk("clock_id=%d timeval=(%ld.%09ld)",
654  __entry->clk_id,
655  __timespec_args(val)
656  )
657 );
658 
659 DEFINE_EVENT(cobalt_clock_timespec, cobalt_clock_getres,
660  TP_PROTO(clockid_t clk_id, const struct timespec *res),
661  TP_ARGS(clk_id, res)
662 );
663 
664 DEFINE_EVENT(cobalt_clock_timespec, cobalt_clock_gettime,
665  TP_PROTO(clockid_t clk_id, const struct timespec *time),
666  TP_ARGS(clk_id, time)
667 );
668 
669 DEFINE_EVENT(cobalt_clock_timespec, cobalt_clock_settime,
670  TP_PROTO(clockid_t clk_id, const struct timespec *time),
671  TP_ARGS(clk_id, time)
672 );
673 
674 #define cobalt_print_timer_flags(__flags) \
675  __print_flags(__flags, "|", \
676  {TIMER_ABSTIME, "TIMER_ABSTIME"})
677 
678 TRACE_EVENT(cobalt_clock_nanosleep,
679  TP_PROTO(clockid_t clk_id, int flags, const struct timespec *time),
680  TP_ARGS(clk_id, flags, time),
681 
682  TP_STRUCT__entry(
683  __field(clockid_t, clk_id)
684  __field(int, flags)
685  __timespec_fields(time)
686  ),
687 
688  TP_fast_assign(
689  __entry->clk_id = clk_id;
690  __entry->flags = flags;
691  __assign_timespec(time, time);
692  ),
693 
694  TP_printk("clock_id=%d flags=%#x(%s) rqt=(%ld.%09ld)",
695  __entry->clk_id,
696  __entry->flags, cobalt_print_timer_flags(__entry->flags),
697  __timespec_args(time)
698  )
699 );
700 
701 DECLARE_EVENT_CLASS(cobalt_clock_ident,
702  TP_PROTO(const char *name, clockid_t clk_id),
703  TP_ARGS(name, clk_id),
704  TP_STRUCT__entry(
705  __string(name, name)
706  __field(clockid_t, clk_id)
707  ),
708  TP_fast_assign(
709  __assign_str(name, name);
710  __entry->clk_id = clk_id;
711  ),
712  TP_printk("name=%s, id=%#x", __get_str(name), __entry->clk_id)
713 );
714 
715 DEFINE_EVENT(cobalt_clock_ident, cobalt_clock_register,
716  TP_PROTO(const char *name, clockid_t clk_id),
717  TP_ARGS(name, clk_id)
718 );
719 
720 DEFINE_EVENT(cobalt_clock_ident, cobalt_clock_deregister,
721  TP_PROTO(const char *name, clockid_t clk_id),
722  TP_ARGS(name, clk_id)
723 );
724 
725 #define cobalt_print_clock(__clk_id) \
726  __print_symbolic(__clk_id, \
727  {CLOCK_MONOTONIC, "CLOCK_MONOTONIC"}, \
728  {CLOCK_MONOTONIC_RAW, "CLOCK_MONOTONIC_RAW"}, \
729  {CLOCK_REALTIME, "CLOCK_REALTIME"})
730 
731 TRACE_EVENT(cobalt_cond_init,
732  TP_PROTO(const struct cobalt_cond_shadow __user *u_cnd,
733  const struct cobalt_condattr *attr),
734  TP_ARGS(u_cnd, attr),
735  TP_STRUCT__entry(
736  __field(const struct cobalt_cond_shadow __user *, u_cnd)
737  __field(clockid_t, clk_id)
738  __field(int, pshared)
739  ),
740  TP_fast_assign(
741  __entry->u_cnd = u_cnd;
742  __entry->clk_id = attr->clock;
743  __entry->pshared = attr->pshared;
744  ),
745  TP_printk("cond=%p attr={ .clock=%s, .pshared=%d }",
746  __entry->u_cnd,
747  cobalt_print_clock(__entry->clk_id),
748  __entry->pshared)
749 );
750 
751 TRACE_EVENT(cobalt_cond_destroy,
752  TP_PROTO(const struct cobalt_cond_shadow __user *u_cnd),
753  TP_ARGS(u_cnd),
754  TP_STRUCT__entry(
755  __field(const struct cobalt_cond_shadow __user *, u_cnd)
756  ),
757  TP_fast_assign(
758  __entry->u_cnd = u_cnd;
759  ),
760  TP_printk("cond=%p", __entry->u_cnd)
761 );
762 
763 TRACE_EVENT(cobalt_cond_timedwait,
764  TP_PROTO(const struct cobalt_cond_shadow __user *u_cnd,
765  const struct cobalt_mutex_shadow __user *u_mx,
766  const struct timespec *timeout),
767  TP_ARGS(u_cnd, u_mx, timeout),
768  TP_STRUCT__entry(
769  __field(const struct cobalt_cond_shadow __user *, u_cnd)
770  __field(const struct cobalt_mutex_shadow __user *, u_mx)
771  __timespec_fields(timeout)
772  ),
773  TP_fast_assign(
774  __entry->u_cnd = u_cnd;
775  __entry->u_mx = u_mx;
776  __assign_timespec(timeout, timeout);
777  ),
778  TP_printk("cond=%p, mutex=%p, timeout=(%ld.%09ld)",
779  __entry->u_cnd, __entry->u_mx, __timespec_args(timeout))
780 );
781 
782 TRACE_EVENT(cobalt_cond_wait,
783  TP_PROTO(const struct cobalt_cond_shadow __user *u_cnd,
784  const struct cobalt_mutex_shadow __user *u_mx),
785  TP_ARGS(u_cnd, u_mx),
786  TP_STRUCT__entry(
787  __field(const struct cobalt_cond_shadow __user *, u_cnd)
788  __field(const struct cobalt_mutex_shadow __user *, u_mx)
789  ),
790  TP_fast_assign(
791  __entry->u_cnd = u_cnd;
792  __entry->u_mx = u_mx;
793  ),
794  TP_printk("cond=%p, mutex=%p",
795  __entry->u_cnd, __entry->u_mx)
796 );
797 
798 TRACE_EVENT(cobalt_mq_open,
799  TP_PROTO(const char *name, int oflags, mode_t mode),
800  TP_ARGS(name, oflags, mode),
801 
802  TP_STRUCT__entry(
803  __string(name, name)
804  __field(int, oflags)
805  __field(mode_t, mode)
806  ),
807 
808  TP_fast_assign(
809  __assign_str(name, name);
810  __entry->oflags = oflags;
811  __entry->mode = (oflags & O_CREAT) ? mode : 0;
812  ),
813 
814  TP_printk("name=%s oflags=%#x(%s) mode=%o",
815  __get_str(name),
816  __entry->oflags, cobalt_print_oflags(__entry->oflags),
817  __entry->mode)
818 );
819 
820 TRACE_EVENT(cobalt_mq_notify,
821  TP_PROTO(mqd_t mqd, const struct sigevent *sev),
822  TP_ARGS(mqd, sev),
823 
824  TP_STRUCT__entry(
825  __field(mqd_t, mqd)
826  __field(int, signo)
827  ),
828 
829  TP_fast_assign(
830  __entry->mqd = mqd;
831  __entry->signo = sev && sev->sigev_notify != SIGEV_NONE ?
832  sev->sigev_signo : 0;
833  ),
834 
835  TP_printk("mqd=%d signo=%d",
836  __entry->mqd, __entry->signo)
837 );
838 
839 TRACE_EVENT(cobalt_mq_close,
840  TP_PROTO(mqd_t mqd),
841  TP_ARGS(mqd),
842 
843  TP_STRUCT__entry(
844  __field(mqd_t, mqd)
845  ),
846 
847  TP_fast_assign(
848  __entry->mqd = mqd;
849  ),
850 
851  TP_printk("mqd=%d", __entry->mqd)
852 );
853 
854 TRACE_EVENT(cobalt_mq_unlink,
855  TP_PROTO(const char *name),
856  TP_ARGS(name),
857 
858  TP_STRUCT__entry(
859  __string(name, name)
860  ),
861 
862  TP_fast_assign(
863  __assign_str(name, name);
864  ),
865 
866  TP_printk("name=%s", __get_str(name))
867 );
868 
869 TRACE_EVENT(cobalt_mq_send,
870  TP_PROTO(mqd_t mqd, const void __user *u_buf, size_t len,
871  unsigned int prio),
872  TP_ARGS(mqd, u_buf, len, prio),
873  TP_STRUCT__entry(
874  __field(mqd_t, mqd)
875  __field(const void __user *, u_buf)
876  __field(size_t, len)
877  __field(unsigned int, prio)
878  ),
879  TP_fast_assign(
880  __entry->mqd = mqd;
881  __entry->u_buf = u_buf;
882  __entry->len = len;
883  __entry->prio = prio;
884  ),
885  TP_printk("mqd=%d buf=%p len=%zu prio=%u",
886  __entry->mqd, __entry->u_buf, __entry->len,
887  __entry->prio)
888 );
889 
890 TRACE_EVENT(cobalt_mq_timedreceive,
891  TP_PROTO(mqd_t mqd, const void __user *u_buf, size_t len,
892  const struct timespec *timeout),
893  TP_ARGS(mqd, u_buf, len, timeout),
894  TP_STRUCT__entry(
895  __field(mqd_t, mqd)
896  __field(const void __user *, u_buf)
897  __field(size_t, len)
898  __timespec_fields(timeout)
899  ),
900  TP_fast_assign(
901  __entry->mqd = mqd;
902  __entry->u_buf = u_buf;
903  __entry->len = len;
904  __assign_timespec(timeout, timeout);
905  ),
906  TP_printk("mqd=%d buf=%p len=%zu timeout=(%ld.%09ld)",
907  __entry->mqd, __entry->u_buf, __entry->len,
908  __timespec_args(timeout))
909 );
910 
911 TRACE_EVENT(cobalt_mq_receive,
912  TP_PROTO(mqd_t mqd, const void __user *u_buf, size_t len),
913  TP_ARGS(mqd, u_buf, len),
914  TP_STRUCT__entry(
915  __field(mqd_t, mqd)
916  __field(const void __user *, u_buf)
917  __field(size_t, len)
918  ),
919  TP_fast_assign(
920  __entry->mqd = mqd;
921  __entry->u_buf = u_buf;
922  __entry->len = len;
923  ),
924  TP_printk("mqd=%d buf=%p len=%zu",
925  __entry->mqd, __entry->u_buf, __entry->len)
926 );
927 
928 DECLARE_EVENT_CLASS(cobalt_posix_mqattr,
929  TP_PROTO(mqd_t mqd, const struct mq_attr *attr),
930  TP_ARGS(mqd, attr),
931  TP_STRUCT__entry(
932  __field(mqd_t, mqd)
933  __field(long, flags)
934  __field(long, curmsgs)
935  __field(long, msgsize)
936  __field(long, maxmsg)
937  ),
938  TP_fast_assign(
939  __entry->mqd = mqd;
940  __entry->flags = attr->mq_flags;
941  __entry->curmsgs = attr->mq_curmsgs;
942  __entry->msgsize = attr->mq_msgsize;
943  __entry->maxmsg = attr->mq_maxmsg;
944  ),
945  TP_printk("mqd=%d flags=%#lx(%s) curmsgs=%ld msgsize=%ld maxmsg=%ld",
946  __entry->mqd,
947  __entry->flags, cobalt_print_oflags(__entry->flags),
948  __entry->curmsgs,
949  __entry->msgsize,
950  __entry->maxmsg
951  )
952 );
953 
954 DEFINE_EVENT(cobalt_posix_mqattr, cobalt_mq_getattr,
955  TP_PROTO(mqd_t mqd, const struct mq_attr *attr),
956  TP_ARGS(mqd, attr)
957 );
958 
959 DEFINE_EVENT(cobalt_posix_mqattr, cobalt_mq_setattr,
960  TP_PROTO(mqd_t mqd, const struct mq_attr *attr),
961  TP_ARGS(mqd, attr)
962 );
963 
964 #define cobalt_print_evflags(__flags) \
965  __print_flags(__flags, "|", \
966  {COBALT_EVENT_SHARED, "shared"}, \
967  {COBALT_EVENT_PRIO, "prio"})
968 
969 TRACE_EVENT(cobalt_event_init,
970  TP_PROTO(const struct cobalt_event_shadow __user *u_event,
971  unsigned long value, int flags),
972  TP_ARGS(u_event, value, flags),
973  TP_STRUCT__entry(
974  __field(const struct cobalt_event_shadow __user *, u_event)
975  __field(unsigned long, value)
976  __field(int, flags)
977  ),
978  TP_fast_assign(
979  __entry->u_event = u_event;
980  __entry->value = value;
981  __entry->flags = flags;
982  ),
983  TP_printk("event=%p value=%lu flags=%#x(%s)",
984  __entry->u_event, __entry->value,
985  __entry->flags, cobalt_print_evflags(__entry->flags))
986 );
987 
988 #define cobalt_print_evmode(__mode) \
989  __print_symbolic(__mode, \
990  {COBALT_EVENT_ANY, "any"}, \
991  {COBALT_EVENT_ALL, "all"})
992 
993 TRACE_EVENT(cobalt_event_timedwait,
994  TP_PROTO(const struct cobalt_event_shadow __user *u_event,
995  unsigned long bits, int mode,
996  const struct timespec *timeout),
997  TP_ARGS(u_event, bits, mode, timeout),
998  TP_STRUCT__entry(
999  __field(const struct cobalt_event_shadow __user *, u_event)
1000  __field(unsigned long, bits)
1001  __field(int, mode)
1002  __timespec_fields(timeout)
1003  ),
1004  TP_fast_assign(
1005  __entry->u_event = u_event;
1006  __entry->bits = bits;
1007  __entry->mode = mode;
1008  __assign_timespec(timeout, timeout);
1009  ),
1010  TP_printk("event=%p bits=%#lx mode=%#x(%s) timeout=(%ld.%09ld)",
1011  __entry->u_event, __entry->bits, __entry->mode,
1012  cobalt_print_evmode(__entry->mode),
1013  __timespec_args(timeout))
1014 );
1015 
1016 TRACE_EVENT(cobalt_event_wait,
1017  TP_PROTO(const struct cobalt_event_shadow __user *u_event,
1018  unsigned long bits, int mode),
1019  TP_ARGS(u_event, bits, mode),
1020  TP_STRUCT__entry(
1021  __field(const struct cobalt_event_shadow __user *, u_event)
1022  __field(unsigned long, bits)
1023  __field(int, mode)
1024  ),
1025  TP_fast_assign(
1026  __entry->u_event = u_event;
1027  __entry->bits = bits;
1028  __entry->mode = mode;
1029  ),
1030  TP_printk("event=%p bits=%#lx mode=%#x(%s)",
1031  __entry->u_event, __entry->bits, __entry->mode,
1032  cobalt_print_evmode(__entry->mode))
1033 );
1034 
1035 DECLARE_EVENT_CLASS(cobalt_event_ident,
1036  TP_PROTO(const struct cobalt_event_shadow __user *u_event),
1037  TP_ARGS(u_event),
1038  TP_STRUCT__entry(
1039  __field(const struct cobalt_event_shadow __user *, u_event)
1040  ),
1041  TP_fast_assign(
1042  __entry->u_event = u_event;
1043  ),
1044  TP_printk("event=%p", __entry->u_event)
1045 );
1046 
1047 DEFINE_EVENT(cobalt_event_ident, cobalt_event_destroy,
1048  TP_PROTO(const struct cobalt_event_shadow __user *u_event),
1049  TP_ARGS(u_event)
1050 );
1051 
1052 DEFINE_EVENT(cobalt_event_ident, cobalt_event_sync,
1053  TP_PROTO(const struct cobalt_event_shadow __user *u_event),
1054  TP_ARGS(u_event)
1055 );
1056 
1057 DEFINE_EVENT(cobalt_event_ident, cobalt_event_inquire,
1058  TP_PROTO(const struct cobalt_event_shadow __user *u_event),
1059  TP_ARGS(u_event)
1060 );
1061 
1062 #endif /* _TRACE_COBALT_POSIX_H */
1063 
1064 /* This part must be outside protection */
1065 #undef TRACE_INCLUDE_PATH
1066 #undef TRACE_INCLUDE_FILE
1067 #define TRACE_INCLUDE_FILE cobalt-posix
1068 #include <trace/define_trace.h>