KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/doc/systemtap-client-1.8/examples/network/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/systemtap-client-1.8/examples/network/autofs4.stp
#!/usr/bin/stap

// Copyright (c) 2009 Red Hat Inc.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.


probe module("autofs4").function("autofs4_lookup")
{
        /*
         * Don't log automounts travels in its own directory hierarchy, as
         * they are treated differently, and certainly not something that is
         * useful for admins to see.
         */
        if (!isinstr(execname(), "automount")) {
                printf("%s process %s[%d] looking up %s%s\n",
                       ctime(gettimeofday_s()), execname(), pid(),
                       d_path($nd), d_name($dentry));
        }
}


probe module("autofs4").function("autofs4_follow_link")
{
        if (!isinstr(execname(), "automount")) {
                /*
                 * dentry->d_name will be '/' for the mount trigger.  Thus,
                 * the path that the trigger lives on is one level up the
                 * directory stack, and the root of that is yet another level
                 * up.
                 */
                printf("%s process %s[%d] following mount trigger %s\n",
                       ctime(gettimeofday_s()), execname(), pid(),
                       d_path($nd));
        }
}


/*
probe module("autofs4").function("autofs4_expire_direct").return
{
        if ($return != 0) {
                relative_path = reverse_path_walk($mnt->mnt_mountpoint)
                root_path = reverse_path_walk($mnt->mnt_parent->mnt_mountpoint)
                printf("%s process %s[%d] expiring direct mount /%s/%s\n",
                       ctime(gettimeofday_s()), execname(), pid(),
                       root_path, relative_path)
        }
}

probe
module("autofs4").statement("autofs4_expire_direct@fs/autofs4/expire.c+17") ?
{
        relative_path = reverse_path_walk($mnt->mnt_mountpoint)
        root_path = reverse_path_walk($mnt->mnt_parent->mnt_mountpoint)
        printf("%s process %s[%d] expiring direct mount /%s/%s\n",
               ctime(gettimeofday_s()), execname(), pid(),
               root_path, relative_path)
}
*/

probe module("autofs4").function("autofs4_expire_indirect").return
{
        if ($return != 0) {
                relative_path = reverse_path_walk($return)
                root_path = reverse_path_walk($mnt->mnt_mountpoint)
                printf("%s process %s[%d] expiring indirect mount /%s%s\n",
                       ctime(gettimeofday_s()), execname(), pid(),
                       root_path, relative_path)
        }
}


/*
 * The struct dentry's name may be '/' if this is a mount trigger, which
 * is not really something that is useful to print out.  Instead, we just
 * indicate whether a mount or umount succeeded or failed.  Coupled with the
 * messages printed out when looking up a directory and traversing a symlink,
 * this should be relatively easy to correlate to the appropriate directory.
 */
probe module("autofs4").function("autofs4_wait").return
{
        if ($notify > 0) {
                dname = d_name($dentry)
                printf("%s %s of %s %s\n",
                       ctime(gettimeofday_s()),
                       ($notify==1?"mount":"unmount"),
                       dname,
                       $return == 0?"succeeded":"failed")
        }
}

Anon7 - 2021