diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2001-01-12 13:34:24 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2001-01-12 13:34:24 +0000 |
commit | d9f61654c70de6dd5d50b714006b0a3519bcfed7 (patch) | |
tree | 11361ade97d48bc8c80e18d16f5f3e3793d0be3d /cpukit/posix/src/README.mqueue | |
parent | 2001-01-12 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-d9f61654c70de6dd5d50b714006b0a3519bcfed7.tar.bz2 |
2001-01-12 Joel Sherrill <joel@OARcorp.com>
* src/README.mqueue: Enhanced example.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/src/README.mqueue | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cpukit/posix/src/README.mqueue b/cpukit/posix/src/README.mqueue index 9912ddd110..12c8afc03e 100644 --- a/cpukit/posix/src/README.mqueue +++ b/cpukit/posix/src/README.mqueue @@ -6,6 +6,7 @@ This program should print out the default attribute settings for a POSIX message queue. #include <mqueue.h> +#include <stdio.h> main() { @@ -13,15 +14,25 @@ main() struct mq_attr mqstat; int status; + /* this should create it */ mqfd = mq_open("myipc",O_WRONLY|O_CREAT,NULL); + if ( (int)mqfd == -1 ) { + perror( "Unable to open message queue" ); + exit( 1 ); + } status = mq_getattr(mqfd, &mqstat); - printf( "status: %d\n", status ); if ( !status ) { printf( "mq_maxmsg: %d\n", mqstat.mq_maxmsg ); printf( "mq_msgsize: %d\n", mqstat.mq_msgsize ); printf( "mq_curmsgs: %d\n", mqstat.mq_curmsgs ); + } else { + perror( "Unable to get attributes on message queue" ); + exit( 1 ); } + + /* this should delete it */ + (void) mq_close( mqfd ); exit( 0 ); } |