From d9f61654c70de6dd5d50b714006b0a3519bcfed7 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 12 Jan 2001 13:34:24 +0000 Subject: 2001-01-12 Joel Sherrill * src/README.mqueue: Enhanced example. --- cpukit/posix/ChangeLog | 4 ++++ cpukit/posix/src/README.mqueue | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'cpukit/posix') diff --git a/cpukit/posix/ChangeLog b/cpukit/posix/ChangeLog index 1103b9b2a8..c8a18e7ec2 100644 --- a/cpukit/posix/ChangeLog +++ b/cpukit/posix/ChangeLog @@ -1,3 +1,7 @@ +2001-01-12 Joel Sherrill + + * src/README.mqueue: Enhanced example. + 2000-12-19 Joel Sherrill * src/pthreadgetschedparam.c: Do not set output parameters if 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 +#include 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 ); } -- cgit v1.2.3