Cygwin: remove some 32-bit-only function definitions
Remove the definitions of the following: acl, aclcheck, aclfrommode, aclfrompbits, aclfromtext, aclsort, acltomode, acltopbits, acltotext, chown, fchown, _fcntl, fstat, _fstat_r, ftruncate, getegid, geteuid, getgid, 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. [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.] Remove the following structs and all code using them (which is 32-bit only): __stat32, __group16, __flock32, __aclent16_t. Remove the typedefs of __blkcnt32_t __dev16_t, __ino32_t, which are used only in code that has been removed. 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.
This commit is contained in:
parent
98180795de
commit
7c0de0af97
|
@ -79,46 +79,5 @@ fcntl64 (int fd, int cmd, ...)
|
|||
return res;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
_fcntl (int fd, int cmd, ...)
|
||||
{
|
||||
intptr_t arg = 0;
|
||||
va_list args;
|
||||
struct __flock32 *src = NULL;
|
||||
struct flock dst;
|
||||
|
||||
__try
|
||||
{
|
||||
va_start (args, cmd);
|
||||
arg = va_arg (args, intptr_t);
|
||||
va_end (args);
|
||||
if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW)
|
||||
{
|
||||
src = (struct __flock32 *) arg;
|
||||
dst.l_type = src->l_type;
|
||||
dst.l_whence = src->l_whence;
|
||||
dst.l_start = src->l_start;
|
||||
dst.l_len = src->l_len;
|
||||
dst.l_pid = src->l_pid;
|
||||
arg = (intptr_t) &dst;
|
||||
}
|
||||
int res = fcntl64 (fd, cmd, arg);
|
||||
if (cmd == F_GETLK)
|
||||
{
|
||||
src->l_type = dst.l_type;
|
||||
src->l_whence = dst.l_whence;
|
||||
src->l_start = dst.l_start;
|
||||
src->l_len = dst.l_len;
|
||||
src->l_pid = (short) dst.l_pid;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
__except (EFAULT)
|
||||
__endtry
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (fcntl64, fcntl)
|
||||
EXPORT_ALIAS (fcntl64, _fcntl)
|
||||
#endif
|
||||
|
|
|
@ -855,38 +855,7 @@ g_opendir(Char *str, glob_t *pglob)
|
|||
return(opendir(buf));
|
||||
}
|
||||
|
||||
#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 = src->st_dev;
|
||||
dst->st_ino = src->st_ino;
|
||||
dst->st_mode = src->st_mode;
|
||||
dst->st_nlink = src->st_nlink;
|
||||
dst->st_uid = src->st_uid;
|
||||
dst->st_gid = src->st_gid;
|
||||
dst->st_rdev = src->st_rdev;
|
||||
dst->st_size = src->st_size;
|
||||
dst->st_atim = src->st_atim;
|
||||
dst->st_mtim = src->st_mtim;
|
||||
dst->st_ctim = src->st_ctim;
|
||||
dst->st_birthtim = src->st_mtim;
|
||||
dst->st_blksize = src->st_blksize;
|
||||
dst->st_blocks = src->st_blocks;
|
||||
}
|
||||
|
||||
#define CYGWIN_gl_stat(sfptr) \
|
||||
({ int ret; \
|
||||
struct __stat32 lsb; \
|
||||
if (CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES) \
|
||||
ret = (*pglob->sfptr) (buf, sb); \
|
||||
else if (!(ret = (*pglob->sfptr) (buf, (struct stat *) &lsb))) \
|
||||
stat32_to_stat64 (&lsb, sb); \
|
||||
ret; \
|
||||
})
|
||||
#endif
|
||||
|
||||
static int
|
||||
g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
|
||||
|
|
|
@ -237,24 +237,6 @@ internal_getgrgid (gid_t gid, cyg_ldap *pldap)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#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 = gp32->gr_name;
|
||||
gp16->gr_passwd = gp32->gr_passwd;
|
||||
gp16->gr_gid = (__gid16_t) gp32->gr_gid; /* Not loss-free */
|
||||
gp16->gr_mem = 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);
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* getgrent functions are not reentrant. */
|
||||
static gr_ent grent;
|
||||
|
@ -502,17 +464,7 @@ getgrent32 (void)
|
|||
return grent.getgrent ();
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
extern "C" void
|
||||
endgrent (void)
|
||||
|
@ -701,31 +653,7 @@ getgroups32 (int gidsetsize, gid_t *grouplist)
|
|||
return internal_getgroups (gidsetsize, grouplist, &cldap);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
EXPORT_ALIAS (getgroups32, getgroups)
|
||||
#else
|
||||
extern "C" int
|
||||
getgroups (int gidsetsize, __gid16_t *grouplist)
|
||||
{
|
||||
gid_t *grouplist32 = NULL;
|
||||
|
||||
if (gidsetsize < 0)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
if (gidsetsize > 0 && grouplist)
|
||||
grouplist32 = (gid_t *) alloca (gidsetsize * sizeof (gid_t));
|
||||
|
||||
int ret = getgroups32 (gidsetsize, grouplist32);
|
||||
|
||||
if (gidsetsize > 0 && grouplist)
|
||||
for (int i = 0; i < ret; ++ i)
|
||||
grouplist[i] = grouplist32[i];
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Core functionality of initgroups and getgrouplist. */
|
||||
static void
|
||||
|
@ -759,15 +687,7 @@ initgroups32 (const char *user, gid_t gid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
EXPORT_ALIAS (initgroups32, initgroups)
|
||||
#else
|
||||
extern "C" int
|
||||
initgroups (const char *user, __gid16_t gid)
|
||||
{
|
||||
return initgroups32 (user, gid16togid32(gid));
|
||||
}
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
setgroups (int ngroups, const __gid16_t *grouplist)
|
||||
{
|
||||
gid_t *grouplist32 = NULL;
|
||||
|
||||
if (ngroups > 0 && grouplist)
|
||||
{
|
||||
grouplist32 = (gid_t *) alloca (ngroups * sizeof (gid_t));
|
||||
if (grouplist32 == NULL)
|
||||
return -1;
|
||||
for (int i = 0; i < ngroups; i++)
|
||||
grouplist32[i] = grouplist[i];
|
||||
}
|
||||
return setgroups32 (ngroups, grouplist32);
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (setgroups32, setgroups)
|
||||
#endif
|
||||
|
|
|
@ -17,16 +17,6 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#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 ();
|
||||
|
|
|
@ -33,25 +33,6 @@ struct stat
|
|||
};
|
||||
|
||||
#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
|
||||
|
||||
extern int fstat64 (int fd, struct stat *buf);
|
||||
extern int stat64 (const char *__restrict file_name,
|
||||
|
|
|
@ -5,14 +5,6 @@
|
|||
|
||||
#include <machine/_default_types.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
|
|
@ -32,17 +32,6 @@ typedef struct timespec timestruc_t;
|
|||
|
||||
typedef __loff_t loff_t;
|
||||
|
||||
#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 */
|
||||
|
|
|
@ -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
|
||||
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
typedef __uint16_t __uid16_t;
|
||||
typedef __uint16_t __gid16_t;
|
||||
#endif
|
||||
|
||||
struct external_pinfo
|
||||
{
|
||||
|
|
|
@ -1145,15 +1145,7 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* munmap () removes all mmapped pages between addr and addr+len. */
|
||||
|
||||
|
|
|
@ -225,15 +225,7 @@ getpwuid32 (uid_t uid)
|
|||
return getpw_cp (temppw);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" struct passwd *
|
||||
getpwuid (__uid16_t uid)
|
||||
{
|
||||
return getpwuid32 (uid16touid32 (uid));
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (getpwuid32, getpwuid)
|
||||
#endif
|
||||
|
||||
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 *buffer, size_t bufsize, struc
|
|||
return 0;
|
||||
}
|
||||
|
||||
#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 bufsize, struct passwd **result)
|
||||
{
|
||||
return getpwuid_r32 (uid16touid32 (uid), pwd, buffer, bufsize, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" struct passwd *
|
||||
getpwnam (const char *name)
|
||||
|
@ -754,14 +738,6 @@ endpwent_filtered (void *pw)
|
|||
((pw_ent *) pw)->endpwent ();
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" struct passwd *
|
||||
getpwduid (__uid16_t)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" int
|
||||
setpassent (int)
|
||||
{
|
||||
|
|
|
@ -1228,16 +1228,6 @@ acl32 (const char *path, int cmd, int nentries, aclent_t *aclbufp)
|
|||
return res;
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
#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 = (aclent_t *) aclbufp;
|
||||
if (aclbufp32)
|
||||
for (int i = 0; i < nentries; i++)
|
||||
aclbufp32[i].a_id &= 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
|
||||
|
|
|
@ -45,13 +45,6 @@ bool check_token_membership (PSID);
|
|||
#define MAP_UNIX_TO_CYGWIN_ID(id) (UNIX_POSIX_OFFSET \
|
||||
| ((id) & UNIX_POSIX_MASK))
|
||||
|
||||
#ifdef __i386__
|
||||
#define ILLEGAL_UID16 ((__uid16_t)-1)
|
||||
#define ILLEGAL_GID16 ((__gid16_t)-1)
|
||||
#define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(uid_t)(u16))
|
||||
#define gid16togid32(g16) ((g16)==ILLEGAL_GID16?ILLEGAL_GID:(gid_t)(g16))
|
||||
#endif
|
||||
|
||||
#define MAX_DACL_LEN(n) (sizeof (ACL) \
|
||||
+ (n) * (sizeof (ACCESS_ALLOWED_ACE) - sizeof (DWORD) \
|
||||
+ SECURITY_MAX_SID_SIZE))
|
||||
|
|
|
@ -1625,19 +1625,8 @@ lseek64 (int fd, off_t pos, int dir)
|
|||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* 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));
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
static void
|
||||
stat64_to_stat32 (struct stat *src, struct __stat32 *dst)
|
||||
{
|
||||
dst->st_dev = ((src->st_dev >> 8) & 0xff00) | (src->st_dev & 0xff);
|
||||
dst->st_ino = ((unsigned) (src->st_ino >> 32)) | (unsigned) src->st_ino;
|
||||
dst->st_mode = src->st_mode;
|
||||
dst->st_nlink = src->st_nlink;
|
||||
dst->st_uid = src->st_uid;
|
||||
dst->st_gid = src->st_gid;
|
||||
dst->st_rdev = ((src->st_rdev >> 8) & 0xff00) | (src->st_rdev & 0xff);
|
||||
dst->st_size = src->st_size;
|
||||
dst->st_atim = src->st_atim;
|
||||
dst->st_mtim = src->st_mtim;
|
||||
dst->st_ctim = src->st_ctim;
|
||||
dst->st_blksize = src->st_blksize;
|
||||
dst->st_blocks = src->st_blocks;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct stat dev_st;
|
||||
static bool dev_st_inited;
|
||||
|
||||
|
@ -1968,33 +1911,8 @@ _fstat64_r (struct _reent *ptr, int fd, struct stat *buf)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#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 = 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 = fstat (fd, buf)) == -1)
|
||||
ptr->_errno = get_errno ();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (fstat64, fstat)
|
||||
EXPORT_ALIAS (_fstat64_r, _fstat_r)
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
stat (const char *__restrict name, struct stat *__restrict buf)
|
||||
{
|
||||
struct stat buf64;
|
||||
int ret = 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 = stat (name, buf)) == -1)
|
||||
ptr->_errno = get_errno ();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (stat64, stat)
|
||||
EXPORT_ALIAS (_stat64_r, _stat_r)
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
#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 = lstat64 (name, &buf64);
|
||||
if (!ret)
|
||||
stat64_to_stat32 (&buf64, (struct __stat32 *) buf);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (lstat64, lstat)
|
||||
#endif
|
||||
|
||||
extern "C" int
|
||||
access (const char *fn, int flags)
|
||||
|
@ -3192,16 +3074,7 @@ ftruncate64 (int fd, off_t length)
|
|||
return res;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
extern "C" long
|
||||
_get_osfhandle (int fd)
|
||||
|
@ -3490,15 +3354,7 @@ mknod32 (const char *path, mode_t mode, dev_t dev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
extern "C" int
|
||||
mkfifo (const char *path, mode_t mode)
|
||||
|
@ -3712,15 +3568,7 @@ seteuid32 (uid_t uid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
seteuid (__uid16_t uid)
|
||||
{
|
||||
return seteuid32 (uid16touid32 (uid));
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (seteuid32, seteuid)
|
||||
#endif
|
||||
|
||||
/* setuid: POSIX 4.2.2.1 */
|
||||
extern "C" int
|
||||
|
@ -3737,15 +3585,7 @@ setuid32 (uid_t uid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
setuid (__uid16_t uid)
|
||||
{
|
||||
return setuid32 (uid16touid32 (uid));
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (setuid32, setuid)
|
||||
#endif
|
||||
|
||||
extern "C" int
|
||||
setreuid32 (uid_t ruid, uid_t euid)
|
||||
|
@ -3766,15 +3606,7 @@ setreuid32 (uid_t ruid, uid_t euid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
setreuid (__uid16_t ruid, __uid16_t euid)
|
||||
{
|
||||
return setreuid32 (uid16touid32 (ruid), uid16touid32 (euid));
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (setreuid32, setreuid)
|
||||
#endif
|
||||
|
||||
/* setegid: from System V. */
|
||||
extern "C" int
|
||||
|
@ -3826,15 +3658,7 @@ setegid32 (gid_t gid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
setegid (__gid16_t gid)
|
||||
{
|
||||
return setegid32 (gid16togid32 (gid));
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (setegid32, setegid)
|
||||
#endif
|
||||
|
||||
/* setgid: POSIX 4.2.2.1 */
|
||||
extern "C" int
|
||||
|
@ -3846,18 +3670,7 @@ setgid32 (gid_t gid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
setgid (__gid16_t gid)
|
||||
{
|
||||
int ret = setegid32 (gid16togid32 (gid));
|
||||
if (!ret)
|
||||
cygheap->user.real_gid = myself->gid;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (setgid32, setgid)
|
||||
#endif
|
||||
|
||||
extern "C" int
|
||||
setregid32 (gid_t rgid, gid_t egid)
|
||||
|
@ -3878,15 +3691,7 @@ setregid32 (gid_t rgid, gid_t egid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" int
|
||||
setregid (__gid16_t rgid, __gid16_t egid)
|
||||
{
|
||||
return setregid32 (gid16togid32 (rgid), gid16togid32 (egid));
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (setregid32, setregid)
|
||||
#endif
|
||||
|
||||
/* chroot: privileged Unix system call. */
|
||||
/* FIXME: Not privileged here. How should this be done? */
|
||||
|
|
|
@ -284,15 +284,7 @@ getuid32 (void)
|
|||
return cygheap->user.real_uid;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" __uid16_t
|
||||
getuid (void)
|
||||
{
|
||||
return cygheap->user.real_uid;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (getuid32, getuid)
|
||||
#endif
|
||||
|
||||
extern "C" gid_t
|
||||
getgid32 (void)
|
||||
|
@ -300,15 +292,7 @@ getgid32 (void)
|
|||
return cygheap->user.real_gid;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" __gid16_t
|
||||
getgid (void)
|
||||
{
|
||||
return cygheap->user.real_gid;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (getgid32, getgid)
|
||||
#endif
|
||||
|
||||
extern "C" uid_t
|
||||
geteuid32 (void)
|
||||
|
@ -316,15 +300,7 @@ geteuid32 (void)
|
|||
return myself->uid;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" uid_t
|
||||
geteuid (void)
|
||||
{
|
||||
return myself->uid;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (geteuid32, geteuid)
|
||||
#endif
|
||||
|
||||
extern "C" gid_t
|
||||
getegid32 (void)
|
||||
|
@ -332,15 +308,7 @@ getegid32 (void)
|
|||
return myself->gid;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
extern "C" __gid16_t
|
||||
getegid (void)
|
||||
{
|
||||
return myself->gid;
|
||||
}
|
||||
#else
|
||||
EXPORT_ALIAS (getegid32, getegid)
|
||||
#endif
|
||||
|
||||
/* Not quite right - cuserid can change, getlogin can't */
|
||||
extern "C" char *
|
||||
|
|
Loading…
Reference in New Issue