Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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_SYS_TYPES_H_
8#define ZEPHYR_INCLUDE_POSIX_SYS_TYPES_H_
9
10#ifndef CONFIG_ARCH_POSIX
11#include <sys/types.h>
12#endif
13
14#include <kernel.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#ifndef __useconds_t_defined
21typedef unsigned long useconds_t;
22#endif
23
24/* time related attributes */
25#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCMWDT_LIBC)
26#ifndef __clockid_t_defined
28#endif
29#endif /* !CONFIG_NEWLIB_LIBC && !CONFIG_ARCMWDT_LIBC */
30#ifndef __timer_t_defined
31typedef unsigned long timer_t;
32#endif
33
34#ifdef CONFIG_PTHREAD_IPC
35/* Thread attributes */
36typedef struct pthread_attr_t {
37 int priority;
38 void *stack;
39 size_t stacksize;
41 uint32_t delayedstart;
42 uint32_t schedpolicy;
43 int32_t detachstate;
44 uint32_t initialized;
45} pthread_attr_t;
46
47typedef void *pthread_t;
48
49/* Semaphore */
50typedef struct k_sem sem_t;
51
52/* Mutex */
53typedef struct pthread_mutex {
54 pthread_t owner;
55 uint16_t lock_count;
56 int type;
57 _wait_q_t wait_q;
58} pthread_mutex_t;
59
60typedef struct pthread_mutexattr {
61 int type;
62} pthread_mutexattr_t;
63
64/* Condition variables */
65typedef struct pthread_cond {
66 _wait_q_t wait_q;
67} pthread_cond_t;
68
69typedef struct pthread_condattr {
70} pthread_condattr_t;
71
72/* Barrier */
73typedef struct pthread_barrier {
74 _wait_q_t wait_q;
75 int max;
76 int count;
77} pthread_barrier_t;
78
79typedef struct pthread_barrierattr {
80} pthread_barrierattr_t;
81
82typedef uint32_t pthread_rwlockattr_t;
83
84typedef struct pthread_rwlock_obj {
85 struct k_sem rd_sem;
86 struct k_sem wr_sem;
87 struct k_sem reader_active;/* blocks WR till reader has acquired lock */
88 int32_t status;
89 k_tid_t wr_owner;
90} pthread_rwlock_t;
91
92#endif /* CONFIG_PTHREAD_IPC */
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* ZEPHYR_INCLUDE_POSIX_SYS_TYPES_H_ */
ZTEST_BMEM int count
Definition: main.c:33
flags
Definition: http_parser.h:131
unsigned long useconds_t
Definition: posix_types.h:21
unsigned long timer_t
Definition: posix_types.h:31
uint32_t clockid_t
Definition: posix_types.h:27
struct k_stack stack
Definition: test_stack_contexts.c:18
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Definition: thread.h:201