Forum Topic - TraceEvent got permission denied during trace buffer allocation (QNX 8.0): (3 Items)
   
TraceEvent got permission denied during trace buffer allocation (QNX 8.0)  
About the system call I use here: TraceEvent(_NTO_TRACE_ALLOCBUFFER, bufnum, paddr);

The issue is that it always return error `errno==EPERM`. I have check my TraceEvent call is working find int QNX 7.0 and
 7.1 version, but it fails on QNX 8.0.

Before the TraceEvent call, I have make sure the following are all satisfied:

- run as root
- disable secpol with --secpol=no
- (tested w/ and w/o) still give it `PROCMGR_AID_TRACE` by `procmgr_ability(0, PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | 
PROCMGR_AID_TRACE, PROCMGR_AID_EOL)`
- (tested w/ and w/o) set IO priv with `ThreadCtl(_NTO_TCTL_IO, 0)`  and `ThreadCtl(_NTO_TCTL_IO_LEVEL, reinterpret_cast
<void *>(_NTO_IO_LEVEL_2 | _NTO_TCTL_IO_LEVEL_INHERIT))`
- make sure there are no existing running instance of TraceEvent.. called `TraceEvent(_NTO_TRACE_STOP);`

My traceevent code is basically reference the document here: https://www.qnx.com/developers/docs/8.0/com.qnx.doc.sat/
topic/datacapture_Buffer_management_TraceEvent.html
But always failed at `TraceEvent(_NTO_TRACE_ALLOCBUFFER, bufnum, paddr);` with EPERM error.

Does anyone have experience about TraceEvent usage in QNX8.0 can help?
Thanks in advanced. :)
Re: TraceEvent got permission denied during trace buffer allocation (QNX 8.0)  
You'll need to call:

    TraceEvent(_NTO_TRACE_LOGGER_ATTACH, NULL, NULL);

(though the last two parameters can be sigevents if you require the events).

You no longer need IO privilege.

 There are also other changes. You need to have a thread bound to each core that calls TraceEvent(_NTO_TRACE_WAITBUFFER,
 &index) (where index will contain the next buffer index with events).
Re: TraceEvent got permission denied during trace buffer allocation (QNX 8.0)  
Thank you for your reply!!

I have finally integrate the TraceEvent() on QNX 8.0 successfully!

For more people can reference, here is the summary of the total change from 7.0 to 8.0:
- **Proactive Tracing**: Registration of the trace event process with the kernel is required using `
_NTO_TRACE_LOGGER_ATTACH`.
  - IO and interrupt privileges are no longer necessary for trace event operations.
- **Buffer Management**: Use `_NTO_TRACE_WAITBUFFER` to check for buffer availability. Each CPU now has its own 
dedicated buffer set.
  - `InterruptHookTrace` is deprecated for trace event interrupts.
  - The second parameter of `_NTO_TRACE_ALLOCBUFFER` now specifies per-CPU buffer count instead of total buffer count.
- **Filtering Capabilities**: Dynamic rule filtering is no longer supported.
  - Only static rule filters and post-processing filters are available.
- **Simplified Buffer Allocation**:
  - `_NTO_TRACE_ALLOCBUFFER` now returns a direct pointer to user space memory.
  - Manual memory mapping of the returned address is no longer required.