mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-30 02:37:14 +02:00
Update IDF to a0468b2 (#2108)
* Update IDF to a0468b2 * add missing ld file * Fix PIO builds and change coex policy
This commit is contained in:
@ -1,28 +1,50 @@
|
||||
// Copyright 2017 Espressif Systems (Shanghai) PTE 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.
|
||||
|
||||
|
||||
/* This header file wraps newlib's own unmodified assert.h and adds
|
||||
support for silent assertion failure.
|
||||
/*
|
||||
assert.h
|
||||
*/
|
||||
#pragma once
|
||||
#include <sdkconfig.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include_next <assert.h>
|
||||
|
||||
#if defined(CONFIG_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG)
|
||||
#undef assert
|
||||
#define assert(__e) ((__e) ? (void)0 : abort())
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "_ansi.h"
|
||||
|
||||
#undef assert
|
||||
|
||||
#ifdef NDEBUG /* required by ANSI standard */
|
||||
# define assert(__e) ((void) sizeof(__e))
|
||||
#else
|
||||
# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
|
||||
__ASSERT_FUNC, #__e))
|
||||
|
||||
# ifndef __ASSERT_FUNC
|
||||
/* Use g++'s demangled names in C++. */
|
||||
# if defined __cplusplus && defined __GNUC__
|
||||
# define __ASSERT_FUNC __PRETTY_FUNCTION__
|
||||
|
||||
/* C99 requires the use of __func__. */
|
||||
# elif __STDC_VERSION__ >= 199901L
|
||||
# define __ASSERT_FUNC __func__
|
||||
|
||||
/* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
|
||||
# elif __GNUC__ >= 2
|
||||
# define __ASSERT_FUNC __FUNCTION__
|
||||
|
||||
/* failed to detect __func__ support. */
|
||||
# else
|
||||
# define __ASSERT_FUNC ((char *) 0)
|
||||
# endif
|
||||
# endif /* !__ASSERT_FUNC */
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
void _EXFUN(__assert, (const char *, int, const char *)
|
||||
_ATTRIBUTE ((__noreturn__)));
|
||||
void _EXFUN(__assert_func, (const char *, int, const char *, const char *)
|
||||
_ATTRIBUTE ((__noreturn__)));
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L && !defined __cplusplus
|
||||
# define static_assert _Static_assert
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,39 +1,11 @@
|
||||
#ifndef __ERRNO_H__
|
||||
#define __ERRNO_H__
|
||||
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE 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 _ESP_PLATFORM_ERRNO_H_
|
||||
#define _ESP_PLATFORM_ERRNO_H_
|
||||
|
||||
#include_next "errno.h"
|
||||
|
||||
//
|
||||
// Possibly define some missing errors
|
||||
//
|
||||
#ifndef ESHUTDOWN
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#ifndef __error_t_defined
|
||||
typedef int error_t;
|
||||
#define __error_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifndef EAI_SOCKTYPE
|
||||
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
|
||||
#endif
|
||||
#include <sys/errno.h>
|
||||
|
||||
#ifndef EAI_AGAIN
|
||||
#define EAI_AGAIN 2 /* temporary failure in name resolution */
|
||||
#endif
|
||||
|
||||
#ifndef EAI_BADFLAGS
|
||||
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
|
||||
#endif
|
||||
|
||||
#endif // _ESP_PLATFORM_ERRNO_H_
|
||||
#endif /* !__ERRNO_H__ */
|
||||
|
@ -1,33 +1,431 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE 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 __ESP_PLATFORM_PTHREAD_H__
|
||||
#define __ESP_PLATFORM_PTHREAD_H__
|
||||
/* pthread.h
|
||||
*
|
||||
* Written by Joel Sherrill <joel@OARcorp.com>.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2013.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose without fee is hereby granted, provided that this entire notice
|
||||
* is included in all copies of any software which is or includes a copy
|
||||
* or modification of this software.
|
||||
*
|
||||
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
|
||||
* OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
|
||||
* SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include_next <pthread.h>
|
||||
#ifndef __PTHREAD_h
|
||||
#define __PTHREAD_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int pthread_condattr_getclock(const pthread_condattr_t * attr, clockid_t * clock_id);
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(_POSIX_THREADS)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/sched.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
struct _pthread_cleanup_context {
|
||||
void (*_routine)(void *);
|
||||
void *_arg;
|
||||
int _canceltype;
|
||||
struct _pthread_cleanup_context *_previous;
|
||||
};
|
||||
|
||||
/* Register Fork Handlers */
|
||||
int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void),
|
||||
void (*child)(void)));
|
||||
|
||||
/* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */
|
||||
|
||||
int _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr));
|
||||
int _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr));
|
||||
int _EXFUN(pthread_mutexattr_getpshared,
|
||||
(_CONST pthread_mutexattr_t *__attr, int *__pshared));
|
||||
int _EXFUN(pthread_mutexattr_setpshared,
|
||||
(pthread_mutexattr_t *__attr, int __pshared));
|
||||
|
||||
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
|
||||
|
||||
/* Single UNIX Specification 2 Mutex Attributes types */
|
||||
|
||||
int _EXFUN(pthread_mutexattr_gettype,
|
||||
(_CONST pthread_mutexattr_t *__attr, int *__kind));
|
||||
int _EXFUN(pthread_mutexattr_settype,
|
||||
(pthread_mutexattr_t *__attr, int __kind));
|
||||
|
||||
#endif
|
||||
|
||||
/* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */
|
||||
|
||||
int _EXFUN(pthread_mutex_init,
|
||||
(pthread_mutex_t *__mutex, _CONST pthread_mutexattr_t *__attr));
|
||||
int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex));
|
||||
|
||||
/* This is used to statically initialize a pthread_mutex_t. Example:
|
||||
|
||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
|
||||
|
||||
/* Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */
|
||||
|
||||
int _EXFUN(pthread_mutex_lock, (pthread_mutex_t *__mutex));
|
||||
int _EXFUN(pthread_mutex_trylock, (pthread_mutex_t *__mutex));
|
||||
int _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex));
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
int _EXFUN(pthread_mutex_timedlock,
|
||||
(pthread_mutex_t *__mutex, _CONST struct timespec *__timeout));
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
/* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */
|
||||
|
||||
int _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr));
|
||||
int _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr));
|
||||
int _EXFUN(pthread_condattr_getpshared,
|
||||
(_CONST pthread_condattr_t *__attr, int *__pshared));
|
||||
int _EXFUN(pthread_condattr_setpshared,
|
||||
(pthread_condattr_t *__attr, int __pshared));
|
||||
|
||||
/* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */
|
||||
|
||||
int _EXFUN(pthread_cond_init,
|
||||
(pthread_cond_t *__cond, _CONST pthread_condattr_t *__attr));
|
||||
int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex));
|
||||
|
||||
/* This is used to statically initialize a pthread_cond_t. Example:
|
||||
|
||||
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF)
|
||||
|
||||
/* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */
|
||||
|
||||
int _EXFUN(pthread_cond_signal, (pthread_cond_t *__cond));
|
||||
int _EXFUN(pthread_cond_broadcast, (pthread_cond_t *__cond));
|
||||
|
||||
/* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */
|
||||
|
||||
int _EXFUN(pthread_cond_wait,
|
||||
(pthread_cond_t *__cond, pthread_mutex_t *__mutex));
|
||||
|
||||
int _EXFUN(pthread_cond_timedwait,
|
||||
(pthread_cond_t *__cond, pthread_mutex_t *__mutex,
|
||||
_CONST struct timespec *__abstime));
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
|
||||
|
||||
/* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */
|
||||
|
||||
int _EXFUN(pthread_attr_setscope,
|
||||
(pthread_attr_t *__attr, int __contentionscope));
|
||||
int _EXFUN(pthread_attr_getscope,
|
||||
(_CONST pthread_attr_t *__attr, int *__contentionscope));
|
||||
int _EXFUN(pthread_attr_setinheritsched,
|
||||
(pthread_attr_t *__attr, int __inheritsched));
|
||||
int _EXFUN(pthread_attr_getinheritsched,
|
||||
(_CONST pthread_attr_t *__attr, int *__inheritsched));
|
||||
int _EXFUN(pthread_attr_setschedpolicy,
|
||||
(pthread_attr_t *__attr, int __policy));
|
||||
int _EXFUN(pthread_attr_getschedpolicy,
|
||||
(_CONST pthread_attr_t *__attr, int *__policy));
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||
|
||||
int _EXFUN(pthread_attr_setschedparam,
|
||||
(pthread_attr_t *__attr, _CONST struct sched_param *__param));
|
||||
int _EXFUN(pthread_attr_getschedparam,
|
||||
(_CONST pthread_attr_t *__attr, struct sched_param *__param));
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
|
||||
|
||||
/* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */
|
||||
|
||||
int _EXFUN(pthread_getschedparam,
|
||||
(pthread_t __pthread, int *__policy, struct sched_param *__param));
|
||||
int _EXFUN(pthread_setschedparam,
|
||||
(pthread_t __pthread, int __policy, struct sched_param *__param));
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
|
||||
/* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */
|
||||
|
||||
int _EXFUN(pthread_mutexattr_setprotocol,
|
||||
(pthread_mutexattr_t *__attr, int __protocol));
|
||||
int _EXFUN(pthread_mutexattr_getprotocol,
|
||||
(_CONST pthread_mutexattr_t *__attr, int *__protocol));
|
||||
int _EXFUN(pthread_mutexattr_setprioceiling,
|
||||
(pthread_mutexattr_t *__attr, int __prioceiling));
|
||||
int _EXFUN(pthread_mutexattr_getprioceiling,
|
||||
(_CONST pthread_mutexattr_t *__attr, int *__prioceiling));
|
||||
|
||||
#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
|
||||
/* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */
|
||||
|
||||
int _EXFUN(pthread_mutex_setprioceiling,
|
||||
(pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling));
|
||||
int _EXFUN(pthread_mutex_getprioceiling,
|
||||
(pthread_mutex_t *__mutex, int *__prioceiling));
|
||||
|
||||
#endif /* _POSIX_THREAD_PRIO_PROTECT */
|
||||
|
||||
/* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */
|
||||
|
||||
int _EXFUN(pthread_attr_init, (pthread_attr_t *__attr));
|
||||
int _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr));
|
||||
int _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr,
|
||||
void *__stackaddr, size_t __stacksize));
|
||||
int _EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr,
|
||||
void **__stackaddr, size_t *__stacksize));
|
||||
int _EXFUN(pthread_attr_getstacksize,
|
||||
(_CONST pthread_attr_t *__attr, size_t *__stacksize));
|
||||
int _EXFUN(pthread_attr_setstacksize,
|
||||
(pthread_attr_t *__attr, size_t __stacksize));
|
||||
int _EXFUN(pthread_attr_getstackaddr,
|
||||
(_CONST pthread_attr_t *__attr, void **__stackaddr));
|
||||
int _EXFUN(pthread_attr_setstackaddr,
|
||||
(pthread_attr_t *__attr, void *__stackaddr));
|
||||
int _EXFUN(pthread_attr_getdetachstate,
|
||||
(_CONST pthread_attr_t *__attr, int *__detachstate));
|
||||
int _EXFUN(pthread_attr_setdetachstate,
|
||||
(pthread_attr_t *__attr, int __detachstate));
|
||||
int _EXFUN(pthread_attr_getguardsize,
|
||||
(_CONST pthread_attr_t *__attr, size_t *__guardsize));
|
||||
int _EXFUN(pthread_attr_setguardsize,
|
||||
(pthread_attr_t *__attr, size_t __guardsize));
|
||||
|
||||
/* POSIX thread APIs beyond the POSIX standard but provided
|
||||
* in GNU/Linux. They may be provided by other OSes for
|
||||
* compatibility.
|
||||
*/
|
||||
#if defined(__GNU_VISIBLE)
|
||||
#if defined(__rtems__)
|
||||
int _EXFUN(pthread_attr_setaffinity_np,
|
||||
(pthread_attr_t *__attr, size_t __cpusetsize,
|
||||
const cpu_set_t *__cpuset));
|
||||
int _EXFUN(pthread_attr_getaffinity_np,
|
||||
(const pthread_attr_t *__attr, size_t __cpusetsize,
|
||||
cpu_set_t *__cpuset));
|
||||
|
||||
int _EXFUN(pthread_setaffinity_np,
|
||||
(pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset));
|
||||
int _EXFUN(pthread_getaffinity_np,
|
||||
(const pthread_t __id, size_t __cpusetsize, cpu_set_t *__cpuset));
|
||||
|
||||
int _EXFUN(pthread_getattr_np,
|
||||
(pthread_t __id, pthread_attr_t *__attr));
|
||||
#endif /* defined(__rtems__) */
|
||||
#endif /* defined(__GNU_VISIBLE) */
|
||||
|
||||
/* Thread Creation, P1003.1c/Draft 10, p. 144 */
|
||||
|
||||
int _EXFUN(pthread_create,
|
||||
(pthread_t *__pthread, _CONST pthread_attr_t *__attr,
|
||||
void *(*__start_routine)( void * ), void *__arg));
|
||||
|
||||
/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */
|
||||
|
||||
int _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr));
|
||||
|
||||
/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */
|
||||
|
||||
int _EXFUN(pthread_detach, (pthread_t __pthread));
|
||||
|
||||
/* Thread Termination, p1003.1c/Draft 10, p. 150 */
|
||||
|
||||
void _EXFUN(pthread_exit, (void *__value_ptr));
|
||||
|
||||
/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */
|
||||
|
||||
pthread_t _EXFUN(pthread_self, (void));
|
||||
|
||||
/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */
|
||||
|
||||
int _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2));
|
||||
|
||||
/* Dynamic Package Initialization */
|
||||
|
||||
/* This is used to statically initialize a pthread_once_t. Example:
|
||||
|
||||
pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
NOTE: This is named inconsistently -- it should be INITIALIZER. */
|
||||
|
||||
#define PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
|
||||
|
||||
int _EXFUN(pthread_once,
|
||||
(pthread_once_t *__once_control, void (*__init_routine)(void)));
|
||||
|
||||
/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */
|
||||
|
||||
int _EXFUN(pthread_key_create,
|
||||
(pthread_key_t *__key, void (*__destructor)( void * )));
|
||||
|
||||
/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */
|
||||
|
||||
int _EXFUN(pthread_setspecific,
|
||||
(pthread_key_t __key, _CONST void *__value));
|
||||
void * _EXFUN(pthread_getspecific, (pthread_key_t __key));
|
||||
|
||||
/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */
|
||||
|
||||
int _EXFUN(pthread_key_delete, (pthread_key_t __key));
|
||||
|
||||
/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */
|
||||
|
||||
#define PTHREAD_CANCEL_ENABLE 0
|
||||
#define PTHREAD_CANCEL_DISABLE 1
|
||||
|
||||
#define PTHREAD_CANCEL_DEFERRED 0
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
||||
|
||||
#define PTHREAD_CANCELED ((void *) -1)
|
||||
|
||||
int _EXFUN(pthread_cancel, (pthread_t __pthread));
|
||||
|
||||
/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */
|
||||
|
||||
int _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate));
|
||||
int _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype));
|
||||
void _EXFUN(pthread_testcancel, (void));
|
||||
|
||||
/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */
|
||||
|
||||
void _EXFUN(_pthread_cleanup_push,
|
||||
(struct _pthread_cleanup_context *_context,
|
||||
void (*_routine)(void *), void *_arg));
|
||||
|
||||
void _EXFUN(_pthread_cleanup_pop,
|
||||
(struct _pthread_cleanup_context *_context,
|
||||
int _execute));
|
||||
|
||||
/* It is intentional to open and close the scope in two different macros */
|
||||
#define pthread_cleanup_push(_routine, _arg) \
|
||||
do { \
|
||||
struct _pthread_cleanup_context _pthread_clup_ctx; \
|
||||
_pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg))
|
||||
|
||||
#define pthread_cleanup_pop(_execute) \
|
||||
_pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \
|
||||
} while (0)
|
||||
|
||||
#if defined(_GNU_SOURCE)
|
||||
void _EXFUN(_pthread_cleanup_push_defer,
|
||||
(struct _pthread_cleanup_context *_context,
|
||||
void (*_routine)(void *), void *_arg));
|
||||
|
||||
void _EXFUN(_pthread_cleanup_pop_restore,
|
||||
(struct _pthread_cleanup_context *_context,
|
||||
int _execute));
|
||||
|
||||
/* It is intentional to open and close the scope in two different macros */
|
||||
#define pthread_cleanup_push_defer_np(_routine, _arg) \
|
||||
do { \
|
||||
struct _pthread_cleanup_context _pthread_clup_ctx; \
|
||||
_pthread_cleanup_push_defer(&_pthread_clup_ctx, (_routine), (_arg))
|
||||
|
||||
#define pthread_cleanup_pop_restore_np(_execute) \
|
||||
_pthread_cleanup_pop_restore(&_pthread_clup_ctx, (_execute)); \
|
||||
} while (0)
|
||||
#endif /* defined(_GNU_SOURCE) */
|
||||
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
|
||||
/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */
|
||||
|
||||
int _EXFUN(pthread_getcpuclockid,
|
||||
(pthread_t __pthread_id, clockid_t *__clock_id));
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_CPUTIME) */
|
||||
|
||||
|
||||
#endif /* defined(_POSIX_THREADS) */
|
||||
|
||||
#if defined(_POSIX_BARRIERS)
|
||||
|
||||
int _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr));
|
||||
int _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr));
|
||||
int _EXFUN(pthread_barrierattr_getpshared,
|
||||
(_CONST pthread_barrierattr_t *__attr, int *__pshared));
|
||||
int _EXFUN(pthread_barrierattr_setpshared,
|
||||
(pthread_barrierattr_t *__attr, int __pshared));
|
||||
|
||||
#define PTHREAD_BARRIER_SERIAL_THREAD -1
|
||||
|
||||
int _EXFUN(pthread_barrier_init,
|
||||
(pthread_barrier_t *__barrier,
|
||||
_CONST pthread_barrierattr_t *__attr, unsigned __count));
|
||||
int _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier));
|
||||
int _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier));
|
||||
|
||||
#endif /* defined(_POSIX_BARRIERS) */
|
||||
|
||||
#if defined(_POSIX_SPIN_LOCKS)
|
||||
|
||||
int _EXFUN(pthread_spin_init,
|
||||
(pthread_spinlock_t *__spinlock, int __pshared));
|
||||
int _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock));
|
||||
int _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock));
|
||||
int _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock));
|
||||
int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock));
|
||||
|
||||
#endif /* defined(_POSIX_SPIN_LOCKS) */
|
||||
|
||||
#if defined(_POSIX_READER_WRITER_LOCKS)
|
||||
|
||||
/* This is used to statically initialize a pthread_rwlock_t. Example:
|
||||
|
||||
pthread_mutex_t mutex = PTHREAD_RWLOCK_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF)
|
||||
|
||||
int _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr));
|
||||
int _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr));
|
||||
int _EXFUN(pthread_rwlockattr_getpshared,
|
||||
(_CONST pthread_rwlockattr_t *__attr, int *__pshared));
|
||||
int _EXFUN(pthread_rwlockattr_setpshared,
|
||||
(pthread_rwlockattr_t *__attr, int __pshared));
|
||||
|
||||
int _EXFUN(pthread_rwlock_init,
|
||||
(pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr));
|
||||
int _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock));
|
||||
int _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock));
|
||||
int _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock));
|
||||
int _EXFUN(pthread_rwlock_timedrdlock,
|
||||
(pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
|
||||
int _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock));
|
||||
int _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock));
|
||||
int _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock));
|
||||
int _EXFUN(pthread_rwlock_timedwrlock,
|
||||
(pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
|
||||
|
||||
#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
|
||||
|
||||
int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __ESP_PLATFORM_PTHREAD_H__
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
@ -1,29 +1,514 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE 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 _ESP_SYS_UNISTD_H
|
||||
#define _ESP_SYS_UNISTD_H
|
||||
#ifndef _SYS_UNISTD_H
|
||||
#define _SYS_UNISTD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include_next <sys/unistd.h>
|
||||
#include <_ansi.h>
|
||||
#define __need_size_t
|
||||
#define __need_ptrdiff_t
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/_types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
extern char **environ;
|
||||
|
||||
void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((__noreturn__)));
|
||||
|
||||
int _EXFUN(access,(const char *__path, int __amode ));
|
||||
unsigned _EXFUN(alarm, (unsigned __secs ));
|
||||
int _EXFUN(chdir, (const char *__path ));
|
||||
int _EXFUN(chmod, (const char *__path, mode_t __mode ));
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group ));
|
||||
#endif
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
int _EXFUN(chroot, (const char *__path ));
|
||||
#endif
|
||||
int _EXFUN(close, (int __fildes ));
|
||||
#if defined(__CYGWIN__)
|
||||
size_t _EXFUN(confstr, (int __name, char *__buf, size_t __len));
|
||||
#endif
|
||||
char * _EXFUN(ctermid, (char *__s ));
|
||||
char * _EXFUN(cuserid, (char *__s ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(daemon, (int nochdir, int noclose));
|
||||
#endif
|
||||
int _EXFUN(dup, (int __fildes ));
|
||||
int _EXFUN(dup2, (int __fildes, int __fildes2 ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(dup3, (int __fildes, int __fildes2, int flags));
|
||||
int _EXFUN(eaccess, (const char *__path, int __mode));
|
||||
void _EXFUN(endusershell, (void));
|
||||
int _EXFUN(euidaccess, (const char *__path, int __mode));
|
||||
#endif
|
||||
int _EXFUN(execl, (const char *__path, const char *, ... ));
|
||||
int _EXFUN(execle, (const char *__path, const char *, ... ));
|
||||
int _EXFUN(execlp, (const char *__file, const char *, ... ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(execlpe, (const char *__file, const char *, ... ));
|
||||
#endif
|
||||
int _EXFUN(execv, (const char *__path, char * const __argv[] ));
|
||||
int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
|
||||
int _EXFUN(execvp, (const char *__file, char * const __argv[] ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(execvpe, (const char *__file, char * const __argv[], char * const __envp[] ));
|
||||
#endif
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags));
|
||||
#endif
|
||||
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__SPU__)
|
||||
int _EXFUN(fchdir, (int __fildes));
|
||||
#endif
|
||||
int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
|
||||
#endif
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(fexecve, (int __fd, char * const __argv[], char * const __envp[] ));
|
||||
#endif
|
||||
pid_t _EXFUN(fork, (void ));
|
||||
long _EXFUN(fpathconf, (int __fd, int __name ));
|
||||
int _EXFUN(fsync, (int __fd));
|
||||
int _EXFUN(fdatasync, (int __fd));
|
||||
#if defined(__CYGWIN__)
|
||||
char * _EXFUN(get_current_dir_name, (void));
|
||||
#endif
|
||||
char * _EXFUN(getcwd, (char *__buf, size_t __size ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(getdomainname ,(char *__name, size_t __len));
|
||||
#endif
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
gid_t _EXFUN(getegid, (void ));
|
||||
uid_t _EXFUN(geteuid, (void ));
|
||||
gid_t _EXFUN(getgid, (void ));
|
||||
#endif
|
||||
int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
|
||||
#if defined(__CYGWIN__)
|
||||
long _EXFUN(gethostid, (void));
|
||||
#endif
|
||||
char * _EXFUN(getlogin, (void ));
|
||||
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
|
||||
int _EXFUN(getlogin_r, (char *name, size_t namesize) );
|
||||
#endif
|
||||
char * _EXFUN(getpass, (const char *__prompt));
|
||||
int _EXFUN(getpagesize, (void));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(getpeereid, (int, uid_t *, gid_t *));
|
||||
#endif
|
||||
pid_t _EXFUN(getpgid, (pid_t));
|
||||
pid_t _EXFUN(getpgrp, (void ));
|
||||
pid_t _EXFUN(getpid, (void ));
|
||||
pid_t _EXFUN(getppid, (void ));
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
pid_t _EXFUN(getsid, (pid_t));
|
||||
#endif
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
uid_t _EXFUN(getuid, (void ));
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
char * _EXFUN(getusershell, (void));
|
||||
char * _EXFUN(getwd, (char *__buf ));
|
||||
int _EXFUN(iruserok, (unsigned long raddr, int superuser, const char *ruser, const char *luser));
|
||||
#endif
|
||||
int _EXFUN(isatty, (int __fildes ));
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
|
||||
#endif
|
||||
int _EXFUN(link, (const char *__path1, const char *__path2 ));
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags ));
|
||||
#endif
|
||||
int _EXFUN(nice, (int __nice_value ));
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
|
||||
#endif
|
||||
#if defined(__SPU__) || defined(__CYGWIN__)
|
||||
#define F_ULOCK 0
|
||||
#define F_LOCK 1
|
||||
#define F_TLOCK 2
|
||||
#define F_TEST 3
|
||||
int _EXFUN(lockf, (int __fd, int __cmd, off_t __len));
|
||||
#endif
|
||||
long _EXFUN(pathconf, (const char *__path, int __name ));
|
||||
int _EXFUN(pause, (void ));
|
||||
#ifdef __CYGWIN__
|
||||
int _EXFUN(pthread_atfork, (void (*)(void), void (*)(void), void (*)(void)));
|
||||
#endif
|
||||
int _EXFUN(pipe, (int __fildes[2] ));
|
||||
#ifdef __CYGWIN__
|
||||
int _EXFUN(pipe2, (int __fildes[2], int flags));
|
||||
#endif
|
||||
ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset));
|
||||
ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset));
|
||||
_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(rresvport, (int *__alport));
|
||||
int _EXFUN(revoke, (char *__path));
|
||||
#endif
|
||||
int _EXFUN(rmdir, (const char *__path ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser));
|
||||
#endif
|
||||
void * _EXFUN(sbrk, (ptrdiff_t __incr));
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
int _EXFUN(setegid, (gid_t __gid ));
|
||||
int _EXFUN(seteuid, (uid_t __uid ));
|
||||
#endif
|
||||
int _EXFUN(setgid, (gid_t __gid ));
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(setgroups, (int ngroups, const gid_t *grouplist ));
|
||||
#endif
|
||||
#if __BSD_VISIBLE || (defined(_XOPEN_SOURCE) && __XSI_VISIBLE < 500)
|
||||
int _EXFUN(sethostname, (const char *, size_t));
|
||||
#endif
|
||||
int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
|
||||
int _EXFUN(setpgrp, (void ));
|
||||
#if defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(setregid, (gid_t __rgid, gid_t __egid));
|
||||
int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid));
|
||||
#endif
|
||||
pid_t _EXFUN(setsid, (void ));
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(setuid, (uid_t __uid ));
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
void _EXFUN(setusershell, (void));
|
||||
#endif
|
||||
unsigned _EXFUN(sleep, (unsigned int __seconds ));
|
||||
void _EXFUN(swab, (const void *__restrict, void *__restrict, ssize_t));
|
||||
long _EXFUN(sysconf, (int __name ));
|
||||
pid_t _EXFUN(tcgetpgrp, (int __fildes ));
|
||||
int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
|
||||
char * _EXFUN(ttyname, (int __fildes ));
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
int _EXFUN(ttyname_r, (int, char *, size_t));
|
||||
#endif
|
||||
int _EXFUN(unlink, (const char *__path ));
|
||||
int _EXFUN(usleep, (useconds_t __useconds));
|
||||
int _EXFUN(vhangup, (void ));
|
||||
_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte ));
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# define __UNISTD_GETOPT__
|
||||
# include <getopt.h>
|
||||
# undef __UNISTD_GETOPT__
|
||||
#else
|
||||
extern char *optarg; /* getopt(3) external variables */
|
||||
extern int optind, opterr, optopt;
|
||||
int getopt(int, char * const [], const char *);
|
||||
extern int optreset; /* getopt(3) external variable */
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
pid_t _EXFUN(vfork, (void ));
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
/* Provide prototypes for most of the _<systemcall> names that are
|
||||
provided in newlib for some compilers. */
|
||||
int _EXFUN(_close, (int __fildes ));
|
||||
pid_t _EXFUN(_fork, (void ));
|
||||
pid_t _EXFUN(_getpid, (void ));
|
||||
int _EXFUN(_isatty, (int __fildes ));
|
||||
int _EXFUN(_link, (const char *__path1, const char *__path2 ));
|
||||
_off_t _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence ));
|
||||
#ifdef __LARGE64_FILES
|
||||
_off64_t _EXFUN(_lseek64, (int __filedes, _off64_t __offset, int __whence ));
|
||||
#endif
|
||||
_READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte ));
|
||||
void * _EXFUN(_sbrk, (ptrdiff_t __incr));
|
||||
int _EXFUN(_unlink, (const char *__path ));
|
||||
_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte ));
|
||||
int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__aarch64__) || defined (__arm__) || defined(__sh__) || defined(__SPU__)
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(ftruncate, (int __fd, off_t __length));
|
||||
int _EXFUN(truncate, (const char *, off_t __length));
|
||||
int _EXFUN(gethostname, (char *__name, size_t __len));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
int _EXFUN(getdtablesize, (void));
|
||||
int _EXFUN(setdtablesize, (int));
|
||||
useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
|
||||
#if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
|
||||
/* winsock[2].h defines as __stdcall, and with int as 2nd arg */
|
||||
int _EXFUN(gethostname, (char *__name, size_t __len));
|
||||
#endif
|
||||
char * _EXFUN(mktemp, (char *));
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__SPU__) || defined(__rtems__)
|
||||
void _EXFUN(sync, (void));
|
||||
#endif
|
||||
|
||||
ssize_t _EXFUN(readlink, (const char *__restrict __path,
|
||||
char *__restrict __buf, size_t __buflen));
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__restrict __path,
|
||||
char *__restrict __buf, size_t __buflen));
|
||||
#endif
|
||||
int _EXFUN(symlink, (const char *__name1, const char *__name2));
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
int _EXFUN(symlinkat, (const char *, int, const char *));
|
||||
int _EXFUN(unlinkat, (int, const char *, int));
|
||||
#endif
|
||||
|
||||
#define F_OK 0
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
|
||||
# define SEEK_SET 0
|
||||
# define SEEK_CUR 1
|
||||
# define SEEK_END 2
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#define STDIN_FILENO 0 /* standard input file descriptor */
|
||||
#define STDOUT_FILENO 1 /* standard output file descriptor */
|
||||
#define STDERR_FILENO 2 /* standard error file descriptor */
|
||||
|
||||
/*
|
||||
* sysconf values per IEEE Std 1003.1, 2008 Edition
|
||||
*/
|
||||
|
||||
#define _SC_ARG_MAX 0
|
||||
#define _SC_CHILD_MAX 1
|
||||
#define _SC_CLK_TCK 2
|
||||
#define _SC_NGROUPS_MAX 3
|
||||
#define _SC_OPEN_MAX 4
|
||||
#define _SC_JOB_CONTROL 5
|
||||
#define _SC_SAVED_IDS 6
|
||||
#define _SC_VERSION 7
|
||||
#define _SC_PAGESIZE 8
|
||||
#define _SC_PAGE_SIZE _SC_PAGESIZE
|
||||
/* These are non-POSIX values we accidentally introduced in 2000 without
|
||||
guarding them. Keeping them unguarded for backward compatibility. */
|
||||
#define _SC_NPROCESSORS_CONF 9
|
||||
#define _SC_NPROCESSORS_ONLN 10
|
||||
#define _SC_PHYS_PAGES 11
|
||||
#define _SC_AVPHYS_PAGES 12
|
||||
/* End of non-POSIX values. */
|
||||
#define _SC_MQ_OPEN_MAX 13
|
||||
#define _SC_MQ_PRIO_MAX 14
|
||||
#define _SC_RTSIG_MAX 15
|
||||
#define _SC_SEM_NSEMS_MAX 16
|
||||
#define _SC_SEM_VALUE_MAX 17
|
||||
#define _SC_SIGQUEUE_MAX 18
|
||||
#define _SC_TIMER_MAX 19
|
||||
#define _SC_TZNAME_MAX 20
|
||||
#define _SC_ASYNCHRONOUS_IO 21
|
||||
#define _SC_FSYNC 22
|
||||
#define _SC_MAPPED_FILES 23
|
||||
#define _SC_MEMLOCK 24
|
||||
#define _SC_MEMLOCK_RANGE 25
|
||||
#define _SC_MEMORY_PROTECTION 26
|
||||
#define _SC_MESSAGE_PASSING 27
|
||||
#define _SC_PRIORITIZED_IO 28
|
||||
#define _SC_REALTIME_SIGNALS 29
|
||||
#define _SC_SEMAPHORES 30
|
||||
#define _SC_SHARED_MEMORY_OBJECTS 31
|
||||
#define _SC_SYNCHRONIZED_IO 32
|
||||
#define _SC_TIMERS 33
|
||||
#define _SC_AIO_LISTIO_MAX 34
|
||||
#define _SC_AIO_MAX 35
|
||||
#define _SC_AIO_PRIO_DELTA_MAX 36
|
||||
#define _SC_DELAYTIMER_MAX 37
|
||||
#define _SC_THREAD_KEYS_MAX 38
|
||||
#define _SC_THREAD_STACK_MIN 39
|
||||
#define _SC_THREAD_THREADS_MAX 40
|
||||
#define _SC_TTY_NAME_MAX 41
|
||||
#define _SC_THREADS 42
|
||||
#define _SC_THREAD_ATTR_STACKADDR 43
|
||||
#define _SC_THREAD_ATTR_STACKSIZE 44
|
||||
#define _SC_THREAD_PRIORITY_SCHEDULING 45
|
||||
#define _SC_THREAD_PRIO_INHERIT 46
|
||||
/* _SC_THREAD_PRIO_PROTECT was _SC_THREAD_PRIO_CEILING in early drafts */
|
||||
#define _SC_THREAD_PRIO_PROTECT 47
|
||||
#define _SC_THREAD_PRIO_CEILING _SC_THREAD_PRIO_PROTECT
|
||||
#define _SC_THREAD_PROCESS_SHARED 48
|
||||
#define _SC_THREAD_SAFE_FUNCTIONS 49
|
||||
#define _SC_GETGR_R_SIZE_MAX 50
|
||||
#define _SC_GETPW_R_SIZE_MAX 51
|
||||
#define _SC_LOGIN_NAME_MAX 52
|
||||
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 53
|
||||
#define _SC_ADVISORY_INFO 54
|
||||
#define _SC_ATEXIT_MAX 55
|
||||
#define _SC_BARRIERS 56
|
||||
#define _SC_BC_BASE_MAX 57
|
||||
#define _SC_BC_DIM_MAX 58
|
||||
#define _SC_BC_SCALE_MAX 59
|
||||
#define _SC_BC_STRING_MAX 60
|
||||
#define _SC_CLOCK_SELECTION 61
|
||||
#define _SC_COLL_WEIGHTS_MAX 62
|
||||
#define _SC_CPUTIME 63
|
||||
#define _SC_EXPR_NEST_MAX 64
|
||||
#define _SC_HOST_NAME_MAX 65
|
||||
#define _SC_IOV_MAX 66
|
||||
#define _SC_IPV6 67
|
||||
#define _SC_LINE_MAX 68
|
||||
#define _SC_MONOTONIC_CLOCK 69
|
||||
#define _SC_RAW_SOCKETS 70
|
||||
#define _SC_READER_WRITER_LOCKS 71
|
||||
#define _SC_REGEXP 72
|
||||
#define _SC_RE_DUP_MAX 73
|
||||
#define _SC_SHELL 74
|
||||
#define _SC_SPAWN 75
|
||||
#define _SC_SPIN_LOCKS 76
|
||||
#define _SC_SPORADIC_SERVER 77
|
||||
#define _SC_SS_REPL_MAX 78
|
||||
#define _SC_SYMLOOP_MAX 79
|
||||
#define _SC_THREAD_CPUTIME 80
|
||||
#define _SC_THREAD_SPORADIC_SERVER 81
|
||||
#define _SC_TIMEOUTS 82
|
||||
#define _SC_TRACE 83
|
||||
#define _SC_TRACE_EVENT_FILTER 84
|
||||
#define _SC_TRACE_EVENT_NAME_MAX 85
|
||||
#define _SC_TRACE_INHERIT 86
|
||||
#define _SC_TRACE_LOG 87
|
||||
#define _SC_TRACE_NAME_MAX 88
|
||||
#define _SC_TRACE_SYS_MAX 89
|
||||
#define _SC_TRACE_USER_EVENT_MAX 90
|
||||
#define _SC_TYPED_MEMORY_OBJECTS 91
|
||||
#define _SC_V7_ILP32_OFF32 92
|
||||
#define _SC_V6_ILP32_OFF32 _SC_V7_ILP32_OFF32
|
||||
#define _SC_XBS5_ILP32_OFF32 _SC_V7_ILP32_OFF32
|
||||
#define _SC_V7_ILP32_OFFBIG 93
|
||||
#define _SC_V6_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG
|
||||
#define _SC_XBS5_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG
|
||||
#define _SC_V7_LP64_OFF64 94
|
||||
#define _SC_V6_LP64_OFF64 _SC_V7_LP64_OFF64
|
||||
#define _SC_XBS5_LP64_OFF64 _SC_V7_LP64_OFF64
|
||||
#define _SC_V7_LPBIG_OFFBIG 95
|
||||
#define _SC_V6_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG
|
||||
#define _SC_XBS5_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG
|
||||
#define _SC_XOPEN_CRYPT 96
|
||||
#define _SC_XOPEN_ENH_I18N 97
|
||||
#define _SC_XOPEN_LEGACY 98
|
||||
#define _SC_XOPEN_REALTIME 99
|
||||
#define _SC_STREAM_MAX 100
|
||||
#define _SC_PRIORITY_SCHEDULING 101
|
||||
#define _SC_XOPEN_REALTIME_THREADS 102
|
||||
#define _SC_XOPEN_SHM 103
|
||||
#define _SC_XOPEN_STREAMS 104
|
||||
#define _SC_XOPEN_UNIX 105
|
||||
#define _SC_XOPEN_VERSION 106
|
||||
#define _SC_2_CHAR_TERM 107
|
||||
#define _SC_2_C_BIND 108
|
||||
#define _SC_2_C_DEV 109
|
||||
#define _SC_2_FORT_DEV 110
|
||||
#define _SC_2_FORT_RUN 111
|
||||
#define _SC_2_LOCALEDEF 112
|
||||
#define _SC_2_PBS 113
|
||||
#define _SC_2_PBS_ACCOUNTING 114
|
||||
#define _SC_2_PBS_CHECKPOINT 115
|
||||
#define _SC_2_PBS_LOCATE 116
|
||||
#define _SC_2_PBS_MESSAGE 117
|
||||
#define _SC_2_PBS_TRACK 118
|
||||
#define _SC_2_SW_DEV 119
|
||||
#define _SC_2_UPE 120
|
||||
#define _SC_2_VERSION 121
|
||||
#define _SC_THREAD_ROBUST_PRIO_INHERIT 122
|
||||
#define _SC_THREAD_ROBUST_PRIO_PROTECT 123
|
||||
#define _SC_XOPEN_UUCP 124
|
||||
|
||||
/*
|
||||
* pathconf values per IEEE Std 1003.1, 2008 Edition
|
||||
*/
|
||||
|
||||
#define _PC_LINK_MAX 0
|
||||
#define _PC_MAX_CANON 1
|
||||
#define _PC_MAX_INPUT 2
|
||||
#define _PC_NAME_MAX 3
|
||||
#define _PC_PATH_MAX 4
|
||||
#define _PC_PIPE_BUF 5
|
||||
#define _PC_CHOWN_RESTRICTED 6
|
||||
#define _PC_NO_TRUNC 7
|
||||
#define _PC_VDISABLE 8
|
||||
#define _PC_ASYNC_IO 9
|
||||
#define _PC_PRIO_IO 10
|
||||
#define _PC_SYNC_IO 11
|
||||
#define _PC_FILESIZEBITS 12
|
||||
#define _PC_2_SYMLINKS 13
|
||||
#define _PC_SYMLINK_MAX 14
|
||||
#define _PC_ALLOC_SIZE_MIN 15
|
||||
#define _PC_REC_INCR_XFER_SIZE 16
|
||||
#define _PC_REC_MAX_XFER_SIZE 17
|
||||
#define _PC_REC_MIN_XFER_SIZE 18
|
||||
#define _PC_REC_XFER_ALIGN 19
|
||||
#define _PC_TIMESTAMP_RESOLUTION 20
|
||||
#ifdef __CYGWIN__
|
||||
/* Ask for POSIX permission bits support. */
|
||||
#define _PC_POSIX_PERMISSIONS 90
|
||||
/* Ask for full POSIX permission support including uid/gid settings. */
|
||||
#define _PC_POSIX_SECURITY 91
|
||||
#endif
|
||||
|
||||
/*
|
||||
* confstr values per IEEE Std 1003.1, 2004 Edition
|
||||
*/
|
||||
|
||||
#ifdef __CYGWIN__ /* Only defined on Cygwin for now. */
|
||||
#define _CS_PATH 0
|
||||
#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1
|
||||
#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
|
||||
#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
|
||||
#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 2
|
||||
#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
|
||||
#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
|
||||
#define _CS_POSIX_V7_ILP32_OFF32_LIBS 3
|
||||
#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS
|
||||
#define _CS_XBS5_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS
|
||||
#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 4
|
||||
#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 5
|
||||
#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
|
||||
#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
|
||||
#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 6
|
||||
#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
|
||||
#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
|
||||
#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 7
|
||||
#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS
|
||||
#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS
|
||||
#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 8
|
||||
#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 9
|
||||
#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS
|
||||
#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS
|
||||
#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 10
|
||||
#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS
|
||||
#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS
|
||||
#define _CS_POSIX_V7_LP64_OFF64_LIBS 11
|
||||
#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS
|
||||
#define _CS_XBS5_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS
|
||||
#define _CS_XBS5_LP64_OFF64_LINTFLAGS 12
|
||||
#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 13
|
||||
#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
|
||||
#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
|
||||
#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 14
|
||||
#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
|
||||
#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
|
||||
#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 15
|
||||
#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
|
||||
#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
|
||||
#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 16
|
||||
#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 17
|
||||
#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
|
||||
#define _CS_XBS5_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
|
||||
#define _CS_POSIX_V7_THREADS_CFLAGS 18
|
||||
#define _CS_POSIX_V7_THREADS_LDFLAGS 19
|
||||
#define _CS_V7_ENV 20
|
||||
#define _CS_V6_ENV _CS_V7_ENV
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,35 +1,291 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE 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.
|
||||
/*
|
||||
* time.h
|
||||
*
|
||||
* Struct and function declarations for dealing with time.
|
||||
*/
|
||||
|
||||
#ifndef _TIME_H_
|
||||
#define _TIME_H_
|
||||
|
||||
#ifndef _ESP_TIME_H
|
||||
#define _ESP_TIME_H
|
||||
#include "_ansi.h"
|
||||
#include <sys/reent.h>
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
/* Get _CLOCKS_PER_SEC_ */
|
||||
#include <machine/time.h>
|
||||
|
||||
#ifndef _CLOCKS_PER_SEC_
|
||||
#define _CLOCKS_PER_SEC_ 1000
|
||||
#endif
|
||||
|
||||
#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
|
||||
#define CLK_TCK CLOCKS_PER_SEC
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
struct tm
|
||||
{
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
#ifdef __TM_GMTOFF
|
||||
long __TM_GMTOFF;
|
||||
#endif
|
||||
#ifdef __TM_ZONE
|
||||
const char *__TM_ZONE;
|
||||
#endif
|
||||
};
|
||||
|
||||
clock_t _EXFUN(clock, (void));
|
||||
double _EXFUN(difftime, (time_t _time2, time_t _time1));
|
||||
time_t _EXFUN(mktime, (struct tm *_timeptr));
|
||||
time_t _EXFUN(time, (time_t *_timer));
|
||||
#ifndef _REENT_ONLY
|
||||
char *_EXFUN(asctime, (const struct tm *_tblock));
|
||||
char *_EXFUN(ctime, (const time_t *_time));
|
||||
struct tm *_EXFUN(gmtime, (const time_t *_timer));
|
||||
struct tm *_EXFUN(localtime,(const time_t *_timer));
|
||||
#endif
|
||||
size_t _EXFUN(strftime, (char *__restrict _s,
|
||||
size_t _maxsize, const char *__restrict _fmt,
|
||||
const struct tm *__restrict _t));
|
||||
|
||||
char *_EXFUN(asctime_r, (const struct tm *__restrict,
|
||||
char *__restrict));
|
||||
char *_EXFUN(ctime_r, (const time_t *, char *));
|
||||
struct tm *_EXFUN(gmtime_r, (const time_t *__restrict,
|
||||
struct tm *__restrict));
|
||||
struct tm *_EXFUN(localtime_r, (const time_t *__restrict,
|
||||
struct tm *__restrict));
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include_next <time.h>
|
||||
|
||||
#define _POSIX_TIMERS 1
|
||||
#define CLOCK_MONOTONIC (clockid_t)4
|
||||
#define CLOCK_BOOTTIME (clockid_t)4
|
||||
#ifndef __STRICT_ANSI__
|
||||
char *_EXFUN(strptime, (const char *__restrict,
|
||||
const char *__restrict,
|
||||
struct tm *__restrict));
|
||||
_VOID _EXFUN(tzset, (_VOID));
|
||||
_VOID _EXFUN(_tzset_r, (struct _reent *));
|
||||
|
||||
typedef struct __tzrule_struct
|
||||
{
|
||||
char ch;
|
||||
int m;
|
||||
int n;
|
||||
int d;
|
||||
int s;
|
||||
time_t change;
|
||||
long offset; /* Match type of _timezone. */
|
||||
} __tzrule_type;
|
||||
|
||||
typedef struct __tzinfo_struct
|
||||
{
|
||||
int __tznorth;
|
||||
int __tzyear;
|
||||
__tzrule_type __tzrule[2];
|
||||
} __tzinfo_type;
|
||||
|
||||
__tzinfo_type *_EXFUN (__gettzinfo, (_VOID));
|
||||
|
||||
/* getdate functions */
|
||||
|
||||
#ifdef HAVE_GETDATE
|
||||
#ifndef _REENT_ONLY
|
||||
#define getdate_err (*__getdate_err())
|
||||
int *_EXFUN(__getdate_err,(_VOID));
|
||||
|
||||
struct tm * _EXFUN(getdate, (const char *));
|
||||
/* getdate_err is set to one of the following values to indicate the error.
|
||||
1 the DATEMSK environment variable is null or undefined,
|
||||
2 the template file cannot be opened for reading,
|
||||
3 failed to get file status information,
|
||||
4 the template file is not a regular file,
|
||||
5 an error is encountered while reading the template file,
|
||||
6 memory allication failed (not enough memory available),
|
||||
7 there is no line in the template that matches the input,
|
||||
8 invalid input specification */
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
/* getdate_r returns the error code as above */
|
||||
int _EXFUN(getdate_r, (const char *, struct tm *));
|
||||
#endif /* HAVE_GETDATE */
|
||||
|
||||
/* defines for the opengroup specifications Derived from Issue 1 of the SVID. */
|
||||
extern __IMPORT long _timezone;
|
||||
extern __IMPORT int _daylight;
|
||||
extern __IMPORT char *_tzname[2];
|
||||
|
||||
/* POSIX defines the external tzname being defined in time.h */
|
||||
#ifndef tzname
|
||||
#define tzname _tzname
|
||||
#endif
|
||||
#endif /* !__STRICT_ANSI__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <cygwin/time.h>
|
||||
#endif /*__CYGWIN__*/
|
||||
|
||||
#if defined(_POSIX_TIMERS)
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Clocks, P1003.1b-1993, p. 263 */
|
||||
|
||||
int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp));
|
||||
int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp));
|
||||
int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res));
|
||||
|
||||
/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
|
||||
|
||||
int _EXFUN(timer_create,
|
||||
(clockid_t clock_id,
|
||||
struct sigevent *__restrict evp,
|
||||
timer_t *__restrict timerid));
|
||||
|
||||
/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
|
||||
|
||||
int _EXFUN(timer_delete, (timer_t timerid));
|
||||
|
||||
/* Per-Process Timers, P1003.1b-1993, p. 267 */
|
||||
|
||||
int _EXFUN(timer_settime,
|
||||
(timer_t timerid, int flags,
|
||||
const struct itimerspec *__restrict value,
|
||||
struct itimerspec *__restrict ovalue));
|
||||
int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value));
|
||||
int _EXFUN(timer_getoverrun, (timer_t timerid));
|
||||
|
||||
/* High Resolution Sleep, P1003.1b-1993, p. 269 */
|
||||
|
||||
int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _ESP_TIME_H */
|
||||
#endif /* _POSIX_TIMERS */
|
||||
|
||||
#if defined(_POSIX_CLOCK_SELECTION)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int _EXFUN(clock_nanosleep,
|
||||
(clockid_t clock_id, int flags, const struct timespec *rqtp,
|
||||
struct timespec *rmtp));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _POSIX_CLOCK_SELECTION */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
|
||||
|
||||
/* values for the clock enable attribute */
|
||||
|
||||
#define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */
|
||||
#define CLOCK_DISABLED 0 /* clock is disabled */
|
||||
|
||||
/* values for the pthread cputime_clock_allowed attribute */
|
||||
|
||||
#define CLOCK_ALLOWED 1 /* If a thread is created with this value a */
|
||||
/* CPU-time clock attached to that thread */
|
||||
/* shall be accessible. */
|
||||
#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
|
||||
/* thread shall not have a CPU-time clock */
|
||||
/* accessible. */
|
||||
|
||||
/* Manifest Constants, P1003.1b-1993, p. 262 */
|
||||
|
||||
#define CLOCK_REALTIME (clockid_t)1
|
||||
|
||||
/* Flag indicating time is "absolute" with respect to the clock
|
||||
associated with a time. */
|
||||
|
||||
#define TIMER_ABSTIME 4
|
||||
|
||||
/* Manifest Constants, P1003.4b/D8, p. 55 */
|
||||
|
||||
#if defined(_POSIX_CPUTIME)
|
||||
|
||||
/* When used in a clock or timer function call, this is interpreted as
|
||||
the identifier of the CPU_time clock associated with the PROCESS
|
||||
making the function call. */
|
||||
|
||||
#define CLOCK_PROCESS_CPUTIME_ID (clockid_t)2
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
|
||||
/* When used in a clock or timer function call, this is interpreted as
|
||||
the identifier of the CPU_time clock associated with the THREAD
|
||||
making the function call. */
|
||||
|
||||
#define CLOCK_THREAD_CPUTIME_ID (clockid_t)3
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_MONOTONIC_CLOCK)
|
||||
|
||||
/* The identifier for the system-wide monotonic clock, which is defined
|
||||
* as a clock whose value cannot be set via clock_settime() and which
|
||||
* cannot have backward clock jumps. */
|
||||
|
||||
#define CLOCK_MONOTONIC (clockid_t)4
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_CPUTIME)
|
||||
|
||||
/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
|
||||
|
||||
int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id));
|
||||
|
||||
#endif /* _POSIX_CPUTIME */
|
||||
|
||||
#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
|
||||
|
||||
/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
|
||||
|
||||
int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr));
|
||||
int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr));
|
||||
|
||||
#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TIME_H_ */
|
||||
|
||||
|
Reference in New Issue
Block a user