]>
Commit | Line | Data |
---|---|---|
d827da23 MY |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) 2021 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="AF_UNIX socket pair created with socketpair(2)" | |
19 | ||
7155e836 | 20 | . "$TS_TOPDIR"/functions.sh |
d827da23 MY |
21 | ts_init "$*" |
22 | ||
23 | ts_check_test_command "$TS_CMD_LSFD" | |
24 | ||
25 | ts_check_test_command "$TS_HELPER_MKFDS" | |
26 | ||
225154fe MY |
27 | ts_check_prog "sed" |
28 | ||
d827da23 MY |
29 | ts_cd "$TS_OUTDIR" |
30 | ||
31 | PID= | |
32 | FD0=3 | |
33 | FD1=4 | |
34 | EXPR= | |
35 | ||
36 | { | |
a60ac11f | 37 | coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=DGRAM; } |
d827da23 MY |
38 | if read -u ${MKFDS[0]} PID; then |
39 | EXPR='(PID == '"${PID}"') and ((FD == '"$FD0"') or (FD == '"$FD1"'))' | |
e193602a | 40 | ${TS_CMD_LSFD} -n -o ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME -Q "${EXPR}" | sed -e 's/UNIX-DGRAM/UNIX/' |
9be2c8b2 | 41 | echo 'ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME': ${PIPESTATUS[0]} |
d827da23 MY |
42 | |
43 | kill -CONT ${PID} | |
d827da23 | 44 | fi |
ffc7662e | 45 | wait ${MKFDS_PID} |
d827da23 MY |
46 | } > $TS_OUTPUT 2>&1 |
47 | ||
48 | ts_finalize |