From ea2670c18699e514ee1d65dfd35ad22c296a74e7 Mon Sep 17 00:00:00 2001 From: Jay Freeman Date: Tue, 1 Jan 2008 05:58:43 +0000 Subject: Initial commit. git-svn-id: http://svn.telesphoreo.org/trunk@2 514c082c-b64e-11dc-b46d-3d985efe055d --- data/kext-tools/_metadata/description | 2 + data/kext-tools/_metadata/license | 1 + data/kext-tools/_metadata/maintainer | 1 + data/kext-tools/_metadata/priority | 1 + data/kext-tools/_metadata/section | 1 + data/kext-tools/_metadata/version | 1 + data/kext-tools/getiopolicy_np.c | 93 ++++++++++++++++++++++++++++++++++ data/kext-tools/kext_tools-117.tar.gz | Bin 0 -> 208690 bytes data/kext-tools/make.sh | 18 +++++++ 9 files changed, 118 insertions(+) create mode 100644 data/kext-tools/_metadata/description create mode 120000 data/kext-tools/_metadata/license create mode 120000 data/kext-tools/_metadata/maintainer create mode 100644 data/kext-tools/_metadata/priority create mode 100644 data/kext-tools/_metadata/section create mode 100644 data/kext-tools/_metadata/version create mode 100644 data/kext-tools/getiopolicy_np.c create mode 100644 data/kext-tools/kext_tools-117.tar.gz create mode 100755 data/kext-tools/make.sh (limited to 'data/kext-tools') diff --git a/data/kext-tools/_metadata/description b/data/kext-tools/_metadata/description new file mode 100644 index 000000000..005d9a0c9 --- /dev/null +++ b/data/kext-tools/_metadata/description @@ -0,0 +1,2 @@ +this package isn't described yet +This package, which I'm certain is incredibly interesting, has yet to be described. This is probably because Jay has spent days getting all kinds of bookkeeping issues, like copyright notifications, all in their correct places, and descriptions just aren't the most important thing he could be working on. If this is a problem, please come back later. diff --git a/data/kext-tools/_metadata/license b/data/kext-tools/_metadata/license new file mode 120000 index 000000000..9e5e5e89d --- /dev/null +++ b/data/kext-tools/_metadata/license @@ -0,0 +1 @@ +../../../licenses/apsl-2.0 \ No newline at end of file diff --git a/data/kext-tools/_metadata/maintainer b/data/kext-tools/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/kext-tools/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik \ No newline at end of file diff --git a/data/kext-tools/_metadata/priority b/data/kext-tools/_metadata/priority new file mode 100644 index 000000000..ea5b3d7ee --- /dev/null +++ b/data/kext-tools/_metadata/priority @@ -0,0 +1 @@ +important diff --git a/data/kext-tools/_metadata/section b/data/kext-tools/_metadata/section new file mode 100644 index 000000000..7fbe952b7 --- /dev/null +++ b/data/kext-tools/_metadata/section @@ -0,0 +1 @@ +admin diff --git a/data/kext-tools/_metadata/version b/data/kext-tools/_metadata/version new file mode 100644 index 000000000..5bc6609e3 --- /dev/null +++ b/data/kext-tools/_metadata/version @@ -0,0 +1 @@ +117 diff --git a/data/kext-tools/getiopolicy_np.c b/data/kext-tools/getiopolicy_np.c new file mode 100644 index 000000000..5a4c842fe --- /dev/null +++ b/data/kext-tools/getiopolicy_np.c @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#include +#include + +extern int __iopolicysys(int, struct _iopol_param_t *); + +int +getiopolicy_np(int iotype, int scope) +{ + int policy, error; + struct _iopol_param_t iop_param; + + if (iotype != IOPOL_TYPE_DISK || + (scope != IOPOL_SCOPE_PROCESS && scope != IOPOL_SCOPE_THREAD)) { + errno = EINVAL; + policy = -1; + goto exit; + } + + iop_param.iop_scope = scope; + iop_param.iop_iotype = iotype; + error = syscall(322, IOPOL_CMD_GET, &iop_param); + if (error != 0) { + errno = error; + policy = -1; + goto exit; + } + + policy = iop_param.iop_policy; + + exit: + return policy; +} + +int +setiopolicy_np(int iotype, int scope, int policy) +{ + int error; + struct _iopol_param_t iop_param; + + if (iotype != IOPOL_TYPE_DISK || + (scope != IOPOL_SCOPE_PROCESS && scope != IOPOL_SCOPE_THREAD)) { + errno = EINVAL; + error = -1; + goto exit; + } + + switch (policy) { + case IOPOL_DEFAULT: + case IOPOL_NORMAL: + case IOPOL_THROTTLE: + case IOPOL_PASSIVE: + break; + default: + errno = EINVAL; + error = -1; + goto exit; + } + + iop_param.iop_scope = scope; + iop_param.iop_iotype = iotype; + iop_param.iop_policy = policy; + error = syscall(322, IOPOL_CMD_SET, &iop_param); + if (error != 0) { + errno = error; + error = -1; + goto exit; + } + + exit: + return error; +} diff --git a/data/kext-tools/kext_tools-117.tar.gz b/data/kext-tools/kext_tools-117.tar.gz new file mode 100644 index 000000000..513cb7764 Binary files /dev/null and b/data/kext-tools/kext_tools-117.tar.gz differ diff --git a/data/kext-tools/make.sh b/data/kext-tools/make.sh new file mode 100755 index 000000000..5d02653d6 --- /dev/null +++ b/data/kext-tools/make.sh @@ -0,0 +1,18 @@ +tar -zxvf "${PKG_DATA}/kext_tools-117.tar.gz" +cd kext_tools-117 +cp -a "${PKG_DATA}/getiopolicy_np.c" . +#arm-apple-darwin-gcc -o kextload kextload_main.c -framework CoreFoundation utility.c -framework IOKit getiopolicy_np.c -DPRIVATE +arm-apple-darwin-gcc -o kextstat kextstat_main.c +arm-apple-darwin-gcc -o kextfind kextfind_*.c -framework IOKit -framework CoreFoundation QEQuery.c utility.c getiopolicy_np.c -DPRIVATE +arm-apple-darwin-gcc -I. -o kextunload kextunload_main.c -framework CoreFoundation -framework IOKit utility.c getiopolicy_np.c -DPRIVATE +arm-apple-darwin-gcc -o kextlibs kextlibs_main.c -framework IOKit -framework CoreFoundation utility.c getiopolicy_np.c -DPRIVATE +arm-apple-darwin-gcc -o kextsymboltool kextsymboltool.c +arm-apple-darwin-gcc -o mkextunpack mkextunpack_main.c -framework CoreFoundation compression.c +#arm-apple-darwin-gcc -o kextd kextd_main.c -framework CoreFoundation -framework IOKit getiopolicy_np.c -DPRIVATE logging.c request.c PTLock.c watchvol.c bootcaches.c utility.c safecalls.c +#arm-apple-darwin-gcc -o kextcache kextcache_main.c -framework CoreFoundation -framework IOKit utility.c prelink.c mkext_file.c logging.c arch.c bootcaches.c compression.c safecalls.c update_boot.c getiopolicy_np.c -DPRIVATE +# XXX: these files shouldn't go in /usr/bin +pkg: mkdir -p /sbin /usr/bin /usr/sbin +pkg: cp -a kextfind kextlibs kextsymboltool /usr/bin +#pkg: cp -a kextd /usr/libexec +pkg: cp -a kextunload /sbin #kextload +pkg: cp -a mkextunpack kextstat /usr/sbin #kextcache -- cgit v1.2.3