fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
fd.c
Go to the documentation of this file.
1#include <fcntl.h>
2#include "fd.h"
3
11int close(int __fd); /* we won't use unistd.h here */
12
13int fd_copy(int to,int from)
14{
15 if (to == from) return 0;
16 if (fcntl(from,F_GETFL,0) == -1) return -1;
17 close(to);
18 if (fcntl(from,F_DUPFD,to) == -1) return -1;
19 return 0;
20}
21
22int fd_move(int to,int from)
23{
24 if (to == from) return 0;
25 if (fd_copy(to,from) == -1) return -1;
26 close(from);
27 return 0;
28}
29
30int fd_coe(int fd)
31{
32 return fcntl(fd,F_SETFD,1);
33}
int close(int __fd)
int fd_move(int to, int from)
Definition: fd.c:22
int fd_copy(int to, int from)
Definition: fd.c:13
int fd_coe(int fd)
Definition: fd.c:30