7abce380ca6a46460385c74033fe8009213c228bvboxsync * IPRT - RTSystemShutdown, linux implementation.
7abce380ca6a46460385c74033fe8009213c228bvboxsync * Copyright (C) 2012 Oracle Corporation
7abce380ca6a46460385c74033fe8009213c228bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
7abce380ca6a46460385c74033fe8009213c228bvboxsync * available from http://www.virtualbox.org. This file is free software;
7abce380ca6a46460385c74033fe8009213c228bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
7abce380ca6a46460385c74033fe8009213c228bvboxsync * General Public License (GPL) as published by the Free Software
7abce380ca6a46460385c74033fe8009213c228bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
7abce380ca6a46460385c74033fe8009213c228bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7abce380ca6a46460385c74033fe8009213c228bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7abce380ca6a46460385c74033fe8009213c228bvboxsync * The contents of this file may alternatively be used under the terms
7abce380ca6a46460385c74033fe8009213c228bvboxsync * of the Common Development and Distribution License Version 1.0
7abce380ca6a46460385c74033fe8009213c228bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
7abce380ca6a46460385c74033fe8009213c228bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
7abce380ca6a46460385c74033fe8009213c228bvboxsync * CDDL are applicable instead of those of the GPL.
7abce380ca6a46460385c74033fe8009213c228bvboxsync * You may elect to license modified versions of this file under the
7abce380ca6a46460385c74033fe8009213c228bvboxsync * terms and conditions of either the GPL or the CDDL or both.
7abce380ca6a46460385c74033fe8009213c228bvboxsync/*******************************************************************************
7abce380ca6a46460385c74033fe8009213c228bvboxsync* Header Files *
7abce380ca6a46460385c74033fe8009213c228bvboxsync*******************************************************************************/
7abce380ca6a46460385c74033fe8009213c228bvboxsyncRTDECL(int) RTSystemShutdown(RTMSINTERVAL cMsDelay, uint32_t fFlags, const char *pszLogMsg)
7abce380ca6a46460385c74033fe8009213c228bvboxsync AssertReturn(!(fFlags & ~RTSYSTEM_SHUTDOWN_VALID_MASK), VERR_INVALID_PARAMETER);
7abce380ca6a46460385c74033fe8009213c228bvboxsync * Assemble the argument vector.
7abce380ca6a46460385c74033fe8009213c228bvboxsync RTStrPrintf(szWhen, sizeof(szWhen), "%u", (unsigned)((cMsDelay + 499) / 1000));
7abce380ca6a46460385c74033fe8009213c228bvboxsync * Start the shutdown process and wait for it to complete.
7abce380ca6a46460385c74033fe8009213c228bvboxsync int rc = RTProcCreate(apszArgs[0], apszArgs, RTENV_DEFAULT, 0 /*fFlags*/, &hProc);
7abce380ca6a46460385c74033fe8009213c228bvboxsync rc = RTProcWait(hProc, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus);