OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [mqueuetranslatereturncode.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 158 chris
/*
2
 *  POSIX Message Queue Error Translation
3
 *
4
 *
5
 *  COPYRIGHT (c) 1989-1999.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12 208 chris
 *  $Id: mqueuetranslatereturncode.c,v 1.2 2001-09-27 11:59:17 chris Exp $
13 158 chris
 */
14
 
15
#include <pthread.h>
16
#include <limits.h>
17
#include <errno.h>
18
#include <fcntl.h>
19
#include <mqueue.h>
20
 
21
#include <rtems/system.h>
22
#include <rtems/score/watchdog.h>
23
#include <rtems/posix/seterr.h>
24
#include <rtems/posix/mqueue.h>
25
#include <rtems/posix/time.h>
26
#include <rtems/score/interr.h>
27
 
28
 
29
/*PAGE
30
 *
31
 *  _POSIX_Message_queue_Translate_core_message_queue_return_code
32
 *
33
 *  Input parameters:
34
 *    the_message_queue_status - message_queue status code to translate
35
 *
36
 *  Output parameters:
37
 *    rtems status code - translated POSIX status code
38
 *
39
 */
40
 
41
int _POSIX_Message_queue_Translate_core_message_queue_return_code(
42
  unsigned32 the_message_queue_status
43
)
44
{
45
  switch ( the_message_queue_status ) {
46
    case  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
47
      return 0;
48
 
49
      /*
50
       *  Bad message size
51
       */
52
    case  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
53
      return EMSGSIZE;
54
 
55
      /*
56
       *  Queue is full of pending messages.
57
       */
58
    case  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
59
      return EAGAIN;
60
 
61
      /*
62
       *  Out of message buffers to queue pending message
63
       */
64
    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
65
      return ENOMEM;
66
 
67
      /*
68
       *  No message available on receive poll
69
       */
70
    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
71
      return EAGAIN;
72
 
73
      /*
74
       *  Queue was deleted while thread blocked on it.
75
       */
76
    case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
77
      return EBADF;
78
 
79
      /*
80
       *  POSIX Real-Time Extensions add timeouts to send and receive.
81
       */
82
    case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
83
      return ETIMEDOUT;
84
 
85
      /*
86
       *  RTEMS POSIX API implementation does not support multiprocessing.
87
       */
88
    case THREAD_STATUS_PROXY_BLOCKING:
89
      return ENOSYS;
90
  }
91
  _Internal_error_Occurred(
92
    INTERNAL_ERROR_POSIX_API,
93
    TRUE,
94
    the_message_queue_status
95
  );
96
  return POSIX_BOTTOM_REACHED();
97
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.