RTEMS: cpukit/include/rtems/posix/posixapi.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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>
24#include <rtems/score/objectimpl.h>
25#include <rtems/score/threadimpl.h>
26#include <rtems/seterr.h>
27
28#include <pthread.h>
29
43 typedef enum {
44 POSIX_FD_PTHREAD,
45 POSIX_FD_PTHREAD_ONCE
46} POSIX_Fatal_domain;
47
56void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
57
58extern const int _POSIX_Get_by_name_error_table[ 3 ];
59
60 RTEMS_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
68 RTEMS_INLINE_ROUTINE int _POSIX_Get_error( Status_Control status )
69{
70 return STATUS_GET_POSIX( status );
71}
72
73 RTEMS_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
80 RTEMS_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 */
98 RTEMS_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 */
assert.h
Information for the Assert Handler.
_POSIX_Fatal_error
void _POSIX_Fatal_error(POSIX_Fatal_domain domain, int eno)
POSIX API Fatal error.
Definition: posixapi.c:174
POSIX_Fatal_domain
POSIX_Fatal_domain
POSIX API Fatal domains.
Definition: posixapi.h:43
POSIX_FD_PTHREAD
@ POSIX_FD_PTHREAD
Definition: posixapi.h:44
POSIX_FD_PTHREAD_ONCE
@ POSIX_FD_PTHREAD_ONCE
Definition: posixapi.h:45
_Assert
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
RTEMS_INLINE_ROUTINE
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
rtems_set_errno_and_return_minus_one
#define rtems_set_errno_and_return_minus_one(_error)
Definition: seterr.h:48
_Thread_Wait_get_status
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
objectimpl.h
Inlined Routines in the Object Handler.
pthread.h
POSIX Threads Private Support.
seterr.h
Data which Ease the Burden of Consistently Setting Errno.
_Thread_Control
Definition: thread.h:732
threadimpl.h
Inlined Routines from the Thread Handler.