Zephyr API Documentation  3.7.0
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
24#if !defined(CONFIG_ARCMWDT_LIBC)
25typedef int pid_t;
26#endif
27
28#ifndef __useconds_t_defined
29typedef unsigned long useconds_t;
30#endif
31
32/* time related attributes */
33#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCMWDT_LIBC)
34#ifndef __clockid_t_defined
36#endif
37#endif /* !CONFIG_NEWLIB_LIBC && !CONFIG_ARCMWDT_LIBC */
38#ifndef __timer_t_defined
39typedef unsigned long timer_t;
40#endif
41
42/* Thread attributes */
44 void *stack;
46};
47
48#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
49 || defined(CONFIG_ARCMWDT_LIBC)
50typedef struct pthread_attr pthread_attr_t;
51#endif
52
53BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
54
57
58/* Semaphore */
59typedef struct k_sem sem_t;
60
61/* Mutex */
63
65 unsigned char type: 2;
66 bool initialized: 1;
67};
68#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
69 || defined(CONFIG_ARCMWDT_LIBC)
70typedef struct pthread_mutexattr pthread_mutexattr_t;
71#endif
72BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
73
74/* Condition variables */
76
79};
80
81#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
82 || defined(CONFIG_ARCMWDT_LIBC)
83typedef struct pthread_condattr pthread_condattr_t;
84#endif
85BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
86
87/* Barrier */
89
90typedef struct pthread_barrierattr {
93
95
97
99 bool flag;
100};
101
102#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
103 || defined(CONFIG_ARCMWDT_LIBC)
104typedef uint32_t pthread_key_t;
105typedef struct pthread_once pthread_once_t;
106#endif
107
108/* Newlib typedefs pthread_once_t as a struct with two ints */
109BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* ZEPHYR_INCLUDE_POSIX_TYPES_H_ */
Public kernel APIs.
uint32_t pthread_cond_t
Definition: posix_types.h:75
unsigned long useconds_t
Definition: posix_types.h:29
uint32_t pthread_spinlock_t
Definition: posix_types.h:56
struct pthread_barrierattr pthread_barrierattr_t
int pid_t
Definition: posix_types.h:25
uint32_t pthread_t
Definition: posix_types.h:55
uint32_t pthread_mutex_t
Definition: posix_types.h:62
uint32_t pthread_rwlockattr_t
Definition: posix_types.h:94
unsigned long timer_t
Definition: posix_types.h:39
uint32_t clockid_t
Definition: posix_types.h:35
uint32_t pthread_rwlock_t
Definition: posix_types.h:96
uint32_t pthread_barrier_t
Definition: posix_types.h:88
struct k_sem sem_t
Definition: posix_types.h:59
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Definition: posix_types.h:43
void * stack
Definition: posix_types.h:44
uint32_t details[2]
Definition: posix_types.h:45
Definition: posix_types.h:90
int pshared
Definition: posix_types.h:91
Definition: posix_types.h:77
clockid_t clock
Definition: posix_types.h:78
Definition: posix_types.h:64
unsigned char type
Definition: posix_types.h:65
bool initialized
Definition: posix_types.h:66
Definition: posix_types.h:98
bool flag
Definition: posix_types.h:99