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.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/system_cmds/shutdown.tproj/shutdown.c b/system_cmds/shutdown.tproj/shutdown.c
index 597f9f2..0dcc41b 100644
--- a/system_cmds/shutdown.tproj/shutdown.c
+++ b/system_cmds/shutdown.tproj/shutdown.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
#ifdef __APPLE__
#include <errno.h>
#include <util.h>
+typedef char *kobject_description_t[512];
#include <bsm/libbsm.h>
#include <bsm/audit_uevents.h>
#include <sys/types.h>
@@ -71,8 +72,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 +87,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 +146,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 +426,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 +677,6 @@ usage(const char *cp)
exit(1);
}
-#ifdef __APPLE__
/*
* The following tokens are included in the audit record for shutdown
* header
@@ -718,6 +724,7 @@ audit_shutdown(int exitstatus)
return 1;
}
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
static bool
kextdDisabled(void)