Browse Source

- -mallign-double removed (incompatible with kqueue on netbst and with epoll
on linux 2.6.* => it has big problem causing potential for almost no benefit)
- sigio_rt mostly cosmetic changes

Andrei Pelinescu-Onciul 20 năm trước cách đây
mục cha
commit
a31a6e8cdd
3 tập tin đã thay đổi với 18 bổ sung11 xóa
  1. 7 4
      Makefile.defs
  2. 3 2
      io_wait.h
  3. 8 5
      tcp_main.c

+ 7 - 4
Makefile.defs

@@ -43,6 +43,7 @@
 #  2005-07-04  HAVE_DEVPOLL added to solaris (andrei)
 #  2005-07-04  HAVE_DEVPOLL added to solaris (andrei)
 #  2005-07-06  gcc 4.0 optimizations support (andrei)
 #  2005-07-06  gcc 4.0 optimizations support (andrei)
 #  2005-07-25  better solaris arch detection (andrei)
 #  2005-07-25  better solaris arch detection (andrei)
+#  2005-09-12  -mallign-double removed (too many problems) (andrei)
 
 
 
 
 # check if already included/exported
 # check if already included/exported
@@ -59,7 +60,7 @@ MAIN_NAME=ser
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 10
 PATCHLEVEL = 10
 SUBLEVEL =   99
 SUBLEVEL =   99
-EXTRAVERSION = -dev17-tcp
+EXTRAVERSION = -dev18-tcp
 
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
@@ -489,7 +490,7 @@ ifeq		($(CC_NAME), gcc)
 			#if gcc 4.0+
 			#if gcc 4.0+
 ifeq			($(CC_SHORTVER), 4.x)
 ifeq			($(CC_SHORTVER), 4.x)
 					CPU ?= athlon64
 					CPU ?= athlon64
-					CFLAGS+=-minline-all-stringops -malign-double \
+					CFLAGS+=-minline-all-stringops \
 							-falign-loops \
 							-falign-loops \
 							-ftree-vectorize \
 							-ftree-vectorize \
 							-mtune=$(CPU) 
 							-mtune=$(CPU) 
@@ -497,14 +498,14 @@ else
 			#if gcc 3.4+
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 ifeq			($(CC_SHORTVER), 3.4)
 					CPU ?= athlon
 					CPU ?= athlon
-					CFLAGS+=-minline-all-stringops -malign-double \
+					CFLAGS+=-minline-all-stringops \
 							-falign-loops \
 							-falign-loops \
 							-mtune=$(CPU) 
 							-mtune=$(CPU) 
 else
 else
 			#if gcc 3.0+
 			#if gcc 3.0+
 ifeq			($(CC_SHORTVER), 3.0)
 ifeq			($(CC_SHORTVER), 3.0)
 					CPU ?= athlon
 					CPU ?= athlon
-					CFLAGS+=-minline-all-stringops -malign-double \
+					CFLAGS+=-minline-all-stringops \
 							-falign-loops \
 							-falign-loops \
 							-mcpu=$(CPU) 
 							-mcpu=$(CPU) 
 else
 else
@@ -1005,6 +1006,8 @@ ifeq ($(OS), linux)
 	ifeq ($(shell [ $(OSREL_N) -ge 2005044 ] && echo has_epoll), has_epoll)
 	ifeq ($(shell [ $(OSREL_N) -ge 2005044 ] && echo has_epoll), has_epoll)
 		ifeq ($(NO_EPOLL),)
 		ifeq ($(NO_EPOLL),)
 			DEFS+=-DHAVE_EPOLL
 			DEFS+=-DHAVE_EPOLL
+			# linux + gcc >= 3.0 + -malign-double + epoll => problems
+			CFLAGS:=$(filter-out -malign-double, $(CFLAGS))
 		endif
 		endif
 	endif
 	endif
 	# check for >= 2.2.0
 	# check for >= 2.2.0

+ 3 - 2
io_wait.h

