Fri May 24 10:08:10 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+ * configure.in (AC_STRUCT_ST_{BLKSIZE,BLOCKS,RDEV}): Use these
+ macros to determine whether or not the appropriate st_<xxx> fields
+ exist in the stat structure.
+ (AC_CHECK_FUNCS): Check for all unix system calls used, except for
+ the real basic ones like open, read, write, etc.
+ * config{.in,ure}: Regenerate.
+
+ * emul_netbsd.c: Add support for missing system calls, and/or
+ missing stat fields.
+
* hw_pal.c (WITH_STDIO): Redefine if O_NDELAY, F_GETFL, or F_SETFL
are not defined.
(scan_hw_pal): Do not cause syntax error if O_NDELAY, F_GETFL, or
/* config.in. Generated automatically from configure.in by autoheader. */
-#ifndef CONFIG_H
-#define CONFIG_H
+/* Define if your struct stat has st_blksize. */
+#undef HAVE_ST_BLKSIZE
+
+/* Define if your struct stat has st_blocks. */
+#undef HAVE_ST_BLOCKS
+
+/* Define if your struct stat has st_rdev. */
+#undef HAVE_ST_RDEV
+
+/* Define if your struct tm has tm_zone. */
+#undef HAVE_TM_ZONE
+
+/* Define if you don't have tm_zone but do have the external array
+ tzname. */
+#undef HAVE_TZNAME
+
+/* Define if your <sys/time.h> declares struct tm. */
+#undef TM_IN_SYS_TIME
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
+/* Define if you have the dup function. */
+#undef HAVE_DUP
+
+/* Define if you have the dup2 function. */
+#undef HAVE_DUP2
+
+/* Define if you have the fcntl function. */
+#undef HAVE_FCNTL
+
+/* Define if you have the fstat function. */
+#undef HAVE_FSTAT
+
+/* Define if you have the fstatfs function. */
+#undef HAVE_FSTATFS
+
+/* Define if you have the getdirentries function. */
+#undef HAVE_GETDIRENTRIES
+
+/* Define if you have the getegid function. */
+#undef HAVE_GETEGID
+
+/* Define if you have the geteuid function. */
+#undef HAVE_GETEUID
+
+/* Define if you have the getgid function. */
+#undef HAVE_GETGID
+
+/* Define if you have the getpid function. */
+#undef HAVE_GETPID
+
/* Define if you have the getrusage function. */
#undef HAVE_GETRUSAGE
+/* Define if you have the gettimeofday function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the getuid function. */
+#undef HAVE_GETUID
+
+/* Define if you have the ioctl function. */
+#undef HAVE_IOCTL
+
+/* Define if you have the kill function. */
+#undef HAVE_KILL
+
+/* Define if you have the lseek function. */
+#undef HAVE_LSEEK
+
+/* Define if you have the lstat function. */
+#undef HAVE_LSTAT
+
+/* Define if you have the sigprocmask function. */
+#undef HAVE_SIGPROCMASK
+
+/* Define if you have the stat function. */
+#undef HAVE_STAT
+
+/* Define if you have the umask function. */
+#undef HAVE_UMASK
+
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
+/* Define if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/mount.h> header file. */
+#undef HAVE_SYS_MOUNT_H
+
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-
-#endif
EOF
fi
- echo ac_cv_c_bigendian = $ac_cv_c_bigendian
+
if test $ac_cv_c_bigendian = yes; then
sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
else
-for ac_func in getrusage
+echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1504 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+int main() { return 0; }
+int t() {
+struct stat s; s.st_blksize;
+; return 0; }
+EOF
+if { (eval echo configure:1513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_st_blksize=yes
+else
+ rm -rf conftest*
+ ac_cv_struct_st_blksize=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6
+if test $ac_cv_struct_st_blksize = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ST_BLKSIZE 1
+EOF
+
+fi
+
+echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1537 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+int main() { return 0; }
+int t() {
+struct stat s; s.st_blocks;
+; return 0; }
+EOF
+if { (eval echo configure:1546: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_st_blocks=yes
+else
+ rm -rf conftest*
+ ac_cv_struct_st_blocks=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6
+if test $ac_cv_struct_st_blocks = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ST_BLOCKS 1
+EOF
+
+else
+ LIBOBJS="$LIBOBJS fileblocks.o"
+fi
+
+echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1572 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+int main() { return 0; }
+int t() {
+struct stat s; s.st_rdev;
+; return 0; }
+EOF
+if { (eval echo configure:1581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_st_rdev=yes
+else
+ rm -rf conftest*
+ ac_cv_struct_st_rdev=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
+if test $ac_cv_struct_st_rdev = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ST_RDEV 1
+EOF
+
+fi
+
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1605 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() { return 0; }
+int t() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:1614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_tm=time.h
+else
+ rm -rf conftest*
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+ cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
+
+fi
+
+echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1638 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+int main() { return 0; }
+int t() {
+struct tm tm; tm.tm_zone;
+; return 0; }
+EOF
+if { (eval echo configure:1647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_tm_zone=yes
+else
+ rm -rf conftest*
+ ac_cv_struct_tm_zone=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
+if test "$ac_cv_struct_tm_zone" = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_TM_ZONE 1
+EOF
+
+else
+ echo $ac_n "checking for tzname""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1670 "configure"
+#include "confdefs.h"
+#include <time.h>
+#ifndef tzname /* For SGI. */
+extern char *tzname[]; /* RS6000 and others reject char **tzname. */
+#endif
+int main() { return 0; }
+int t() {
+atoi(*tzname);
+; return 0; }
+EOF
+if { (eval echo configure:1681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_var_tzname=yes
+else
+ rm -rf conftest*
+ ac_cv_var_tzname=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_var_tzname" 1>&6
+ if test $ac_cv_var_tzname = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_TZNAME 1
+EOF
+
+ fi
+fi
+
+
+for ac_func in dup dup2 fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getrusage gettimeofday getuid ioctl kill lseek lstat sigprocmask stat umask
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1506 "configure"
+#line 1709 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1566 "configure"
+#line 1769 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1581 "configure"
+#line 1784 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1587: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1790: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
fi
echo "$ac_t""$CPP" 1>&6
-for ac_hdr in string.h strings.h stdlib.h time.h sys/mount.h sys/types.h sys/time.h sys/times.h unistd.h sys/resource.h
+for ac_hdr in string.h strings.h stdlib.h time.h sys/mount.h sys/types.h sys/time.h sys/times.h unistd.h sys/resource.h sys/ioctl.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1615 "configure"
+#line 1818 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1620: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1653 "configure"
+#line 1856 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:1662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1693 "configure"
+#line 1896 "configure"
#include "confdefs.h"
int main() { return 0; }
opendir()
; return 0; }
EOF
-if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1728 "configure"
+#line 1931 "configure"
#include "confdefs.h"
int main() { return 0; }
opendir()
; return 0; }
EOF
-if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
s%@sim_default_model@%$sim_default_model%g
s%@sim_model_issue@%$sim_model_issue%g
s%@sim_stdio@%$sim_stdio%g
+s%@LIBOBJS@%$LIBOBJS%g
s%@CPP@%$CPP%g
CEOF
AC_SUBST(sim_model_issue)
AC_SUBST(sim_stdio)
-AC_CHECK_FUNCS(getrusage)
+AC_STRUCT_ST_BLKSIZE
+AC_STRUCT_ST_BLOCKS
+AC_STRUCT_ST_RDEV
+AC_STRUCT_TIMEZONE
+
+AC_CHECK_FUNCS(dup dup2 fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getrusage gettimeofday getuid ioctl kill lseek lstat sigprocmask stat umask)
AC_CHECK_HEADERS(string.h strings.h stdlib.h time.h sys/mount.h sys/types.h sys/time.h sys/times.h unistd.h sys/resource.h sys/ioctl.h)
AC_HEADER_DIRENT
#include <sys/syscall.h> /* FIXME - should not be including this one */
#include <sys/sysctl.h>
extern int getdirentries(int fd, char *buf, int nbytes, long *basep);
+#else
+
+/* If this is not netbsd, don't allow fstatfs or getdirentries at this time */
+#undef HAVE_FSTATFS
+#undef HAVE_GETDIRENTRIES
#endif
#if (BSD < 199306) /* here BSD as just a bug */
H2T(buf.st_nlink);
H2T(buf.st_uid);
H2T(buf.st_gid);
- H2T(buf.st_rdev);
H2T(buf.st_size);
H2T(buf.st_atime);
/* H2T(buf.st_spare1); */
/* H2T(buf.st_spare2); */
H2T(buf.st_ctime);
/* H2T(buf.st_spare3); */
+#ifdef AC_STRUCT_ST_RDEV
+ H2T(buf.st_rdev);
+#endif
+#ifdef AC_STRUCT_ST_BLKSIZE
H2T(buf.st_blksize);
+#endif
+#ifdef AC_STRUCT_ST_BLOCKS
H2T(buf.st_blocks);
+#endif
#if WITH_NetBSD_HOST
H2T(buf.st_flags);
H2T(buf.st_gen);
}
-#if NetBSD
+#ifdef HAVE_FSTATFS
STATIC_INLINE_EMUL_NETBSD void
write_statfs(unsigned_word addr,
struct statfs buf,
}
-#if WITH_NetBSD_HOST
+#ifdef HAVE_GETDIRENTRIES
STATIC_INLINE_EMUL_NETBSD void
write_direntries(unsigned_word addr,
char *buf,
}
+#ifndef HAVE_GETPID
+#define do_getpid 0
+#else
static void
do_getpid(os_emul_data *emul,
unsigned call,
SYS(getpid);
emul_write_status(processor, (int)getpid(), 0);
}
+#endif
-
+#ifndef HAVE_GETUID
+#define do_getuid 0
+#else
static void
do_getuid(os_emul_data *emul,
unsigned call,
SYS(getuid);
emul_write_status(processor, (int)getuid(), 0);
}
+#endif
-
+#ifndef HAVE_GETEUID
+#define do_geteuid 0
+#else
static void
do_geteuid(os_emul_data *emul,
unsigned call,
SYS(geteuid);
emul_write_status(processor, (int)geteuid(), 0);
}
+#endif
-
+#ifndef HAVE_KILL
+#define do_kill 0
+#else
static void
do_kill(os_emul_data *emul,
unsigned call,
(long)cia);
cpu_halt(processor, cia, was_signalled, sig);
}
+#endif
-
+#ifndef HAVE_DUP
+#define do_dup 0
+#else
static void
do_dup(os_emul_data *emul,
unsigned call,
SYS(dup);
emul_write_status(processor, status, err);
}
+#endif
-
+#ifndef HAVE_GETEGID
+#define do_getegid 0
+#else
static void
do_getegid(os_emul_data *emul,
unsigned call,
SYS(getegid);
emul_write_status(processor, (int)getegid(), 0);
}
+#endif
-
+#ifndef HAVE_GETGID
+#define do_getgid 0
+#else
static void
do_getgid(os_emul_data *emul,
unsigned call,
SYS(getgid);
emul_write_status(processor, (int)getgid(), 0);
}
+#endif
-
+#ifndef HAVE_SIGPROCMASK
+#define do_sigprocmask 0
+#else
static void
do_sigprocmask(os_emul_data *emul,
unsigned call,
emul_write_status(processor, 0, 0);
cpu_registers(processor)->gpr[4] = set;
}
+#endif
-
+#ifndef HAVE_IOCTL
+#define do_ioctl 0
+#else
static void
do_ioctl(os_emul_data *emul,
unsigned call,
if (WITH_TRACE && ppc_trace[trace_os_emul])
printf_filtered ("%d, 0x%x, 0x%lx", d, request, (long)argp_addr);
}
+#endif
-
+#ifndef HAVE_UMASK
+#define do_umask 0
+#else
static void
do_umask(os_emul_data *emul,
unsigned call,
SYS(umask);
emul_write_status(processor, umask(mask), 0);
}
+#endif
-
+#ifndef HAVE_DUP2
+#define do_dup2 0
+#else
static void
do_dup2(os_emul_data *emul,
unsigned call,
SYS(dup2);
emul_write_status(processor, status, err);
}
+#endif
-
+#ifndef HAVE_FCNTL
+#define do_fcntl 0
+#else
static void
do_fcntl(os_emul_data *emul,
unsigned call,
status = fcntl(fd, cmd, arg);
emul_write_status(processor, status, errno);
}
+#endif
-
+#ifndef HAVE_GETTIMEOFDAY
+#define do_gettimeofday 0
+#else
static void
do_gettimeofday(os_emul_data *emul,
unsigned call,
write_timezone(tz_addr, tz, processor, cia);
}
}
-
+#endif
#ifndef HAVE_GETRUSAGE
#define do_getrusage 0
#endif
-#if !WITH_NetBSD_HOST
+#ifndef HAVE_FSTATFS
#define do_fstatfs 0
#else
static void
}
#endif
-
+#ifndef HAVE_STAT
+#define do_stat 0
+#else
static void
do_stat(os_emul_data *emul,
unsigned call,
if (status == 0)
write_stat(stat_buf_addr, buf, processor, cia);
}
+#endif
-
+#ifndef HAVE_FSTAT
+#define do_fstat 0
+#else
static void
do_fstat(os_emul_data *emul,
unsigned call,
emul_write_status(processor, fstat(fd, &buf), errno);
write_stat(stat_buf_addr, buf, processor, cia);
}
+#endif
-
+#ifndef HAVE_LSTAT
+#define do_lstat 0
+#else
static void
do_lstat(os_emul_data *emul,
unsigned call,
emul_write_status(processor, stat(path, &buf), errno);
write_stat(stat_buf_addr, buf, processor, cia);
}
+#endif
-
-#if !WITH_NetBSD_HOST
+#ifndef HAVE_GETDIRENTRIES
#define do_getdirentries 0
#else
static void
cia);
}
-
+#ifndef HAVE_LSEEK
+#define do_lseek 0
+#else
static void
do_lseek(os_emul_data *emul,
unsigned call,
emul_write_gpr64(processor, 3, status);
}
}
-
+#endif
static void
do___sysctl(os_emul_data *emul,