c48f1fef175708331706594f51d54e6d69d0662f
4 * check whether a file exists
6 * \param fn the file name
8 * \return Non-zero iff file exists.
10 int file_exists(const char *fn
)
14 return !stat(fn
, &statbuf
);
17 int para_select(int n
, fd_set
*readfds
, fd_set
*writefds
,
18 struct timeval
*timeout
)
22 ret
= select(n
, readfds
, writefds
, NULL
, timeout
);
24 } while (ret
< 0 && errno
== EINTR
);
26 PARA_CRIT_LOG("select error (%s)\n", strerror(err
));
30 int mark_fd_nonblock(int fd
)
32 int flags
= fcntl(fd
, F_GETFL
);
35 if (fcntl(fd
, F_SETFL
, ((long)flags
) | O_NONBLOCK
) < 0)