szaydel
4/25/2017 - 9:24 PM

Observe renameat behavior

Observe renameat behavior

#!/bin/sh
for pid in `pgrep -u jbal,jcor,amar,nort,lbir,anie,sben,tracfone afpd`; do
    dtrace -qn '
    pid$target::renameat:entry {
        this->old = arg1 ; this->new = arg3 ;
    }
    pid$target::renameat:return {
        this->res = arg1 == 0 ? "OK" : "!OK" ;
        printf("%Y %d %d %s %s => %s\n", walltimestamp, pid, errno, this->res,
                copyinstr(this->old), copyinstr(this->new));
    }' -p ${pid} > /bp/logs/renameat-${pid}.log 2>&1 &
done