source: rtems/testsuites/psxtests/psxhdrs/mqueue/mq_timedsend.c @ 93ccf479

5
Last change on this file since 93ccf479 was 93ccf479, checked in by Himanshu40 <himanshuwindows8.1@…>, on 11/28/18 at 08:04:34

psxtests: add POSIX API signature compliance tests for mqueue.h file (GCI 2018)

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *  @brief mq_timedsend() API Conformance Test
4 */
5
6 /*
7  *  COPYRIGHT (c) 2018.
8  *  Himanshu Sekhar Nayak
9  *
10  *  Permission to use, copy, modify, and/or distribute this software
11  *  for any purpose with or without fee is hereby granted.
12  *
13  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
14  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
15  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
16  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
17  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21
22  #ifdef HAVE_CONFIG_H
23  #include "config.h"
24  #endif
25
26  #include <fcntl.h>
27  #include <time.h>
28  #include <mqueue.h>
29
30  int test( void );
31
32  #define MQ_MAXMSG     1
33  #define MQ_MSGSIZE    sizeof(int)
34
35  int test( void )
36  {
37    mqd_t mqdes;
38    struct mq_attr mqstat;
39    const char *q_name;
40    struct timespec abs_timeout;
41    unsigned int msg_prio;
42    int msg_ptr;
43    int result;
44
45    mqstat.mq_maxmsg  = MQ_MAXMSG;
46    mqstat.mq_msgsize = MQ_MSGSIZE;
47    abs_timeout.tv_sec  = 0;
48    abs_timeout.tv_nsec = 1;
49    msg_ptr = 5;
50    msg_prio = 1;
51    q_name = "queue";
52
53    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
54    result = mq_timedsend(
55             mqdes, (const char *)&msg_ptr, MQ_MSGSIZE, msg_prio, &abs_timeout);
56
57    return result;
58  }
Note: See TracBrowser for help on using the repository browser.