@@ -440,7 +440,11 @@ int mq_close( mqd_t mqdes )
440
440
else
441
441
{
442
442
/* Queue not found; bad descriptor. */
443
- errno = EBADF ;
443
+ #if ( configUSE_POSIX_ERRNO == 1 )
444
+ {
445
+ errno = EBADF ;
446
+ }
447
+ #endif
444
448
iStatus = -1 ;
445
449
}
446
450
@@ -479,7 +483,11 @@ int mq_getattr( mqd_t mqdes,
479
483
else
480
484
{
481
485
/* Queue not found; bad descriptor. */
482
- errno = EBADF ;
486
+ #if ( configUSE_POSIX_ERRNO == 1 )
487
+ {
488
+ errno = EBADF ;
489
+ }
490
+ #endif
483
491
iStatus = -1 ;
484
492
}
485
493
@@ -518,7 +526,11 @@ mqd_t mq_open( const char * name,
518
526
if ( prvValidateQueueName ( name , & xNameLength ) == pdFALSE )
519
527
{
520
528
/* Invalid name. */
521
- errno = EINVAL ;
529
+ #if ( configUSE_POSIX_ERRNO == 1 )
530
+ {
531
+ errno = EINVAL ;
532
+ }
533
+ #endif
522
534
xMessageQueue = ( mqd_t ) - 1 ;
523
535
}
524
536
@@ -528,7 +540,11 @@ mqd_t mq_open( const char * name,
528
540
if ( ( oflag & O_CREAT ) && ( attr != NULL ) && ( ( attr -> mq_maxmsg <= 0 ) || ( attr -> mq_msgsize <= 0 ) ) )
529
541
{
530
542
/* Invalid mq_attr.mq_maxmsg or mq_attr.mq_msgsize. */
531
- errno = EINVAL ;
543
+ #if ( configUSE_POSIX_ERRNO == 1 )
544
+ {
545
+ errno = EINVAL ;
546
+ }
547
+ #endif
532
548
xMessageQueue = ( mqd_t ) - 1 ;
533
549
}
534
550
}
@@ -548,7 +564,11 @@ mqd_t mq_open( const char * name,
548
564
* O_CREAT and O_EXCL. */
549
565
if ( ( oflag & O_EXCL ) && ( oflag & O_CREAT ) )
550
566
{
551
- errno = EEXIST ;
567
+ #if ( configUSE_POSIX_ERRNO == 1 )
568
+ {
569
+ errno = EEXIST ;
570
+ }
571
+ #endif
552
572
xMessageQueue = ( mqd_t ) - 1 ;
553
573
}
554
574
else
@@ -557,7 +577,11 @@ mqd_t mq_open( const char * name,
557
577
if ( ( ( QueueListElement_t * ) xMessageQueue )-> xPendingUnlink == pdTRUE )
558
578
{
559
579
/* Queue pending deletion. Don't allow it to be re-opened. */
560
- errno = EINVAL ;
580
+ #if ( configUSE_POSIX_ERRNO == 1 )
581
+ {
582
+ errno = EINVAL ;
583
+ }
584
+ #endif
561
585
xMessageQueue = ( mqd_t ) - 1 ;
562
586
}
563
587
else
@@ -588,13 +612,21 @@ mqd_t mq_open( const char * name,
588
612
name ,
589
613
xNameLength ) == pdFALSE )
590
614
{
591
- errno = ENOSPC ;
615
+ #if ( configUSE_POSIX_ERRNO == 1 )
616
+ {
617
+ errno = ENOSPC ;
618
+ }
619
+ #endif
592
620
xMessageQueue = ( mqd_t ) - 1 ;
593
621
}
594
622
}
595
623
else
596
624
{
597
- errno = ENOENT ;
625
+ #if ( configUSE_POSIX_ERRNO == 1 )
626
+ {
627
+ errno = ENOENT ;
628
+ }
629
+ #endif
598
630
xMessageQueue = ( mqd_t ) - 1 ;
599
631
}
600
632
}
@@ -651,7 +683,11 @@ ssize_t mq_timedreceive( mqd_t mqdes,
651
683
if ( prvFindQueueInList ( NULL , NULL , mqdes ) == pdFALSE )
652
684
{
653
685
/* Queue not found; bad descriptor. */
654
- errno = EBADF ;
686
+ #if ( configUSE_POSIX_ERRNO == 1 )
687
+ {
688
+ errno = EBADF ;
689
+ }
690
+ #endif
655
691
xStatus = -1 ;
656
692
}
657
693
@@ -661,7 +697,11 @@ ssize_t mq_timedreceive( mqd_t mqdes,
661
697
if ( msg_len < ( size_t ) pxMessageQueue -> xAttr .mq_msgsize )
662
698
{
663
699
/* msg_len too small. */
664
- errno = EMSGSIZE ;
700
+ #if ( configUSE_POSIX_ERRNO == 1 )
701
+ {
702
+ errno = EMSGSIZE ;
703
+ }
704
+ #endif
665
705
xStatus = -1 ;
666
706
}
667
707
}
@@ -675,7 +715,11 @@ ssize_t mq_timedreceive( mqd_t mqdes,
675
715
676
716
if ( iCalculateTimeoutReturn != 0 )
677
717
{
678
- errno = iCalculateTimeoutReturn ;
718
+ #if ( configUSE_POSIX_ERRNO == 1 )
719
+ {
720
+ errno = iCalculateTimeoutReturn ;
721
+ }
722
+ #endif
679
723
xStatus = -1 ;
680
724
}
681
725
}
@@ -694,12 +738,20 @@ ssize_t mq_timedreceive( mqd_t mqdes,
694
738
if ( pxMessageQueue -> xAttr .mq_flags & O_NONBLOCK )
695
739
{
696
740
/* Set errno to EAGAIN for nonblocking mq. */
697
- errno = EAGAIN ;
741
+ #if ( configUSE_POSIX_ERRNO == 1 )
742
+ {
743
+ errno = EAGAIN ;
744
+ }
745
+ #endif
698
746
}
699
747
else
700
748
{
701
749
/* Otherwise, set errno to ETIMEDOUT. */
702
- errno = ETIMEDOUT ;
750
+ #if ( configUSE_POSIX_ERRNO == 1 )
751
+ {
752
+ errno = ETIMEDOUT ;
753
+ }
754
+ #endif
703
755
}
704
756
705
757
xStatus = -1 ;
@@ -743,7 +795,11 @@ int mq_timedsend( mqd_t mqdes,
743
795
if ( prvFindQueueInList ( NULL , NULL , mqdes ) == pdFALSE )
744
796
{
745
797
/* Queue not found; bad descriptor. */
746
- errno = EBADF ;
798
+ #if ( configUSE_POSIX_ERRNO == 1 )
799
+ {
800
+ errno = EBADF ;
801
+ }
802
+ #endif
747
803
iStatus = -1 ;
748
804
}
749
805
@@ -753,7 +809,11 @@ int mq_timedsend( mqd_t mqdes,
753
809
if ( msg_len > ( size_t ) pxMessageQueue -> xAttr .mq_msgsize )
754
810
{
755
811
/* msg_len too large. */
756
- errno = EMSGSIZE ;
812
+ #if ( configUSE_POSIX_ERRNO == 1 )
813
+ {
814
+ errno = EMSGSIZE ;
815
+ }
816
+ #endif
757
817
iStatus = -1 ;
758
818
}
759
819
}
@@ -767,7 +827,11 @@ int mq_timedsend( mqd_t mqdes,
767
827
768
828
if ( iCalculateTimeoutReturn != 0 )
769
829
{
770
- errno = iCalculateTimeoutReturn ;
830
+ #if ( configUSE_POSIX_ERRNO == 1 )
831
+ {
832
+ errno = iCalculateTimeoutReturn ;
833
+ }
834
+ #endif
771
835
iStatus = -1 ;
772
836
}
773
837
}
@@ -785,7 +849,11 @@ int mq_timedsend( mqd_t mqdes,
785
849
if ( xSendData .pcData == NULL )
786
850
{
787
851
/* msg_len too large. */
788
- errno = EMSGSIZE ;
852
+ #if ( configUSE_POSIX_ERRNO == 1 )
853
+ {
854
+ errno = EMSGSIZE ;
855
+ }
856
+ #endif
789
857
iStatus = -1 ;
790
858
}
791
859
else
@@ -806,12 +874,20 @@ int mq_timedsend( mqd_t mqdes,
806
874
if ( pxMessageQueue -> xAttr .mq_flags & O_NONBLOCK )
807
875
{
808
876
/* Set errno to EAGAIN for nonblocking mq. */
809
- errno = EAGAIN ;
877
+ #if ( configUSE_POSIX_ERRNO == 1 )
878
+ {
879
+ errno = EAGAIN ;
880
+ }
881
+ #endif
810
882
}
811
883
else
812
884
{
813
885
/* Otherwise, set errno to ETIMEDOUT. */
814
- errno = ETIMEDOUT ;
886
+ #if ( configUSE_POSIX_ERRNO == 1 )
887
+ {
888
+ errno = ETIMEDOUT ;
889
+ }
890
+ #endif
815
891
}
816
892
817
893
/* Free the allocated queue data. */
@@ -840,7 +916,11 @@ int mq_unlink( const char * name )
840
916
if ( prvValidateQueueName ( name , & xNameSize ) == pdFALSE )
841
917
{
842
918
/* Error with mq name. */
843
- errno = EINVAL ;
919
+ #if ( configUSE_POSIX_ERRNO == 1 )
920
+ {
921
+ errno = EINVAL ;
922
+ }
923
+ #endif
844
924
iStatus = -1 ;
845
925
}
846
926
@@ -873,7 +953,11 @@ int mq_unlink( const char * name )
873
953
else
874
954
{
875
955
/* The named message queue doesn't exist. */
876
- errno = ENOENT ;
956
+ #if ( configUSE_POSIX_ERRNO == 1 )
957
+ {
958
+ errno = ENOENT ;
959
+ }
960
+ #endif
877
961
iStatus = -1 ;
878
962
}
879
963
0 commit comments