Debian Codegraph @

tests/ts/ipcs/mk-rm-sem

raw symbols SCIP
1 #!/bin/bash
2
3 # This file is part of util-linux.
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15 TS_TOPDIR="${0%/*}/../.."
16 TS_DESC="mk-rm-sem"
17
18 . "$TS_TOPDIR"/functions.sh
19 ts_init "$*"
20
21 ts_check_test_command "$TS_CMD_IPCS"
22 ts_check_test_command "$TS_CMD_IPCMK"
23 ts_check_test_command "$TS_CMD_IPCRM"
24 ts_check_test_command "$TS_HELPER_SYSINFO"
25
26 . "$TS_SELF"/functions.sh
27
28 rm -f $TS_OUTDIR/id-sem
29 $TS_CMD_IPCMK --semaphore 1 2>>$TS_OUTPUT | ipcmk_output_handler $TS_OUTPUT $TS_OUTDIR/id-sem
30 $TS_CMD_IPCS --semaphores --id "$(cat $TS_OUTDIR/id-sem)" | grep "^nsems" >>$TS_OUTPUT
31 $TS_CMD_IPCRM -s "$(cat $TS_OUTDIR/id-sem)" >> $TS_OUTPUT 2>> $TS_ERRLOG
32
33 rm -f $TS_OUTDIR/id-sem
34 $TS_CMD_IPCMK --semaphore 2 2>>$TS_OUTPUT | ipcmk_output_handler $TS_OUTPUT $TS_OUTDIR/id-sem
35 $TS_CMD_IPCS --semaphores --id "$(cat $TS_OUTDIR/id-sem)" | grep "^nsems" >>$TS_OUTPUT
36 $TS_CMD_IPCRM --semaphore-key "$(
37 $TS_CMD_IPCS --semaphores |
38 awk -v id="$(cat $TS_OUTDIR/id-sem)" '{if ($2 == id){print $1}}' |
39 uniq
40 )" >> $TS_OUTPUT 2>> $TS_ERRLOG
41
42 rm -f $TS_OUTDIR/id-sem
43
44 ts_finalize