Feature #11145 » 0001-socket-avoid-redundant-fcntl-on-Linux.patch
ext/socket/ancdata.c | ||
---|---|---|
#endif
|
||
rb_io_check_closed(fptr);
|
||
if (nonblock)
|
||
if (nonblock && !MSG_DONTWAIT_RELIABLE)
|
||
rb_io_set_nonblock(fptr);
|
||
ss = rb_sendmsg(fptr->fd, &mh, flags);
|
||
... | ... | |
flags |= MSG_PEEK;
|
||
rb_io_check_closed(fptr);
|
||
if (nonblock)
|
||
if (nonblock && !MSG_DONTWAIT_RELIABLE)
|
||
rb_io_set_nonblock(fptr);
|
||
ss = rb_recvmsg(fptr->fd, &mh, flags);
|
ext/socket/init.c | ||
---|---|---|
str = rb_tainted_str_new(0, buflen);
|
||
rb_io_check_closed(fptr);
|
||
rb_io_set_nonblock(fptr);
|
||
if (!MSG_DONTWAIT_RELIABLE)
|
||
rb_io_set_nonblock(fptr);
|
||
len0 = alen;
|
||
slen = recvfrom(fd, RSTRING_PTR(str), buflen, flags, &buf.addr, &alen);
|
||
if (slen != -1 && len0 < alen)
|
ext/socket/rubysocket.h | ||
---|---|---|
#if defined(__linux__)
|
||
static inline int rsock_maybe_fd_writable(int fd) { return 1; }
|
||
static inline void rsock_maybe_wait_fd(int fd) { }
|
||
# ifdef MSG_DONTWAIT
|
||
# define MSG_DONTWAIT_RELIABLE 1
|
||
# endif
|
||
#else /* some systems (mswin/mingw) need these. ref: r36946 */
|
||
# define rsock_maybe_fd_writable(fd) rb_thread_fd_writable((fd))
|
||
# define rsock_maybe_wait_fd(fd) rb_thread_wait_fd((fd))
|
||
#endif
|
||
/*
|
||
* some OSes may support MSG_DONTWAIT inconsistently depending on socket
|
||
* type, we only expect Linux to support it consistently for all socket types.
|
||
*/
|
||
#ifndef MSG_DONTWAIT_RELIABLE
|
||
# define MSG_DONTWAIT_RELIABLE 0
|
||
#endif
|
||
#endif
|
||
-
|
- « Previous
- 1
- 2
- Next »