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:
父節點
4010ddaab5
當前提交
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);
|
||||
}
|
||||
|
||||
|
載入中…
新增問題並參考
Block a user