| 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-shm" |
| 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-shm |
| 29 | $TS_CMD_IPCMK -M 1 2>>$TS_OUTPUT | ipcmk_output_handler $TS_OUTPUT $TS_OUTDIR/id-shm |
| 30 | $TS_CMD_IPCS -m -i "$(cat $TS_OUTDIR/id-shm)" | sed -n '/^bytes/s/\t.*//p' >>$TS_OUTPUT |
| 31 | $TS_CMD_IPCRM -m "$(cat $TS_OUTDIR/id-shm)" >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 32 | rm -f $TS_OUTDIR/id-shm |
| 33 | |
| 34 | $TS_CMD_IPCMK -M 12 2>>$TS_OUTPUT | ipcmk_output_handler $TS_OUTPUT $TS_OUTDIR/id-shm |
| 35 | $TS_CMD_IPCS -m -i "$(cat $TS_OUTDIR/id-shm)" | sed -n '/^bytes/s/\t.*//p' >>$TS_OUTPUT |
| 36 | $TS_CMD_IPCRM -M "$( |
| 37 | $TS_CMD_IPCS -m | |
| 38 | awk -v id="$(cat $TS_OUTDIR/id-shm)" '{if ($2 == id){print $1}}' | |
| 39 | uniq |
| 40 | )" >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 41 | |
| 42 | rm -f $TS_OUTDIR/id-shm |
| 43 | |
| 44 | ts_finalize |