Home | History | Annotate | Download | only in mqueue_h
      1 /*
      2  * Ngie Cooper, August 2010
      3  *
      4  * Verify that mq_flags, mq_maxmsg, mq_msgsize, and mq_curmsgs exist in the
      5  * struct mq_attr structure and are long integers as per the
      6  * IEEE Std 1003.1-2008 spec.
      7  */
      8 
      9 #include <limits.h>
     10 #include <mqueue.h>
     11 #include <stdio.h>
     12 #include "posixtest.h"
     13 
     14 #define TEST_LIMITS(structure_and_field) do {			\
     15 		printf("%s..\n", # structure_and_field);	\
     16 		printf("\t.. -LONG_MIN\n");			\
     17 		structure_and_field = -LONG_MIN;		\
     18 		if (structure_and_field != -LONG_MIN) {		\
     19 			return (PTS_FAIL);			\
     20 		}						\
     21 		printf("\t.. LONG_MAX\n");			\
     22 		structure_and_field = LONG_MAX;			\
     23 		if (structure_and_field != LONG_MAX) {		\
     24 			return (PTS_FAIL);			\
     25 		}						\
     26 		printf("\t.. -(LONG_MIN+1)\n");			\
     27 		structure_and_field = -(LONG_MIN+1);		\
     28 		if (structure_and_field != LONG_MAX) {		\
     29 			return (PTS_FAIL);			\
     30 		}						\
     31 		structure_and_field = LONG_MAX+1;		\
     32 		printf("\t.. (LONG_MAX+1)\n");			\
     33 		if (structure_and_field != LONG_MIN) {		\
     34 			return (PTS_FAIL);			\
     35 		}						\
     36 	} while (0)
     37 
     38 int main()
     39 {
     40 	struct mq_attr mqs;
     41 
     42 	TEST_LIMITS(mqs.mq_flags);
     43 	TEST_LIMITS(mqs.mq_maxmsg);
     44 	TEST_LIMITS(mqs.mq_msgsize);
     45 	TEST_LIMITS(mqs.mq_curmsgs);
     46 
     47 	printf("PASSED!\n");
     48 
     49 	return (PTS_PASS);
     50 
     51 }
     52