... | ... |
@@ -10,7 +10,7 @@ auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc |
10 | 10 |
#include source related defs |
11 | 11 |
include Makefile.sources |
12 | 12 |
|
13 |
-exclude_modules=CVS mysql auth cpl jabber acc pike ext |
|
13 |
+exclude_modules=CVS mysql pike |
|
14 | 14 |
static_modules= |
15 | 15 |
static_modules_path=$(addprefix modules/, $(static_modules)) |
16 | 16 |
extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path))) |
... | ... |
@@ -22,6 +22,8 @@ DEFS+=$(static_defs) |
22 | 22 |
modules=$(filter-out $(addprefix modules/, \ |
23 | 23 |
$(exclude_modules) $(static_modules)), \ |
24 | 24 |
$(wildcard modules/*)) |
25 |
+modules_names=$(patsubst modules/%/, %.so, $(modules)) |
|
26 |
+modules_full_path=$(join $(modules), $(modules_names)) |
|
25 | 27 |
|
26 | 28 |
NAME=ser |
27 | 29 |
|
... | ... |
@@ -84,3 +86,43 @@ tar: mantainer-clean |
84 | 86 |
tar -C .. -zcf ../$(NAME)-$(RELEASE)_src.tar.gz $(notdir $(CURDIR)) |
85 | 87 |
|
86 | 88 |
|
89 |
+install: all mk-install-dirs install-cfg install-bin install-modules \ |
|
90 |
+ install-doc |
|
91 |
+ |
|
92 |
+ |
|
93 |
+mk-install-dirs: $(cfg-prefix)/$(cfg-dir) $(bin-prefix)/$(bin-dir) \ |
|
94 |
+ $(modules-prefix)/$(modules-dir) $(doc-prefix)/$(doc-dir) |
|
95 |
+ |
|
96 |
+$(cfg-prefix)/$(cfg-dir): |
|
97 |
+ mkdir -p $(cfg-prefix)/$(cfg-dir) |
|
98 |
+ |
|
99 |
+$(bin-prefix)/$(bin-dir): |
|
100 |
+ mkdir -p $(bin-prefix)/$(bin-dir) |
|
101 |
+ |
|
102 |
+$(modules-prefix)/$(modules-dir): |
|
103 |
+ mkdir -p $(modules-prefix)/$(modules-dir) |
|
104 |
+ |
|
105 |
+ |
|
106 |
+$(doc-prefix)/$(doc-dir): |
|
107 |
+ mkdir -p $(doc-prefix)/$(doc-dir) |
|
108 |
+ |
|
109 |
+ |
|
110 |
+install-cfg: |
|
111 |
+ $(INSTALL-CFG) ser.cfg $(cfg-prefix)/$(cfg-dir) |
|
112 |
+ |
|
113 |
+install-bin: |
|
114 |
+ $(INSTALL-BIN) ser $(bin-prefix)/$(bin-dir) |
|
115 |
+ |
|
116 |
+ |
|
117 |
+install-modules: |
|
118 |
+ -@for r in $(modules_full_path) "" ; do \ |
|
119 |
+ if [ -n "$$r" ]; then \ |
|
120 |
+ $(INSTALL-MODULES) $$r $(modules-prefix)/$(modules-dir) ; \ |
|
121 |
+ fi ; \ |
|
122 |
+ done |
|
123 |
+ |
|
124 |
+ |
|
125 |
+install-doc: |
|
126 |
+ $(INSTALL-DOC) README $(doc-prefix)/$(doc-dir) |
|
127 |
+ |
|
128 |
+ |
... | ... |
@@ -8,12 +8,31 @@ |
8 | 8 |
VERSION = 0 |
9 | 9 |
PATCHLEVEL = 8 |
10 | 10 |
SUBLEVEL = 7 |
11 |
-EXTRAVERSION = -5-ipv6 |
|
11 |
+EXTRAVERSION = -6-ipv6 |
|
12 | 12 |
|
13 | 13 |
RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
14 | 14 |
OS = $(shell uname -s) |
15 | 15 |
ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ ) |
16 | 16 |
|
17 |
+prefix = /usr/local |
|
18 |
+cfg-prefix = $(prefix) |
|
19 |
+bin-prefix = $(prefix) |
|
20 |
+modules-prefix= $(prefix) |
|
21 |
+doc-prefix = $(prefix) |
|
22 |
+ |
|
23 |
+# dirs |
|
24 |
+cfg-dir = etc/ser/ |
|
25 |
+bin-dir = sbin/ |
|
26 |
+modules-dir = lib/ser/modules/ |
|
27 |
+doc-dir = doc/ser/ |
|
28 |
+ |
|
29 |
+INSTALL = install -b |
|
30 |
+INSTALL-CFG = $(INSTALL) -m 644 |
|
31 |
+INSTALL-BIN = $(INSTALL) -m 755 |
|
32 |
+INSTALL-MODULES = $(INSTALL) -m 755 |
|
33 |
+INSTALL-DOC = $(INSTALL) -m 644 |
|
34 |
+ |
|
35 |
+ |
|
17 | 36 |
# compile-time options |
18 | 37 |
# |
19 | 38 |
# -DSTATS |
... | ... |
@@ -484,7 +484,6 @@ int main_loop() |
484 | 484 |
} |
485 | 485 |
} |
486 | 486 |
/* main process, receive loop */ |
487 |
- is_main=1; |
|
488 | 487 |
pids[0]=getpid(); |
489 | 488 |
process_bit = 1; |
490 | 489 |
process_no=0; /*main process number*/ |
... | ... |
@@ -497,6 +496,8 @@ int main_loop() |
497 | 496 |
LOG(L_ERR, "init_child failed\n"); |
498 | 497 |
goto error; |
499 | 498 |
} |
499 |
+ is_main=1; /* hack 42: call init_child with is_main=0 in case |
|
500 |
+ some modules wants to fork a child */ |
|
500 | 501 |
|
501 | 502 |
return udp_rcv_loop(); |
502 | 503 |
}else{ |
... | ... |
@@ -593,7 +594,7 @@ static void sig_usr(int signo) |
593 | 594 |
else /* previous sig. not processed yet, ignoring? */ |
594 | 595 |
return; ; |
595 | 596 |
if (dont_fork) |
596 |
- /* only one proc, dooing everything from the sig handler, |
|
597 |
+ /* only one proc, doing everything from the sig handler, |
|
597 | 598 |
unsafe, but this is only for debugging mode*/ |
598 | 599 |
handle_sigs(); |
599 | 600 |
}else{ |
... | ... |
@@ -611,6 +612,8 @@ static void sig_usr(int signo) |
611 | 612 |
case SIGUSR2: |
612 | 613 |
case SIGHUP: |
613 | 614 |
break; |
615 |
+ case SIGCHLD: |
|
616 |
+ exit(0); /* terminate if one child died */ |
|
614 | 617 |
} |
615 | 618 |
} |
616 | 619 |
} |