From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 443943856DC1; Mon, 30 May 2022 15:06:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 443943856DC1 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: remove some 32-bit-only function definitions X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 98180795ded4dae9bb5d24e7d38a4589fca9a0cf X-Git-Newrev: 7c0de0af97d35c8fed5ffbf311e54af85d1c4af3 Message-Id: <20220530150640.443943856DC1@sourceware.org> Date: Mon, 30 May 2022 15:06:40 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 15:06:40 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D7c0de0af97d= 35c8fed5ffbf311e54af85d1c4af3 commit 7c0de0af97d35c8fed5ffbf311e54af85d1c4af3 Author: Ken Brown Date: Sun May 22 15:16:47 2022 -0400 Cygwin: remove some 32-bit-only function definitions =20 Remove the definitions of the following: acl, aclcheck, aclfrommode, aclfrompbits, aclfromtext, aclsort, acltomode, acltopbits, acltotext, chown, fchown, _fcntl, fstat, _fstat_r, ftruncate, getegid, geteuid, ge= tgid, getgrent, getgrgid, getgrnam, getgroups, getpwduid, getpwuid, getpwuid_r, getuid, initgroups, lacl, lacl32, lchown, lseek, lstat, mknod, mmap, setegid, seteuid, setgid, setgroups, setregid, setreuid, setuid, stat, _stat_r, truncate. =20 [For most of these, the corresponding 64-bit entry points are obtained by exporting aliases. For example, acl is an alias for acl32, and truncate is an alias for truncate64.] =20 Remove the following structs and all code using them (which is 32-bit only): __stat32, __group16, __flock32, __aclent16_t. =20 Remove the typedefs of __blkcnt32_t __dev16_t, __ino32_t, which are used only in code that has been removed. =20 Put the typedefs of __uid16_t and __gid16_t in one header, instead of one header if __INSIDE_CYGWIN__ is defined and a different header otherwise. Diff: --- winsup/cygwin/fcntl.cc | 41 ------- winsup/cygwin/glob.cc | 31 ------ winsup/cygwin/grp.cc | 98 ----------------- winsup/cygwin/include/cygwin/grp.h | 10 -- winsup/cygwin/include/cygwin/stat.h | 19 ---- winsup/cygwin/include/machine/_types.h | 8 -- winsup/cygwin/include/machine/types.h | 11 -- winsup/cygwin/include/sys/cygwin.h | 2 - winsup/cygwin/mmap.cc | 8 -- winsup/cygwin/passwd.cc | 24 ---- winsup/cygwin/sec_acl.cc | 98 ----------------- winsup/cygwin/security.h | 7 -- winsup/cygwin/syscalls.cc | 195 -----------------------------= ---- winsup/cygwin/uinfo.cc | 32 ------ 14 files changed, 584 deletions(-) diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index 507ba61f7..437fcf128 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -79,46 +79,5 @@ fcntl64 (int fd, int cmd, ...) return res; } =20 -#ifdef __i386__ -extern "C" int -_fcntl (int fd, int cmd, ...) -{ - intptr_t arg =3D 0; - va_list args; - struct __flock32 *src =3D NULL; - struct flock dst; - - __try - { - va_start (args, cmd); - arg =3D va_arg (args, intptr_t); - va_end (args); - if (cmd =3D=3D F_GETLK || cmd =3D=3D F_SETLK || cmd =3D=3D F_SETLKW) - { - src =3D (struct __flock32 *) arg; - dst.l_type =3D src->l_type; - dst.l_whence =3D src->l_whence; - dst.l_start =3D src->l_start; - dst.l_len =3D src->l_len; - dst.l_pid =3D src->l_pid; - arg =3D (intptr_t) &dst; - } - int res =3D fcntl64 (fd, cmd, arg); - if (cmd =3D=3D F_GETLK) - { - src->l_type =3D dst.l_type; - src->l_whence =3D dst.l_whence; - src->l_start =3D dst.l_start; - src->l_len =3D dst.l_len; - src->l_pid =3D (short) dst.l_pid; - } - return res; - } - __except (EFAULT) - __endtry - return -1; -} -#else EXPORT_ALIAS (fcntl64, fcntl) EXPORT_ALIAS (fcntl64, _fcntl) -#endif diff --git a/winsup/cygwin/glob.cc b/winsup/cygwin/glob.cc index b0d393f98..b14cf6dab 100644 --- a/winsup/cygwin/glob.cc +++ b/winsup/cygwin/glob.cc @@ -855,38 +855,7 @@ g_opendir(Char *str, glob_t *pglob) return(opendir(buf)); } =20 -#ifdef __x86_64__ #define CYGWIN_gl_stat(sfptr) ((*pglob->sfptr) (buf, sb)) -#else -static void -stat32_to_stat64 (struct __stat32 *src, struct stat *dst) -{ - dst->st_dev =3D src->st_dev; - dst->st_ino =3D src->st_ino; - dst->st_mode =3D src->st_mode; - dst->st_nlink =3D src->st_nlink; - dst->st_uid =3D src->st_uid; - dst->st_gid =3D src->st_gid; - dst->st_rdev =3D src->st_rdev; - dst->st_size =3D src->st_size; - dst->st_atim =3D src->st_atim; - dst->st_mtim =3D src->st_mtim; - dst->st_ctim =3D src->st_ctim; - dst->st_birthtim =3D src->st_mtim; - dst->st_blksize =3D src->st_blksize; - dst->st_blocks =3D src->st_blocks; -} - -#define CYGWIN_gl_stat(sfptr) \ - ({ int ret; \ - struct __stat32 lsb; \ - if (CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES) \ - ret =3D (*pglob->sfptr) (buf, sb); \ - else if (!(ret =3D (*pglob->sfptr) (buf, (struct stat *) &lsb))) \ - stat32_to_stat64 (&lsb, sb); \ - ret; \ - }) -#endif =20 static int g_lstat(Char *fn, struct stat *sb, glob_t *pglob) diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 23e2d0251..893e4cc0f 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -237,24 +237,6 @@ internal_getgrgid (gid_t gid, cyg_ldap *pldap) return NULL; } =20 -#ifdef __i386__ -static struct __group16 * -grp32togrp16 (struct __group16 *gp16, struct group *gp32) -{ - if (!gp16 || !gp32) - return NULL; - - /* Copying the pointers is actually unnecessary. Just having the correct - return type is important. */ - gp16->gr_name =3D gp32->gr_name; - gp16->gr_passwd =3D gp32->gr_passwd; - gp16->gr_gid =3D (__gid16_t) gp32->gr_gid; /* Not loss-free */ - gp16->gr_mem =3D gp32->gr_mem; - - return gp16; -} -#endif - extern "C" int getgrgid_r (gid_t gid, struct group *grp, char *buffer, size_t bufsize, struct group **result) @@ -325,17 +307,7 @@ getgrgid32 (gid_t gid) return getgr_cp (tempgr); } =20 -#ifdef __x86_64__ EXPORT_ALIAS (getgrgid32, getgrgid) -#else -extern "C" struct __group16 * -getgrgid (__gid16_t gid) -{ - static struct __group16 g16; /* FIXME: thread-safe? */ - - return grp32togrp16 (&g16, getgrgid32 (gid16togid32 (gid))); -} -#endif =20 extern "C" int getgrnam_r (const char *nam, struct group *grp, char *buffer, @@ -375,17 +347,7 @@ getgrnam32 (const char *name) return getgr_cp (tempgr); } =20 -#ifdef __x86_64__ EXPORT_ALIAS (getgrnam32, getgrnam) -#else -extern "C" struct __group16 * -getgrnam (const char *name) -{ - static struct __group16 g16; /* FIXME: thread-safe? */ - - return grp32togrp16 (&g16, getgrnam32 (name)); -} -#endif =20 /* getgrent functions are not reentrant. */ static gr_ent grent; @@ -502,17 +464,7 @@ getgrent32 (void) return grent.getgrent (); } =20 -#ifdef __x86_64__ EXPORT_ALIAS (getgrent32, getgrent) -#else -extern "C" struct __group16 * -getgrent () -{ - static struct __group16 g16; /* FIXME: thread-safe? */ - - return grp32togrp16 (&g16, getgrent32 ()); -} -#endif =20 extern "C" void endgrent (void) @@ -701,31 +653,7 @@ getgroups32 (int gidsetsize, gid_t *grouplist) return internal_getgroups (gidsetsize, grouplist, &cldap); } =20 -#ifdef __x86_64__ EXPORT_ALIAS (getgroups32, getgroups) -#else -extern "C" int -getgroups (int gidsetsize, __gid16_t *grouplist) -{ - gid_t *grouplist32 =3D NULL; - - if (gidsetsize < 0) - { - set_errno (EINVAL); - return -1; - } - if (gidsetsize > 0 && grouplist) - grouplist32 =3D (gid_t *) alloca (gidsetsize * sizeof (gid_t)); - - int ret =3D getgroups32 (gidsetsize, grouplist32); - - if (gidsetsize > 0 && grouplist) - for (int i =3D 0; i < ret; ++ i) - grouplist[i] =3D grouplist32[i]; - - return ret; -} -#endif =20 /* Core functionality of initgroups and getgrouplist. */ static void @@ -759,15 +687,7 @@ initgroups32 (const char *user, gid_t gid) return 0; } =20 -#ifdef __x86_64__ EXPORT_ALIAS (initgroups32, initgroups) -#else -extern "C" int -initgroups (const char *user, __gid16_t gid) -{ - return initgroups32 (user, gid16togid32(gid)); -} -#endif =20 extern "C" int getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups) @@ -837,22 +757,4 @@ setgroups32 (int ngroups, const gid_t *grouplist) return 0; } =20 -#ifdef __i386__ -extern "C" int -setgroups (int ngroups, const __gid16_t *grouplist) -{ - gid_t *grouplist32 =3D NULL; - - if (ngroups > 0 && grouplist) - { - grouplist32 =3D (gid_t *) alloca (ngroups * sizeof (gid_t)); - if (grouplist32 =3D=3D NULL) - return -1; - for (int i =3D 0; i < ngroups; i++) - grouplist32[i] =3D grouplist[i]; - } - return setgroups32 (ngroups, grouplist32); -} -#else EXPORT_ALIAS (setgroups32, setgroups) -#endif diff --git a/winsup/cygwin/include/cygwin/grp.h b/winsup/cygwin/include/cyg= win/grp.h index 6efa29fc2..ea253e936 100644 --- a/winsup/cygwin/include/cygwin/grp.h +++ b/winsup/cygwin/include/cygwin/grp.h @@ -17,16 +17,6 @@ extern "C" { #endif =20 #ifdef __INSIDE_CYGWIN__ -#ifdef __i386__ -struct __group16 -{ - char *gr_name; - char *gr_passwd; - __gid16_t gr_gid; - char **gr_mem; -}; -#endif - struct group * getgrgid32 (gid_t gid); struct group * getgrnam32 (const char *name); gid_t getgid32 (); diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cy= gwin/stat.h index 153052910..b890f61a1 100644 --- a/winsup/cygwin/include/cygwin/stat.h +++ b/winsup/cygwin/include/cygwin/stat.h @@ -33,25 +33,6 @@ struct stat }; =20 #if defined (__INSIDE_CYGWIN__) || defined (_LIBC) -#ifdef __i386__ -struct __stat32 -{ - __dev16_t st_dev; - __ino32_t st_ino; - mode_t st_mode; - nlink_t st_nlink; - __uid16_t st_uid; - __gid16_t st_gid; - __dev16_t st_rdev; - _off_t st_size; - timestruc_t st_atim; - timestruc_t st_mtim; - timestruc_t st_ctim; - blksize_t st_blksize; - __blkcnt32_t st_blocks; - long st_spare4[2]; -}; -#endif =20 extern int fstat64 (int fd, struct stat *buf); extern int stat64 (const char *__restrict file_name, diff --git a/winsup/cygwin/include/machine/_types.h b/winsup/cygwin/include= /machine/_types.h index cc4c9b343..a8807c4b7 100644 --- a/winsup/cygwin/include/machine/_types.h +++ b/winsup/cygwin/include/machine/_types.h @@ -5,14 +5,6 @@ =20 #include =20 -#if defined (__INSIDE_CYGWIN__) || defined (_LIBC) -typedef __int32_t __blkcnt32_t; -typedef __int16_t __dev16_t; -typedef __uint16_t __uid16_t; -typedef __uint16_t __gid16_t; -typedef __uint32_t __ino32_t; -#endif - #define __machine_blkcnt_t_defined typedef __int64_t __blkcnt_t; =20 diff --git a/winsup/cygwin/include/machine/types.h b/winsup/cygwin/include/= machine/types.h index 54b4acf0a..a752bc1b9 100644 --- a/winsup/cygwin/include/machine/types.h +++ b/winsup/cygwin/include/machine/types.h @@ -32,17 +32,6 @@ typedef struct timespec timestruc_t; =20 typedef __loff_t loff_t; =20 -#if defined (__INSIDE_CYGWIN__) && !defined (__x86_64__) -struct __flock32 { - short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ - short l_whence; /* flag to choose starting offset */ - _off_t l_start; /* relative offset, in bytes */ - _off_t l_len; /* length, in bytes; 0 means lock to EOF */ - short l_pid; /* returned with F_GETLK */ - short l_xxx; /* reserved for future use */ -}; -#endif - struct flock { short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ short l_whence; /* flag to choose starting offset */ diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys= /cygwin.h index c9d4599a3..0c3c2d65d 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -400,10 +400,8 @@ extern void cygwin_premain3 (int, char **, struct per_= process *); #define EXTERNAL_PINFO_VERSION_32_LP 2 #define EXTERNAL_PINFO_VERSION EXTERNAL_PINFO_VERSION_32_LP =20 -#ifndef __INSIDE_CYGWIN__ typedef __uint16_t __uid16_t; typedef __uint16_t __gid16_t; -#endif =20 struct external_pinfo { diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index b38ffc39e..d8f5cf046 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1145,15 +1145,7 @@ out: return ret; } =20 -#ifdef __i386__ -extern "C" void * -mmap (void *addr, size_t len, int prot, int flags, int fd, _off_t off) -{ - return mmap64 (addr, len, prot, flags, fd, (off_t)off); -} -#else EXPORT_ALIAS (mmap64, mmap) -#endif =20 /* munmap () removes all mmapped pages between addr and addr+len. */ =20 diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 1d6757b37..1e4c5bab5 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -225,15 +225,7 @@ getpwuid32 (uid_t uid) return getpw_cp (temppw); } =20 -#ifdef __i386__ -extern "C" struct passwd * -getpwuid (__uid16_t uid) -{ - return getpwuid32 (uid16touid32 (uid)); -} -#else EXPORT_ALIAS (getpwuid32, getpwuid) -#endif =20 extern "C" int getpwuid_r32 (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize,= struct passwd **result) @@ -268,15 +260,7 @@ getpwuid_r32 (uid_t uid, struct passwd *pwd, char *buf= fer, size_t bufsize, struc return 0; } =20 -#ifdef __x86_64__ EXPORT_ALIAS (getpwuid_r32, getpwuid_r) -#else -extern "C" int -getpwuid_r (__uid16_t uid, struct passwd *pwd, char *buffer, size_t bufsiz= e, struct passwd **result) -{ - return getpwuid_r32 (uid16touid32 (uid), pwd, buffer, bufsize, result); -} -#endif =20 extern "C" struct passwd * getpwnam (const char *name) @@ -754,14 +738,6 @@ endpwent_filtered (void *pw) ((pw_ent *) pw)->endpwent (); } =20 -#ifdef __i386__ -extern "C" struct passwd * -getpwduid (__uid16_t) -{ - return NULL; -} -#endif - extern "C" int setpassent (int) { diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index 32edf0d32..a65d4a2b0 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -1228,16 +1228,6 @@ acl32 (const char *path, int cmd, int nentries, acle= nt_t *aclbufp) return res; } =20 -#ifdef __i386__ -extern "C" int -lacl32 (const char *path, int cmd, int nentries, aclent_t *aclbufp) -{ - /* This call was an accident. Make it absolutely clear. */ - set_errno (ENOSYS); - return -1; -} -#endif - extern "C" int facl32 (int fd, int cmd, int nentries, aclent_t *aclbufp) { @@ -1975,93 +1965,6 @@ aclfromtext32 (char *acltextp, int *aclcnt) return (aclent_t *) __aclfromtext (acltextp, aclcnt, false); } =20 -#ifdef __i386__ -typedef struct __acl16 { - int a_type; - __uid16_t a_id; - mode_t a_perm; -} __aclent16_t; - -/* __aclent16_t and aclent_t have same size and same member offsets */ -static aclent_t * -acl16to32 (__aclent16_t *aclbufp, int nentries) -{ - aclent_t *aclbufp32 =3D (aclent_t *) aclbufp; - if (aclbufp32) - for (int i =3D 0; i < nentries; i++) - aclbufp32[i].a_id &=3D USHRT_MAX; - return aclbufp32; -} - -extern "C" int -acl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp) -{ - return acl32 (path, cmd, nentries, acl16to32 (aclbufp, nentries)); -} - -extern "C" int -facl (int fd, int cmd, int nentries, __aclent16_t *aclbufp) -{ - return facl32 (fd, cmd, nentries, acl16to32 (aclbufp, nentries)); -} - -extern "C" int -lacl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp) -{ - /* This call was an accident. Make it absolutely clear. */ - set_errno (ENOSYS); - return -1; -} - -extern "C" int -aclcheck (__aclent16_t *aclbufp, int nentries, int *which) -{ - return aclcheck32 (acl16to32 (aclbufp, nentries), nentries, which); -} - -extern "C" int -aclsort (int nentries, int i, __aclent16_t *aclbufp) -{ - return aclsort32 (nentries, i, acl16to32 (aclbufp, nentries)); -} - - -extern "C" int -acltomode (__aclent16_t *aclbufp, int nentries, mode_t *modep) -{ - return acltomode32 (acl16to32 (aclbufp, nentries), nentries, modep); -} - -extern "C" int -aclfrommode (__aclent16_t *aclbufp, int nentries, mode_t *modep) -{ - return aclfrommode32 ((aclent_t *)aclbufp, nentries, modep); -} - -extern "C" int -acltopbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp) -{ - return acltopbits32 (acl16to32 (aclbufp, nentries), nentries, pbitsp); -} - -extern "C" int -aclfrompbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp) -{ - return aclfrompbits32 ((aclent_t *)aclbufp, nentries, pbitsp); -} - -extern "C" char * -acltotext (__aclent16_t *aclbufp, int aclcnt) -{ - return acltotext32 (acl16to32 (aclbufp, aclcnt), aclcnt); -} - -extern "C" __aclent16_t * -aclfromtext (char *acltextp, int *aclcnt) -{ - return (__aclent16_t *) aclfromtext32 (acltextp, aclcnt); -} -#else EXPORT_ALIAS (acl32, acl) EXPORT_ALIAS (facl32, facl) EXPORT_ALIAS (aclcheck32, aclcheck) @@ -2072,4 +1975,3 @@ EXPORT_ALIAS (acltopbits32, acltopbits) EXPORT_ALIAS (aclfrompbits32, aclfrompbits) EXPORT_ALIAS (acltotext32, acltotext) EXPORT_ALIAS (aclfromtext32, aclfromtext) -#endif diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index 651f6d0e8..f5ac1a922 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -45,13 +45,6 @@ bool check_token_membership (PSID); #define MAP_UNIX_TO_CYGWIN_ID(id) (UNIX_POSIX_OFFSET \ | ((id) & UNIX_POSIX_MASK)) =20 -#ifdef __i386__ -#define ILLEGAL_UID16 ((__uid16_t)-1) -#define ILLEGAL_GID16 ((__gid16_t)-1) -#define uid16touid32(u16) ((u16)=3D=3DILLEGAL_UID16?ILLEGAL_UID:(uid_t)(u= 16)) -#define gid16togid32(g16) ((g16)=3D=3DILLEGAL_GID16?ILLEGAL_GID:(gid_t)(g= 16)) -#endif - #define MAX_DACL_LEN(n) (sizeof (ACL) \ + (n) * (sizeof (ACCESS_ALLOWED_ACE) - sizeof (DWORD) \ + SECURITY_MAX_SID_SIZE)) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 344d1d329..bd4910690 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1625,19 +1625,8 @@ lseek64 (int fd, off_t pos, int dir) } =20 EXPORT_ALIAS (lseek64, _lseek64) - -#ifdef __i386__ -extern "C" _off_t -lseek (int fd, _off_t pos, int dir) -{ - return lseek64 (fd, (off_t) pos, dir); -} -EXPORT_ALIAS (lseek, _lseek) -#else EXPORT_ALIAS (lseek64, lseek) EXPORT_ALIAS (lseek64, _lseek) -#endif - =20 extern "C" int close (int fd) @@ -1742,16 +1731,7 @@ chown32 (const char * name, uid_t uid, gid_t gid) return chown_worker (name, PC_SYM_FOLLOW, uid, gid); } =20 -#ifdef __i386__ -extern "C" int -chown (const char * name, __uid16_t uid, __gid16_t gid) -{ - return chown_worker (name, PC_SYM_FOLLOW, - uid16touid32 (uid), gid16togid32 (gid)); -} -#else EXPORT_ALIAS (chown32, chown) -#endif =20 extern "C" int lchown32 (const char * name, uid_t uid, gid_t gid) @@ -1759,16 +1739,7 @@ lchown32 (const char * name, uid_t uid, gid_t gid) return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid); } =20 -#ifdef __i386__ -extern "C" int -lchown (const char * name, __uid16_t uid, __gid16_t gid) -{ - return chown_worker (name, PC_SYM_NOFOLLOW, - uid16touid32 (uid), gid16togid32 (gid)); -} -#else EXPORT_ALIAS (lchown32, lchown) -#endif =20 extern "C" int fchown32 (int fd, uid_t uid, gid_t gid) @@ -1791,15 +1762,7 @@ fchown32 (int fd, uid_t uid, gid_t gid) return res; } =20 -#ifdef __i386__ -extern "C" int -fchown (int fd, __uid16_t uid, __gid16_t gid) -{ - return fchown32 (fd, uid16touid32 (uid), gid16togid32 (gid)); -} -#else EXPORT_ALIAS (fchown32, fchown) -#endif =20 /* umask: POSIX 5.3.3.1 */ extern "C" mode_t @@ -1865,26 +1828,6 @@ fchmod (int fd, mode_t mode) return cfd->fchmod (FILTERED_MODE (mode)); } =20 -#ifdef __i386__ -static void -stat64_to_stat32 (struct stat *src, struct __stat32 *dst) -{ - dst->st_dev =3D ((src->st_dev >> 8) & 0xff00) | (src->st_dev & 0xff); - dst->st_ino =3D ((unsigned) (src->st_ino >> 32)) | (unsigned) src->st_in= o; - dst->st_mode =3D src->st_mode; - dst->st_nlink =3D src->st_nlink; - dst->st_uid =3D src->st_uid; - dst->st_gid =3D src->st_gid; - dst->st_rdev =3D ((src->st_rdev >> 8) & 0xff00) | (src->st_rdev & 0xff); - dst->st_size =3D src->st_size; - dst->st_atim =3D src->st_atim; - dst->st_mtim =3D src->st_mtim; - dst->st_ctim =3D src->st_ctim; - dst->st_blksize =3D src->st_blksize; - dst->st_blocks =3D src->st_blocks; -} -#endif - static struct stat dev_st; static bool dev_st_inited; =20 @@ -1968,33 +1911,8 @@ _fstat64_r (struct _reent *ptr, int fd, struct stat = *buf) return ret; } =20 -#ifdef __i386__ -/* This entry point is retained only to serve old 32 bit applications -built under Cygwin 1.3.x or earlier. Newer 32 bit apps are redirected -to fstat64; see NEW_FUNCTIONS in Makefile.in. */ -extern "C" int -fstat (int fd, struct stat *buf) -{ - struct stat buf64; - int ret =3D fstat64 (fd, &buf64); - if (!ret) - stat64_to_stat32 (&buf64, (struct __stat32 *) buf); - return ret; -} - -extern "C" int -_fstat_r (struct _reent *ptr, int fd, struct stat *buf) -{ - int ret; - - if ((ret =3D fstat (fd, buf)) =3D=3D -1) - ptr->_errno =3D get_errno (); - return ret; -} -#else EXPORT_ALIAS (fstat64, fstat) EXPORT_ALIAS (_fstat64_r, _fstat_r) -#endif =20 /* fsync: P96 6.6.1.1 */ extern "C" int @@ -2145,31 +2063,8 @@ _stat64_r (struct _reent *__restrict ptr, const char= *__restrict name, return ret; } =20 -#ifdef __i386__ -extern "C" int -stat (const char *__restrict name, struct stat *__restrict buf) -{ - struct stat buf64; - int ret =3D stat64 (name, &buf64); - if (!ret) - stat64_to_stat32 (&buf64, (struct __stat32 *) buf); - return ret; -} - -extern "C" int -_stat_r (struct _reent *__restrict ptr, const char *__restrict name, - struct stat *__restrict buf) -{ - int ret; - - if ((ret =3D stat (name, buf)) =3D=3D -1) - ptr->_errno =3D get_errno (); - return ret; -} -#else EXPORT_ALIAS (stat64, stat) EXPORT_ALIAS (_stat64_r, _stat_r) -#endif =20 /* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ extern "C" int @@ -2181,20 +2076,7 @@ lstat64 (const char *__restrict name, struct stat *_= _restrict buf) return stat_worker (pc, buf); } =20 -#ifdef __i386__ -/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ -extern "C" int -lstat (const char *__restrict name, struct stat *__restrict buf) -{ - struct stat buf64; - int ret =3D lstat64 (name, &buf64); - if (!ret) - stat64_to_stat32 (&buf64, (struct __stat32 *) buf); - return ret; -} -#else EXPORT_ALIAS (lstat64, lstat) -#endif =20 extern "C" int access (const char *fn, int flags) @@ -3192,16 +3074,7 @@ ftruncate64 (int fd, off_t length) return res; } =20 -#ifdef __i386__ -/* ftruncate: P96 5.6.7.1 */ -extern "C" int -ftruncate (int fd, _off_t length) -{ - return ftruncate64 (fd, (off_t)length); -} -#else EXPORT_ALIAS (ftruncate64, ftruncate) -#endif =20 /* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ extern "C" int @@ -3222,16 +3095,7 @@ truncate64 (const char *pathname, off_t length) return res; } =20 -#ifdef __i386__ -/* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ -extern "C" int -truncate (const char *pathname, _off_t length) -{ - return truncate64 (pathname, (off_t)length); -} -#else EXPORT_ALIAS (truncate64, truncate) -#endif =20 extern "C" long _get_osfhandle (int fd) @@ -3490,15 +3354,7 @@ mknod32 (const char *path, mode_t mode, dev_t dev) return -1; } =20 -#ifdef __i386__ -extern "C" int -mknod (const char *_path, mode_t mode, __dev16_t dev) -{ - return mknod32 (_path, mode, (dev_t) dev); -} -#else EXPORT_ALIAS (mknod32, mknod) -#endif =20 extern "C" int mkfifo (const char *path, mode_t mode) @@ -3712,15 +3568,7 @@ seteuid32 (uid_t uid) return 0; } =20 -#ifdef __i386__ -extern "C" int -seteuid (__uid16_t uid) -{ - return seteuid32 (uid16touid32 (uid)); -} -#else EXPORT_ALIAS (seteuid32, seteuid) -#endif =20 /* setuid: POSIX 4.2.2.1 */ extern "C" int @@ -3737,15 +3585,7 @@ setuid32 (uid_t uid) return ret; } =20 -#ifdef __i386__ -extern "C" int -setuid (__uid16_t uid) -{ - return setuid32 (uid16touid32 (uid)); -} -#else EXPORT_ALIAS (setuid32, setuid) -#endif =20 extern "C" int setreuid32 (uid_t ruid, uid_t euid) @@ -3766,15 +3606,7 @@ setreuid32 (uid_t ruid, uid_t euid) return ret; } =20 -#ifdef __i386__ -extern "C" int -setreuid (__uid16_t ruid, __uid16_t euid) -{ - return setreuid32 (uid16touid32 (ruid), uid16touid32 (euid)); -} -#else EXPORT_ALIAS (setreuid32, setreuid) -#endif =20 /* setegid: from System V. */ extern "C" int @@ -3826,15 +3658,7 @@ setegid32 (gid_t gid) return 0; } =20 -#ifdef __i386__ -extern "C" int -setegid (__gid16_t gid) -{ - return setegid32 (gid16togid32 (gid)); -} -#else EXPORT_ALIAS (setegid32, setegid) -#endif =20 /* setgid: POSIX 4.2.2.1 */ extern "C" int @@ -3846,18 +3670,7 @@ setgid32 (gid_t gid) return ret; } =20 -#ifdef __i386__ -extern "C" int -setgid (__gid16_t gid) -{ - int ret =3D setegid32 (gid16togid32 (gid)); - if (!ret) - cygheap->user.real_gid =3D myself->gid; - return ret; -} -#else EXPORT_ALIAS (setgid32, setgid) -#endif =20 extern "C" int setregid32 (gid_t rgid, gid_t egid) @@ -3878,15 +3691,7 @@ setregid32 (gid_t rgid, gid_t egid) return ret; } =20 -#ifdef __i386__ -extern "C" int -setregid (__gid16_t rgid, __gid16_t egid) -{ - return setregid32 (gid16togid32 (rgid), gid16togid32 (egid)); -} -#else EXPORT_ALIAS (setregid32, setregid) -#endif =20 /* chroot: privileged Unix system call. */ /* FIXME: Not privileged here. How should this be done? */ diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 6173b0324..f5d5093d3 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -284,15 +284,7 @@ getuid32 (void) return cygheap->user.real_uid; } =20 -#ifdef __i386__ -extern "C" __uid16_t -getuid (void) -{ - return cygheap->user.real_uid; -} -#else EXPORT_ALIAS (getuid32, getuid) -#endif =20 extern "C" gid_t getgid32 (void) @@ -300,15 +292,7 @@ getgid32 (void) return cygheap->user.real_gid; } =20 -#ifdef __i386__ -extern "C" __gid16_t -getgid (void) -{ - return cygheap->user.real_gid; -} -#else EXPORT_ALIAS (getgid32, getgid) -#endif =20 extern "C" uid_t geteuid32 (void) @@ -316,15 +300,7 @@ geteuid32 (void) return myself->uid; } =20 -#ifdef __i386__ -extern "C" uid_t -geteuid (void) -{ - return myself->uid; -} -#else EXPORT_ALIAS (geteuid32, geteuid) -#endif =20 extern "C" gid_t getegid32 (void) @@ -332,15 +308,7 @@ getegid32 (void) return myself->gid; } =20 -#ifdef __i386__ -extern "C" __gid16_t -getegid (void) -{ - return myself->gid; -} -#else EXPORT_ALIAS (getegid32, getegid) -#endif =20 /* Not quite right - cuserid can change, getlogin can't */ extern "C" char *