mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-06 10:02:23 +00:00
file_utils: add fd_make_nonblocking helper
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
This commit is contained in:
parent
747c4df31a
commit
7eff16cc4c
@ -700,6 +700,18 @@ int fd_make_blocking(int fd)
|
||||
return fcntl(fd, F_SETFL, flags);
|
||||
}
|
||||
|
||||
int fd_make_nonblocking(int fd)
|
||||
{
|
||||
int flags;
|
||||
|
||||
flags = fcntl(fd, F_GETFL);
|
||||
if (flags < 0)
|
||||
return -1;
|
||||
|
||||
flags |= O_NONBLOCK;
|
||||
return fcntl(fd, F_SETFL, flags);
|
||||
}
|
||||
|
||||
#define BATCH_SIZE 50
|
||||
static void batch_realloc(char **mem, size_t oldlen, size_t newlen)
|
||||
{
|
||||
|
@ -110,6 +110,7 @@ __hidden extern int open_at_same(int fd_same, int dfd, const char *path,
|
||||
unsigned int resolve_flags, mode_t mode);
|
||||
__hidden extern int open_beneath(int dfd, const char *path, unsigned int flags);
|
||||
__hidden int fd_make_blocking(int fd);
|
||||
__hidden int fd_make_nonblocking(int fd);
|
||||
__hidden extern char *read_file_at(int dfd, const char *fnam,
|
||||
unsigned int o_flags,
|
||||
unsigned resolve_flags);
|
||||
|
Loading…
Reference in New Issue
Block a user