From a6131306dd49537de45afdfdc6d4ad2dcac7655b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 14 Feb 2014 13:22:51 +0200 Subject: VMS updates. --- extension/ChangeLog | 4 ++++ extension/time.c | 31 ++++++++++++++++++++----------- vms/ChangeLog | 7 ++++++- vms/vmstest.com | 11 ++++++++++- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/extension/ChangeLog b/extension/ChangeLog index 965e0c66..bde626de 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2014-02-12 John E. Malmberg + + * time.c: Better hack for nanosleep bug based on feedback from HP. + 2013-12-29 John E. Malmberg * filefuncs.c: Fix compile on VMS. diff --git a/extension/time.c b/extension/time.c index b1e9a40a..c336df88 100644 --- a/extension/time.c +++ b/extension/time.c @@ -1,25 +1,24 @@ /* * time.c - Builtin functions that provide time-related functions. - * */ /* * Copyright (C) 2012, 2013 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -46,18 +45,28 @@ #undef gettimeofday #endif #ifdef __ia64__ -/* nanosleep not working on IA64 */ +/* nanosleep not working correctly on IA64 */ static int -vms_fake_nanosleep(const struct timespec *rqdly, struct timespec *rmdly) +vms_fake_nanosleep(struct timespec *rqdly, struct timespec *rmdly) { int result; + struct timespec mtime1, mtime2; - result = sleep(rqdly->tv_sec); - if (result == 0) { + result = nanosleep(rqdly, &mtime1); + if (result == 0) return 0; - } else { - return -1; + + /* On IA64 it returns 100 nanoseconds early with an error */ + if ((mtime1.tv_sec == 0) && (mtime1.tv_nsec <= 100)) { + mtime1.tv_nsec += 100; + result = nanosleep(&mtime1, &mtime2); + if (result == 0) + return 0; + if ((mtime2.tv_sec == 0) && (mtime2.tv_nsec <= 100)) { + return 0; + } } + return result; } #define nanosleep(x,y) vms_fake_nanosleep(x, y) #endif diff --git a/vms/ChangeLog b/vms/ChangeLog index c3780cf3..94bc9f1a 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,8 @@ +2014-02-12 John E. Malmberg + + * vmstest.com: (strftime) requires GNV Coreutils date command to run + (readdir) fix file cleanup to not generate warnings. + 2014-01-21 John E. Malmberg * generate_config_vms_h_gawk.com: upate copyright and fix exit status. @@ -9,7 +14,7 @@ 2014-01-03 John E. Malmberg * config_h.com, generate_config_vms_h_gawk.com, - vms_args.c, vms_cli.c, vms_fwrite.c, vms_gawk.c, vms_misc.c, + vms_args.c, vms_cli.c, vms_fwrite.c, vms_gawk.c, vms_misc.c, vms_popen.c: Update copyright to 2014. * descrip.mms: Improve spotless cleanup. * vmstest.com: Improve test cleanup. diff --git a/vms/vmstest.com b/vms/vmstest.com index 4b5e2d5c..30bdbf22 100644 --- a/vms/vmstest.com +++ b/vms/vmstest.com @@ -606,6 +606,14 @@ $ ! this test could fail on slow machines or on a second boundary, $ ! so if it does, double check the actual results $ ! This test needs SYS$TIMEZONE_NAME and SYS$TIMEZONE_RULE $ ! to be properly defined. +$ ! This test now needs GNV Corutils to work +$ date_bin = "gnv$gnu:[bin]gnv$date.exe" +$ if f$search(date_bin) .eqs. "" +$ then +$ echo "''test' skipped" +$ return +$ endif +$ date := $'date_bin' $!! date | gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk $ now = f$time() $ wkd = f$extract(0,3,f$cvtime(now,,"WEEKDAY")) @@ -1902,7 +1910,8 @@ $ then $ call exit_code '$status' _'test'.tmp $ write sys$output _'test'.tmp $ else -$ rm _'test'.tmp;*,_'test'.;* +$ if f$search("_''test'.tmp") .nes. "" then rm _'test'.tmp;* +$ if f$search("_''test'.") .nes. "" then rm _'test'.;* $ endif $ set On $ return -- cgit v1.2.1