• Andi Kleen's avatar
    [PATCH] Add prctl to modify current->comm · 90d4cd4f
    Andi Kleen authored
    This patch adds a prctl to modify current->comm as shown in /proc.  This
    feature was requested by KDE developers.  In KDE most programs are started by
    forking from a kdeinit program that already has the libraries loaded and some
    other state.
    
    Problem is to give these forked programs the proper name.  It already writes
    the command line in the environment (as seen in ps), but top uses a different
    field in /proc/pid/status that reports current->comm.  And that was always
    "kdeinit" instead of the real command name.  So you ended up with lots of
    kdeinits in your top listing, which was not very useful.
    
    This patch adds a new prctl PR_SET_NAME to allow a program to change its comm
    field.
    
    I considered the potential security issues of a program obscuring itself with
    this interface, but I don't think it matters much because a program can
    already obscure itself when the admin uses ps instead of top.  In case of a
    KDE desktop calling everything kdeinit is much more obfuscation than the
    alternative.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    90d4cd4f
prctl.h 2.24 KB