inetd.c (102938) | inetd.c (102939) |
---|---|
1/* 2 * Copyright (c) 1983, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94"; 43#endif 44#endif /* not lint */ 45 46#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1983, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94"; 43#endif 44#endif /* not lint */ 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/usr.sbin/inetd/inetd.c 102938 2002-09-04 20:31:53Z dwmalone $"); | 47__FBSDID("$FreeBSD: head/usr.sbin/inetd/inetd.c 102939 2002-09-04 21:00:45Z dwmalone $"); |
48 49/* 50 * Inetd - Internet super-server 51 * 52 * This program invokes all internet services as needed. Connection-oriented 53 * services are invoked each time a connection is made, by creating a process. 54 * This process is passed the connection as file descriptor 0 and is expected 55 * to do a getpeername to find out the source host and port. --- 856 unchanged lines hidden (view full) --- 912 pid_t pid; 913 struct servtab *sep; 914 915 for (;;) { 916 pid = wait3(&status, WNOHANG, (struct rusage *)0); 917 if (pid <= 0) 918 break; 919 if (debug) | 48 49/* 50 * Inetd - Internet super-server 51 * 52 * This program invokes all internet services as needed. Connection-oriented 53 * services are invoked each time a connection is made, by creating a process. 54 * This process is passed the connection as file descriptor 0 and is expected 55 * to do a getpeername to find out the source host and port. --- 856 unchanged lines hidden (view full) --- 912 pid_t pid; 913 struct servtab *sep; 914 915 for (;;) { 916 pid = wait3(&status, WNOHANG, (struct rusage *)0); 917 if (pid <= 0) 918 break; 919 if (debug) |
920 warnx("%d reaped, status %#x", pid, status); | 920 warnx("%d reaped, %s %u", pid, 921 WIFEXITED(status) ? "status" : "signal", 922 WIFEXITED(status) ? WEXITSTATUS(status) 923 : WTERMSIG(status)); |
921 for (sep = servtab; sep; sep = sep->se_next) { 922 for (k = 0; k < sep->se_numchild; k++) 923 if (sep->se_pids[k] == pid) 924 break; 925 if (k == sep->se_numchild) 926 continue; 927 if (sep->se_numchild == sep->se_maxchild) 928 enable(sep); 929 sep->se_pids[k] = sep->se_pids[--sep->se_numchild]; | 924 for (sep = servtab; sep; sep = sep->se_next) { 925 for (k = 0; k < sep->se_numchild; k++) 926 if (sep->se_pids[k] == pid) 927 break; 928 if (k == sep->se_numchild) 929 continue; 930 if (sep->se_numchild == sep->se_maxchild) 931 enable(sep); 932 sep->se_pids[k] = sep->se_pids[--sep->se_numchild]; |
930 if (status) | 933 if (WIFSIGNALED(status) || WEXITSTATUS(status)) |
931 syslog(LOG_WARNING, | 934 syslog(LOG_WARNING, |
932 "%s[%d]: exit status 0x%x", 933 sep->se_server, pid, status); | 935 "%s[%d]: exited, %s %u", 936 sep->se_server, pid, 937 WIFEXITED(status) ? "status" : "signal", 938 WIFEXITED(status) ? WEXITSTATUS(status) 939 : WTERMSIG(status)); |
934 break; 935 } 936 reapchild_conn(pid); 937 } 938} 939 940void 941flag_config(int signo __unused) --- 1601 unchanged lines hidden --- | 940 break; 941 } 942 reapchild_conn(pid); 943 } 944} 945 946void 947flag_config(int signo __unused) --- 1601 unchanged lines hidden --- |