2 #include <fcntl.h> /* file control functions */
4 int main(int argc, char *argv[])
12 /* copy stdin to stdout */
13 len = tee(STDIN_FILENO, STDOUT_FILENO, size, 0);
16 if (errno == EAGAIN) {
19 perror("error on tee stdin to stdout");
23 /* write data to the file using splice */
25 nwrite = splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
27 perror("error on splice stdin to file");