RTEMS  5.0.0
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 
41 typedef enum {
45 
54 void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
55 
56 extern const int _POSIX_Get_by_name_error_table[ 3 ];
57 
58 RTEMS_INLINE_ROUTINE int _POSIX_Get_by_name_error(
59  Objects_Get_by_name_error error
60 )
61 {
62  _Assert( (size_t) error < RTEMS_ARRAY_SIZE( _POSIX_Get_by_name_error_table ) );
63  return _POSIX_Get_by_name_error_table[ error ];
64 }
65 
66 RTEMS_INLINE_ROUTINE int _POSIX_Get_error( Status_Control status )
67 {
68  return STATUS_GET_POSIX( status );
69 }
70 
71 RTEMS_INLINE_ROUTINE int _POSIX_Get_error_after_wait(
72  const Thread_Control *executing
73 )
74 {
75  return _POSIX_Get_error( _Thread_Wait_get_status( executing ) );
76 }
77 
78 RTEMS_INLINE_ROUTINE int _POSIX_Zero_or_minus_one_plus_errno(
79  Status_Control status
80 )
81 {
82  if ( status == STATUS_SUCCESSFUL ) {
83  return 0;
84  }
85 
86  rtems_set_errno_and_return_minus_one( _POSIX_Get_error( status ) );
87 }
88 
89 /*
90  * See also The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008,
91  * 2016 Edition, subsection 2.9.9, Synchronization Object Copies and
92  * Alternative Mappings.
93  *
94  * http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_09
95  */
96 RTEMS_INLINE_ROUTINE bool _POSIX_Is_valid_pshared( int pshared )
97 {
98  return pshared == PTHREAD_PROCESS_PRIVATE ||
99  pshared == PTHREAD_PROCESS_SHARED;
100 }
101 
104 #endif
105 /* end of include file */
Data which Ease the Burden of Consistently Setting Errno.
void _POSIX_Fatal_error(POSIX_Fatal_domain domain, int eno)
POSIX API Fatal error.
Definition: posixapi.c:174
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
POSIX Threads Private Support.
POSIX_Fatal_domain
POSIX API Fatal domains.
Definition: posixapi.h:41
#define rtems_set_errno_and_return_minus_one(_error)
Definition: seterr.h:48
Definition: thread.h:728
Definition: posixapi.h:42
Definition: posixapi.h:43
Inlined Routines from the Thread Handler.
Inlined Routines in the Object Handler.