]>
git.saurik.com Git - apple/xnu.git/blob - libsyscall/wrappers/libproc/libproc_internal.h
d8fc8f1f9c4fabf7d87893243ff908200026cc49
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _LIBPROC_INTERNALH_
24 #define _LIBPROC_INTERNALH_
26 #include <TargetConditionals.h>
28 #include <sys/cdefs.h>
30 #include <mach/message.h>
35 /* resume the process suspend due to low VM resource */
36 int proc_clear_vmpressure(pid_t pid
);
37 /* set self as the one who is going to resume suspended processes due to low VM. Need to be root */
38 int proc_set_owner_vmpressure(void);
40 /* mark yourself to delay idle sleep on disk IO */
41 int proc_set_delayidlesleep(void);
42 /* Reset yourself to delay idle sleep on disk IO, if already set */
43 int proc_clear_delayidlesleep(void);
46 /* sub policies for PROC_POLICY_APPTYPE */
47 #define PROC_POLICY_OSX_APPTYPE_NONE 0
48 #define PROC_POLICY_OSX_APPTYPE_TAL 1 /* TAL based launched */
49 #define PROC_POLICY_OSX_APPTYPE_WIDGET 2 /* for dashboard client */
50 #define PROC_POLICY_OSX_APPTYPE_DASHCLIENT 2 /* rename to move away from widget */
53 * Resumes the backgrounded TAL or dashboard client. Only priv users can disable TAL apps.
54 * Valid apptype are PROC_POLICY_OSX_APPTYPE_DASHCLIENT and PROC_POLICY_OSX_APPTYPE_TAL.
55 * Returns 0 on success otherwise appropriate error code.
57 int proc_disable_apptype(pid_t pid
, int apptype
);
58 int proc_enable_apptype(pid_t pid
, int apptype
);
61 /* mark process as importance donating */
62 int proc_donate_importance_boost(void);
64 /* DEPRECATED: supported for backward compatibility only */
65 /* check the message for an importance boost and take an assertion on it */
66 int proc_importance_assertion_begin_with_msg(mach_msg_header_t
*msg
,
67 mach_msg_trailer_t
*trailer
,
68 uint64_t *assertion_token
) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8
, __MAC_10_10
, __IPHONE_6_0
, __IPHONE_8_0
);
70 /* DEPRECATED: supported for backward compatibility only */
71 /* drop an assertion */
72 int proc_importance_assertion_complete(uint64_t assertion_handle
);
74 /* check the message for a App De-Nap boost and take an assertion on it */
75 int proc_denap_assertion_begin_with_msg(mach_msg_header_t
*msg
,
76 uint64_t *assertion_token
);
78 /* drop a de-nap assertion */
79 int proc_denap_assertion_complete(uint64_t assertion_handle
);
81 /* ongoing percent-over-time CPU monitor */
82 int proc_set_cpumon_defaults(pid_t pid
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_6_0
);
83 int proc_set_cpumon_params(pid_t pid
, int percentage
, int interval
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_6_0
);
84 int proc_set_cpumon_params_fatal(pid_t pid
, int percentage
, int interval
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_8_0
);
86 int proc_get_cpumon_params(pid_t pid
, int *percentage
, int *interval
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_6_0
);
87 int proc_resume_cpumon(pid_t pid
) __OSX_AVAILABLE_STARTING(__MAC_10_12
, __IPHONE_10_0
);
88 int proc_disable_cpumon(pid_t pid
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_6_0
);
90 /* ongoing wakes/second monitor */
91 int proc_set_wakemon_defaults(pid_t pid
) __OSX_AVAILABLE_STARTING(__MAC_10_9
, __IPHONE_7_0
);
92 int proc_set_wakemon_params(pid_t pid
, int rate_hz
, int flags
) __OSX_AVAILABLE_STARTING(__MAC_10_9
, __IPHONE_7_0
);
93 int proc_get_wakemon_params(pid_t pid
, int *rate_hz
, int *flags
) __OSX_AVAILABLE_STARTING(__MAC_10_9
, __IPHONE_7_0
);
94 int proc_disable_wakemon(pid_t pid
) __OSX_AVAILABLE_STARTING(__MAC_10_9
, __IPHONE_7_0
);
96 /* request trace buffer collection */
97 int proc_trace_log(pid_t pid
, uint64_t uniqueid
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_8_0
);
99 /* proc_info call to get the originator information */
100 int proc_pidoriginatorinfo(int flavor
, void *buffer
, int buffersize
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_8_0
);
102 int proc_listcoalitions(int flavor
, int coaltype
, void *buffer
, int buffersize
) __OSX_AVAILABLE_STARTING(__MAC_10_11
, __IPHONE_8_3
);
104 #if !TARGET_IPHONE_SIMULATOR
106 #define PROC_SUPPRESS_SUCCESS (0)
107 #define PROC_SUPPRESS_BAD_ARGUMENTS (-1)
108 #define PROC_SUPPRESS_OLD_GENERATION (-2)
109 #define PROC_SUPPRESS_ALREADY_SUPPRESSED (-3)
111 int proc_suppress(pid_t pid
, uint64_t *generation
);
112 #endif /* !TARGET_IPHONE_SIMULATOR */
116 #endif /* _LIBPROC_INTERNALH_ */