simplify
authorBrendan Gregg <brendan.d.gregg@gmail.com>
Sun, 7 Feb 2016 01:19:59 +0000 (17:19 -0800)
committerBrendan Gregg <brendan.d.gregg@gmail.com>
Sun, 7 Feb 2016 01:19:59 +0000 (17:19 -0800)
tools/biosnoop.py

index 51a8f6a..37ee3f9 100755 (executable)
@@ -31,12 +31,10 @@ BPF_HASH(infobyreq, struct request *, struct val_t);
 // cache PID and comm by-req
 int trace_pid_start(struct pt_regs *ctx, struct request *req)
 {
-    u32 pid;
     struct val_t val = {};
 
-    pid = bpf_get_current_pid_tgid();
     if (bpf_get_current_comm(&val.name, sizeof(val.name)) == 0) {
-        val.pid = pid;
+        val.pid = bpf_get_current_pid_tgid();
         infobyreq.update(&req, &val);
     }