forked from Imagelibrary/rtems
2001-01-12 Joel Sherrill <joel@OARcorp.com>
* src/README.mqueue: Enhanced example.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2001-01-12 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* src/README.mqueue: Enhanced example.
|
||||||
|
|
||||||
2000-12-19 Joel Sherrill <joel@OARcorp.com>
|
2000-12-19 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* src/pthreadgetschedparam.c: Do not set output parameters if
|
* src/pthreadgetschedparam.c: Do not set output parameters if
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ This program should print out the default attribute settings for a
|
|||||||
POSIX message queue.
|
POSIX message queue.
|
||||||
|
|
||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@@ -13,15 +14,25 @@ main()
|
|||||||
struct mq_attr mqstat;
|
struct mq_attr mqstat;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
/* this should create it */
|
||||||
mqfd = mq_open("myipc",O_WRONLY|O_CREAT,NULL);
|
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);
|
status = mq_getattr(mqfd, &mqstat);
|
||||||
printf( "status: %d\n", status );
|
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
printf( "mq_maxmsg: %d\n", mqstat.mq_maxmsg );
|
printf( "mq_maxmsg: %d\n", mqstat.mq_maxmsg );
|
||||||
printf( "mq_msgsize: %d\n", mqstat.mq_msgsize );
|
printf( "mq_msgsize: %d\n", mqstat.mq_msgsize );
|
||||||
printf( "mq_curmsgs: %d\n", mqstat.mq_curmsgs );
|
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 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2001-01-12 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* src/README.mqueue: Enhanced example.
|
||||||
|
|
||||||
2000-12-19 Joel Sherrill <joel@OARcorp.com>
|
2000-12-19 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* src/pthreadgetschedparam.c: Do not set output parameters if
|
* src/pthreadgetschedparam.c: Do not set output parameters if
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ This program should print out the default attribute settings for a
|
|||||||
POSIX message queue.
|
POSIX message queue.
|
||||||
|
|
||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@@ -13,15 +14,25 @@ main()
|
|||||||
struct mq_attr mqstat;
|
struct mq_attr mqstat;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
/* this should create it */
|
||||||
mqfd = mq_open("myipc",O_WRONLY|O_CREAT,NULL);
|
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);
|
status = mq_getattr(mqfd, &mqstat);
|
||||||
printf( "status: %d\n", status );
|
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
printf( "mq_maxmsg: %d\n", mqstat.mq_maxmsg );
|
printf( "mq_maxmsg: %d\n", mqstat.mq_maxmsg );
|
||||||
printf( "mq_msgsize: %d\n", mqstat.mq_msgsize );
|
printf( "mq_msgsize: %d\n", mqstat.mq_msgsize );
|
||||||
printf( "mq_curmsgs: %d\n", mqstat.mq_curmsgs );
|
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 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user