ba84ce32a3fee75f8bfbd5f08fc69c4b5a58bbc4
2 * Copyright (C) 2007 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __CUTILS_SCHED_POLICY_H
18 #define __CUTILS_SCHED_POLICY_H
24 /* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */
29 SP_SYSTEM
= 2, // can't be used with set_sched_policy()
34 SP_SYSTEM_DEFAULT
= SP_FOREGROUND
,
37 /* Assign thread tid to the cgroup associated with the specified policy.
38 * If the thread is a thread group leader, that is it's gettid() == getpid(),
39 * then the other threads in the same thread group are _not_ affected.
40 * On platforms which support gettid(), zero tid means current thread.
41 * Return value: 0 for success, or -errno for error.
43 extern int set_sched_policy(int tid
, SchedPolicy policy
);
45 /* Return the policy associated with the cgroup of thread tid via policy pointer.
46 * On platforms which support gettid(), zero tid means current thread.
47 * Return value: 0 for success, or -1 for error and set errno.
49 extern int get_sched_policy(int tid
, SchedPolicy
*policy
);
51 /* Return a displayable string corresponding to policy.
52 * Return value: non-NULL NUL-terminated name of unspecified length;
53 * the caller is responsible for displaying the useful part of the string.
55 extern const char *get_sched_policy_name(SchedPolicy policy
);
61 #endif /* __CUTILS_SCHED_POLICY_H */