]>
Commit | Line | Data |
---|---|---|
1f2f436a A |
1 | /* |
2 | * Copyright (c) 2010 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | #ifndef _LIBPROC_INTERNALH_ | |
24 | #define _LIBPROC_INTERNALH_ | |
25 | ||
26 | #include <TargetConditionals.h> | |
27 | ||
28 | #include <sys/cdefs.h> | |
29 | #include <libproc.h> | |
30 | #include <sys/process_policy.h> | |
31 | ||
32 | __BEGIN_DECLS | |
33 | ||
34 | #if TARGET_OS_EMBEDDED | |
35 | ||
36 | #define PROC_SETCPU_ACTION_NONE 0 | |
37 | #define PROC_SETCPU_ACTION_THROTTLE 1 | |
38 | #define PROC_SETCPU_ACTION_SUSPEND 2 | |
39 | #define PROC_SETCPU_ACTION_TERMINATE 3 | |
40 | #define PROC_SETCPU_ACTION_NOTIFY 4 | |
41 | ||
42 | int proc_setcpu_percentage(pid_t pid, int action, int percentage) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); | |
43 | int proc_setcpu_deadline(pid_t pid, int action, uint64_t deadline) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); | |
44 | int proc_setcpu_percentage_withdeadline(pid_t pid, int action, int percentage, uint64_t deadline) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); | |
45 | int proc_clear_cpulimits(pid_t pid) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); | |
46 | ||
47 | #define PROC_APPSTATE_NONE 0 | |
48 | #define PROC_APPSTATE_ACTIVE 1 | |
49 | #define PROC_APPSTATE_BACKGROUND 2 | |
50 | #define PROC_APPSTATE_NONUI 3 | |
51 | #define PROC_APPSTATE_INACTIVE 4 | |
52 | ||
53 | int proc_setappstate(int pid, int appstate); | |
54 | int proc_appstate(int pid, int * appstatep); | |
55 | ||
56 | #define PROC_DEVSTATUS_SHORTTERM 1 | |
57 | #define PROC_DEVSTATUS_LONGTERM 2 | |
58 | ||
59 | int proc_devstatusnotify(int devicestatus); | |
60 | ||
61 | #define PROC_PIDBIND_CLEAR 0 | |
62 | #define PROC_PIDBIND_SET 1 | |
63 | int proc_pidbind(int pid, uint64_t threadid, int bind); | |
64 | ||
65 | ||
66 | #else /* TARGET_OS_EMBEDDED */ | |
67 | ||
68 | /* resume the process suspend due to low VM resource */ | |
69 | int proc_clear_vmpressure(pid_t pid); | |
70 | /* set self as the one who is going to resume suspended processes due to low VM. Need to be root */ | |
71 | int proc_set_owner_vmpressure(void); | |
72 | ||
73 | /* | |
74 | * Resumes the backgrounded TAL or dashboard client. Only priv users can disable TAL apps. | |
75 | * Valid apptype are PROC_POLICY_OSX_APPTYPE_DASHCLIENT and PROC_POLICY_OSX_APPTYPE_TAL. | |
76 | * Returns 0 on success otherwise appropriate error code. | |
77 | */ | |
78 | int proc_disable_apptype(pid_t pid, int apptype); | |
79 | int proc_enable_apptype(pid_t pid, int apptype); | |
80 | ||
81 | #endif /* TARGET_OS_EMBEDDED */ | |
82 | ||
83 | __END_DECLS | |
84 | ||
85 | #endif /* _LIBPROC_INTERNALH_ */ | |
86 |