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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [README.mqueue] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
#
2
#  README.mqueue,v 1.2 2001/01/12 13:34:24 joel Exp
3
#
4
 
5
This program should print out the default attribute settings for a
6
POSIX message queue.
7
 
8
#include 
9
#include 
10
 
11
main()
12
{
13
  mqd_t mqfd;
14
  struct mq_attr mqstat;
15
  int status;
16
 
17
  /* this should create it */
18
  mqfd = mq_open("myipc",O_WRONLY|O_CREAT,NULL);
19
  if ( (int)mqfd == -1 ) {
20
    perror( "Unable to open message queue" );
21
    exit( 1 );
22
  }
23
 
24
  status = mq_getattr(mqfd, &mqstat);
25
  if ( !status ) {
26
    printf( "mq_maxmsg: %d\n", mqstat.mq_maxmsg );
27
    printf( "mq_msgsize: %d\n", mqstat.mq_msgsize );
28
    printf( "mq_curmsgs: %d\n", mqstat.mq_curmsgs );
29
  } else {
30
    perror( "Unable to get attributes on message queue" );
31
    exit( 1 );
32
  }
33
 
34
  /* this should delete it */
35
  (void) mq_close( mqfd );
36
  exit( 0 );
37
}
38
 

powered by: WebSVN 2.1.0

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