vshelper.initSync(): fixed parameter naming
[util-vserver.git] / util-vserver / scripts / vserver.stop
index 40198b4..53be835 100644 (file)
@@ -36,30 +36,39 @@ function cleanup
        $_RM -f "$sync_fifo"
        $_RMDIR $($_DIRNAME "$sync_fifo")
     }
+
+    test ! -d "$vwait_statdir" ||
+       $_RM -rf "$vwait_statdir"
 }
 
+vwait_statdir=
+vwait_pid=
 sync_fifo=
 trap "cleanup" EXIT
 
+OPTION_FORCE_SYNC=1
+
 set -e
 generateOptions   "$VSERVER_DIR"
 set +e
 
 vshelper.doDestroy "$VSERVER_DIR" "$S_CONTEXT"
-initSync           "$VSERVER_DIR" sync_fifo
-prepareStop "$VSERVER_DIR"
+initSync           "$VSERVER_DIR" "$S_CONTEXT" sync_fifo
+prepareStop        "$VSERVER_DIR"
 
 cd "$VSERVER_DIR"/vdir/
-execScriptlets    "$VSERVER_DIR" "$VSERVER_NAME" pre-stop
+execScriptlets     "$VSERVER_DIR" "$VSERVER_NAME" pre-stop
 cd "$VSERVER_DIR"/vdir/
 
 test -z "$OPTION_DEFAULTTTY" || setDefaultTTY "$VSERVER_DIR"
 
 fail=
+initWait          "$VSERVER_DIR" "$S_CONTEXT" vwait_statdir
 if test -n "$_IS_FAKEINIT" && \
-   $_VSERVER_INFO - FEATURE vkill && \
-   initpid=$($_VSERVER_INFO "$S_CONTEXT" INITPID 2>/dev/null); then
-    $_VKILL -s INT -- "$initpid" || fail=1
+   $_VSERVER_INFO - FEATURE vkill; then
+    $_VKILL -s INT --xid "$S_CONTEXT" -- 1 || fail=1
+    ## HACK: remove the 'initpid' stuff above when PID virtualization
+    ## is implemented
 elif $_VSERVER_INFO - FEATURE migrate; then
     "${NICE_CMD[@]}" \
     ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT" -- } \
@@ -75,7 +84,7 @@ else
     "${INITCMD_STOP[@]}" || fail=1
 fi
 
-test -n "$fail" || waitForSync "$VSERVER_DIR" "$sync_fifo"
+test -n "$fail" || waitForSync "$VSERVER_DIR" "$sync_fifo" "$vwait_statdir"
 
 vshelper.doDestroy "$VSERVER_DIR" "$S_CONTEXT"
 sendKillSequence   "$S_CONTEXT" "${INITKILL_SEQ[@]}"