Zephyr API Documentation  3.6.0
A Scalable Open Source RTOS
3.6.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
posix_types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_POSIX_TYPES_H_
8#define ZEPHYR_INCLUDE_POSIX_TYPES_H_
9
10#if !(defined(CONFIG_ARCH_POSIX) && defined(CONFIG_EXTERNAL_LIBC))
11#include <sys/types.h>
12#endif
13
14#ifdef CONFIG_NEWLIB_LIBC
15#include <sys/_pthreadtypes.h>
16#endif
17
18#include <zephyr/kernel.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24typedef int pid_t;
25
26#ifndef __useconds_t_defined
27typedef unsigned long useconds_t;
28#endif
29
30/* time related attributes */
31#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCMWDT_LIBC)
32#ifndef __clockid_t_defined
34#endif
35#endif /* !CONFIG_NEWLIB_LIBC && !CONFIG_ARCMWDT_LIBC */
36#ifndef __timer_t_defined
37typedef unsigned long timer_t;
38#endif
39
40/* Thread attributes */
42 void *stack;
44};
45
46#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
47 || defined(CONFIG_ARCMWDT_LIBC)
48typedef struct pthread_attr pthread_attr_t;
49#endif
50
51BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
52
55
56/* Semaphore */
57typedef struct k_sem sem_t;
58
59/* Mutex */
61
63 int type;
64};
65#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
66 || defined(CONFIG_ARCMWDT_LIBC)
67typedef struct pthread_mutexattr pthread_mutexattr_t;
68#endif
69BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
70
71/* Condition variables */
73
76};
77
78#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
79 || defined(CONFIG_ARCMWDT_LIBC)
80typedef struct pthread_condattr pthread_condattr_t;
81#endif
82BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
83
84/* Barrier */
86
87typedef struct pthread_barrierattr {
90
92
94
96 bool flag;
97};
98
99#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
100 || defined(CONFIG_ARCMWDT_LIBC)
101typedef uint32_t pthread_key_t;
102typedef struct pthread_once pthread_once_t;
103#endif
104
105/* Newlib typedefs pthread_once_t as a struct with two ints */
106BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* ZEPHYR_INCLUDE_POSIX_TYPES_H_ */
Public kernel APIs.
uint32_t pthread_cond_t
Definition: posix_types.h:72
unsigned long useconds_t
Definition: posix_types.h:27
uint32_t pthread_spinlock_t
Definition: posix_types.h:54
struct pthread_barrierattr pthread_barrierattr_t
int pid_t
Definition: posix_types.h:24
uint32_t pthread_t
Definition: posix_types.h:53
uint32_t pthread_mutex_t
Definition: posix_types.h:60
uint32_t pthread_rwlockattr_t
Definition: posix_types.h:91
unsigned long timer_t
Definition: posix_types.h:37
uint32_t clockid_t
Definition: posix_types.h:33
uint32_t pthread_rwlock_t
Definition: posix_types.h:93
uint32_t pthread_barrier_t
Definition: posix_types.h:85
struct k_sem sem_t
Definition: posix_types.h:57
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Definition: posix_types.h:41
void * stack
Definition: posix_types.h:42
uint32_t details[2]
Definition: posix_types.h:43
Definition: posix_types.h:87
int pshared
Definition: posix_types.h:88
Definition: posix_types.h:74
clockid_t clock
Definition: posix_types.h:75
Definition: posix_types.h:62
int type
Definition: posix_types.h:63
Definition: posix_types.h:95
bool flag
Definition: posix_types.h:96