Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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 unsigned char type: 2;
64 bool initialized: 1;
65};
66#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
67 || defined(CONFIG_ARCMWDT_LIBC)
68typedef struct pthread_mutexattr pthread_mutexattr_t;
69#endif
70BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
71
72/* Condition variables */
74
77};
78
79#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
80 || defined(CONFIG_ARCMWDT_LIBC)
81typedef struct pthread_condattr pthread_condattr_t;
82#endif
83BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
84
85/* Barrier */
87
88typedef struct pthread_barrierattr {
91
93
95
97 bool flag;
98};
99
100#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
101 || defined(CONFIG_ARCMWDT_LIBC)
102typedef uint32_t pthread_key_t;
103typedef struct pthread_once pthread_once_t;
104#endif
105
106/* Newlib typedefs pthread_once_t as a struct with two ints */
107BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
108
109#ifdef __cplusplus
110}
111#endif
112
113#endif /* ZEPHYR_INCLUDE_POSIX_TYPES_H_ */
Public kernel APIs.
uint32_t pthread_cond_t
Definition: posix_types.h:73
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:92
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:94
uint32_t pthread_barrier_t
Definition: posix_types.h:86
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:88
int pshared
Definition: posix_types.h:89
Definition: posix_types.h:75
clockid_t clock
Definition: posix_types.h:76
Definition: posix_types.h:62
unsigned char type
Definition: posix_types.h:63
bool initialized
Definition: posix_types.h:64
Definition: posix_types.h:96
bool flag
Definition: posix_types.h:97