File: blocking.c

package info (click to toggle)
tinyssh 20250501-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,388 kB
  • sloc: ansic: 20,245; sh: 1,582; python: 1,449; makefile: 913
file content (15 lines) | stat: -rw-r--r-- 325 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
taken from nacl-20110221, from from curvecp/blocking.c
- reformated using clang-format
*/

#include <fcntl.h>
#include "blocking.h"

void blocking_enable(int fd) {
    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK);
}

void blocking_disable(int fd) {
    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
}