--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="inotify"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_LSFD"
+ts_check_prog "stat"
+ts_check_prog "sed"
+
+ts_cd "$TS_OUTDIR"
+
+PID=
+FD=3
+ROOT_DEV=$(stat -c %d /)
+ROOT="$(stat -c %i /)"@"$(((ROOT_DEV >> 8) & 255)):$((ROOT_DEV & 255))"
+FSTAB_DEV=$(stat -c %d /etc/fstab)
+FSTAB="$(stat -c %i /etc/fstab)"@"$(((FSTAB_DEV >> 8) & 255)):$((FSTAB_DEV & 255))"
+{
+ coproc MKFDS { "$TS_HELPER_MKFDS" inotify $FD; }
+ if read -u ${MKFDS[0]} PID; then
+ EXPR='(PID == '"${PID}"') and (FD == '"$FD"')'
+ INODES_RAW=$(${TS_CMD_LSFD} --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}")
+ echo "INOTIFY.INODES.RAW": $?
+ if [[ "$INODES_RAW" == "$FSTAB","$ROOT" ]]; then
+ echo "INOTIFY.INODES.RAW" == "FSTAB","ROOT"
+ else
+ echo "INOTIFY.INODES.RAW": "$INODES_RAW"
+ echo "FSTAB": "$FSTAB"
+ echo "ROOT": "$ROOT"
+ fi
+ kill -CONT "${PID}"
+ fi
+ wait "${MKFDS_PID}"
+} > "$TS_OUTPUT" 2>&1
+
+ts_finalize