projects
/
gapil.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f00c8a5
)
Modifica da uso.
author
Simone Piccardi
<piccardi@gnulinux.it>
Fri, 20 May 2011 17:57:22 +0000
(17:57 +0000)
committer
Simone Piccardi
<piccardi@gnulinux.it>
Fri, 20 May 2011 17:57:22 +0000
(17:57 +0000)
sources/testsignalcgi.c
patch
|
blob
|
history
diff --git
a/sources/testsignalcgi.c
b/sources/testsignalcgi.c
index 5692c83f59676d1e28f165e09fffca2dc725d00b..b021b2fbc1f992a22d3a2fe765c7b0eae839b9a4 100644
(file)
--- a/
sources/testsignalcgi.c
+++ b/
sources/testsignalcgi.c
@@
-45,7
+45,6
@@
typedef void SigFunc(int, siginfo_t *, void *);
SigFunc * Signal(int signo, SigFunc *func);
FILE * file;
SigFunc * Signal(int signo, SigFunc *func);
FILE * file;
-time_t t;
/* Program begin */
int main(int argc, char *argv[], char *envp[])
/* Program begin */
int main(int argc, char *argv[], char *envp[])
@@
-54,11
+53,12
@@
int main(int argc, char *argv[], char *envp[])
* Variables definition
*/
char content[]="Content-type: text/html\n\n";
* Variables definition
*/
char content[]="Content-type: text/html\n\n";
+ time_t t;
int i;
struct sigaction new_handl, old_handl;
/* write mime-type to stdout */
write(STDOUT_FILENO, content, strlen(content));
int i;
struct sigaction new_handl, old_handl;
/* write mime-type to stdout */
write(STDOUT_FILENO, content, strlen(content));
- file = fopen("/tmp/testcgi.out","w+");
+ file = fopen("/tmp/test
signal
cgi.out","w+");
Signal(SIGPIPE,sig_hand);
Signal(SIGQUIT,sig_hand);
Signal(SIGTERM,sig_hand);
Signal(SIGPIPE,sig_hand);
Signal(SIGQUIT,sig_hand);
Signal(SIGTERM,sig_hand);
@@
-67,12
+67,10
@@
int main(int argc, char *argv[], char *envp[])
Signal(SIGUSR1,sig_hand);
Signal(SIGUSR2,sig_hand);
Signal(SIGIO,sig_hand);
Signal(SIGUSR1,sig_hand);
Signal(SIGUSR2,sig_hand);
Signal(SIGIO,sig_hand);
- Signal(SIGIO,sig_hand);
Signal(SIGURG,sig_hand);
Signal(SIGABRT,sig_hand);
pause();
t = time(NULL);
Signal(SIGURG,sig_hand);
Signal(SIGABRT,sig_hand);
pause();
t = time(NULL);
- fprintf(stdout, "Exit time: %s", ctime(&t));
fprintf(file, "Exit time: %s", ctime(&t));
exit(0);
}
fprintf(file, "Exit time: %s", ctime(&t));
exit(0);
}
@@
-84,10
+82,9
@@
void sig_hand(int sig, siginfo_t * siginfo, void *ptr) {
/* just return to interrupt sigsuspend */
pid_t pid;
/* just return to interrupt sigsuspend */
pid_t pid;
+ time_t t;
t = time(NULL);
t = time(NULL);
- fprintf(stdout, "Received time: %s", ctime(&t));
fprintf(file, "Received time: %s", ctime(&t));
fprintf(file, "Received time: %s", ctime(&t));
- fprintf(stdout, "Signal is: %i\n", sig);
pid=getpid();
fprintf(file, "My pid is: %i, sending pid %i, uid %i\n",
pid,siginfo->si_pid,siginfo->si_uid);
pid=getpid();
fprintf(file, "My pid is: %i, sending pid %i, uid %i\n",
pid,siginfo->si_pid,siginfo->si_uid);
@@
-95,7
+92,6
@@
void sig_hand(int sig, siginfo_t * siginfo, void *ptr) {
sig,siginfo->si_signo,siginfo->si_errno,siginfo->si_code);
sleep(1);
t = time(NULL);
sig,siginfo->si_signo,siginfo->si_errno,siginfo->si_code);
sleep(1);
t = time(NULL);
- fprintf(stdout, "Printed time: %s", ctime(&t));
fprintf(file, "Printed time: %s", ctime(&t));
}
fprintf(file, "Printed time: %s", ctime(&t));
}