Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.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#ifndef CONFIG_ARCH_POSIX
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#ifndef __useconds_t_defined
25typedef unsigned long useconds_t;
26#endif
27
28/* time related attributes */
29#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCMWDT_LIBC)
30#ifndef __clockid_t_defined
32#endif
33#endif /* !CONFIG_NEWLIB_LIBC && !CONFIG_ARCMWDT_LIBC */
34#ifndef __timer_t_defined
35typedef unsigned long timer_t;
36#endif
37
38/* Thread attributes */
41 void *stack;
48};
49#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
50 || defined(CONFIG_ARCMWDT_LIBC)
51typedef struct pthread_attr pthread_attr_t;
52#endif
53
54BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
55
58
59/* Semaphore */
60typedef struct k_sem sem_t;
61
62/* Mutex */
64
66 int type;
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
96typedef struct pthread_rwlock_obj {
97 struct k_sem rd_sem;
98 struct k_sem wr_sem;
99 struct k_sem reader_active;/* blocks WR till reader has acquired lock */
103
104#ifdef __cplusplus
105}
106#endif
107
108#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:25
uint32_t pthread_spinlock_t
Definition: posix_types.h:57
struct pthread_barrierattr pthread_barrierattr_t
uint32_t pthread_t
Definition: posix_types.h:56
uint32_t pthread_mutex_t
Definition: posix_types.h:63
uint32_t pthread_rwlockattr_t
Definition: posix_types.h:94
unsigned long timer_t
Definition: posix_types.h:35
uint32_t clockid_t
Definition: posix_types.h:31
struct pthread_rwlock_obj pthread_rwlock_t
uint32_t pthread_barrier_t
Definition: posix_types.h:88
struct k_sem sem_t
Definition: posix_types.h:60
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
Thread Structure.
Definition: thread.h:250
Definition: posix_types.h:39
int priority
Definition: posix_types.h:40
uint32_t stacksize
Definition: posix_types.h:42
uint32_t flags
Definition: posix_types.h:43
void * stack
Definition: posix_types.h:41
uint32_t schedpolicy
Definition: posix_types.h:45
int32_t detachstate
Definition: posix_types.h:46
uint32_t delayedstart
Definition: posix_types.h:44
uint32_t initialized
Definition: posix_types.h:47
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:65
int type
Definition: posix_types.h:66
Definition: posix_types.h:96
struct k_sem wr_sem
Definition: posix_types.h:98
struct k_sem reader_active
Definition: posix_types.h:99
struct k_sem rd_sem
Definition: posix_types.h:97
int32_t status
Definition: posix_types.h:100
k_tid_t wr_owner
Definition: posix_types.h:101