diff options
Diffstat (limited to 'include/cutils')
-rw-r--r-- | include/cutils/ashmem.h | 2 | ||||
-rw-r--r-- | include/cutils/compiler.h | 32 | ||||
-rw-r--r-- | include/cutils/sched_policy.h | 36 | ||||
-rw-r--r-- | include/cutils/tztime.h | 7 |
4 files changed, 77 insertions, 0 deletions
diff --git a/include/cutils/ashmem.h b/include/cutils/ashmem.h index 0683bf2..fd56dbe 100644 --- a/include/cutils/ashmem.h +++ b/include/cutils/ashmem.h @@ -10,6 +10,8 @@ #ifndef _CUTILS_ASHMEM_H #define _CUTILS_ASHMEM_H +#include <stdint.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/include/cutils/compiler.h b/include/cutils/compiler.h new file mode 100644 index 0000000..09112d5 --- /dev/null +++ b/include/cutils/compiler.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_CUTILS_COMPILER_H +#define ANDROID_CUTILS_COMPILER_H + +/* + * helps the compiler's optimizer predicting branches + */ + +#ifdef __cplusplus +# define CC_LIKELY( exp ) (__builtin_expect( !!(exp), true )) +# define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), false )) +#else +# define CC_LIKELY( exp ) (__builtin_expect( !!(exp), 1 )) +# define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 )) +#endif + +#endif // ANDROID_CUTILS_COMPILER_H diff --git a/include/cutils/sched_policy.h b/include/cutils/sched_policy.h new file mode 100644 index 0000000..eaf3993 --- /dev/null +++ b/include/cutils/sched_policy.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CUTILS_SCHED_POLICY_H +#define __CUTILS_SCHED_POLICY_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SP_BACKGROUND = 0, + SP_FOREGROUND = 1, +} SchedPolicy; + +extern int set_sched_policy(int tid, SchedPolicy policy); +extern int get_sched_policy(int tid, SchedPolicy *policy); + +#ifdef __cplusplus +} +#endif + +#endif /* __CUTILS_SCHED_POLICY_H */ diff --git a/include/cutils/tztime.h b/include/cutils/tztime.h index 69dbc88..cf103ca 100644 --- a/include/cutils/tztime.h +++ b/include/cutils/tztime.h @@ -17,6 +17,8 @@ #ifndef _CUTILS_TZTIME_H #define _CUTILS_TZTIME_H +#include <time.h> + #ifdef __cplusplus extern "C" { #endif @@ -24,6 +26,9 @@ extern "C" { time_t mktime_tz(struct tm * const tmp, char const * tz); void localtime_tz(const time_t * const timep, struct tm * tmp, const char* tz); +#ifndef HAVE_ANDROID_OS +/* the following is defined in <time.h> in Bionic */ + struct strftime_locale { const char *mon[12]; /* short names */ const char *month[12]; /* long names */ @@ -40,6 +45,8 @@ struct strftime_locale { size_t strftime_tz(char *s, size_t max, const char *format, const struct tm *tm, const struct strftime_locale *locale); +#endif /* !HAVE_ANDROID_OS */ + #ifdef __cplusplus } #endif |