2
0
Эх сурвалжийг харах

- openbsd fixes from Hendrik Scholz <[email protected]>:
- sigwaitinfo is not available on openbsd => s/sigwaitinfo/sigwait/
- sigwait requires linking with libpthread (on openbsd)
- openbsd requires netinet/in_systm.h

Andrei Pelinescu-Onciul 19 жил өмнө
parent
commit
000f4d3382
2 өөрчлөгдсөн 9 нэмэгдсэн , 3 устгасан
  1. 5 3
      Makefile.defs
  2. 4 0
      timer.c

+ 5 - 3
Makefile.defs

@@ -61,7 +61,7 @@ MAIN_NAME=ser
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 10
 PATCHLEVEL = 10
 SUBLEVEL =   99
 SUBLEVEL =   99
-EXTRAVERSION = -dev32
+EXTRAVERSION = -dev33
 
 
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 			$(SUBLEVEL) )
 			$(SUBLEVEL) )
@@ -1094,7 +1094,8 @@ endif
 ifeq ($(OS), openbsd)
 ifeq ($(OS), openbsd)
 	DEFS+=-DHAVE_SOCKADDR_SA_LEN  -DHAVE_GETHOSTBYNAME2 \
 	DEFS+=-DHAVE_SOCKADDR_SA_LEN  -DHAVE_GETHOSTBYNAME2 \
 		-DHAVE_UNION_SEMUN -DHAVE_MSGHDR_MSG_CONTROL \
 		-DHAVE_UNION_SEMUN -DHAVE_MSGHDR_MSG_CONTROL \
-		-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM
+		-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
+		-DHAVE_NETINET_IN_SYSTM -DUSE_SIGWAIT
 	ifneq ($(found_lock_method), yes)
 	ifneq ($(found_lock_method), yes)
 		DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
 		DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
 		found_lock_method=yes
 		found_lock_method=yes
@@ -1111,7 +1112,8 @@ ifeq ($(OS), openbsd)
 	# (symbols on openbsd are prefixed by "_")
 	# (symbols on openbsd are prefixed by "_")
 	YACC=yacc
 	YACC=yacc
 	# no sched_yield on openbsd unless linking with c_r (not recommended)
 	# no sched_yield on openbsd unless linking with c_r (not recommended)
-	LIBS= -lfl 
+	# unfortunately pthread is needed for sigwait
+	LIBS= -lfl -lpthread
 	OPENBSD_IS_AOUT= $(shell echo "$(OSREL)" | \
 	OPENBSD_IS_AOUT= $(shell echo "$(OSREL)" | \
 				sed -e 's/^3\.[0-3][^0-9]*$$/yes/' |sed -e 's/^[0-2]\..*/yes/')
 				sed -e 's/^3\.[0-3][^0-9]*$$/yes/' |sed -e 's/^[0-2]\..*/yes/')
 # exception: on sparc openbsd 3.2 is elf and not aout
 # exception: on sparc openbsd 3.2 is elf and not aout

+ 4 - 0
timer.c

@@ -987,7 +987,11 @@ void slow_timer_main()
 	
 	
 	in_slow_timer=1; /* mark this process as the slow timer */
 	in_slow_timer=1; /* mark this process as the slow timer */
 	while(1){
 	while(1){
+#ifdef USE_SIGWAIT
+		n=sigwait(&slow_timer_sset, 0);
+#else
 		n=sigwaitinfo(&slow_timer_sset, 0);
 		n=sigwaitinfo(&slow_timer_sset, 0);
+#endif
 		if (n==-1){
 		if (n==-1){
 			if (errno==EINTR) continue; /* some other signal, ignore it */
 			if (errno==EINTR) continue; /* some other signal, ignore it */
 			LOG(L_ERR, "ERROR: slow_timer_main: sigwaitinfo failed: %s [%d]\n",
 			LOG(L_ERR, "ERROR: slow_timer_main: sigwaitinfo failed: %s [%d]\n",