Changeset 83520 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Apr 3, 2020 8:33:32 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/serialport-posix.cpp
r82968 r83520 822 822 */ 823 823 ssize_t cbRead = read(pThis->iFd, pvBuf, cbToRead); 824 if (cbRead > =0)824 if (cbRead > 0) 825 825 { 826 826 if (pcbRead) … … 835 835 if (cbReadPart < 0) 836 836 return RTErrConvertFromErrno(errno); 837 else if (cbReadPart == 0) 838 return VERR_DEV_IO_ERROR; 837 839 838 840 cbRead += cbReadPart; … … 840 842 } 841 843 } 844 else if (cbRead == 0) 845 rc = VERR_DEV_IO_ERROR; 842 846 else 843 847 rc = RTErrConvertFromErrno(errno); … … 874 878 *pcbRead = cbThisRead; 875 879 } 876 else if (cbThisRead == 0 || errno == EAGAIN || errno == EWOULDBLOCK) 880 else if (cbThisRead == 0) 881 rc = VERR_DEV_IO_ERROR; 882 else if ( errno == EAGAIN 883 # ifdef EWOULDBLOCK 884 # if EWOULDBLOCK != EAGAIN 885 || errno == EWOULDBLOCK 886 # endif 887 # endif 888 ) 877 889 rc = VINF_TRY_AGAIN; 878 890 else … … 899 911 */ 900 912 ssize_t cbWritten = write(pThis->iFd, pvBuf, cbToWrite); 901 if (cbWritten > =0)913 if (cbWritten > 0) 902 914 { 903 915 if (pcbWritten) … … 912 924 if (cbWrittenPart < 0) 913 925 return RTErrConvertFromErrno(errno); 926 else if (cbWrittenPart == 0) 927 return VERR_DEV_IO_ERROR; 914 928 cbWritten += cbWrittenPart; 915 929 } 916 930 } 917 931 } 932 else if (cbWritten == 0) 933 rc = VERR_DEV_IO_ERROR; 934 else 935 rc = RTErrConvertFromErrno(errno); 918 936 } 919 937 … … 939 957 if (cbThisWrite > 0) 940 958 *pcbWritten = cbThisWrite; 941 else if (cbThisWrite == 0 || errno == EAGAIN || errno == EWOULDBLOCK) 959 else if (cbThisWrite == 0) 960 rc = VERR_DEV_IO_ERROR; 961 else if ( errno == EAGAIN 962 # ifdef EWOULDBLOCK 963 # if EWOULDBLOCK != EAGAIN 964 || errno == EWOULDBLOCK 965 # endif 966 # endif 967 ) 942 968 rc = VINF_TRY_AGAIN; 943 969 else … … 1092 1118 if (aPollFds[0].revents != 0) 1093 1119 { 1094 fEvtsPending |= (aPollFds[0].revents & POLLIN) ? RTSERIALPORT_EVT_F_DATA_RX : 0; 1095 fEvtsPending |= (aPollFds[0].revents & POLLOUT) ? RTSERIALPORT_EVT_F_DATA_TX : 0; 1096 /** @todo BREAK condition detection. */ 1120 if (aPollFds[0].revents & POLLERR) 1121 rc = VERR_DEV_IO_ERROR; 1122 else 1123 { 1124 fEvtsPending |= (aPollFds[0].revents & POLLIN) ? RTSERIALPORT_EVT_F_DATA_RX : 0; 1125 fEvtsPending |= (aPollFds[0].revents & POLLOUT) ? RTSERIALPORT_EVT_F_DATA_TX : 0; 1126 /** @todo BREAK condition detection. */ 1127 } 1097 1128 } 1098 1129
Note:
See TracChangeset
for help on using the changeset viewer.