qubes-rpc: save one syscall on each data block
read_all/write_all calls set_* on every call, so this can be noticeable performance improvement.
This commit is contained in:
parent
4010ddaab5
commit
9b859c9ac5
@ -35,12 +35,16 @@ void perror_wrapper(char * msg)
|
||||
void set_nonblock(int fd)
|
||||
{
|
||||
int fl = fcntl(fd, F_GETFL, 0);
|
||||
if (fl & O_NONBLOCK)
|
||||
return;
|
||||
fcntl(fd, F_SETFL, fl | O_NONBLOCK);
|
||||
}
|
||||
|
||||
void set_block(int fd)
|
||||
{
|
||||
int fl = fcntl(fd, F_GETFL, 0);
|
||||
if (!(fl & O_NONBLOCK))
|
||||
return;
|
||||
fcntl(fd, F_SETFL, fl & ~O_NONBLOCK);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user