@@ -538,7 +538,7 @@ inline static int io_watch_del(io_wait_h* h, int fd, int idx, int flags)
 			/* the O_ASYNC flag must be reset all the time, the fd
 			/* the O_ASYNC flag must be reset all the time, the fd
 			 *  can be changed only if  O_ASYNC is reset (if not and
 			 *  can be changed only if  O_ASYNC is reset (if not and
 			 *  the fd is a duplicate, you will get signals from the dup. fd
 			 *  the fd is a duplicate, you will get signals from the dup. fd
-			 *  and not from the original, even if the dup. fd wa closed
+			 *  and not from the original, even if the dup. fd was closed
 			 *  and the signals re-set on the original) -- andrei
 			 *  and the signals re-set on the original) -- andrei
 			 */
 			 */
 			/*if (!(flags & IO_FD_CLOSING)){*/
 			/*if (!(flags & IO_FD_CLOSING)){*/
@@ -868,7 +868,8 @@ again:
 					handle_io(fm, -1);
 					handle_io(fm, -1);
 				else
 				else
 					LOG(L_ERR, "WARNING: io_wait_loop_sigio_rt: ignoring event"
 					LOG(L_ERR, "WARNING: io_wait_loop_sigio_rt: ignoring event"
-							"%x on fd %d\n", sigio_band, sigio_fd);
+							" %x on fd %d (fm->fd=%d, fm->data=%p)\n",
+							sigio_band, sigio_fd, fm->fd, fm->data);
 			}else{
 			}else{
 				LOG(L_ERR, "ERROR: io_wait_loop_sigio_rt: unexpected event"
 				LOG(L_ERR, "ERROR: io_wait_loop_sigio_rt: unexpected event"
 							" on fd %d: %x\n", sigio_fd, sigio_band);
 							" on fd %d: %x\n", sigio_fd, sigio_band);

+ 8 - 5
tcp_main.c

@@ -223,7 +223,9 @@ static int tcp_blocking_connect(int fd, const struct sockaddr *servaddr,
 	int ticks;
 	int ticks;
 	int err;
 	int err;
 	unsigned int err_len;
 	unsigned int err_len;
+	int poll_err;
 	
 	
+	poll_err=0;
 	to=tcp_connect_timeout;
 	to=tcp_connect_timeout;
 	ticks=get_ticks();
 	ticks=get_ticks();
 again:
 again:
@@ -270,17 +272,18 @@ again:
 			goto error;
 			goto error;
 		}else if (n==0) /* timeout */ continue;
 		}else if (n==0) /* timeout */ continue;
 #if defined(HAVE_SELECT) && defined(BLOCKING_USE_SELECT)
 #if defined(HAVE_SELECT) && defined(BLOCKING_USE_SELECT)
-		if (FD_ISSET(fd, &sel_set)){
+		if (FD_ISSET(fd, &sel_set))
 #else
 #else
 		if (pf.revents&(POLLERR|POLLHUP|POLLNVAL)){ 
 		if (pf.revents&(POLLERR|POLLHUP|POLLNVAL)){ 
-			LOG(L_ERR, "ERROR: tcp_blocking_connect: bad poll flags %x\n",
+			LOG(L_ERR, "ERROR: tcp_blocking_connect: poll error: flags %x\n",
 					pf.revents);
 					pf.revents);
-			goto error;
-		}else{
+			poll_err=1;
+		}
 #endif
 #endif
+		{
 			err_len=sizeof(err);
 			err_len=sizeof(err);
 			getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &err_len);
 			getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &err_len);
-			if (err==0) goto end;
+			if ((err==0) && (poll_err==0)) goto end;
 			if (err!=EINPROGRESS && err!=EALREADY){
 			if (err!=EINPROGRESS && err!=EALREADY){
 				LOG(L_ERR, "ERROR: tcp_blocking_connect: SO_ERROR (%d) %s\n",
 				LOG(L_ERR, "ERROR: tcp_blocking_connect: SO_ERROR (%d) %s\n",
 						err, strerror(err));
 						err, strerror(err));