mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
AP_HAL_SITL: avoid calling fcntl on -1
in-line the method to make setting non-blocking on _fd more proximate to where the thing is opened
This commit is contained in:
committed by
Peter Barker
parent
409226a637
commit
b65870fbe7
@@ -200,8 +200,6 @@ void UARTDriver::_begin(uint32_t baud, uint16_t rxSpace, uint16_t txSpace)
|
||||
_readbuffer.clear();
|
||||
_writebuffer.clear();
|
||||
}
|
||||
|
||||
_set_nonblocking(_fd);
|
||||
}
|
||||
|
||||
void UARTDriver::_end()
|
||||
@@ -734,11 +732,6 @@ bool UARTDriver::_select_check(int fd)
|
||||
return false;
|
||||
}
|
||||
|
||||
void UARTDriver::_set_nonblocking(int fd)
|
||||
{
|
||||
unsigned v = fcntl(fd, F_GETFL, 0);
|
||||
fcntl(fd, F_SETFL, v | O_NONBLOCK);
|
||||
}
|
||||
|
||||
bool UARTDriver::set_unbuffered_writes(bool on) {
|
||||
if (_fd == -1) {
|
||||
|
||||
@@ -108,7 +108,7 @@ private:
|
||||
void _udp_start_multicast(const char *address, uint16_t port);
|
||||
void _check_connection(void);
|
||||
static bool _select_check(int );
|
||||
static void _set_nonblocking(int );
|
||||
|
||||
bool set_speed(int speed) const;
|
||||
|
||||
SITL_State *_sitlState;
|
||||
|
||||
Reference in New Issue
Block a user