+/*
+ * Routine: macx_backing_store_recovery
+ * Function:
+ * Syscall interface to set a tasks privilege
+ * level so that it is not subject to
+ * macx_backing_store_suspend
+ */
+int
+macx_backing_store_recovery(
+ struct macx_backing_store_recovery_args *args)
+{
+ int pid = args->pid;
+ int error;
+ struct proc *p = current_proc();
+ boolean_t funnel_state;
+
+ funnel_state = thread_funnel_set(kernel_flock, TRUE);
+ if ((error = suser(kauth_cred_get(), 0)))
+ goto backing_store_recovery_return;
+
+ /* for now restrict backing_store_recovery */
+ /* usage to only present task */
+ if(pid != proc_selfpid()) {
+ error = EINVAL;
+ goto backing_store_recovery_return;
+ }
+
+ task_backing_store_privileged(p->task);
+
+backing_store_recovery_return:
+ (void) thread_funnel_set(kernel_flock, FALSE);
+ return(error);
+}
+
+/*
+ * Routine: macx_backing_store_suspend
+ * Function:
+ * Syscall interface to stop new demand for
+ * backing store when backing store is low
+ */
+
+int
+macx_backing_store_suspend(
+ struct macx_backing_store_suspend_args *args)
+{
+ boolean_t suspend = args->suspend;
+ int error;
+ boolean_t funnel_state;
+
+ funnel_state = thread_funnel_set(kernel_flock, TRUE);
+ if ((error = suser(kauth_cred_get(), 0)))
+ goto backing_store_suspend_return;
+
+ vm_backing_store_disable(suspend);
+
+backing_store_suspend_return:
+ (void) thread_funnel_set(kernel_flock, FALSE);
+ return(error);
+}
+
+extern boolean_t backing_store_stop_compaction;
+
+/*
+ * Routine: macx_backing_store_compaction
+ * Function:
+ * Turn compaction of swap space on or off. This is
+ * used during shutdown/restart so that the kernel
+ * doesn't waste time compacting swap files that are
+ * about to be deleted anyway. Compaction is always
+ * on by default when the system comes up and is turned
+ * off when a shutdown/restart is requested. It is
+ * re-enabled if the shutdown/restart is aborted for any reason.
+ */
+
+int
+macx_backing_store_compaction(int flags)
+{
+ int error;
+
+ if ((error = suser(kauth_cred_get(), 0)))
+ return error;
+
+ if (flags & SWAP_COMPACT_DISABLE) {
+ backing_store_stop_compaction = TRUE;
+
+ } else if (flags & SWAP_COMPACT_ENABLE) {
+ backing_store_stop_compaction = FALSE;
+ }
+
+ return 0;
+}
+
+/*
+ * Routine: macx_triggers
+ * Function:
+ * Syscall interface to set the call backs for low and
+ * high water marks.
+ */
+int
+macx_triggers(
+ struct macx_triggers_args *args)
+{
+ int error;
+
+ error = suser(kauth_cred_get(), 0);
+ if (error)
+ return error;
+
+ return mach_macx_triggers(args);
+}
+
+
+extern boolean_t dp_isssd;