From 4ccee8f7628b27136616cb54f50061d40a1205b8 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Fri, 4 Jan 2019 11:07:42 +0200 Subject: [PATCH] feature_tests.h: always use largefile interfaces this is transitional; we'll remove the non-64bit interfaces after bootstrapping everything to use largefile. remove the #error from libelf.h; the notes in libelf/README.LFS claim that new interfaces using off64_t would have to be written to make libelf large-file aware, but that's not true if off_t is always 64 bits (which it is after the feature_tests.h change). do similarly for old_procfs.h, swap.h, and ustat.h. in 32-bit libc/libgen/madv, stop building the 32-bit interfaces. the header pragmas should ensure everything ends up using the *64 symbols. the resulting 32-bit libc will *only* have symbol names ending in "64", and the 64-bit one has normal names. in rtld, apply a temporary workaround that copes with the modified symbol names. to bootstrap, first install the new headers onto your current system and rebuild & install all of userland to make everything 32-bit there use the *64 symbols. then build base. --- arch/x86/include/sys/old_procfs.h | 4 -- include/libelf.h | 5 -- include/sys/feature_tests.h | 45 +------------ include/sys/swap.h | 4 -- include/sys/ustat.h | 4 -- usr/src/cmd/sgs/rtld/common/_rtld.h | 39 ++++++----- usr/src/cmd/sgs/rtld/common/external.c | 11 ++++ usr/src/cmd/sgs/rtld/common/util.c | 65 ------------------- usr/src/cmd/truss/expound.c | 8 --- usr/src/lib/libc/Makefile.targ | 36 ----------- usr/src/lib/libc/common/sys/fstatvfs.s | 4 +- usr/src/lib/libc/common/sys/getdents.s | 4 +- usr/src/lib/libc/common/sys/getrlimit.s | 4 +- usr/src/lib/libc/common/sys/lseek.s | 4 +- usr/src/lib/libc/common/sys/mmap.s | 4 +- usr/src/lib/libc/common/sys/pread.s | 2 +- usr/src/lib/libc/common/sys/preadv.s | 2 +- usr/src/lib/libc/common/sys/pwrite.s | 2 +- usr/src/lib/libc/common/sys/pwritev.s | 2 +- usr/src/lib/libc/common/sys/setrlimit.s | 4 +- usr/src/lib/libc/common/sys/statvfs.s | 4 +- usr/src/lib/libc/i386/Makefile.com | 67 ------------------- usr/src/lib/libc/i386/sys/ptrace.c | 2 +- usr/src/lib/libc/inc/asyncio.h | 1 - usr/src/lib/libc/port/aio/aio.c | 3 +- usr/src/lib/libc/port/aio/posix_aio.c | 51 +++++++++------ usr/src/lib/libc/port/gen/attropen.c | 12 ++-- usr/src/lib/libc/port/gen/posix_fadvise.c | 5 +- usr/src/lib/libc/port/gen/posix_fallocate.c | 4 +- usr/src/lib/libc/port/gen/readdir.c | 37 +---------- usr/src/lib/libc/port/gen/readdir_r.c | 36 ----------- usr/src/lib/libc/port/gen/scandir.c | 11 ++-- usr/src/lib/libc/port/gen/walkstack.c | 6 +- usr/src/lib/libc/port/mapfile-vers | 86 ++++++++++++++++++++++++- usr/src/lib/libc/port/stdio/fseeko.c | 6 +- usr/src/lib/libc/port/stdio/ftello.c | 6 +- usr/src/lib/libc/port/stdio/tmpfile.c | 3 +- usr/src/lib/libc/port/threads/scalls.c | 63 +++++++++--------- usr/src/lib/libc/port/threads/thr.c | 5 ++ usr/src/lib/libgen/common/copylist.c | 4 +- usr/src/lib/libgen/common/mapfile-vers | 2 + usr/src/lib/libproc/common/pr_fcntl.c | 2 +- usr/src/lib/madv/common/madv.c | 5 +- usr/src/test/os-tests/tests/file-locking/util.c | 15 +++-- 44 files changed, 254 insertions(+), 435 deletions(-) diff --git a/arch/x86/include/sys/old_procfs.h b/arch/x86/include/sys/old_procfs.h index bbca8e89b7..29d23edc92 100644 --- a/arch/x86/include/sys/old_procfs.h +++ b/arch/x86/include/sys/old_procfs.h @@ -48,10 +48,6 @@ extern "C" { #endif -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 -#error "Cannot use procfs in the large file compilation environment" -#endif - #if _STRUCTURED_PROC == 0 /* diff --git a/include/libelf.h b/include/libelf.h index 722d0cdc97..8258a054f2 100644 --- a/include/libelf.h +++ b/include/libelf.h @@ -38,11 +38,6 @@ extern "C" { #endif - -#if defined(_ILP32) && (_FILE_OFFSET_BITS != 32) -#error "large files are not supported by libelf" -#endif - typedef void Elf_Void; /* diff --git a/include/sys/feature_tests.h b/include/sys/feature_tests.h index 0b12311616..42ceb42a36 100644 --- a/include/sys/feature_tests.h +++ b/include/sys/feature_tests.h @@ -137,56 +137,13 @@ extern "C" { * * Requesting _LARGEFILE64_SOURCE implies requesting _LARGEFILE_SOURCE as * well. - * - * The large file interfaces are made visible regardless of the initial values - * of the feature test macros under certain circumstances: - * - If no explicit standards-conforming environment is requested (neither - * of _POSIX_SOURCE nor _XOPEN_SOURCE is defined and the value of - * __STDC__ does not imply standards conformance). - * - Extended system interfaces are explicitly requested (__EXTENSIONS__ - * is defined). - * - Access to in-kernel interfaces is requested (_KERNEL or _KMEMUSER is - * defined). (Note that this dependency is an artifact of the current - * kernel implementation and may change in future releases.) */ -#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ - defined(_KERNEL) || defined(_KMEMUSER) || \ - defined(__EXTENSIONS__) #undef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE 1 -#endif -#if _LARGEFILE64_SOURCE - 0 == 1 #undef _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE 1 -#endif -/* - * Large file compilation environment control: - * - * The setting of _FILE_OFFSET_BITS controls the size of various file-related - * types and governs the mapping between file-related source function symbol - * names and the corresponding binary entry points. - * - * In the 32-bit environment, the default value is 32; if not set, set it to - * the default here, to simplify tests in other headers. - * - * In the 64-bit compilation environment, the only value allowed is 64. - */ -#if defined(_LP64) -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 -#endif -#if _FILE_OFFSET_BITS - 0 != 64 -#error "invalid _FILE_OFFSET_BITS value specified" -#endif -#else /* _LP64 */ -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 32 -#endif -#if _FILE_OFFSET_BITS - 0 != 32 && _FILE_OFFSET_BITS - 0 != 64 -#error "invalid _FILE_OFFSET_BITS value specified" -#endif -#endif /* _LP64 */ +#define _FILE_OFFSET_BITS 64 /* * Use of _XOPEN_SOURCE diff --git a/include/sys/swap.h b/include/sys/swap.h index f45dca7618..da5800ef3a 100644 --- a/include/sys/swap.h +++ b/include/sys/swap.h @@ -48,10 +48,6 @@ extern "C" { #endif -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 -#error "Cannot use swapctl in the large files compilation environment" -#endif - /* The following are for the swapctl system call */ #define SC_ADD 1 /* add a specified resource for swapping */ diff --git a/include/sys/ustat.h b/include/sys/ustat.h index 03e2bbe608..53857bff2d 100644 --- a/include/sys/ustat.h +++ b/include/sys/ustat.h @@ -43,10 +43,6 @@ extern "C" { #endif -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 -#error "Cannot use ustat in the large files compilation environment" -#endif - struct ustat { daddr_t f_tfree; /* total free */ ino_t f_tinode; /* total inodes free */ diff --git a/usr/src/cmd/sgs/rtld/common/_rtld.h b/usr/src/cmd/sgs/rtld/common/_rtld.h index ca8872e284..4ea022654a 100644 --- a/usr/src/cmd/sgs/rtld/common/_rtld.h +++ b/usr/src/cmd/sgs/rtld/common/_rtld.h @@ -57,6 +57,18 @@ extern "C" { #endif /* + * FIXME: hack for always-largefile transition. we must match the libc symbol + * names here or we pull in objects from libc_pic.a we should not. + */ +#ifndef _LP64 +#pragma redefine_extname mmap mmap64 +#pragma redefine_extname readdir readdir64 +#pragma redefine_extname getdents getdents64 +#pragma redefine_extname __open __open64 +#pragma redefine_extname __openat __openat64 +#endif + +/* * Dependency search rule order. */ #define RPLENV 1 /* replaceable LD_LIBRARY_PATH */ @@ -480,28 +492,17 @@ typedef struct { /* should be retried */ #define BINFO_MSK_REJECTED 0xff0000 /* a mask of bindings that */ /* have been rejected */ - /* - * The 32-bit version of rtld uses special stat() wrapper functions - * that preserve the non-largefile semantics of stat()/fstat() while - * allowing for large inode values. The 64-bit rtld uses stat() directly. + * XXX always-largefile transitional hack */ -#ifdef _LP64 +#ifndef _LP64 +#define rtld_fstat fstat64 +#define rtld_stat stat64 +typedef struct stat64 rtld_stat_t; +#else #define rtld_fstat fstat #define rtld_stat stat typedef struct stat rtld_stat_t; -#else -typedef struct { - dev_t st_dev; - rtld_ino_t st_ino; - mode_t st_mode; - uid_t st_uid; - off_t st_size; - timestruc_t st_mtim; -#ifdef sparc - blksize_t st_blksize; -#endif -} rtld_stat_t; #endif /* @@ -776,10 +777,6 @@ extern void rtld_db_dlactivity(Lm_list *); extern void rtld_db_preinit(Lm_list *); extern void rtld_db_postinit(Lm_list *); extern void rtldexit(Lm_list *, int); -#ifndef _LP64 -extern int rtld_fstat(int, rtld_stat_t *restrict); -extern int rtld_stat(const char *restrict, rtld_stat_t *restrict); -#endif extern int rtld_getopt(char **, char ***, auxv_t **, Word *, Word *, int); extern void security(uid_t, uid_t, gid_t, gid_t, int); diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c index f3b14b8725..3a2104ebc1 100644 --- a/usr/src/cmd/sgs/rtld/common/external.c +++ b/usr/src/cmd/sgs/rtld/common/external.c @@ -633,6 +633,17 @@ fcntl(int fildes, int cmd, ...) return (__fcntl(fildes, cmd, arg)); } +#ifndef _LP64 +/* + * XXX always-largefile hack: open/openat are special: they are defined in + * external.c, and we want to use those. but the system headers have + * #redefine_extname'd them to the *64 versions. so for 32-bit, define the *64 + * funcs here. + */ +#define open open64 +#define openat openat64 +#endif + int open(const char *path, int oflag, ...) { diff --git a/usr/src/cmd/sgs/rtld/common/util.c b/usr/src/cmd/sgs/rtld/common/util.c index 2e1d767419..7072983745 100644 --- a/usr/src/cmd/sgs/rtld/common/util.c +++ b/usr/src/cmd/sgs/rtld/common/util.c @@ -3721,68 +3721,3 @@ demangle(const char *name) else return (name); } - -#ifndef _LP64 -/* - * Wrappers on stat() and fstat() for 32-bit rtld that uses stat64() - * underneath while preserving the object size limits of a non-largefile - * enabled 32-bit process. The purpose of this is to prevent large inode - * values from causing stat() to fail. - */ -inline static int -rtld_stat_process(int r, struct stat64 *lbuf, rtld_stat_t *restrict buf) -{ - extern int errno; - - /* - * Although we used a 64-bit capable stat(), the 32-bit rtld - * can only handle objects < 2GB in size. If this object is - * too big, turn the success into an overflow error. - */ - if ((lbuf->st_size & 0xffffffff80000000) != 0) { - errno = EOVERFLOW; - return (-1); - } - - /* - * Transfer the information needed by rtld into a rtld_stat_t - * structure that preserves the non-largile types for everything - * except inode. - */ - buf->st_dev = lbuf->st_dev; - buf->st_ino = lbuf->st_ino; - buf->st_mode = lbuf->st_mode; - buf->st_uid = lbuf->st_uid; - buf->st_size = (off_t)lbuf->st_size; - buf->st_mtim = lbuf->st_mtim; -#ifdef sparc - buf->st_blksize = lbuf->st_blksize; -#endif - - return (r); -} - -int -rtld_stat(const char *restrict path, rtld_stat_t *restrict buf) -{ - struct stat64 lbuf; - int r; - - r = stat64(path, &lbuf); - if (r != -1) - r = rtld_stat_process(r, &lbuf, buf); - return (r); -} - -int -rtld_fstat(int fildes, rtld_stat_t *restrict buf) -{ - struct stat64 lbuf; - int r; - - r = fstat64(fildes, &lbuf); - if (r != -1) - r = rtld_stat_process(r, &lbuf, buf); - return (r); -} -#endif diff --git a/usr/src/cmd/truss/expound.c b/usr/src/cmd/truss/expound.c index 652bf69d6b..bba1467230 100644 --- a/usr/src/cmd/truss/expound.c +++ b/usr/src/cmd/truss/expound.c @@ -1829,14 +1829,6 @@ show_fcntl(private_t *pri) show_flock64(pri, offset); break; #else /* _LP64 */ - case F_GETLK: - case F_SETLK: - case F_SETLKW: - case F_FREESP: - case F_ALLOCSP: - case F_SETLK_NBMAND: - show_flock32(pri, offset); - break; case F_GETLK64: case F_SETLK64: case F_SETLKW64: diff --git a/usr/src/lib/libc/Makefile.targ b/usr/src/lib/libc/Makefile.targ index 15b9675b67..25aab2a601 100644 --- a/usr/src/lib/libc/Makefile.targ +++ b/usr/src/lib/libc/Makefile.targ @@ -106,42 +106,6 @@ pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/sys/%.s $(BUILD.s) $(POST_PROCESS_O) -# rules to build large file aware objects (xxx64.o from xxx.s or xxx.c) - -pics/%64.o: $(LIBCBASE)/../common/sys/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/sys/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/gen/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/../port/gen/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/../port/sys/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/../port/print/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/../port/regex/%.c - $(COMPILE.c) -DM_I18N_MB -DI18N \ - -I$(LIBCBASE)/../port/regex \ - -I$(LIBCBASE)/../port/gen -o $@ $< - $(POST_PROCESS_O) - -pics/%64.o: $(LIBCBASE)/../port/stdio/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - pics/%_w.o: $(LIBCBASE)/../port/stdio/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) diff --git a/usr/src/lib/libc/common/sys/fstatvfs.s b/usr/src/lib/libc/common/sys/fstatvfs.s index 9300fbed80..57aca692ad 100644 --- a/usr/src/lib/libc/common/sys/fstatvfs.s +++ b/usr/src/lib/libc/common/sys/fstatvfs.s @@ -34,7 +34,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(fstatvfs,function) #else ANSI_PRAGMA_WEAK(fstatvfs64,function) @@ -42,7 +42,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL_RVAL1(fstatvfs) RETC diff --git a/usr/src/lib/libc/common/sys/getdents.s b/usr/src/lib/libc/common/sys/getdents.s index 5c9577aeed..a55e6c0dee 100644 --- a/usr/src/lib/libc/common/sys/getdents.s +++ b/usr/src/lib/libc/common/sys/getdents.s @@ -34,7 +34,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(getdents,function) #else ANSI_PRAGMA_WEAK(getdents64,function) @@ -42,7 +42,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL_RVAL1(getdents) RET diff --git a/usr/src/lib/libc/common/sys/getrlimit.s b/usr/src/lib/libc/common/sys/getrlimit.s index 0ac2bad9a5..ee6f9e289d 100644 --- a/usr/src/lib/libc/common/sys/getrlimit.s +++ b/usr/src/lib/libc/common/sys/getrlimit.s @@ -34,7 +34,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(getrlimit,function) #else ANSI_PRAGMA_WEAK(getrlimit64,function) @@ -42,7 +42,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL_RVAL1(getrlimit) RETC diff --git a/usr/src/lib/libc/common/sys/lseek.s b/usr/src/lib/libc/common/sys/lseek.s index 20be131543..a91cd83368 100644 --- a/usr/src/lib/libc/common/sys/lseek.s +++ b/usr/src/lib/libc/common/sys/lseek.s @@ -34,7 +34,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(lseek,function) #else ANSI_PRAGMA_WEAK(lseek64,function) @@ -42,7 +42,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL_RVAL1(lseek) RET diff --git a/usr/src/lib/libc/common/sys/mmap.s b/usr/src/lib/libc/common/sys/mmap.s index 385d1fdd48..5a92d95a3d 100644 --- a/usr/src/lib/libc/common/sys/mmap.s +++ b/usr/src/lib/libc/common/sys/mmap.s @@ -31,7 +31,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(mmap,function) #else ANSI_PRAGMA_WEAK(mmap64,function) @@ -39,7 +39,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 /* * C library -- mmap diff --git a/usr/src/lib/libc/common/sys/pread.s b/usr/src/lib/libc/common/sys/pread.s index 7b9821e049..62e04d9e19 100644 --- a/usr/src/lib/libc/common/sys/pread.s +++ b/usr/src/lib/libc/common/sys/pread.s @@ -34,7 +34,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL2_RESTART_RVAL1(__pread,pread) RET diff --git a/usr/src/lib/libc/common/sys/preadv.s b/usr/src/lib/libc/common/sys/preadv.s index da4514e91a..fead9cce54 100644 --- a/usr/src/lib/libc/common/sys/preadv.s +++ b/usr/src/lib/libc/common/sys/preadv.s @@ -20,7 +20,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL2_RESTART_RVAL1(__preadv,preadv) RET diff --git a/usr/src/lib/libc/common/sys/pwrite.s b/usr/src/lib/libc/common/sys/pwrite.s index 20fd3a198a..0e4ac95409 100644 --- a/usr/src/lib/libc/common/sys/pwrite.s +++ b/usr/src/lib/libc/common/sys/pwrite.s @@ -28,7 +28,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 /* C library -- pwrite */ /* ssize_t __pwrite(int, const void *, size_t, off_t); */ diff --git a/usr/src/lib/libc/common/sys/pwritev.s b/usr/src/lib/libc/common/sys/pwritev.s index 05bd90912a..9bee801805 100644 --- a/usr/src/lib/libc/common/sys/pwritev.s +++ b/usr/src/lib/libc/common/sys/pwritev.s @@ -20,7 +20,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL2_RESTART_RVAL1(__pwritev,pwritev) RET diff --git a/usr/src/lib/libc/common/sys/setrlimit.s b/usr/src/lib/libc/common/sys/setrlimit.s index 37de71059d..f83672e66f 100644 --- a/usr/src/lib/libc/common/sys/setrlimit.s +++ b/usr/src/lib/libc/common/sys/setrlimit.s @@ -34,7 +34,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(setrlimit,function) #else ANSI_PRAGMA_WEAK(setrlimit64,function) @@ -42,7 +42,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL_RVAL1(setrlimit) RETC diff --git a/usr/src/lib/libc/common/sys/statvfs.s b/usr/src/lib/libc/common/sys/statvfs.s index 33dd10e690..758a25336b 100644 --- a/usr/src/lib/libc/common/sys/statvfs.s +++ b/usr/src/lib/libc/common/sys/statvfs.s @@ -34,7 +34,7 @@ #include -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 ANSI_PRAGMA_WEAK(statvfs,function) #else ANSI_PRAGMA_WEAK(statvfs64,function) @@ -42,7 +42,7 @@ #include "SYS.h" -#if !defined(_LARGEFILE_SOURCE) +#ifdef _LP64 SYSCALL_RVAL1(statvfs) RETC diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index 9992091df2..9f9a5bd9b4 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -170,22 +170,6 @@ GENOBJS= \ unvis.o \ vis.o -# sysobjs that contain large-file interfaces -COMSYSOBJS64= \ - fstatvfs64.o \ - getdents64.o \ - getrlimit64.o \ - lseek64.o \ - mmap64.o \ - pread64.o \ - preadv64.o \ - pwrite64.o \ - pwritev64.o \ - setrlimit64.o \ - statvfs64.o - -SYSOBJS64= - COMSYSOBJS= \ __clock_timer.o \ __getloadavg.o \ @@ -342,17 +326,6 @@ SYSOBJS= \ vforkx.o \ xstat.o -# objects under $(LIBCDIR)/port which contain transitional large file interfaces -PORTGEN64= \ - _xftw64.o \ - attropen64.o \ - fts64.o \ - ftw64.o \ - mkstemp64.o \ - nftw64.o \ - tell64.o \ - truncate64.o - # objects from source under $(LIBCDIR)/port PORTFP= \ __flt_decim.o \ @@ -652,12 +625,6 @@ PORTPRINT= \ vwprintf.o \ wprintf.o -# portable stdio objects that contain large file interfaces. -# Note: fopen64 is a special case, as we build it small. -PORTSTDIO64= \ - fopen64.o \ - fpos64.o - PORTSTDIO_W= \ doscan_w.o @@ -956,11 +923,6 @@ UNWINDMACHOBJS= \ UNWINDASMOBJS= \ unwind_frame.o -# objects that implement the transitional large file API -PORTSYS64= \ - lockf64.o \ - stat64.o - PORTSYS= \ _autofssys.o \ access.o \ @@ -1031,9 +993,6 @@ PORTREGEX= \ regfree.o \ wordexp.o -PORTREGEX64= \ - glob64.o - PORTSOCKET= _soutil.o sockatmark.o socket.o socketpair.o weaks.o MOSTOBJS= \ @@ -1050,7 +1009,6 @@ MOSTOBJS= \ $(GENOBJS) \ $(PORTFP) \ $(PORTGEN) \ - $(PORTGEN64) \ $(PORTI18N) \ $(PORTI18N_COND) \ $(PORTINET) \ @@ -1059,13 +1017,10 @@ MOSTOBJS= \ $(PORTPRINT) \ $(PORTPRINT_W) \ $(PORTREGEX) \ - $(PORTREGEX64) \ $(PORTSOCKET) \ $(PORTSTDIO) \ - $(PORTSTDIO64) \ $(PORTSTDIO_W) \ $(PORTSYS) \ - $(PORTSYS64) \ $(AIOOBJS) \ $(RTOBJS) \ $(SECFLAGSOBJS) \ @@ -1078,8 +1033,6 @@ MOSTOBJS= \ $(UNWINDASMOBJS) \ $(COMSYSOBJS) \ $(SYSOBJS) \ - $(COMSYSOBJS64) \ - $(SYSOBJS64) \ $(VALUES) TRACEOBJS= \ @@ -1232,26 +1185,6 @@ SRCS= \ $(DYNLIB) := CRTI = crti.o $(DYNLIB) := CRTN = crtn.o -# large-file-aware components that should be built large - -$(COMSYSOBJS64:%=pics/%) := \ - CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - -$(SYSOBJS64:%=pics/%) := \ - CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - -$(PORTGEN64:%=pics/%) := \ - CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - -$(PORTREGEX64:%=pics/%) := \ - CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - -$(PORTSTDIO64:%=pics/%) := \ - CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - -$(PORTSYS64:%=pics/%) := \ - CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - $(PORTSTDIO_W:%=pics/%) := \ CPPFLAGS += -D_WIDE diff --git a/usr/src/lib/libc/i386/sys/ptrace.c b/usr/src/lib/libc/i386/sys/ptrace.c index c4ecdd34f4..5ca6bcceba 100644 --- a/usr/src/lib/libc/i386/sys/ptrace.c +++ b/usr/src/lib/libc/i386/sys/ptrace.c @@ -707,7 +707,7 @@ GetPsargs(cstatus_t *cp) return; } (void) pread(fd, cp->user.u_psargs, PSARGSZ, - (off_t)((psinfo_t *)0)->pr_psargs); + (intptr_t)((psinfo_t *)0)->pr_psargs); (void) close(fd); cp->flags |= CS_PSARGS; diff --git a/usr/src/lib/libc/inc/asyncio.h b/usr/src/lib/libc/inc/asyncio.h index 02d33cd700..051cc435b8 100644 --- a/usr/src/lib/libc/inc/asyncio.h +++ b/usr/src/lib/libc/inc/asyncio.h @@ -287,7 +287,6 @@ extern void _aio_lio_free(aio_lio_t *); extern int _aio_idle(aio_worker_t *); extern void *_aio_do_request(void *); extern void *_aio_do_notify(void *); -extern void _lio_remove(aio_req_t *); extern aio_req_t *_aio_req_remove(aio_req_t *); extern int _aio_get_timedelta(timespec_t *, timespec_t *); extern aio_result_t *_aio_req_done(void); diff --git a/usr/src/lib/libc/port/aio/aio.c b/usr/src/lib/libc/port/aio/aio.c index 9bccbc2a36..3cfdedae9e 100644 --- a/usr/src/lib/libc/port/aio/aio.c +++ b/usr/src/lib/libc/port/aio/aio.c @@ -314,6 +314,7 @@ _kaio_init() lmutex_unlock(&__aio_initlock); } +#ifdef _LP64 int aioread(int fd, caddr_t buf, int bufsz, off_t offset, int whence, aio_result_t *resultp) @@ -328,7 +329,7 @@ aiowrite(int fd, caddr_t buf, int bufsz, off_t offset, int whence, return (_aiorw(fd, buf, bufsz, offset, whence, resultp, AIOWRITE)); } -#if !defined(_LP64) +#else int aioread64(int fd, caddr_t buf, int bufsz, off64_t offset, int whence, aio_result_t *resultp) diff --git a/usr/src/lib/libc/port/aio/posix_aio.c b/usr/src/lib/libc/port/aio/posix_aio.c index 443b061401..54f30e9de5 100644 --- a/usr/src/lib/libc/port/aio/posix_aio.c +++ b/usr/src/lib/libc/port/aio/posix_aio.c @@ -62,6 +62,7 @@ static int _aio_check_timeout(const timespec_t *, timespec_t *, int *); static void _lio_list_decr(aio_lio_t *); static long aio_list_max = 0; +#ifdef _LP64 int aio_read(aiocb_t *aiocbp) { @@ -98,6 +99,8 @@ aio_write(aiocb_t *aiocbp) (AIO_KAIO | AIO_NO_DUPS))); } +#endif + /* * __lio_listio() cancellation handler. */ @@ -118,6 +121,8 @@ _lio_listio_cleanup(aio_lio_t *head) _aio_lio_free(head); } +#ifdef _LP64 + int lio_listio(int mode, aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list, int nent, struct sigevent *_RESTRICT_KYWD sigevp) @@ -316,6 +321,8 @@ lio_listio(int mode, aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list, return (error); } +#endif + static void _lio_list_decr(aio_lio_t *head) { @@ -621,6 +628,8 @@ __aio_suspend(void **list, int nent, const timespec_t *timo, int largefile) return (-1); } +#ifdef _LP64 + int aio_suspend(const aiocb_t * const list[], int nent, const timespec_t *timeout) @@ -724,24 +733,6 @@ aio_return(aiocb_t *aiocbp) return (retval); } -void -_lio_remove(aio_req_t *reqp) -{ - aio_lio_t *head; - int refcnt; - - if ((head = reqp->req_head) != NULL) { - sig_mutex_lock(&head->lio_mutex); - ASSERT(head->lio_refcnt == head->lio_nent); - refcnt = --head->lio_nent; - head->lio_refcnt--; - sig_mutex_unlock(&head->lio_mutex); - if (refcnt == 0) - _aio_lio_free(head); - reqp->req_head = NULL; - } -} - /* * This function returns the number of asynchronous I/O requests submitted. */ @@ -899,6 +890,26 @@ aio_cancel(int fd, aiocb_t *aiocbp) return (aiocancel_all(fd)); } +#endif + +static void +_lio_remove(aio_req_t *reqp) +{ + aio_lio_t *head; + int refcnt; + + if ((head = reqp->req_head) != NULL) { + sig_mutex_lock(&head->lio_mutex); + ASSERT(head->lio_refcnt == head->lio_nent); + refcnt = --head->lio_nent; + head->lio_refcnt--; + sig_mutex_unlock(&head->lio_mutex); + if (refcnt == 0) + _aio_lio_free(head); + reqp->req_head = NULL; + } +} + /* * __aio_waitn() cancellation handler. */ @@ -1196,6 +1207,8 @@ out: return (error); } +#ifdef _LP64 + int aio_waitn(aiocb_t *list[], uint_t nent, uint_t *nwait, const timespec_t *timeout) @@ -1203,6 +1216,8 @@ aio_waitn(aiocb_t *list[], uint_t nent, uint_t *nwait, return (__aio_waitn((void **)list, nent, nwait, timeout)); } +#endif + void _aio_waitn_wakeup(void) { diff --git a/usr/src/lib/libc/port/gen/attropen.c b/usr/src/lib/libc/port/gen/attropen.c index 46a6111dd9..e9658ffc28 100644 --- a/usr/src/lib/libc/port/gen/attropen.c +++ b/usr/src/lib/libc/port/gen/attropen.c @@ -30,12 +30,6 @@ * attropen -- C library extension routine */ -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 -#pragma weak _attropen64 = attropen64 -#else -#pragma weak _attropen = attropen -#endif - #include "lint.h" #include #include @@ -46,6 +40,12 @@ #include #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#pragma weak _attropen64 = attropen64 +#else +#pragma weak _attropen = attropen +#endif + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 int attropen64(const char *file, const char *attr, int oflag, ...) diff --git a/usr/src/lib/libc/port/gen/posix_fadvise.c b/usr/src/lib/libc/port/gen/posix_fadvise.c index a42d1a9e88..100b2c835d 100644 --- a/usr/src/lib/libc/port/gen/posix_fadvise.c +++ b/usr/src/lib/libc/port/gen/posix_fadvise.c @@ -45,6 +45,8 @@ */ /* ARGSUSED1 */ + +#if defined(_LP64) int posix_fadvise(int fd, off_t offset, off_t len, int advice) { @@ -70,8 +72,7 @@ posix_fadvise(int fd, off_t offset, off_t len, int advice) return (0); } -#if !defined(_LP64) - +#else /* ARGSUSED1 */ int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice) diff --git a/usr/src/lib/libc/port/gen/posix_fallocate.c b/usr/src/lib/libc/port/gen/posix_fallocate.c index d82876f1e8..6ebc7093e7 100644 --- a/usr/src/lib/libc/port/gen/posix_fallocate.c +++ b/usr/src/lib/libc/port/gen/posix_fallocate.c @@ -53,6 +53,7 @@ fallocate_errno(int fd) return (error); } +#if defined(_LP64) int posix_fallocate(int fd, off_t offset, off_t len) { @@ -77,8 +78,7 @@ posix_fallocate(int fd, off_t offset, off_t len) return (0); } -#if !defined(_LP64) - +#else int posix_fallocate64(int fd, off64_t offset, off64_t len) { diff --git a/usr/src/lib/libc/port/gen/readdir.c b/usr/src/lib/libc/port/gen/readdir.c index faa863380e..34f907509b 100644 --- a/usr/src/lib/libc/port/gen/readdir.c +++ b/usr/src/lib/libc/port/gen/readdir.c @@ -47,8 +47,9 @@ #if !defined(_LP64) #pragma weak _readdir64 = readdir64 -#endif +#else #pragma weak _readdir = readdir +#endif #include "lint.h" #include @@ -124,38 +125,4 @@ readdir64(DIR *dirp) dp64 = (dirent64_t *)(uintptr_t)&dirp->dd_buf[dirp->dd_loc]; return (dp64); } - -/* - * readdir now does translation of dirent64 entries into dirent entries. - * We rely on the fact that dirents are smaller than dirent64s and we - * reuse the space accordingly. - */ -dirent_t * -readdir(DIR *dirp) -{ - dirent64_t *dp64; /* -> directory data */ - dirent_t *dp32; /* -> directory data */ - - if ((dp64 = readdir64(dirp)) == NULL) - return (NULL); - - /* - * Make sure that the offset fits in 32 bits. - */ - if (((off_t)dp64->d_off != dp64->d_off && - (uint64_t)dp64->d_off > (uint64_t)UINT32_MAX) || - dp64->d_ino > SIZE_MAX) { - errno = EOVERFLOW; - return (NULL); - } - - dp32 = (dirent_t *)(&dp64->d_off); - dp32->d_off = (off_t)dp64->d_off; - dp32->d_ino = (ino_t)dp64->d_ino; - dp32->d_reclen = (unsigned short)(dp64->d_reclen - - ((char *)&dp64->d_off - (char *)dp64)); - dp64->d_ino = (ino64_t)-1; /* flag as converted for readdir64 */ - /* d_name d_reclen should not move */ - return (dp32); -} #endif /* _LP64 */ diff --git a/usr/src/lib/libc/port/gen/readdir_r.c b/usr/src/lib/libc/port/gen/readdir_r.c index 71b07dacc2..279cf083fb 100644 --- a/usr/src/lib/libc/port/gen/readdir_r.c +++ b/usr/src/lib/libc/port/gen/readdir_r.c @@ -146,40 +146,4 @@ readdir64_r(DIR *dirp, dirent64_t *entry, dirent64_t **result) lmutex_unlock(&pdirp->dd_lock); return (0); } - -/* - * POSIX.1c standard version of the function readdir_r. - */ - -int -readdir_r(DIR *dirp, dirent_t *entry, dirent_t **result) -{ - int error; - dirent64_t *dp64; - struct { - dirent64_t dirent64; - char chars[MAXNAMLEN]; - } buf; - - error = readdir64_r(dirp, (dirent64_t *)&buf, &dp64); - if (error != 0 || dp64 == NULL) { - *result = NULL; - return (error); - } - - if (dp64->d_ino > SIZE_MAX || - (uint64_t)dp64->d_off > (uint64_t)UINT32_MAX) { - *result = NULL; - return (EOVERFLOW); - } - - entry->d_ino = (ino_t)dp64->d_ino; - entry->d_off = (off_t)dp64->d_off; - entry->d_reclen = (unsigned short)((((char *)entry->d_name - - (char *)entry) + strlen(dp64->d_name) + 1 + 3) & ~3); - (void) strcpy(entry->d_name, dp64->d_name); - *result = entry; - return (0); -} - #endif /* _LP64 */ diff --git a/usr/src/lib/libc/port/gen/scandir.c b/usr/src/lib/libc/port/gen/scandir.c index ec425e0466..592afbe3cb 100644 --- a/usr/src/lib/libc/port/gen/scandir.c +++ b/usr/src/lib/libc/port/gen/scandir.c @@ -52,11 +52,12 @@ #include -#pragma weak _scandir = scandir -#pragma weak _alphasort = alphasort #if !defined(_LP64) #pragma weak _scandir64 = scandir64 #pragma weak _alphasort64 = alphasort64 +#else +#pragma weak _scandir = scandir +#pragma weak _alphasort = alphasort #endif #include "lint.h" @@ -152,7 +153,7 @@ fail: (void) closedir(dirp); return (-1); } -#endif +#else int @@ -237,10 +238,12 @@ fail: (void) closedir(dirp); return (-1); } +#endif /* * Alphabetic order comparison routine for those who want it. */ +#if defined(_LP64) int alphasort(const struct dirent **d1, const struct dirent **d2) { @@ -248,7 +251,7 @@ alphasort(const struct dirent **d1, const struct dirent **d2) (*d2)->d_name)); } -#if !defined(_LP64) +#else int alphasort64(const struct dirent64 **d1, const struct dirent64 **d2) { diff --git a/usr/src/lib/libc/port/gen/walkstack.c b/usr/src/lib/libc/port/gen/walkstack.c index de8cc3f6e6..bf55cefb30 100644 --- a/usr/src/lib/libc/port/gen/walkstack.c +++ b/usr/src/lib/libc/port/gen/walkstack.c @@ -162,15 +162,15 @@ static int read_safe(int fd, struct frame *fp, struct frame **savefp, uintptr_t *savepc) { - uintptr_t newfp; + uintptr_t newfp, savfp, savpc; if ((uintptr_t)fp & (sizeof (void *) - 1)) return (-1); /* misaligned */ if ((pread(fd, (void *)&newfp, sizeof (fp->fr_savfp), - (off_t)&fp->fr_savfp) != sizeof (fp->fr_savfp)) || + (intptr_t)&fp->fr_savfp) != sizeof (fp->fr_savfp)) || pread(fd, (void *)savepc, sizeof (fp->fr_savpc), - (off_t)&fp->fr_savpc) != sizeof (fp->fr_savpc)) + (intptr_t)&fp->fr_savpc) != sizeof (fp->fr_savpc)) return (-1); /* diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index 19f03b3ab0..eab15aec5c 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -217,8 +217,10 @@ SYMBOL_VERSION ILLUMOS_0.11 { # Illumos additions SYMBOL_VERSION ILLUMOS_0.10 { # Illumos additions protected: +$if _ELF64 preadv; pwritev; +$endif $if lf64 preadv64; @@ -315,9 +317,11 @@ SYMBOL_VERSION ILLUMOS_0.8 { # POSIX 2008 newlocale and friends } ILLUMOS_0.7; SYMBOL_VERSION ILLUMOS_0.7 { # Illumos additions +$if _ELF64 protected: _glob_ext; _globfree_ext; +$endif } ILLUMOS_0.6; SYMBOL_VERSION ILLUMOS_0.6 { # Illumos additions @@ -337,8 +341,10 @@ SYMBOL_VERSION ILLUMOS_0.4 { # Illumos additions protected: pipe2; dup3; +$if _ELF64 mkostemp; mkostemps; +$endif $if lf64 mkostemp64; @@ -383,18 +389,20 @@ $if sparc32 $endif addrtosymstr; - aio_cancel; aiocancel; +$if _ELF64 + aio_cancel; aio_error; aio_fsync; aio_read; aioread; aio_return; aio_suspend; - aiowait; aio_waitn; aio_write; aiowrite; +$endif + aiowait; asprintf; assfail; backtrace; @@ -446,13 +454,17 @@ $endif htonll; htons; linkat; +$if _ELF64 lio_listio; +$endif memmem; mkdirat; mkdtemp; mkfifoat; mknodat; +$if _ELF64 mkstemps; +$endif mmapobj; mq_close; mq_getattr; @@ -470,8 +482,10 @@ $endif ntohl; ntohll; ntohs; +$if _ELF64 posix_fadvise; posix_fallocate; +$endif posix_madvise; posix_memalign; posix_spawn_file_actions_addclosefrom_np; @@ -774,8 +788,10 @@ $error unknown platform $endif protected: +$if _ELF64 alphasort; _alphasort; +$endif atomic_add_16; atomic_add_16_nv; atomic_add_32; @@ -926,8 +942,10 @@ $endif pthread_spin_trylock; pthread_spin_unlock; rctlblk_set_recipient_pid; +$if _ELF64 scandir; _scandir; +$endif schedctl_exit; schedctl_init; schedctl_lookup; @@ -1075,8 +1093,10 @@ SYMBOL_VERSION SUNW_1.21.1 { # SunOS 5.9 (Solaris 9) patch additions SYMBOL_VERSION SUNW_1.21 { # SunOS 5.9 (Solaris 9) protected: +$if _ELF64 attropen; _attropen; +$endif bind_textdomain_codeset; closefrom; _closefrom; @@ -1089,7 +1109,9 @@ SYMBOL_VERSION SUNW_1.21 { # SunOS 5.9 (Solaris 9) _fdopendir; fdwalk; _fdwalk; +$if _ELF64 fstatat; +$endif futimesat; _futimesat; getcpuid; @@ -1105,7 +1127,9 @@ SYMBOL_VERSION SUNW_1.21 { # SunOS 5.9 (Solaris 9) meminfo; _meminfo; ngettext; +$if _ELF64 openat; +$endif printstack; priocntl; priocntlset; @@ -1374,8 +1398,10 @@ SYMBOL_VERSION SUNW_1.1 { # SunOS 5.6 (Solaris 2.6) fpsetround; fputwc; fputws; +$if _ELF64 fseeko; ftello; +$endif ftrylockfile; getexecname; _getexecname; @@ -1675,8 +1701,10 @@ SYMBOL_VERSION SUNW_0.8 { # SunOS 5.4 (Solaris 2.4) confstr; fnmatch; _getdate_err_addr; +$if _ELF64 glob; globfree; +$endif iconv; iconv_close; iconv_open; @@ -1817,12 +1845,16 @@ $endif fpsetmask; fpsetsticky; fstatfs; +$if _ELF64 ftruncate; ftw; +$endif func_to_decimal; gconvert; gcvt; +$if _ELF64 getdents; +$endif gethrtime; gethrvtime; getmntany; @@ -1887,8 +1919,10 @@ $endif __makedev; mincore; __minor; +$if _ELF64 mkstemp; _mkstemp; +$endif mlockall; mrand48; munlockall; @@ -1904,7 +1938,9 @@ $endif openlog; plock; p_online; +$if _ELF64 pread; +$endif __priocntl; __priocntlset; processor_bind; @@ -1915,7 +1951,9 @@ $endif putspent; pututline; pututxline; +$if _ELF64 pwrite; +$endif qeconvert; qecvt; qfconvert; @@ -1961,7 +1999,9 @@ $endif syslog; _syslog; tmpnam_r; +$if _ELF64 truncate; +$endif ttyslot; uadmin; ulckpwdf; @@ -2030,7 +2070,9 @@ $endif putchar_unlocked; putc_unlocked; rand_r; +$if _ELF64 readdir_r; +$endif setgrent; setitimer; _setitimer; @@ -2163,7 +2205,9 @@ $endif close; closedir; _closedir; +$if _ELF64 creat; +$endif ctermid; ctime; cuserid; @@ -2206,7 +2250,9 @@ $endif ferror; fflush; fgetc; +$if _ELF64 fgetpos; +$endif fgets; __filbuf; fileno; @@ -2214,7 +2260,9 @@ $endif __flsbuf; fmtmsg; _fmtmsg; +$if _ELF64 fopen; +$endif fork; fpathconf; _fpathconf; @@ -2222,13 +2270,17 @@ $endif fputc; fputs; fread; +$if _ELF64 freopen; +$endif fscanf; fseek; +$if _ELF64 fsetpos; fstat; fstatvfs; _fstatvfs; +$endif fsync; ftell; ftok; @@ -2269,8 +2321,10 @@ $endif _getppid; getpwnam; getpwuid; +$if _ELF64 getrlimit; _getrlimit; +$endif gets; getsid; _getsid; @@ -2324,13 +2378,17 @@ $endif _link; localeconv; localtime; +$if _ELF64 lockf; +$endif longjmp; lsearch; _lsearch; +$if _ELF64 lseek; _lseek; lstat; +$endif makecontext; _makecontext; mblen; @@ -2352,8 +2410,10 @@ $endif mktime; mlock; _mlock; +$if _ELF64 mmap; _mmap; +$endif monitor; _monitor; mount; @@ -2371,13 +2431,17 @@ $endif _munlock; munmap; _munmap; +$if _ELF64 nftw; _nftw; +$endif nice; _nice; nl_langinfo; _nl_langinfo; +$if _ELF64 open; +$endif opendir; _opendir; pathconf; @@ -2410,8 +2474,10 @@ $endif raise; rand; read; +$if _ELF64 readdir; _readdir; +$endif readlink; _readlink; readv; @@ -2446,8 +2512,10 @@ $endif _setpgid; setpgrp; _setpgrp; +$if _ELF64 setrlimit; _setrlimit; +$endif setsid; _setsid; setuid; @@ -2502,9 +2570,11 @@ $endif sprintf; srand; sscanf; +$if _ELF64 stat; statvfs; _statvfs; +$endif stime; _stime; strcat; @@ -2560,8 +2630,10 @@ $endif _tcsetpgrp; tdelete; _tdelete; +$if _ELF64 tell; _tell; +$endif telldir; _telldir; tempnam; @@ -2572,7 +2644,9 @@ $endif _time; times; _times; +$if _ELF64 tmpfile; +$endif tmpnam; toascii; _toascii; @@ -2613,7 +2687,9 @@ $endif wctomb; write; writev; +$if _ELF64 _xftw; +$endif $if _ELF32 ptrace; @@ -2934,11 +3010,15 @@ $endif _fpsetmask; _fpsetround; _fpsetsticky; +$if _ELF64 _ftw; +$endif _gcvt; _getarg; __getcontext; +$if _ELF64 _getdents; +$endif _get_exit_frame_monitor; _getfp; _getgroupsbymember; @@ -4002,11 +4082,13 @@ $endif verrc; warnc; vwarnc; +$if _ELF64 fts_close; fts_children; fts_open; fts_read; fts_set; +$endif vis; strvis; strnvis; diff --git a/usr/src/lib/libc/port/stdio/fseeko.c b/usr/src/lib/libc/port/stdio/fseeko.c index b47c7a5313..5c85e92375 100644 --- a/usr/src/lib/libc/port/stdio/fseeko.c +++ b/usr/src/lib/libc/port/stdio/fseeko.c @@ -37,8 +37,9 @@ #if !defined(_LP64) #pragma weak _fseeko64 = fseeko64 -#endif +#else #pragma weak _fseeko = fseeko +#endif #include "lint.h" #include "file64.h" @@ -87,10 +88,11 @@ fseeko64(FILE *iop, off64_t offset, int ptrname) FUNLOCKFILE(lk); return ((p == -1)? -1: 0); } -#endif /* _LP64 */ +#else int fseeko(FILE *iop, off_t offset, int ptrname) { return (fseek(iop, offset, ptrname)); } +#endif diff --git a/usr/src/lib/libc/port/stdio/ftello.c b/usr/src/lib/libc/port/stdio/ftello.c index 2eafdf1fef..c492502e68 100644 --- a/usr/src/lib/libc/port/stdio/ftello.c +++ b/usr/src/lib/libc/port/stdio/ftello.c @@ -38,8 +38,9 @@ #if !defined(_LP64) #pragma weak _ftello64 = ftello64 -#endif +#else #pragma weak _ftello = ftello +#endif #include "lint.h" #include "file64.h" @@ -86,10 +87,11 @@ ftello64(FILE *iop) return (tres); } -#endif /* _LP64 */ +#else off_t ftello(FILE *iop) { return ((off_t)ftell(iop)); } +#endif diff --git a/usr/src/lib/libc/port/stdio/tmpfile.c b/usr/src/lib/libc/port/stdio/tmpfile.c index 884a7a369a..c092df5aab 100644 --- a/usr/src/lib/libc/port/stdio/tmpfile.c +++ b/usr/src/lib/libc/port/stdio/tmpfile.c @@ -101,7 +101,7 @@ tmpfile64(void) { return (_common(B_TRUE)); } -#endif /* _LP64 */ +#else /* * This is a bit confusing -- some explanation is in order. @@ -116,3 +116,4 @@ tmpfile(void) { return (_common(B_FALSE)); } +#endif diff --git a/usr/src/lib/libc/port/threads/scalls.c b/usr/src/lib/libc/port/threads/scalls.c index 0c792168a7..b963c93426 100644 --- a/usr/src/lib/libc/port/threads/scalls.c +++ b/usr/src/lib/libc/port/threads/scalls.c @@ -706,6 +706,7 @@ fsync(int fildes) PERFORM(__fdsync(fildes, O_SYNC)) } +#ifdef _LP64 int lockf(int fildes, int function, off_t size) { @@ -715,7 +716,7 @@ lockf(int fildes, int function, off_t size) PERFORM(__lockf(fildes, function, size)) } -#if !defined(_LP64) +#else int lockf64(int fildes, int function, off64_t size) { @@ -724,7 +725,7 @@ lockf64(int fildes, int function, off64_t size) PERFORM(__lockf64(fildes, function, size)) } -#endif /* !_LP64 */ +#endif /* _LP64 */ ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg) @@ -753,6 +754,7 @@ msync(void *addr, size_t len, int flags) PERFORM(__msync(addr, len, flags)) } +#ifdef _LP64 int openat(int fd, const char *path, int oflag, ...) { @@ -785,7 +787,7 @@ creat(const char *path, mode_t mode) return (open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); } -#if !defined(_LP64) +#else int openat64(int fd, const char *path, int oflag, ...) { @@ -817,7 +819,7 @@ creat64(const char *path, mode_t mode) { return (open64(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); } -#endif /* !_LP64 */ +#endif /* _LP64 */ int pause(void) @@ -828,6 +830,7 @@ pause(void) PERFORM(__pause()) } +#ifdef _LP64 ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset) { @@ -837,47 +840,54 @@ pread(int fildes, void *buf, size_t nbyte, off_t offset) PERFORM(__pread(fildes, buf, nbyte, offset)) } -#if !defined(_LP64) ssize_t -pread64(int fildes, void *buf, size_t nbyte, off64_t offset) +preadv(int fildes, const struct iovec *iov, int iovcnt, off_t offset) { - extern ssize_t __pread64(int, void *, size_t, off64_t); + + extern ssize_t __preadv(int, const struct iovec *, int, off_t, off_t); ssize_t rv; - PERFORM(__pread64(fildes, buf, nbyte, offset)) + PERFORM(__preadv(fildes, iov, iovcnt, offset, 0)) } - ssize_t -preadv64(int fildes, const struct iovec *iov, int iovcnt, off64_t offset) +pwrite(int fildes, const void *buf, size_t nbyte, off_t offset) { - - extern ssize_t __preadv64(int, const struct iovec *, int, off_t, off_t); + extern ssize_t __pwrite(int, const void *, size_t, off_t); ssize_t rv; - PERFORM(__preadv64(fildes, iov, iovcnt, offset & 0xffffffffULL, - offset>>32)) + PERFORM(__pwrite(fildes, buf, nbyte, offset)) } -#endif /* !_LP64 */ ssize_t -preadv(int fildes, const struct iovec *iov, int iovcnt, off_t offset) +pwritev(int fildes, const struct iovec *iov, int iovcnt, off_t offset) { + extern ssize_t __pwritev(int, const struct iovec *, int, off_t, off_t); + ssize_t rv; - extern ssize_t __preadv(int, const struct iovec *, int, off_t, off_t); + PERFORM(__pwritev(fildes, iov, iovcnt, offset, 0)) +} + +#else +ssize_t +pread64(int fildes, void *buf, size_t nbyte, off64_t offset) +{ + extern ssize_t __pread64(int, void *, size_t, off64_t); ssize_t rv; - PERFORM(__preadv(fildes, iov, iovcnt, offset, 0)) + PERFORM(__pread64(fildes, buf, nbyte, offset)) } + ssize_t -pwrite(int fildes, const void *buf, size_t nbyte, off_t offset) +preadv64(int fildes, const struct iovec *iov, int iovcnt, off64_t offset) { - extern ssize_t __pwrite(int, const void *, size_t, off_t); + + extern ssize_t __preadv64(int, const struct iovec *, int, off_t, off_t); ssize_t rv; - PERFORM(__pwrite(fildes, buf, nbyte, offset)) + PERFORM(__preadv64(fildes, iov, iovcnt, offset & 0xffffffffULL, + offset>>32)) } -#if !defined(_LP64) ssize_t pwrite64(int fildes, const void *buf, size_t nbyte, off64_t offset) { @@ -902,15 +912,6 @@ pwritev64(int fildes, const struct iovec *iov, int iovcnt, off64_t offset) #endif /* !_LP64 */ ssize_t -pwritev(int fildes, const struct iovec *iov, int iovcnt, off_t offset) -{ - extern ssize_t __pwritev(int, const struct iovec *, int, off_t, off_t); - ssize_t rv; - - PERFORM(__pwritev(fildes, iov, iovcnt, offset, 0)) -} - -ssize_t readv(int fildes, const struct iovec *iov, int iovcnt) { extern ssize_t __readv(int, const struct iovec *, int); diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c index 24090adb07..572b819e00 100644 --- a/usr/src/lib/libc/port/threads/thr.c +++ b/usr/src/lib/libc/port/threads/thr.c @@ -2460,7 +2460,12 @@ thr_setstate(thread_t tid, int flag, gregset_t rs) int getlwpstatus(thread_t tid, struct lwpstatus *sp) { +#ifdef _LP64 extern ssize_t __pread(int, void *, size_t, off_t); +#else + extern ssize_t __pread64(int, void *, size_t, off64_t); +#define __pread __pread64 +#endif char buf[100]; int fd; diff --git a/usr/src/lib/libgen/common/copylist.c b/usr/src/lib/libgen/common/copylist.c index 33d0da3018..78b6dc1595 100644 --- a/usr/src/lib/libgen/common/copylist.c +++ b/usr/src/lib/libgen/common/copylist.c @@ -90,8 +90,7 @@ copylist64(const char *filenm, off64_t *szptr) return (common_copylist(filenm, stbuf.st_size)); } -#endif - +#else char * copylist(const char *filenm, off_t *szptr) @@ -112,3 +111,4 @@ copylist(const char *filenm, off_t *szptr) return (common_copylist(filenm, stbuf.st_size)); } +#endif diff --git a/usr/src/lib/libgen/common/mapfile-vers b/usr/src/lib/libgen/common/mapfile-vers index ec4a5ac5a4..24b72546ef 100644 --- a/usr/src/lib/libgen/common/mapfile-vers +++ b/usr/src/lib/libgen/common/mapfile-vers @@ -48,7 +48,9 @@ SYMBOL_VERSION SUNW_1.1 { ___braslist; bufsplit; compile; +$if _ELF64 copylist; +$endif eaccess; gmatch; isencrypt; diff --git a/usr/src/lib/libproc/common/pr_fcntl.c b/usr/src/lib/libproc/common/pr_fcntl.c index c2c34e1d41..1ef83d8ad1 100644 --- a/usr/src/lib/libproc/common/pr_fcntl.c +++ b/usr/src/lib/libproc/common/pr_fcntl.c @@ -95,6 +95,7 @@ pr_fcntl(struct ps_prochandle *Pr, int fd, int cmd, void *argp) adp->arg_type = AT_BYREF; adp->arg_inout = AI_INOUT; switch (cmd) { +#ifdef _LP64 case F_GETLK: case F_SETLK: case F_SETLKW: @@ -102,7 +103,6 @@ pr_fcntl(struct ps_prochandle *Pr, int fd, int cmd, void *argp) case F_FREESP: adp->arg_size = sizeof (struct flock); break; -#ifdef _LP64 case 33: case 34: case 35: diff --git a/usr/src/lib/madv/common/madv.c b/usr/src/lib/madv/common/madv.c index d1e3cd179a..7b12682e86 100644 --- a/usr/src/lib/madv/common/madv.c +++ b/usr/src/lib/madv/common/madv.c @@ -718,6 +718,7 @@ shmat(int shmid, const void *shmaddr, int shmflag) return (result); } +#ifdef _LP64 /* * mmap interpose */ @@ -770,7 +771,7 @@ mmap(void *addr, size_t len, int prot, int flags, int fd, off_t pos) return (result); } -#if !defined(_LP64) +#else /* * mmap64 interpose */ @@ -820,4 +821,4 @@ mmap64(void *addr, size_t len, int prot, int flags, int fd, off64_t pos) return (result); } -#endif /* !_LP64 */ +#endif /* _LP64 */ diff --git a/usr/src/test/os-tests/tests/file-locking/util.c b/usr/src/test/os-tests/tests/file-locking/util.c index b178e8a405..55affb6dd0 100644 --- a/usr/src/test/os-tests/tests/file-locking/util.c +++ b/usr/src/test/os-tests/tests/file-locking/util.c @@ -154,21 +154,22 @@ flock_cmdname(int cmd) switch (cmd) { case F_SETLK: return ("F_SETLK"); - case F_OFD_SETLK: - return ("F_OFD_SETLK"); case F_SETLKW: return ("F_SETLKW"); - case F_OFD_SETLKW: - return ("F_OFD_SETLKW"); case F_GETLK: return ("F_GETLK"); - case F_OFD_GETLK: - return ("F_OFD_GETLK"); case F_FLOCK: return ("F_FLOCK"); case F_FLOCKW: return ("F_FLOCKW"); -#if !defined(_LP64) +#ifdef _LP64 + case F_OFD_SETLK: + return ("F_OFD_SETLK"); + case F_OFD_SETLKW: + return ("F_OFD_SETLKW"); + case F_OFD_GETLK: + return ("F_OFD_GETLK"); +#else case F_OFD_SETLK64: return ("F_OFD_SETLK64"); case F_OFD_SETLKW64: -- 2.11.4.GIT