Module Name:    src
Committed By:   kamil
Date:           Fri Jun 30 03:23:18 UTC 2017

Modified Files:
        src/bin/ksh: c_sh.c config.h jobs.c
Removed Files:
        src/bin/ksh: ksh_times.h

Log Message:
ksh: Drop support for systems with broken times(3)

This fallback code wouldn't work anyway.

times(3) is an obsolete interface by getrusage(2) and gettimeofday(2).
In future it will be swiched to more modern interfaces.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/c_sh.c
cvs rdiff -u -r1.46 -r1.47 src/bin/ksh/config.h
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/jobs.c
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_times.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.19 src/bin/ksh/c_sh.c:1.20
--- src/bin/ksh/c_sh.c:1.19	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,14 +6,15 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $");
 #endif
 
+#include <sys/times.h>
 
 #include "sh.h"
 #include "ksh_stat.h" 	/* umask() */
 #include "ksh_time.h"
-#include "ksh_times.h"
+
 
 static	char *clocktos ARGS((clock_t t));
 
@@ -706,7 +707,7 @@ c_times(wp)
 {
 	struct tms all;
 
-	(void) ksh_times(&all);
+	times(&all);
 	shprintf("Shell: %8ss user ", clocktos(all.tms_utime));
 	shprintf("%8ss system\n", clocktos(all.tms_stime));
 	shprintf("Kids:  %8ss user ", clocktos(all.tms_cutime));
@@ -733,7 +734,7 @@ timex(t, f)
 	extern clock_t j_usrtime, j_systime; /* computed by j_wait */
 	char opts[1];
 
-	t0t = ksh_times(&t0);
+	t0t = times(&t0);
 	if (t->left) {
 		/*
 		 * Two ways of getting cpu usage of a command: just use t0
@@ -749,7 +750,7 @@ timex(t, f)
 		opts[0] = 0;
 		rv = execute(t->left, f | XTIME);
 		tf |= opts[0];
-		t1t = ksh_times(&t1);
+		t1t = times(&t1);
 	} else
 		tf = TF_NOARGS;
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.46 src/bin/ksh/config.h:1.47
--- src/bin/ksh/config.h:1.46	Fri Jun 30 02:51:14 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.46 2017/06/30 02:51:14 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.47 2017/06/30 03:23:18 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -78,9 +78,6 @@
 /* Define if you have a sane <termio.h> header file */
 /* #undef HAVE_TERMIO_H */
 
-/* Define if you don't have times() or if it always returns 0 */
-/* #undef TIMES_BROKEN */
-
 /* Define if opendir() will open non-directory files */
 /* #undef OPENDIR_DOES_NONDIR */
 

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.16 src/bin/ksh/jobs.c:1.17
--- src/bin/ksh/jobs.c:1.16	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -21,14 +21,14 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $");
 #endif
 
+#include <sys/times.h>
 #include <sys/wait.h>
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_times.h"
 #include "tty.h"
 
 /* Start of system configuration stuff */
@@ -1263,14 +1263,14 @@ j_sigchld(sig)
 			return RETSIGVAL;
 		}
 
-	ksh_times(&t0);
+	times(&t0);
 	do {
 		pid = waitpid(-1, &status, (WNOHANG|WUNTRACED));
 
 		if (pid <= 0)	/* return if would block (0) ... */
 			break;	/* ... or no children or interrupted (-1) */
 
-		ksh_times(&t1);
+		times(&t1);
 
 		/* find job and process structures for this pid */
 		for (j = job_list; j != (Job *) 0; j = j->next)

Reply via email to