aboutsummaryrefslogtreecommitdiffstats
path: root/system_cmds/shutdown.tproj/shutdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'system_cmds/shutdown.tproj/shutdown.c')
-rw-r--r--system_cmds/shutdown.tproj/shutdown.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/system_cmds/shutdown.tproj/shutdown.c b/system_cmds/shutdown.tproj/shutdown.c
index 597f9f2..021ce59 100644
--- a/system_cmds/shutdown.tproj/shutdown.c
+++ b/system_cmds/shutdown.tproj/shutdown.c
@@ -71,8 +71,10 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
#include <vproc.h>
#include <vproc_priv.h>
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
#include "kextmanager.h"
#include <IOKit/kext/kextmanager_types.h>
+#endif
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <mach/mach_port.h> // allocate
#include <mach/mach.h> // task_self, etc
@@ -84,6 +86,10 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
#include "pathnames.h"
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
+int reboot3(int);
+
#ifdef DEBUG
#undef _PATH_NOLOGIN
#define _PATH_NOLOGIN "./nologin"
@@ -139,8 +145,8 @@ void nolog(void);
void timeout(int);
void timewarn(time_t);
void usage(const char *);
-#ifdef __APPLE__
int audit_shutdown(int);
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
int reserve_reboot(void);
#endif
@@ -419,13 +425,13 @@ log_and_exec_reboot_or_halt()
die_you_gravy_sucking_pig_dog()
#endif
{
-#ifndef __APPLE__
- char *empty_environ[] = { NULL };
-#else
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
if ((errno = reserve_reboot())) {
warn("couldn't lock for reboot");
finish(0);
}
+#else
+ char *empty_environ[] = { NULL };
#endif
syslog(LOG_NOTICE, "%s%s by %s: %s",
@@ -670,7 +676,6 @@ usage(const char *cp)
exit(1);
}
-#ifdef __APPLE__
/*
* The following tokens are included in the audit record for shutdown
* header
@@ -718,6 +723,7 @@ audit_shutdown(int exitstatus)
return 1;
}
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
static bool
kextdDisabled(void)