title: Retrieving session Id in linux kernel (Kernel Space)
body: <p>I want to retrieve the sessionid of the current process in linux kernel (Kernel Space). I saw <code>task_struct</code> has a field <code>sessionid</code> but it is defined only when the macro <code>CONFIG_AUDITSYSCALL</code> is ON. So i tried to build the kernel with this macro ON but still i was not getting the result. Also I tried getting its value from function with <code>CONFIG_AUDITSYSCALL</code> on <code>audit_get_sessionid(current)</code> but was getting either -1 or junk value ( different from  <code>getsid(0)</code> method in user space).</p>
  
  <p>I am struck at this point. Any suggestion would be of great help.</p>