From: John Hughes Date: Thu, 8 Mar 2001 13:59:00 +0000 (+0000) Subject: Use configure to detect 64bit off_t and rlim_t X-Git-Tag: v4.5.18~1081 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70623be853b5524d87d980ac3d611b11890800ea;p=strace Use configure to detect 64bit off_t and rlim_t --- diff --git a/ChangeLog b/ChangeLog index 9e991879..abcafa0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2001-03-08 John Hughes + + * acconfig.h: new #defines HAVE_LONG_LONG_OFF_T and HAVE_LONG_LONG_RLIM_T. + * aclocal.m4: routines to check for long long off_t and rlim_t. + * configure.in: check for long long off_t and rlim_t. + * desc.c: if HAVE_LONG_LONG_OFF_T treat flock as flock64 + * file.c: if HAVE_LONG_LONG_OFF_T treat stat,lstat,fstat and lseek as 64 + bit versions. + * io.c: if HAVE_LONG_LONG_OFF_T use 64 bit versions of pread and pwrite. + * mem.c: if HAVE_LONG_LONG_OFF_T use 64 bit version of mmap + * resource.c: if HAVE_LONG_LONG_OFF_T use 64 bit versions of getrlimit + and setrlimit. + * freebsd/syscalls.print: don't explicitly use 64 bit versions of calls, + now done automaticaly for us. + * freebsd/i386/syscall.h: ditto. + * freebsd/i386/syscallent.h ditto. + 2001-03-07 John Hughes * desc.c: On FreeBSD flock structure uses 64 bit offsets. diff --git a/acconfig.h b/acconfig.h index 67bdf912..5c420a10 100644 --- a/acconfig.h +++ b/acconfig.h @@ -75,9 +75,15 @@ /* Define if stat64 is available in asm/stat.h. */ #undef HAVE_STAT64 -/* Define if yor compilers know abuot long long */ +/* Define if your compiler knows about long long */ #undef HAVE_LONG_LONG +/* Define if off_t is a long long */ +#undef HAVE_LONG_LONG_OFF_T + +/* Define if rlim_t is a long long */ +#undef HAVE_LONG_LONG_RLIM_T + /* Define if struct sockaddr_in6 contains sin6_scope_id field. */ #undef HAVE_SIN6_SCOPE_ID diff --git a/aclocal.m4 b/aclocal.m4 index 76a592b8..6986bd87 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -325,6 +325,56 @@ then fi ]) +dnl ### A macro to determine if off_t is a long long +AC_DEFUN(AC_OFF_T_IS_LONG_LONG, +[AC_MSG_CHECKING(for long long off_t) +AC_CACHE_VAL(ac_cv_have_long_long_off_t, +[AC_TRY_RUN([#include +main () { + if (sizeof (off_t) == sizeof (long long) && + sizeof (off_t) > sizeof (long)) + return 0; + return 1; +} +], +ac_cv_have_long_long_off_t=yes, +ac_cv_have_long_long_off_t=no, +[# Should try to guess here +ac_cv_have_long_long_off_t=no +])]) +AC_MSG_RESULT($ac_cv_have_long_long_off_t) +if test "$ac_cv_have_long_long_off_t" = yes +then + AC_DEFINE(HAVE_LONG_LONG_OFF_T) +fi +]) + +dnl ### A macro to determine if rlim_t is a long long +AC_DEFUN(AC_RLIM_T_IS_LONG_LONG, +[AC_MSG_CHECKING(for long long rlim_t) +AC_CACHE_VAL(ac_cv_have_long_long_rlim_t, +[AC_TRY_RUN([#include +#include +#include +main () { + if (sizeof (rlim_t) == sizeof (long long) && + sizeof (rlim_t) > sizeof (long)) + return 0; + return 1; +} +], +ac_cv_have_long_long_rlim_t=yes, +ac_cv_have_long_long_rlim_t=no, +[# Should try to guess here +ac_cv_have_long_long_rlim_t=no +])]) +AC_MSG_RESULT($ac_cv_have_long_long_rlim_t) +if test "$ac_cv_have_long_long_rlim_t" = yes +then + AC_DEFINE(HAVE_LONG_LONG_RLIM_T) +fi +]) + dnl ### A macro to determine whether sin6_scope_id is available. AC_DEFUN(AC_SIN6_SCOPE_ID, [AC_MSG_CHECKING(for sin6_scope_id in sockaddr_in6) diff --git a/configure.in b/configure.in index a7916b28..75a8410e 100644 --- a/configure.in +++ b/configure.in @@ -148,6 +148,8 @@ AC_SIG_ATOMIC_T AC_STAT64 AC_SIN6_SCOPE_ID AC_LONG_LONG +AC_OFF_T_IS_LONG_LONG +AC_RLIM_T_IS_LONG_LONG if test x$OPSYS != xLINUX; then AC_CHECK_LIB(nsl, main) fi diff --git a/desc.c b/desc.c index b9d8d352..5cc1c3b7 100644 --- a/desc.c +++ b/desc.c @@ -35,7 +35,10 @@ #include #include -#if FREEBSD +#if HAVE_LONG_LONG_OFF_T +/* + * Hacks for systems that have a long long off_t + */ #define flock64 flock /* Horrid hack */ #define printflock printflock64 /* Horrider hack */ #endif @@ -178,7 +181,7 @@ static struct xlat whence[] = { { 0, NULL }, }; -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T /* fcntl/lockf */ static void printflock(tcp, addr, getlk) @@ -204,7 +207,7 @@ int getlk; } #endif -#if _LFS64_LARGEFILE || FREEBSD +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T /* fcntl/lockf */ static void printflock64(tcp, addr, getlk) diff --git a/file.c b/file.c index ee6bc9e9..678b6d9c 100644 --- a/file.c +++ b/file.c @@ -130,9 +130,22 @@ struct stat { #include #include #include +#endif + +#if HAVE_LONG_LONG_OFF_T +/* + * Ugly hacks for systems that have typedef long long off_t + */ #define stat64 stat #define HAVE_STAT64 1 /* Ugly hack */ + +#define sys_stat64 sys_stat +#define sys_fstat64 sys_fstat +#define sys_lstat64 sys_lstat +#define sys_lseek64 sys_lseek +#define sys_truncate64 sys_truncate +#define sys_ftruncate64 sys_ftruncate #endif #ifdef MAJOR_IN_SYSMACROS @@ -354,7 +367,7 @@ static struct xlat whence[] = { { 0, NULL }, }; -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T int sys_lseek(tcp) struct tcb *tcp; @@ -403,7 +416,7 @@ struct tcb *tcp; } #endif -#if _LFS64_LARGEFILE || FREEBSD +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int sys_lseek64 (tcp) struct tcb *tcp; @@ -422,7 +435,7 @@ struct tcb *tcp; } #endif -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T int sys_truncate(tcp) struct tcb *tcp; @@ -435,7 +448,7 @@ struct tcb *tcp; } #endif -#if _LFS64_LARGEFILE || FREEBSD +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int sys_truncate64(tcp) struct tcb *tcp; @@ -449,7 +462,7 @@ struct tcb *tcp; } #endif -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T int sys_ftruncate(tcp) struct tcb *tcp; @@ -461,7 +474,7 @@ struct tcb *tcp; } #endif -#if _LFS64_LARGEFILE || FREEBSD +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int sys_ftruncate64(tcp) struct tcb *tcp; @@ -655,7 +668,7 @@ struct tcb *tcp; } #endif -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T static void realprintstat(tcp, statbuf) struct tcb *tcp; @@ -735,7 +748,7 @@ long addr; realprintstat(tcp, &statbuf); } -#endif /* !FREEBSD */ +#endif /* !HAVE_LONG_LONG_OFF_T */ #ifdef HAVE_STAT64 static void @@ -884,7 +897,7 @@ long addr; } #endif /* linux && !IA64 */ -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T int sys_stat(tcp) struct tcb *tcp; @@ -933,7 +946,7 @@ struct tcb *tcp; # endif /* !IA64 */ #endif /* linux */ -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T int sys_fstat(tcp) struct tcb *tcp; @@ -979,7 +992,7 @@ struct tcb *tcp; # endif /* !IA64 */ #endif -#ifndef FREEBSD +#ifndef HAVE_LONG_LONG_OFF_T int sys_lstat(tcp) struct tcb *tcp; diff --git a/freebsd/i386/syscall.h b/freebsd/i386/syscall.h index c09e5a2b..a9020721 100644 --- a/freebsd/i386/syscall.h +++ b/freebsd/i386/syscall.h @@ -1,5 +1,5 @@ /* - * Automatically generated by ./../syscalls.pl on Wed Mar 7 17:11:33 2001 + * Automatically generated by ./../syscalls.pl on Thu Mar 8 11:47:44 2001 */ #define sys_syscall printargs @@ -20,7 +20,7 @@ int sys_chmod(); int sys_chown(); #define sys_break printargs #define sys_getfsstat printargs -int sys_lseek64(); +int sys_lseek(); int sys_getpid(); #define sys_mount printargs #define sys_unmount printargs @@ -39,9 +39,9 @@ int sys_chflags(); int sys_fchflags(); #define sys_sync printargs int sys_kill(); -int sys_stat64(); +int sys_stat(); #define sys_getppid printargs -int sys_lstat64(); +int sys_lstat(); int sys_dup(); int sys_pipe(); #define sys_getegid printargs @@ -63,14 +63,14 @@ int sys_readlink(); int sys_execve(); int sys_umask(); int sys_chroot(); -int sys_fstat64(); +int sys_fstat(); #define sys_getkerninfo printargs int sys_getpagesize(); int sys_msync(); int sys_vfork(); int sys_sbrk(); #define sys_sstk printargs -int sys_mmap64(); +int sys_mmap(); #define sys_vadvise printargs int sys_munmap(); int sys_mprotect(); @@ -121,8 +121,8 @@ int sys_recvfrom(); int sys_setreuid(); int sys_setregid(); int sys_rename(); -int sys_truncate64(); -int sys_ftruncate64(); +int sys_truncate(); +int sys_ftruncate(); int sys_flock(); int sys_mkfifo(); int sys_sendto(); @@ -155,25 +155,25 @@ int sys_uname(); #define sys_semsys printargs #define sys_msgsys printargs #define sys_shmsys printargs -int sys_pread64(); -int sys_pwrite64(); +int sys_pread(); +int sys_pwrite(); #define sys_ntp_adjtime printargs #define sys_setgid printargs #define sys_setegid printargs #define sys_seteuid printargs -int sys_stat64(); -int sys_fstat64(); -int sys_lstat64(); +int sys_stat(); +int sys_fstat(); +int sys_lstat(); int sys_pathconf(); int sys_fpathconf(); int sys_getrlimit(); int sys_setrlimit(); int sys_getdirentries(); -int sys_mmap64(); +int sys_mmap(); #define sys___syscall printargs -int sys_lseek64(); -int sys_truncate64(); -int sys_ftruncate64(); +int sys_lseek(); +int sys_truncate(); +int sys_ftruncate(); int sys___sysctl(); #define sys_mlock printargs #define sys_munlock printargs diff --git a/freebsd/i386/syscallent.h b/freebsd/i386/syscallent.h index b45ee364..a8fb64e4 100644 --- a/freebsd/i386/syscallent.h +++ b/freebsd/i386/syscallent.h @@ -1,5 +1,5 @@ /* - * Automatically generated by ./../syscalls.pl on Wed Mar 7 17:11:33 2001 + * Automatically generated by ./../syscalls.pl on Thu Mar 8 11:47:44 2001 */ { 1, 0, sys_syscall, "syscall" }, /* 0 */ @@ -21,7 +21,7 @@ { 3, TF, sys_chown, "chown" }, /* 16 */ { 1, 0, sys_break, "break" }, /* 17 */ { 3, 0, sys_getfsstat, "getfsstat" }, /* 18 */ - { 3, 0, sys_lseek64, "lseek" }, /* 19 */ + { 3, 0, sys_lseek, "lseek" }, /* 19 */ { 1, 0, sys_getpid, "getpid" }, /* 20 */ { 4, TF, sys_mount, "mount" }, /* 21 */ { 2, TF, sys_unmount, "unmount" }, /* 22 */ @@ -40,9 +40,9 @@ { 2, TF, sys_fchflags, "fchflags" }, /* 35 */ { 1, 0, sys_sync, "sync" }, /* 36 */ { 2, TS, sys_kill, "kill" }, /* 37 */ - { 2, TF, sys_stat64, "stat" }, /* 38 */ + { 2, TF, sys_stat, "stat" }, /* 38 */ { 1, 0, sys_getppid, "getppid" }, /* 39 */ - { 2, TF, sys_lstat64, "lstat" }, /* 40 */ + { 2, TF, sys_lstat, "lstat" }, /* 40 */ { 1, 0, sys_dup, "dup" }, /* 41 */ { 1, 0, sys_pipe, "pipe" }, /* 42 */ { 1, 0, sys_getegid, "getegid" }, /* 43 */ @@ -64,7 +64,7 @@ { 3, TF|TP, sys_execve, "execve" }, /* 59 */ { 1, 0, sys_umask, "umask" }, /* 60 */ { 1, TF, sys_chroot, "chroot" }, /* 61 */ - { 2, TF, sys_fstat64, "fstat" }, /* 62 */ + { 2, TF, sys_fstat, "fstat" }, /* 62 */ { 4, 0, sys_getkerninfo, "getkerninfo" }, /* 63 */ { 1, 0, sys_getpagesize, "getpagesize" }, /* 64 */ { 3, 0, sys_msync, "msync" }, /* 65 */ @@ -73,7 +73,7 @@ { -1, 0, printargs, "SYS_68" }, /* 68 */ { 1, 0, sys_sbrk, "sbrk" }, /* 69 */ { 1, 0, sys_sstk, "sstk" }, /* 70 */ - { 6, 0, sys_mmap64, "mmap" }, /* 71 */ + { 6, 0, sys_mmap, "mmap" }, /* 71 */ { 1, 0, sys_vadvise, "vadvise" }, /* 72 */ { 2, 0, sys_munmap, "munmap" }, /* 73 */ { 3, 0, sys_mprotect, "mprotect" }, /* 74 */ @@ -131,8 +131,8 @@ { 2, 0, sys_setreuid, "setreuid" }, /* 126 */ { 2, 0, sys_setregid, "setregid" }, /* 127 */ { 2, TF, sys_rename, "rename" }, /* 128 */ - { 2, TF, sys_truncate64, "truncate" }, /* 129 */ - { 2, 0, sys_ftruncate64, "ftruncate" }, /* 130 */ + { 2, TF, sys_truncate, "truncate" }, /* 129 */ + { 2, 0, sys_ftruncate, "ftruncate" }, /* 130 */ { 2, 0, sys_flock, "flock" }, /* 131 */ { 2, 0, sys_mkfifo, "mkfifo" }, /* 132 */ { 6, TN, sys_sendto, "sendto" }, /* 133 */ @@ -175,8 +175,8 @@ { 6, TI, sys_msgsys, "msgsys" }, /* 170 */ { 4, TI, sys_shmsys, "shmsys" }, /* 171 */ { -1, 0, printargs, "SYS_172" }, /* 172 */ - { 5, TF, sys_pread64, "pread" }, /* 173 */ - { 5, TF, sys_pwrite64, "pwrite" }, /* 174 */ + { 5, TF, sys_pread, "pread" }, /* 173 */ + { 5, TF, sys_pwrite, "pwrite" }, /* 174 */ { -1, 0, printargs, "SYS_175" }, /* 175 */ { 1, 0, sys_ntp_adjtime, "ntp_adjtime" }, /* 176 */ { -1, 0, printargs, "SYS_177" }, /* 177 */ @@ -190,20 +190,20 @@ { -1, 0, printargs, "SYS_185" }, /* 185 */ { -1, 0, printargs, "SYS_186" }, /* 186 */ { -1, 0, printargs, "SYS_187" }, /* 187 */ - { 2, TF, sys_stat64, "stat" }, /* 188 */ - { 2, TF, sys_fstat64, "fstat" }, /* 189 */ - { 2, TF, sys_lstat64, "lstat" }, /* 190 */ + { 2, TF, sys_stat, "stat" }, /* 188 */ + { 2, TF, sys_fstat, "fstat" }, /* 189 */ + { 2, TF, sys_lstat, "lstat" }, /* 190 */ { 2, TF, sys_pathconf, "pathconf" }, /* 191 */ { 2, 0, sys_fpathconf, "fpathconf" }, /* 192 */ { -1, 0, printargs, "SYS_193" }, /* 193 */ { 2, 0, sys_getrlimit, "getrlimit" }, /* 194 */ { 2, 0, sys_setrlimit, "setrlimit" }, /* 195 */ { 4, 0, sys_getdirentries, "getdirentries" }, /* 196 */ - { 7, 0, sys_mmap64, "mmap" }, /* 197 */ + { 7, 0, sys_mmap, "mmap" }, /* 197 */ { 1, 0, sys___syscall, "__syscall" }, /* 198 */ - { 4, 0, sys_lseek64, "lseek" }, /* 199 */ - { 3, TF, sys_truncate64, "truncate" }, /* 200 */ - { 3, 0, sys_ftruncate64, "ftruncate" }, /* 201 */ + { 4, 0, sys_lseek, "lseek" }, /* 199 */ + { 3, TF, sys_truncate, "truncate" }, /* 200 */ + { 3, 0, sys_ftruncate, "ftruncate" }, /* 201 */ { 6, 0, sys___sysctl, "__sysctl" }, /* 202 */ { 2, 0, sys_mlock, "mlock" }, /* 203 */ { 2, 0, sys_munlock, "munlock" }, /* 204 */ diff --git a/freebsd/syscalls.print b/freebsd/syscalls.print index fe0336d7..bc59a6f2 100644 --- a/freebsd/syscalls.print +++ b/freebsd/syscalls.print @@ -64,10 +64,10 @@ fcntl flock fork fpathconf -fstat sys_fstat64 +fstat fstatfs fsync -ftruncate sys_ftruncate64 +ftruncate getdents getdirentries getdomainname @@ -96,13 +96,13 @@ kill killpg link listen -lseek sys_lseek64 -lstat sys_lstat64 +lseek +lstat mincore mkdir mkfifo mknod -mmap sys_mmap64 +mmap mprotect msgctl msgget @@ -116,9 +116,9 @@ open pathconf pipe poll -pread sys_pread64 +pread ptrace -pwrite sys_pwrite64 +pwrite quotactl read readlink @@ -171,14 +171,14 @@ sigsuspend sigvec socket socketpair -stat sys_stat64 +stat statfs stime symlink sysctl time times -truncate sys_truncate64 +truncate umask uname unlink diff --git a/io.c b/io.c index 6bb986cb..4bb00025 100644 --- a/io.c +++ b/io.c @@ -35,6 +35,15 @@ #include #include +#ifdef HAVE_LONG_LONG_OFF_T +/* + * Hacks for systems that have a long long off_t + */ + +#define sys_pread64 sys_pread +#define sys_pwrite64 sys_pwrite +#endif + int sys_read(tcp) struct tcb *tcp; @@ -269,7 +278,7 @@ struct tcb *tcp; #endif /* LINUX */ -#if _LFS64_LARGEFILE || FREEBSD +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int sys_pread64(tcp) struct tcb *tcp; diff --git a/mem.c b/mem.c index 7278c537..85f80a12 100644 --- a/mem.c +++ b/mem.c @@ -41,6 +41,13 @@ #include #endif +#ifdef HAVE_LONG_LONG_OFF_T +/* + * Ugly hacks for systems that have a long long off_t + */ +#define sys_mmap64 sys_mmap +#endif + int sys_brk(tcp) struct tcb *tcp; @@ -153,6 +160,7 @@ static struct xlat mmap_flags[] = { { 0, NULL }, }; +#if !HAVE_LONG_LONG_OFF_T static int print_mmap(tcp,u_arg) @@ -223,8 +231,9 @@ struct tcb *tcp; { return print_mmap(tcp, tcp->u_arg); } +#endif /* !HAVE_LONG_LONG_OFF_T */ -#if _LFS64_LARGEFILE || FREEBSD +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int sys_mmap64(tcp) struct tcb *tcp; diff --git a/resource.c b/resource.c index 833e0f6b..75e0bd81 100644 --- a/resource.c +++ b/resource.c @@ -46,6 +46,19 @@ #include #endif +#if HAVE_LONG_LONG_RLIM_T +/* + * Hacks for systems that have a long long rlim_t + */ + +#define rlimit64 rlimit /* Ugly hack */ +#define rlim64_t rlim_t /* Ugly hack */ +#define RLIM64_INFINITY RLIM_INFINITY /* You guessed it */ + +#define sys_getrlimit64 sys_getrlimit +#define sys_setrlimit64 sys_setrlimit +#endif + static struct xlat resources[] = { #ifdef RLIMIT_CPU { RLIMIT_CPU, "RLIMIT_CPU" }, @@ -83,6 +96,7 @@ static struct xlat resources[] = { { 0, NULL }, }; +#if !HAVE_LONG_LONG_RLIM_T static char * sprintrlim(lim) long lim; @@ -141,8 +155,9 @@ struct tcb *tcp; } return 0; } +#endif /* !HAVE_LONG_LONG_RLIM_T */ -#if _LFS64_LARGEFILE +#if _LFS64_LARGEFILE || HAVE_LONG_LONG_RLIM_T static char * sprintrlim64(lim) rlim64_t lim; @@ -201,7 +216,7 @@ struct tcb *tcp; } return 0; } -#endif +#endif /* _LFS64_LARGEFILES || HAVE_LONG_LONG_RLIM_T */ #ifndef SVR4