Re: I'm sorry. I know I'm boring.

From: Chris Wright (chrisat_private)
Date: Mon Jan 20 2003 - 14:27:08 PST

  • Next message: Chris Wright: "Re: (no subject)"

    *   (phanixat_private) wrote:
    > 
    >  Me again. Sorry for so many questions.
    >  Here's another one.
    > 
    >  In the kernel module, how do I get the filename infomation of a process
    >  according to its pid?
    >  for example, a running bash's pid is 652, then in /proc/652, the "exe" 
    > points
    >  to "/bin/bash". How do I get this infomation?
    
    Read the source in fs/proc/base.c:proc_exe_link() to see how that is
    done.  However, consider that you may not want to lock the tasklist and
    search it based on pid, as you typically have the 'current' pointer to
    the currently scheduled task.  Typically, this is all the context you
    will need.  Also, you can find out the name of the executable binary
    through LSM during execve(2).  See the binprm hooks in the LSM framework.
    
    thanks,
    -chris
    -- 
    Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net
    _______________________________________________
    linux-security-module mailing list
    linux-security-moduleat_private
    http://mail.wirex.com/mailman/listinfo/linux-security-module
    



    This archive was generated by hypermail 2b30 : Mon Jan 20 2003 - 14:33:24 PST