Hi,<div><br></div><div>I try to modified the lttng2.0 source code for my research. For example, I try to log the "comm" for the write system call, I add the following filed in the file x86-64-syscalls-3.0.4_pointers.h located at the path lttng-modules-2.0.3/instrumentation/syscalls/headers. I modify the TRACE_EVENTS() macro from the original one:</div>
<div><br></div><div><div><div>#ifndef OVERRIDE_64_sys_write</div><div>SC_TRACE_EVENT(sys_write,</div><div><span class="Apple-tab-span" style="white-space:pre">   </span>TP_PROTO(unsigned int fd, const char * buf, size_t count),</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>TP_ARGS(fd, buf, count),</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>TP_STRUCT__entry(__field(unsigned int, fd) __field_hex(const char *, buf) __field(size_t, count)),</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>TP_fast_assign(tp_assign(fd, fd) tp_assign(buf, buf) tp_assign(count, count)),</div><div><span class="Apple-tab-span" style="white-space:pre">       </span>TP_printk()</div>
<div>)</div><div>#endif</div></div><div><br></div><div>to the following one:</div><div><br></div><div>#ifndef OVERRIDE_64_sys_write</div><div>SC_TRACE_EVENT(sys_write,</div><div><span class="Apple-tab-span" style="white-space:pre">   </span>TP_PROTO(unsigned int fd, const char * buf, size_t count, struct task_struct *p),</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>TP_ARGS(fd, buf, count, p),</div><div><span class="Apple-tab-span" style="white-space:pre">  </span>TP_STRUCT__entry(<span class="Apple-tab-span" style="white-space:pre">   </span>__field(unsigned int, fd)<span class="Apple-tab-span" style="white-space:pre">   </span>__field_hex(const char *, buf)<span class="Apple-tab-span" style="white-space:pre">      </span>__field(size_t, count)<span class="Apple-tab-span" style="white-space:pre">      </span>__array_text(char, comm, TASK_COMM_LEN)),</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>TP_fast_assign(<span class="Apple-tab-span" style="white-space:pre">             </span>tp_assign(fd, fd)<span class="Apple-tab-span" style="white-space:pre">                   </span>tp_assign(buf, buf)<span class="Apple-tab-span" style="white-space:pre">                         </span>tp_assign(count, 2064)<span class="Apple-tab-span" style="white-space:pre">      </span>tp_memcpy(comm, p->comm, TASK_COMM_LEN)),</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>TP_printk()</div><div>)</div><div>#endif</div></div><div><br></div><div>I add one argument *p and one filed "comm"  for the macro. It was able to be compiled, however, after reload the lttng modules, It will show the following error messages when I start lttng. </div>
<div><br></div><div><div>PERROR: ioctl start session: No buffer space available [in kernel_start_session() at kernel.c:397]</div><div>Error: Starting kernel trace failed</div></div><div><br></div><div>It won't work. Please help me out with this. My next step is try to add extra fields in the sys_connect macros to enable the logging of the connected IP/port from the socket. Is this method right? what are other possible solutions in order to logging the details of the socket information? </div>
<div><br></div><div>Thank you very much.</div><div><br></div><div>Regards,</div><div>Rui</div><div><br></div>