未验证 提交 00eb0886 编写于 作者: O openharmony_ci 提交者: Gitee

!465 增加NDK符号

Merge pull request !465 from maweiye/ndksymbols
...@@ -25,6 +25,18 @@ extern "C" { ...@@ -25,6 +25,18 @@ extern "C" {
#define SDK_VERSION_8 8 #define SDK_VERSION_8 8
#define SDK_VERSION_9 9 #define SDK_VERSION_9 9
/**
* @brief Get the target sdk version number of the application.
* @return The target sdk version number.
*/
int get_application_target_sdk_version(void);
/**
* @brief Set the target sdk version number of the application.
* @param target The target sdk version number.
*/
void set_application_target_sdk_version(int target);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
extern "C" { extern "C" {
#endif #endif
/**
* @brief Get the api version number of the device.
* @return The api version number of the device.
*/
int get_device_api_version(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -28,6 +28,18 @@ typedef struct fatal_msg { ...@@ -28,6 +28,18 @@ typedef struct fatal_msg {
char msg[0]; char msg[0];
} fatal_msg_t; } fatal_msg_t;
/**
* @brief Set up fatal message
* @param msg The fatal message
*/
void set_fatal_message(const char *msg);
/**
* @brief Get the set fatal message
* @return Address of fatal message
*/
fatal_msg_t *get_fatal_message(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -128,12 +128,97 @@ int pthread_mutex_unlock(pthread_mutex_t *); ...@@ -128,12 +128,97 @@ int pthread_mutex_unlock(pthread_mutex_t *);
int pthread_mutex_trylock(pthread_mutex_t *); int pthread_mutex_trylock(pthread_mutex_t *);
int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict); int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
int pthread_mutex_destroy(pthread_mutex_t *); int pthread_mutex_destroy(pthread_mutex_t *);
/**
* @brief lock the mutex object referenced by mutex. If the mutex is already locked,
* the calling thread shall block until the mutex becomes available as in the
* pthread_mutex_lock() function. If the mutex cannot be locked without waiting for
* another thread to unlock the mutex, this wait shall be terminated when the specified
* timeout expires. The timeout shall be based on the CLOCK_REALTIME or CLOCK_MONOTONIC clock.
* The resolution of the timeout shall be the resolution of the clock on which it is based.
* @param mutex a robust mutex and the process containing the owning thread terminated while holding the mutex lock.
* @param clock_id specified CLOCK_REALTIME or CLOCK_MONOTONIC clock.
* @param timespec the timeout shall expire specified by abstime passes.
* @return clocklock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_mutex_clocklock(pthread_mutex_t *__restrict, clockid_t, const struct timespec *__restrict);
/**
* @brief lock the mutex object referenced by mutex. If the mutex is already locked,
* the calling thread shall block until the mutex becomes available as in the
* pthread_mutex_lock() function. If the mutex cannot be locked without waiting for
* another thread to unlock the mutex, this wait shall be terminated when the specified
* timeout expires. The timeout shall be based on the CLOCK_MONOTONIC clock.
* The resolution of the timeout shall be the resolution of the clock on which it is based.
* @param mutex a robust mutex and the process containing the owning thread terminated while holding the mutex lock.
* @param timespec the timeout shall expire specified by abstime passes.
* @return clocklock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_mutex_timedlock_monotonic_np(pthread_mutex_t *__restrict, const struct timespec *__restrict);
/**
* @brief lock the mutex object referenced by mutex. If the mutex is already locked,
* the calling thread shall block until the mutex becomes available as in the
* pthread_mutex_lock() function. If the mutex cannot be locked without waiting for
* another thread to unlock the mutex, this wait shall be terminated when the specified
* timeout expires. The timeout shall be based on the CLOCK_MONOTONIC clock.
* The resolution of the timeout shall be the resolution of the clock on which it is based.
* @param mutex a robust mutex and the process containing the owning thread terminated while holding the mutex lock.
* @param ms the timeout shall expire specified by relative time(ms) passes.
* @return clocklock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_mutex_lock_timeout_np(pthread_mutex_t *__restrict, unsigned int);
int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict); int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
int pthread_cond_destroy(pthread_cond_t *); int pthread_cond_destroy(pthread_cond_t *);
int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict); int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict); int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
/**
* @brief The thread waits for a signal to trigger, and if timeout or signal is triggered,
* the thread wakes up.
* @param pthread_cond_t Condition variables for multithreading.
* @param pthread_mutex_t Thread mutex variable.
* @param clockid_t Clock ID used in clock and timer functions.
* @param timespec The timeout shall expire specified by abstime passes.
* @return pthread_cond_clockwait result.
* @retval 0 pthread_cond_clockwait successful.
* @retval ETIMEDOUT pthread_cond_clockwait Connection timed out.
* @retval EINVAL pthread_cond_clockwait error.
*/
int pthread_cond_clockwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict,
clockid_t, const struct timespec *__restrict);
/**
* @brief Condition variables have an initialization option to use CLOCK_MONOTONIC.
* The thread waits for a signal to trigger, and if timeout or signal is triggered,
* the thread wakes up.
* @param pthread_cond_t Condition variables for multithreading.
* @param pthread_mutex_t Thread mutex variable.
* @param timespec The timeout shall expire specified by abstime passes.
* @return pthread_cond_timedwait_monotonic_np result.
* @retval 0 pthread_cond_timedwait_monotonic_np successful.
* @retval ETIMEDOUT pthread_cond_timedwait_monotonic_np Connection timed out.
* @retval EINVAL pthread_cond_timedwait_monotonic_np error.
*/
int pthread_cond_timedwait_monotonic_np(pthread_cond_t *__restrict, pthread_mutex_t *__restrict,
const struct timespec *__restrict);
/**
* @brief Condition variables have an initialization option to use CLOCK_MONOTONIC and The time
* parameter is in milliseconds. The thread waits for a signal to trigger, and if timeout or
* signal is triggered, the thread wakes up.
* @param pthread_cond_t Condition variables for multithreading.
* @param pthread_mutex_t Thread mutex variable.
* @param unsigned Timeout, in milliseconds.
* @return pthread_cond_timeout_np result.
* @retval 0 pthread_cond_timeout_np successful.
* @retval ETIMEDOUT pthread_cond_timeout_np Connection timed out.
* @retval EINVAL pthread_cond_timeout_np error.
*/
int pthread_cond_timeout_np(pthread_cond_t* __restrict, pthread_mutex_t* __restrict, unsigned int);
int pthread_cond_broadcast(pthread_cond_t *); int pthread_cond_broadcast(pthread_cond_t *);
int pthread_cond_signal(pthread_cond_t *); int pthread_cond_signal(pthread_cond_t *);
...@@ -142,11 +227,74 @@ int pthread_rwlock_destroy(pthread_rwlock_t *); ...@@ -142,11 +227,74 @@ int pthread_rwlock_destroy(pthread_rwlock_t *);
int pthread_rwlock_rdlock(pthread_rwlock_t *); int pthread_rwlock_rdlock(pthread_rwlock_t *);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *); int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict); int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
/**
* @brief Apply a read lock to the read-write lock referenced by rwlock as in the
* pthread_rwlock_rdlock() function. However, if the lock cannot be acquired without
* waiting for other threads to unlock the lock, this wait shall be terminated when
* the specified timeout expires. The timeout shall expire when the absolute time specified by
* abstime passes, as measured by the clock on which timeouts are based, or if the absolute time
* specified by abstime has already been passed at the time of the call.
* The timeout shall be based on the CLOCK_REALTIME or CLOCK_MONOTONIC clock.
* @param rw a read lock to the read-write lock referenced.
* @param clock_id specified CLOCK_REALTIME or CLOCK_MONOTONIC clock.
* @param timespec the timeout shall expire specified by abstime passes.
* @return clockrdlock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_rwlock_clockrdlock(pthread_rwlock_t *__restrict, clockid_t, const struct timespec *__restrict);
/**
* @brief Apply a read lock to the read-write lock referenced by rwlock as in the
* pthread_rwlock_rdlock() function. However, if the lock cannot be acquired without
* waiting for other threads to unlock the lock, this wait shall be terminated when
* the specified timeout expires. The timeout shall expire when the absolute time specified by
* abstime passes, as measured by the clock on which timeouts are based, or if the absolute time
* specified by abstime has already been passed at the time of the call.
* The timeout shall be based on the CLOCK_MONOTONIC clock.
* @param rw a read lock to the read-write lock referenced.
* @param timespec the timeout shall expire specified by abstime passes.
* @return clockrdlock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_rwlock_timedrdlock_monotonic_np(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
int pthread_rwlock_wrlock(pthread_rwlock_t *); int pthread_rwlock_wrlock(pthread_rwlock_t *);
int pthread_rwlock_trywrlock(pthread_rwlock_t *); int pthread_rwlock_trywrlock(pthread_rwlock_t *);
int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict); int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
int pthread_rwlock_unlock(pthread_rwlock_t *); int pthread_rwlock_unlock(pthread_rwlock_t *);
/**
* @brief Read-write lock variables have an initialization option to use CLOCK_MONOTONIC.
* apply a read lock to the read-write lock referenced by rwlock as in the
* pthread_rwlock_wrlock() function. However, if the lock cannot be acquired without
* waiting for other threads to unlock the lock, this wait shall be terminated when
* the specified timeout expires. The timeout shall expire when the absolute time specified by
* abstime passes, as measured by the clock on which timeouts are based, or if the absolute time
* specified by abstime has already been passed at the time of the call.
* The timeout shall be based on the CLOCK_MONOTONIC clock.
* @param rw a read lock to the read-write lock referenced.
* @param timespec the timeout shall expire specified by abstime passes.
* @return clockrdlock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_rwlock_timedwrlock_monotonic_np(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
/**
* @brief Apply a read lock to the read-write lock referenced by rwlock as in the
* pthread_rwlock_wrlock() function. However, if the lock cannot be acquired without
* waiting for other threads to unlock the lock, this wait shall be terminated when
* the specified timeout expires. The timeout shall expire when the absolute time specified by
* abstime passes, as measured by the clock on which timeouts are based, or if the absolute time
* specified by abstime has already been passed at the time of the call.
* The timeout shall be based on the CLOCK_REALTIME or CLOCK_MONOTONIC clock.
* @param rw a read lock to the read-write lock referenced.
* @param clock_id specified CLOCK_REALTIME or CLOCK_MONOTONIC clock.
* @param timespec the timeout shall expire specified by abstime passes.
* @return clockrdlock result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int pthread_rwlock_clockwrlock(pthread_rwlock_t *__restrict, clockid_t, const struct timespec *__restrict);
int pthread_spin_init(pthread_spinlock_t *, int); int pthread_spin_init(pthread_spinlock_t *, int);
int pthread_spin_destroy(pthread_spinlock_t *); int pthread_spin_destroy(pthread_spinlock_t *);
...@@ -229,6 +377,7 @@ void _pthread_cleanup_pop(struct __ptcb *, int); ...@@ -229,6 +377,7 @@ void _pthread_cleanup_pop(struct __ptcb *, int);
struct cpu_set_t; struct cpu_set_t;
int pthread_getattr_np(pthread_t, pthread_attr_t *); int pthread_getattr_np(pthread_t, pthread_attr_t *);
int pthread_setname_np(pthread_t, const char *); int pthread_setname_np(pthread_t, const char *);
int pthread_getname_np(pthread_t, char *, size_t);
#endif #endif
#if _REDIR_TIME64 #if _REDIR_TIME64
......
...@@ -85,6 +85,7 @@ void *calloc(size_t, size_t); ...@@ -85,6 +85,7 @@ void *calloc(size_t, size_t);
void free(void *); void free(void *);
typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t; typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
cpu_set_t* __sched_cpualloc(size_t __count);
int __sched_cpucount(size_t, const cpu_set_t *); int __sched_cpucount(size_t, const cpu_set_t *);
int sched_getcpu(void); int sched_getcpu(void);
int sched_getaffinity(pid_t, size_t, cpu_set_t *); int sched_getaffinity(pid_t, size_t, cpu_set_t *);
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* 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 _SYS_TGKILL_H
#define _SYS_TGKILL_H
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief send any signal to any process group or process.
* @param tgid the group ID of the calling process.
* @param tid the thread ID of the calling process.
* @param sig the actual signal.
* @return tgkill result.
* @retval 0 is returned on success.
* @retval -1 is returned on failure, and errno is set to indicate the error.
*/
int tgkill(int tgid, int tid, int sig);
#ifdef __cplusplus
}
#endif
#endif
\ No newline at end of file
...@@ -1498,5 +1498,23 @@ ...@@ -1498,5 +1498,23 @@
{ "name": "stdin", "type": "variable" }, { "name": "stdin", "type": "variable" },
{ "name": "stdout", "type": "variable" }, { "name": "stdout", "type": "variable" },
{ "name": "timezone", "type": "variable" }, { "name": "timezone", "type": "variable" },
{ "name": "tzname", "type": "variable" } { "name": "tzname", "type": "variable" },
{ "name": "__sched_cpualloc" },
{ "name": "get_application_target_sdk_version" },
{ "name": "get_device_api_version" },
{ "name": "get_fatal_message" },
{ "name": "pthread_cond_clockwait" },
{ "name": "pthread_cond_timedwait_monotonic_np" },
{ "name": "pthread_cond_timeout_np" },
{ "name": "pthread_getname_np" },
{ "name": "pthread_mutex_lock_timeout_np" },
{ "name": "pthread_mutex_timedlock_monotonic_np" },
{ "name": "pthread_mutex_clocklock" },
{ "name": "pthread_rwlock_clockrdlock" },
{ "name": "pthread_rwlock_clockwrlock" },
{ "name": "pthread_rwlock_timedrdlock_monotonic_np" },
{ "name": "pthread_rwlock_timedwrlock_monotonic_np" },
{ "name": "set_application_target_sdk_version" },
{ "name": "set_fatal_message" },
{ "name": "tgkill" }
] ]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册