Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/ksh ksh: Drop support for systems with broken times(3)



details:   https://anonhg.NetBSD.org/src/rev/88ee05a02f4d
branches:  trunk
changeset: 354796:88ee05a02f4d
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Jun 30 03:23:18 2017 +0000

description:
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.

diffstat:

 bin/ksh/c_sh.c      |  13 +++++++------
 bin/ksh/config.h    |   5 +----
 bin/ksh/jobs.c      |  10 +++++-----
 bin/ksh/ksh_times.h |  20 --------------------
 4 files changed, 13 insertions(+), 35 deletions(-)

diffs (140 lines):

diff -r 89531795f63f -r 88ee05a02f4d bin/ksh/c_sh.c
--- a/bin/ksh/c_sh.c    Fri Jun 30 02:51:14 2017 +0000
+++ b/bin/ksh/c_sh.c    Fri Jun 30 03:23:18 2017 +0000
@@ -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 @@
 {
        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 @@
        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 @@
                opts[0] = 0;
                rv = execute(t->left, f | XTIME);
                tf |= opts[0];
-               t1t = ksh_times(&t1);
+               t1t = times(&t1);
        } else
                tf = TF_NOARGS;
 
diff -r 89531795f63f -r 88ee05a02f4d bin/ksh/config.h
--- a/bin/ksh/config.h  Fri Jun 30 02:51:14 2017 +0000
+++ b/bin/ksh/config.h  Fri Jun 30 03:23:18 2017 +0000
@@ -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 */
 
diff -r 89531795f63f -r 88ee05a02f4d bin/ksh/jobs.c
--- a/bin/ksh/jobs.c    Fri Jun 30 02:51:14 2017 +0000
+++ b/bin/ksh/jobs.c    Fri Jun 30 03:23:18 2017 +0000
@@ -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 @@
                        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)
diff -r 89531795f63f -r 88ee05a02f4d bin/ksh/ksh_times.h
--- a/bin/ksh/ksh_times.h       Fri Jun 30 02:51:14 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-/*     $NetBSD: ksh_times.h,v 1.2 1997/01/12 19:12:02 tls Exp $        */
-
-#ifndef KSH_TIMES_H
-# define KSH_TIMES_H
-
-/* Needed for clock_t on some systems (ie, NeXT in non-posix mode) */
-#include "ksh_time.h"
-
-#include <sys/times.h>
-
-#ifdef TIMES_BROKEN
-extern clock_t ksh_times ARGS((struct tms *));
-#else /* TIMES_BROKEN */
-# define ksh_times times
-#endif /* TIMES_BROKEN */
-
-#ifdef HAVE_TIMES
-extern clock_t times ARGS((struct tms *));
-#endif /* HAVE_TIMES */
-#endif /* KSH_TIMES_H */



Home | Main Index | Thread Index | Old Index