comparison os_support.c @ 2057:857fbfeb2fa0 libavformat

implement ff_socket_nonblock and use it in networking code
author alex
date Fri, 27 Apr 2007 00:41:50 +0000
parents 3d04317ab396
children 8fc44b349f59
comparison
equal deleted inserted replaced
2056:eeea52739ff3 2057:857fbfeb2fa0
112 return -1; 112 return -1;
113 memcpy(sin_addr, hp->h_addr, sizeof(struct in_addr)); 113 memcpy(sin_addr, hp->h_addr, sizeof(struct in_addr));
114 } 114 }
115 return 0; 115 return 0;
116 } 116 }
117
118 int ff_socket_nonblock(int socket, int enable)
119 {
120 if (enable)
121 return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
122 else
123 return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
124 }
117 #endif /* CONFIG_NETWORK */ 125 #endif /* CONFIG_NETWORK */
118 126
119 #ifdef CONFIG_FFSERVER 127 #ifdef CONFIG_FFSERVER
120 #ifndef HAVE_SYS_POLL_H 128 #ifndef HAVE_SYS_POLL_H
121 int poll(struct pollfd *fds, nfds_t numfds, int timeout) 129 int poll(struct pollfd *fds, nfds_t numfds, int timeout)