Commit a5343e76 authored by Andrew Tridgell's avatar Andrew Tridgell

put set_nonblocking() code back in.

parent 704f908e
...@@ -24,15 +24,33 @@ ...@@ -24,15 +24,33 @@
*/ */
#include "rsync.h" #include "rsync.h"
int num_waiting(int fd) /****************************************************************************
Set a fd into nonblocking mode. Uses POSIX O_NONBLOCK if available,
else
if SYSV use O_NDELAY
if BSD use FNDELAY
****************************************************************************/
int set_nonblocking(int fd)
{ {
int len=0; int val;
ioctl(fd,FIONREAD,&len); #ifdef O_NONBLOCK
return(len); #define FLAG_TO_SET O_NONBLOCK
#else
#ifdef SYSV
#define FLAG_TO_SET O_NDELAY
#else /* BSD */
#define FLAG_TO_SET FNDELAY
#endif
#endif
if((val = fcntl(fd, F_GETFL, 0)) == -1)
return -1;
val |= FLAG_TO_SET;
return fcntl( fd, F_SETFL, val);
#undef FLAG_TO_SET
} }
/* this is taken from CVS */ /* this is taken from CVS */
int piped_child(char **command,int *f_in,int *f_out) int piped_child(char **command,int *f_in,int *f_out)
{ {
...@@ -206,7 +224,7 @@ int create_directory_path(char *fname) ...@@ -206,7 +224,7 @@ int create_directory_path(char *fname)
derived from GNU C's cccp.c. derived from GNU C's cccp.c.
*/ */
int full_write(int desc, char *ptr, int len) static int full_write(int desc, char *ptr, int len)
{ {
int total_written; int total_written;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment