RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
posixapi.h
Go to the documentation of this file.
1
10/*
11 * COPYRIGHT (c) 1989-2011.
12 * On-Line Applications Research Corporation (OAR).
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_POSIX_POSIXAPI_H
20#define _RTEMS_POSIX_POSIXAPI_H
21
22#include <rtems/config.h>
23#include <rtems/score/assert.h>
26#include <rtems/seterr.h>
27
28#include <pthread.h>
29
43typedef enum {
47
56void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
57
58extern const int _POSIX_Get_by_name_error_table[ 3 ];
59
60RTEMS_INLINE_ROUTINE int _POSIX_Get_by_name_error(
61 Objects_Get_by_name_error error
62)
63{
64 _Assert( (size_t) error < RTEMS_ARRAY_SIZE( _POSIX_Get_by_name_error_table ) );
65 return _POSIX_Get_by_name_error_table[ error ];
66}
67
68RTEMS_INLINE_ROUTINE int _POSIX_Get_error( Status_Control status )
69{
70 return STATUS_GET_POSIX( status );
71}
72
73RTEMS_INLINE_ROUTINE int _POSIX_Get_error_after_wait(
74 const Thread_Control *executing
75)
76{
77 return _POSIX_Get_error( _Thread_Wait_get_status( executing ) );
78}
79
80RTEMS_INLINE_ROUTINE int _POSIX_Zero_or_minus_one_plus_errno(
81 Status_Control status
82)
83{
84 if ( status == STATUS_SUCCESSFUL ) {
85 return 0;
86 }
87
88 rtems_set_errno_and_return_minus_one( _POSIX_Get_error( status ) );
89}
90
91/*
92 * See also The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008,
93 * 2016 Edition, subsection 2.9.9, Synchronization Object Copies and
94 * Alternative Mappings.
95 *
96 * http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_09
97 */
98RTEMS_INLINE_ROUTINE bool _POSIX_Is_valid_pshared( int pshared )
99{
100 return pshared == PTHREAD_PROCESS_PRIVATE ||
101 pshared == PTHREAD_PROCESS_SHARED;
102}
103
106#endif
107/* end of include file */
Information for the Assert Handler.
void _POSIX_Fatal_error(POSIX_Fatal_domain domain, int eno)
POSIX API Fatal error.
Definition: posixapi.c:174
POSIX_Fatal_domain
POSIX API Fatal domains.
Definition: posixapi.h:43
@ POSIX_FD_PTHREAD
Definition: posixapi.h:44
@ POSIX_FD_PTHREAD_ONCE
Definition: posixapi.h:45
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define rtems_set_errno_and_return_minus_one(_error)
Definition: seterr.h:48
RTEMS_INLINE_ROUTINE Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
Definition: threadimpl.h:2328
Inlined Routines in the Object Handler.
POSIX Threads Private Support.
Data which Ease the Burden of Consistently Setting Errno.
Definition: thread.h:732
Inlined Routines from the Thread Handler.