• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Opengate Source Repository


Commit MetaInfo

Révision162203c25e16fae8eb8be77b3189da062a7f7111 (tree)
l'heure2016-05-06 12:57:59
Auteurwatanaby <watanaby@user...>
Commiterwatanaby

Message de Log

Ver.1.5.36 relpaced signal function.

Change Summary

Modification

--- a/opengate/README
+++ b/opengate/README
@@ -43,7 +43,7 @@ doc/ Documentation files
4343 Changes.html Change log
4444 GPL.txt GNU General Public License
4545
46-javahtml/ Client Java Applet and HTML files
46+javahtml/ Client JavaScript and HTML files
4747 index.html.var Document selector placed in DocumentRoot
4848 httpkeep.js JavaScript code for http keep-alive
4949 md5.js JavaScript code for MD5 hash
--- a/opengate/doc/Changes.html
+++ b/opengate/doc/Changes.html
@@ -787,6 +787,11 @@ Opengate History</H3>
787787 </DT><DD>
788788 Modified comments.
789789 </DD>
790+ <DT>
791+ Ver.1.5.36 at 2016.5.6
792+ </DT><DD>
793+ Replaced signal function to NO-RESTART one.
794+ </DD>
790795 </DL>
791796 <P>
792797 <B>Please see GIT on osdn.jp to check the differences between versions.</B>
--- a/opengate/opengatesrv/comm-ip6fw.c
+++ b/opengate/opengatesrv/comm-ip6fw.c
@@ -54,7 +54,7 @@ int openClientGate6(char *clientAddr6, char *userid, char *macAddr6, char *userP
5454 }
5555
5656 /* set timeout */
57- if((defaultSigFunc=Signal(SIGALRM, sigFunc))==SIG_ERR) return 1;
57+ if((defaultSigFunc=signalx(SIGALRM, sigFunc))==SIG_ERR) return 1;
5858 alarm(atoi(GetConfValue("LockTimeout")));
5959
6060 /* lock */
@@ -64,7 +64,7 @@ int openClientGate6(char *clientAddr6, char *userid, char *macAddr6, char *userP
6464 }
6565
6666 /* reset timeout */
67- Signal(SIGALRM, defaultSigFunc);
67+ signalx(SIGALRM, defaultSigFunc);
6868 alarm(0);
6969
7070 /**** read rules ****/
--- a/opengate/opengatesrv/comm-ipfw.c
+++ b/opengate/opengatesrv/comm-ipfw.c
@@ -54,7 +54,7 @@ int openClientGate4(char *clientAddr4, char *userid, char *macAddr4, char *userP
5454 }
5555
5656 /* set timeout */
57- if((defaultSigFunc=Signal(SIGALRM, sigFunc))==SIG_ERR) return 1;
57+ if((defaultSigFunc=signalx(SIGALRM, sigFunc))==SIG_ERR) return 1;
5858 alarm(atoi(GetConfValue("LockTimeout")));
5959
6060 /* lock */
@@ -64,7 +64,7 @@ int openClientGate4(char *clientAddr4, char *userid, char *macAddr4, char *userP
6464 }
6565
6666 /* reset timeout */
67- Signal(SIGALRM, defaultSigFunc);
67+ signalx(SIGALRM, defaultSigFunc);
6868 alarm(0);
6969
7070 /**** read rules ****/
--- a/opengate/opengatesrv/ctrl-alarms.c
+++ b/opengate/opengatesrv/ctrl-alarms.c
@@ -213,8 +213,8 @@ int enableAlarm(void)
213213 pRunningAlarm = p;
214214
215215 /* set signal alarm */
216- if(defaultSigfunc==NULL)defaultSigfunc=signal(SIGALRM, alarmSigFunc);
217- else signal(SIGALRM, alarmSigFunc);
216+ if(defaultSigfunc==NULL)defaultSigfunc=signalx(SIGALRM, alarmSigFunc);
217+ else signalx(SIGALRM, alarmSigFunc);
218218 alarm(alarmemain);
219219 alarmSet=TRUE;
220220
@@ -233,7 +233,7 @@ Time count is not stoped in disable mode
233233 int disableAlarm(void)
234234 {
235235 /* reset alarm */
236- signal(SIGALRM, defaultSigfunc);
236+ signalx(SIGALRM, defaultSigfunc);
237237 alarm(0);
238238
239239 return 0;
--- a/opengate/opengatesrv/main.c
+++ b/opengate/opengatesrv/main.c
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
212212 CreateCookie(cookie);
213213
214214 /* set terminate signal handler */
215- if(Signal(SIGTERM, closeExit)==SIG_ERR){
215+ if(signalx(SIGTERM, closeExit)==SIG_ERR){
216216 PutClientMsg("Error: Please contact the administrator(2)");
217217 return 0;
218218 }
@@ -331,7 +331,7 @@ void closeExit(int signo)
331331 PutSessionEndToDb(cookie, mode[connectionMode]);
332332
333333 /* signal is disabled */
334- Signal(SIGTERM, SIG_DFL);
334+ signalx(SIGTERM, SIG_DFL);
335335
336336 /* ignore redundant process */
337337 if(connectionMode!=DUPLICATED){
--- a/opengate/opengatesrv/opengatesrv.h
+++ b/opengate/opengatesrv/opengatesrv.h
@@ -218,7 +218,6 @@ int Pipe(int *fds);
218218 int Getpeername(int fd, struct sockaddr *sa, socklen_t *salenptr);
219219 int Socket(int family, int type, int protocol);
220220 int Listen(int fd, int backlog);
221-Sigfunc * Signal(int signo, Sigfunc *func);
222221 void * Malloc(size_t size);
223222
224223 char* getenvEx(char* env, int pre, int post);
@@ -252,3 +251,6 @@ void listAlarm(void);
252251 /* udp-client.c */
253252 int PutMacAddressToOpengateMd(char* macAddress);
254253 int PutDataToUdpPort(char* udpServerAddr, char* udpServerPort, char* buff);
254+
255+/* signal.c */
256+Sigfunc* signalx(int signo, Sigfunc* func);
--- a/opengate/opengatesrv/signal.c
+++ b/opengate/opengatesrv/signal.c
@@ -1,41 +1,18 @@
1-/**********************************************************/
2-/* signal function */
3-/* from UNIX NETWORK PROGRAMMING,Vol.1,Second Edition, */
4-/* By W. Richard Stevens, Published By Prentice Hall */
5-/* ftp://ftp.kohala.com/pub/rstevens/unpv12e.tar.gz */
6-/**********************************************************/
7-/* include signal */
81 #include "opengatesrv.h"
92
10-Sigfunc *
11-signal(int signo, Sigfunc *func)
3+/**********************************************************/
4+/* signal function WITHOUT SA_RESTART */
5+/**********************************************************/
6+Sigfunc* signalx(int signo, Sigfunc* func)
127 {
13- struct sigaction act, oact;
8+ struct sigaction act, oldact;
149
15- act.sa_handler = func;
16- sigemptyset(&act.sa_mask);
17- act.sa_flags = 0;
18- if (signo == SIGALRM) {
19-#ifdef SA_INTERRUPT
20- act.sa_flags |= SA_INTERRUPT; /* SunOS 4.x */
21-#endif
22- } else {
23-#ifdef SA_RESTART
24- act.sa_flags |= SA_RESTART; /* SVR4, 44BSD */
25-#endif
26- }
27- if (sigaction(signo, &act, &oact) < 0)
28- return(SIG_ERR);
29- return(oact.sa_handler);
30-}
31-/* end signal */
32-
33-Sigfunc *
34-Signal(int signo, Sigfunc *func) /* for our signal() function */
35-{
36- Sigfunc *sigfunc;
10+ act.sa_handler = func;
11+ sigemptyset(&act.sa_mask);
12+ act.sa_flags = 0;
3713
38- if ( (sigfunc = signal(signo, func)) == SIG_ERR)
39- err_msg("signal error");
40- return(sigfunc);
14+ if (sigaction(signo, &act, &oldact) < 0) return(SIG_ERR);
15+
16+ return(oldact.sa_handler);
4117 }
18+