RT tells me Minix 2 (i386) also doesn’t have gettimeofday(2)

This commit is contained in:
tg 2012-11-20 18:50:46 +00:00
parent f284261018
commit 2fc5aa487b
4 changed files with 25 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.589 2012/10/22 20:19:08 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.590 2012/11/20 18:50:41 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -1495,7 +1495,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.589 2012/10/22 20:19:08 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.590 2012/11/20 18:50:41 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in
@ -1589,6 +1589,12 @@ ac_test getrusage <<-'EOF'
}
EOF
ac_test gettimeofday <<-'EOF'
#define MKSH_INCLUDES_ONLY
#include "sh.h"
int main(void) { return (gettimeofday(NULL, NULL)); }
EOF
ac_test killpg <<-'EOF'
#include <signal.h>
int main(int ac, char *av[]) { return (av[0][killpg(123, ac)]); }

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.104 2012/10/21 17:16:44 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.105 2012/11/20 18:50:42 tg Exp $
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -46,8 +46,8 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
-DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 -DHAVE_RLIM_T=1 \
-DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 -DHAVE_SYS_SIGLIST=1 \
-DHAVE_STRSIGNAL=0 -DHAVE_FLOCK=1 -DHAVE_LOCK_FCNTL=1 \
-DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 -DHAVE_MKNOD=0 \
-DHAVE_MMAP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \
-DHAVE_GETRUSAGE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_KILLPG=1 \
-DHAVE_MKNOD=0 -DHAVE_MMAP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \
-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
-DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 \
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.565 2012/11/12 19:13:44 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.566 2012/11/20 18:50:42 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R40 2012/11/12
@(#)MIRBSD KSH R40 2012/11/20
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R40 2012/11/12
@(#)LEGACY KSH R40 2012/11/20
description:
Check version of legacy shell.
stdin:

19
sh.h
View File

@ -157,9 +157,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.602 2012/11/12 19:13:46 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.603 2012/11/20 18:50:46 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/11/12"
#define MKSH_VERSION "R40 2012/11/20"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -338,6 +338,15 @@ struct rusage {
extern int flock(int, int);
#endif
#if !HAVE_GETTIMEOFDAY
#define mksh_TIME(tv) do { \
(tv).tv_usec = 0; \
(tv).tv_sec = time(NULL); \
} while (/* CONSTCOND */ 0)
#else
#define mksh_TIME(tv) gettimeofday(&(tv), NULL)
#endif
#if !HAVE_GETRUSAGE
extern int getrusage(int, struct rusage *);
#endif
@ -366,12 +375,6 @@ extern int __cdecl setegid(gid_t);
/* this need not work everywhere, take care */
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
#endif
#define mksh_TIME(tv) do { \
(tv).tv_usec = 0; \
(tv).tv_sec = time(NULL); \
} while (/* CONSTCOND */ 0)
#else
#define mksh_TIME(tv) gettimeofday(&(tv), NULL)
#endif
#ifdef MKSH__NO_SYMLINK