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.
    Linux Security Modules
    linux-security-module mailing list

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