[svn-commits] kharwell: trunk r402546 - in /trunk: apps/ main/ utils/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 8 08:58:18 CST 2013


Author: kharwell
Date: Fri Nov  8 08:58:13 2013
New Revision: 402546

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402546
Log:
app_dahdiras: Use waitpid instead of wait4.

Several places in the code were using wait4 while other places were using
waitpid.  This change makes all places use waitpid in order to make things
more consistent and since the 'rusage' object passed in/out of wait4 was
never used.

(closes issue ASTERISK-22557)
Reported by: YvesGael
Patches:
     asterisk-11.5.1-wait4.patch uploaded by hurdman (license 6537)

Modified:
    trunk/apps/app_dahdiras.c
    trunk/main/asterisk.c
    trunk/utils/extconf.c

Modified: trunk/apps/app_dahdiras.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dahdiras.c?view=diff&rev=402546&r1=402545&r2=402546
==============================================================================
--- trunk/apps/app_dahdiras.c (original)
+++ trunk/apps/app_dahdiras.c Fri Nov  8 08:58:13 2013
@@ -150,7 +150,7 @@
 		ast_log(LOG_WARNING, "Failed to spawn RAS\n");
 	} else {
 		for (;;) {
-			res = wait4(pid, &status, WNOHANG, NULL);
+			res = waitpid(pid, &status, WNOHANG);
 			if (!res) {
 				/* Check for hangup */
 				if (ast_check_hangup(chan) && !signalled) {
@@ -163,7 +163,7 @@
 				continue;
 			}
 			if (res < 0) {
-				ast_log(LOG_WARNING, "wait4 returned %d: %s\n", res, strerror(errno));
+				ast_log(LOG_WARNING, "waitpid returned %d: %s\n", res, strerror(errno));
 			}
 			if (WIFEXITED(status)) {
 				ast_verb(3, "RAS on %s terminated with status %d\n", ast_channel_name(chan), WEXITSTATUS(status));

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=402546&r1=402545&r2=402546
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Fri Nov  8 08:58:13 2013
@@ -1233,7 +1233,6 @@
 {
 	pid_t pid;
 	int res;
-	struct rusage rusage;
 	int status;
 
 #if defined(HAVE_WORKING_FORK) || defined(HAVE_WORKING_VFORK)
@@ -1265,7 +1264,7 @@
 		_exit(1);
 	} else if (pid > 0) {
 		for (;;) {
-			res = wait4(pid, &status, 0, &rusage);
+			res = waitpid(pid, &status, 0);
 			if (res > -1) {
 				res = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
 				break;
@@ -1751,7 +1750,7 @@
 	/*
 	 * Reap all dead children -- not just one
 	 */
-	for (n = 0; wait4(-1, &status, WNOHANG, NULL) > 0; n++)
+	for (n = 0; waitpid(-1, &status, WNOHANG) > 0; n++)
 		;
 	if (n == 0 && option_debug)
 		printf("Huh?  Child handler, but nobody there?\n");

Modified: trunk/utils/extconf.c
URL: http://svnview.digium.com/svn/asterisk/trunk/utils/extconf.c?view=diff&rev=402546&r1=402545&r2=402546
==============================================================================
--- trunk/utils/extconf.c (original)
+++ trunk/utils/extconf.c Fri Nov  8 08:58:13 2013
@@ -1330,7 +1330,6 @@
 	int x;
 #endif
 	int res;
-	struct rusage rusage;
 	int status;
 
 #if defined(HAVE_WORKING_FORK) || defined(HAVE_WORKING_VFORK)
@@ -1352,7 +1351,7 @@
 		_exit(1);
 	} else if (pid > 0) {
 		for(;;) {
-			res = wait4(pid, &status, 0, &rusage);
+			res = waitpid(pid, &status, 0);
 			if (res > -1) {
 				res = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
 				break;




More information about the svn-commits mailing list