diff options
author | jimw@mysql.com <> | 2005-10-11 09:12:12 -0700 |
---|---|---|
committer | jimw@mysql.com <> | 2005-10-11 09:12:12 -0700 |
commit | c8a6c2c6143dd8c92704920d455cc57050ce71ad (patch) | |
tree | 4607d81d45be27a727b93a40191ed4853e10f8ef /vio/vio.c | |
parent | 52181cc810ecf3d2103d7782055c14b7157aabcb (diff) | |
download | mariadb-git-c8a6c2c6143dd8c92704920d455cc57050ce71ad.tar.gz |
Fix wait_timeout (and kill) handling on Mac OS X by cleaning up how
signal handlers are set up, the blocking flags for sockets are set,
and which thread-related functions are used. (Bug #8731)
Diffstat (limited to 'vio/vio.c')
-rw-r--r-- | vio/vio.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/vio/vio.c b/vio/vio.c index 45572b93ed6..f60a53d2f04 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -136,10 +136,18 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) vio->sd); #if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(NO_FCNTL_NONBLOCK) -#if defined(__FreeBSD__) - fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */ -#endif - vio->fcntl_mode = fcntl(sd, F_GETFL); + /* + We call fcntl() to set the flags and then immediately read them back + to make sure that we and the system are in agreement on the state of + things. + + An example of why we need to do this is FreeBSD (and apparently some + other BSD-derived systems, like Mac OS X), where the system sometimes + reports that the socket is set for non-blocking when it really will + block. + */ + fcntl(sd, F_SETFL, vio->fcntl_mode); + vio->fcntl_mode= fcntl(sd, F_GETFL); #elif defined(HAVE_SYS_IOCTL_H) /* hpux */ /* Non blocking sockets doesn't work good on HPUX 11.0 */ (void) ioctl(sd,FIOSNBIO,0); |