]>
Commit | Line | Data |
---|---|---|
be019f66 MY |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) 2022 Masatake YAMATO <yamato@redhat.com> | |
4 | # | |
5 | # This file is part of util-linux. | |
6 | # | |
7 | # This file is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 2 of the License, or | |
10 | # (at your option) any later version. | |
11 | # | |
12 | # This file is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | TS_TOPDIR="${0%/*}/../.." | |
18 | TS_DESC="TYPE and STTYPE column" | |
19 | ||
7e51ea86 | 20 | . "$TS_TOPDIR"/functions.sh |
be019f66 MY |
21 | ts_init "$*" |
22 | ||
3de730ad | 23 | . "$TS_SELF/lsfd-functions.bash" |
be019f66 MY |
24 | ts_check_test_command "$TS_CMD_LSFD" |
25 | ts_check_test_command "$TS_HELPER_MKFDS" | |
26 | ||
27 | ts_cd "$TS_OUTDIR" | |
28 | ||
29 | PID= | |
30 | FD=3 | |
31 | EXPR="(FD == 3)" | |
32 | ||
3de730ad MY |
33 | for C in ro-regular-file pidfd inotify socketpair; do |
34 | ts_init_subtest $C | |
35 | { | |
be019f66 | 36 | coproc MKFDS { |
9d0d3205 | 37 | argv=() |
be019f66 MY |
38 | case $C in |
39 | socketpair) | |
9d0d3205 MY |
40 | argv[0]="$((FD + 1))" |
41 | argv[1]="socktype=DGRAM" | |
be019f66 | 42 | esac |
9d0d3205 | 43 | "$TS_HELPER_MKFDS" $C $FD "${argv[@]}" |
be019f66 | 44 | } |
7e51ea86 | 45 | if read -r -u "${MKFDS[0]}" PID; then |
be019f66 MY |
46 | ${TS_CMD_LSFD} -n -o ASSOC,STTYPE,TYPE -p "${PID}" -Q "${EXPR}" |
47 | echo "$C"':ASSOC,STTYPE,TYPE': $? | |
48 | ||
0fec4965 | 49 | echo DONE >&"${MKFDS[1]}" |
be019f66 | 50 | fi |
ffc7662e | 51 | wait "${MKFDS_PID}" |
3de730ad | 52 | } > "$TS_OUTPUT" 2>&1 |
73a0eecf | 53 | if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then |
3de730ad MY |
54 | ts_skip_subtest "pidfd_open(2) is not available" |
55 | continue | |
56 | fi | |
57 | ts_finalize_subtest | |
58 | done | |
be019f66 MY |
59 | |
60 | ts_finalize |