File: case-20-pidfd-pid.bash

package info (click to toggle)
lsof 4.99.4%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,924 kB
  • sloc: ansic: 50,680; sh: 8,351; makefile: 1,194; perl: 940; awk: 214
file content (24 lines) | stat: -rwxr-xr-x 457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
source tests/common.bash

TARGET=$tcasedir/pidfd

{
$TARGET | (
    read pid fd
    if [[ $pid = -1 && $fd = -1 ]]; then
        echo "pidfd is not available on this platform, skipping"
        exit 77
    fi
    line=$($lsof -p $pid -a -d $fd -F pfn| tr '\n' ' ')
    if ! grep -Fq "p${pid} f${fd} n[pidfd:$pid]" <<<"$line"; then
	$lsof -p $pid -a -d $fd -F pfn
	echo
	echo $line
	echo
	r=1
    fi
    kill $pid
    exit $r
)
} >> $report 2>&1