Mercurial > unleashed > wips
changeset 20465:f0a82d6e44ca
libc: remove largefile seekdir/telldir
author | Lauri Tirkkonen <lotheac@iki.fi> |
---|---|
date | Tue, 12 Mar 2019 00:06:37 +0200 |
parents | 584ed1f64e05 |
children | 83c0aa6b504e |
files | usr/src/lib/libc/port/gen/seekdir.c usr/src/lib/libc/port/gen/telldir.c usr/src/lib/libc/port/mapfile-vers |
diffstat | 3 files changed, 0 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libc/port/gen/seekdir.c Mon Mar 11 23:58:19 2019 +0200 +++ b/usr/src/lib/libc/port/gen/seekdir.c Tue Mar 12 00:06:37 2019 +0200 @@ -27,19 +27,12 @@ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * seekdir -- C library extension routine */ #include <sys/feature_tests.h> -#if !defined(_LP64) -#pragma weak _seekdir64 = seekdir64 -#endif -#pragma weak _seekdir = seekdir - #include "lint.h" #include "libc.h" #include <mtlib.h> @@ -47,8 +40,6 @@ #include <fcntl.h> #include <unistd.h> -#ifdef _LP64 - void seekdir(DIR *dirp, long loc) { @@ -74,54 +65,3 @@ } lmutex_unlock(&pdirp->dd_lock); } - -#else /* _LP64 */ - -/* - * Note: Instead of making this function static, we reduce it to local - * scope in the mapfile. That allows the linker to prevent it from - * appearing in the .SUNW_dynsymsort section. - */ -void -seekdir64(DIR *dirp, off64_t loc) -{ - private_DIR *pdirp = (private_DIR *)(uintptr_t)dirp; - dirent64_t *dp64; - off64_t off = 0; - - lmutex_lock(&pdirp->dd_lock); - if (lseek64(dirp->dd_fd, 0, SEEK_CUR) != 0) { - dp64 = (dirent64_t *)(uintptr_t)&dirp->dd_buf[dirp->dd_loc]; - /* was converted by readdir and needs to be reversed */ - if (dp64->d_ino == (ino64_t)-1) { - dirent_t *dp32; - - dp32 = (dirent_t *)((uintptr_t)dp64 + sizeof (ino64_t)); - dp64->d_ino = (ino64_t)dp32->d_ino; - dp64->d_off = (off64_t)dp32->d_off; - dp64->d_reclen = (unsigned short)(dp32->d_reclen + - ((char *)&dp64->d_off - (char *)dp64)); - } - off = dp64->d_off; - } - if (off != loc) { - dirp->dd_loc = 0; - (void) lseek64(dirp->dd_fd, loc, SEEK_SET); - dirp->dd_size = 0; - - /* - * Save seek offset in d_off field, in case telldir - * follows seekdir with no intervening call to readdir - */ - ((dirent64_t *)(uintptr_t)&dirp->dd_buf[0])->d_off = loc; - } - lmutex_unlock(&pdirp->dd_lock); -} - -void -seekdir(DIR *dirp, long loc) -{ - seekdir64(dirp, (off64_t)(uint32_t)loc); -} - -#endif /* _LP64 */
--- a/usr/src/lib/libc/port/gen/telldir.c Mon Mar 11 23:58:19 2019 +0200 +++ b/usr/src/lib/libc/port/gen/telldir.c Tue Mar 12 00:06:37 2019 +0200 @@ -27,19 +27,12 @@ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * telldir -- C library extension routine */ #include <sys/isa_defs.h> -#if !defined(_LP64) -#pragma weak _telldir64 = telldir64 -#endif -#pragma weak _telldir = telldir - #include "lint.h" #include "libc.h" #include <mtlib.h> @@ -49,8 +42,6 @@ #include <fcntl.h> #include <unistd.h> -#ifdef _LP64 - long telldir(DIR *dirp) { @@ -67,56 +58,3 @@ lmutex_unlock(&pdirp->dd_lock); return (off); } - -#else - -/* - * Note: Instead of making this function static, we reduce it to local - * scope in the mapfile. That allows the linker to prevent it from - * appearing in the .SUNW_dynsymsort section. - */ -off64_t -telldir64(DIR *dirp) -{ - private_DIR *pdirp = (private_DIR *)(uintptr_t)dirp; - dirent64_t *dp64; - off64_t off = 0; - - lmutex_lock(&pdirp->dd_lock); - /* if at beginning of dir, return 0 */ - if (lseek64(dirp->dd_fd, 0, SEEK_CUR) != 0) { - dp64 = (dirent64_t *)(uintptr_t)(&dirp->dd_buf[dirp->dd_loc]); - /* was converted by readdir and needs to be reversed */ - if (dp64->d_ino == (ino64_t)-1) { - dirent_t *dp32; - - dp32 = (dirent_t *)((uintptr_t)dp64 + sizeof (ino64_t)); - dp64->d_ino = (ino64_t)dp32->d_ino; - dp64->d_off = (off64_t)dp32->d_off; - dp64->d_reclen = (unsigned short)(dp32->d_reclen + - ((char *)&dp64->d_off - (char *)dp64)); - } - off = dp64->d_off; - } - lmutex_unlock(&pdirp->dd_lock); - return (off); -} - -long -telldir(DIR *dirp) -{ - off64_t off; - - off = telldir64(dirp); - - /* - * Make sure that the offset fits in 32 bits. - */ - if ((long)off != off && (uint64_t)off > (uint64_t)UINT32_MAX) { - errno = EOVERFLOW; - return (-1); - } - return ((long)off); -} - -#endif /* _LP64 */
--- a/usr/src/lib/libc/port/mapfile-vers Mon Mar 11 23:58:19 2019 +0200 +++ b/usr/src/lib/libc/port/mapfile-vers Tue Mar 12 00:06:37 2019 +0200 @@ -2369,7 +2369,6 @@ _rmdir; scanf; seekdir; - _seekdir; semctl; _semctl; semget; @@ -2504,7 +2503,6 @@ _tdelete; tell; telldir; - _telldir; tempnam; _tempnam; tfind;