1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | #if HAVE_CONFIG_H1 |
25 | #include "config.h" |
26 | #endif |
27 | |
28 | #include <stdarg.h> |
29 | |
30 | #include <pthread.h> |
31 | #include <limits.h> |
32 | #include <errno(*__errno_location ()).h> |
33 | #include <fcntl.h> |
34 | #include <mqueue.h> |
35 | |
36 | #include <rtems/system.h> |
37 | #include <rtems/score/watchdog.h> |
38 | #include <rtems/seterr.h> |
39 | #include <rtems/posix/mqueue.h> |
40 | #include <rtems/posix/time.h> |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | int mq_getattr( |
48 | mqd_t mqdes, |
49 | struct mq_attr *mqstat |
50 | ) |
51 | { |
52 | POSIX_Message_queue_Control *the_mq; |
53 | POSIX_Message_queue_Control_fd *the_mq_fd; |
54 | Objects_Locations location; |
55 | CORE_message_queue_Attributes *the_mq_attr; |
56 | |
57 | if ( !mqstat ) |
58 | rtems_set_errno_and_return_minus_one( EINVAL )do { (*__errno_location ()) = (22); return -1; } while(0); |
59 | |
60 | the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location ); |
61 | switch ( location ) { |
62 | |
63 | case OBJECTS_LOCAL: |
64 | the_mq = the_mq_fd->Queue; |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | the_mq_attr = &the_mq->Message_queue.Attributes; |
| Value stored to 'the_mq_attr' is never read |
71 | |
72 | mqstat->mq_flags = the_mq_fd->oflag; |
73 | mqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size; |
74 | mqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages; |
75 | mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages; |
76 | |
77 | _Thread_Enable_dispatch(); |
78 | return 0; |
79 | |
80 | #if defined(RTEMS_MULTIPROCESSING) |
81 | case OBJECTS_REMOTE: |
82 | #endif |
83 | case OBJECTS_ERROR: |
84 | break; |
85 | } |
86 | |
87 | rtems_set_errno_and_return_minus_one( EBADF )do { (*__errno_location ()) = (9); return -1; } while(0); |
88 | } |