cygwin: convert most #ifndef __x86_64__ to #ifdef __i386__

Address the real offender

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2017-11-27 14:36:06 +01:00
parent bc14f1c174
commit 76f06705be
27 changed files with 140 additions and 140 deletions

View File

@ -401,7 +401,7 @@ __attribute__ ((used, noinline)) static two_addr_t
std_dll_init ()
#endif
{
#ifndef __x86_64__
#ifdef __i386__
struct func_info *func = (struct func_info *) __builtin_return_address (0);
#endif
struct dll_info *dll = func->dll;
@ -453,7 +453,7 @@ std_dll_init ()
InterlockedDecrement (&dll->here);
#ifndef __x86_64__
#ifdef __i386__
/* Kludge alert. Redirects the return address to dll_chain. */
uintptr_t *volatile frame = (uintptr_t *) __builtin_frame_address (0);
frame[1] = (uintptr_t) dll_chain;
@ -480,7 +480,7 @@ wsock_init ()
See the git log for a description. */
static WSADATA NO_COPY wsadata;
static LONG NO_COPY here = -1L;
#ifndef __x86_64__
#ifdef __i386__
struct func_info *func = (struct func_info *) __builtin_return_address (0);
#endif
struct dll_info *dll = func->dll;
@ -514,7 +514,7 @@ wsock_init ()
}
}
#ifndef __x86_64__
#ifdef __i386__
/* Kludge alert. Redirects the return address to dll_chain. */
uintptr_t *volatile frame = (uintptr_t *) __builtin_frame_address (0);
frame[1] = (uintptr_t) dll_chain;

View File

@ -390,7 +390,7 @@ check_sanity_and_sync (per_process *p)
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %u > %u",
p->api_major, cygwin_version.api_major);
#ifndef __x86_64__
#ifdef __i386__
/* This is a kludge to work around a version of _cygwin_common_crt0
which overwrote the cxx_malloc field with the local DLL copy.
Hilarity ensues if the DLL is not loaded while the process
@ -712,7 +712,7 @@ init_windows_system_directory ()
api_fatal ("can't find windows system directory");
windows_system_directory[windows_system_directory_length++] = L'\\';
windows_system_directory[windows_system_directory_length] = L'\0';
#ifndef __x86_64__
#ifdef __i386__
system_wow64_directory_length =
GetSystemWow64DirectoryW (system_wow64_directory, MAX_PATH);
if (system_wow64_directory_length)
@ -720,7 +720,7 @@ init_windows_system_directory ()
system_wow64_directory[system_wow64_directory_length++] = L'\\';
system_wow64_directory[system_wow64_directory_length] = L'\0';
}
#endif /* !__x86_64__ */
#endif /* __i386__ */
}
}
@ -1103,14 +1103,14 @@ dll_crt0 (per_process *uptr)
extern "C" void
cygwin_dll_init ()
{
#ifndef __x86_64__
#ifdef __i386__
static char **envp;
#endif
static int _fmode;
user_data->magic_biscuit = sizeof (per_process);
#ifndef __x86_64__
#ifdef __i386__
user_data->envptr = &envp;
#endif
user_data->fmode_ptr = &_fmode;

View File

@ -273,7 +273,7 @@ dlopen (const char *name, int flags)
break;
}
#ifndef __x86_64__
#ifdef __i386__
/* Workaround for broken DLLs built against Cygwin versions 1.7.0-49
up to 1.7.0-57. They override the cxx_malloc pointer in their
DLL initialization code even if loaded dynamically. This is a
@ -300,7 +300,7 @@ dlopen (const char *name, int flags)
++d->count;
}
#ifndef __x86_64__
#ifdef __i386__
/* Restore original cxx_malloc pointer. */
__cygwin_user_data.cxx_malloc = tmp_malloc;
#endif

View File

@ -84,7 +84,7 @@ dll::init ()
{
int ret = 1;
#ifndef __x86_64__
#ifdef __i386__
/* This should be a no-op. Why didn't we just import this variable? */
if (!p.envptr)
p.envptr = &__cygwin_environ;
@ -243,7 +243,7 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
loaded_dlls++;
}
guard (false);
#ifndef __x86_64__
#ifdef __i386__
assert (p->envptr != NULL);
#endif
return d;
@ -725,7 +725,7 @@ dll_dllcrt0_1 (VOID *x)
res = (PVOID) d;
}
#ifndef __x86_64__
#ifdef __i386__
/* OBSOLETE: This function is obsolete and will go away in the
future. Cygwin can now handle being loaded from a noncygwin app
using the same entry point. */
@ -734,7 +734,7 @@ dll_noncygwin_dllcrt0 (HMODULE h, per_process *p)
{
return (int) dll_dllcrt0 (h, p);
}
#endif /* !__x86_64__ */
#endif /* __i386__ */
extern "C" void
cygwin_detach_dll (dll *)
@ -753,7 +753,7 @@ dlfork (int val)
dlls.reload_on_fork = val;
}
#ifndef __x86_64__
#ifdef __i386__
/* Called from various places to update all of the individual
ideas of the environ block. Explain to me again why we didn't
just import __cygwin_environ? */

View File

@ -8,7 +8,7 @@ details. */
struct per_module
{
#ifndef __x86_64__
#ifdef __i386__
char ***envptr;
#endif
void (**ctors)(void);
@ -20,7 +20,7 @@ struct per_module
int (*main)(int, char **, char **);
per_module &operator = (per_process *p)
{
#ifndef __x86_64__
#ifdef __i386__
envptr = p->envptr;
#endif
ctors = p->ctors;

View File

@ -1260,7 +1260,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
return newenv;
}
#ifndef __x86_64__
#ifdef __i386__
/* This idiocy is necessary because the early implementers of cygwin
did not seem to know about importing data variables from the DLL.
So, we have to synchronize cygwin's idea of the environment with the

View File

@ -6,7 +6,7 @@ details. */
#pragma once
#ifndef __x86_64__
#ifdef __i386__
/* Documentation on the innards of 32 bit Windows exception handling (i.e.
from the perspective of a compiler implementor) apparently doesn't exist.
However, the following came from Onno Hovers <onno@stack.urc.tue.nl>
@ -123,7 +123,7 @@ public:
~exception () __attribute__ ((always_inline)) { _except_list = save; }
};
#else /* __x86_64__ */
#else /* !__i386__ */
#define exception_list void
typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT;
@ -159,7 +159,7 @@ public:
LONG CALLBACK myfault_altstack_handler (EXCEPTION_POINTERS *);
#endif /* !__x86_64__ */
#endif /* __i386__ */
class cygwin_exception
{

View File

@ -434,7 +434,7 @@ _cygtls::inside_kernel (CONTEXT *cx)
checkdir += 4;
res = wcsncasecmp (windows_system_directory, checkdir,
windows_system_directory_length) == 0;
#ifndef __x86_64__
#ifdef __i386__
if (!res && system_wow64_directory_length)
res = wcsncasecmp (system_wow64_directory, checkdir,
system_wow64_directory_length) == 0;
@ -628,7 +628,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
static int NO_COPY debugging = 0;
_cygtls& me = _my_tls;
#ifndef __x86_64__
#ifdef __i386__
if (me.andreas)
me.andreas->leave (); /* Return from a "san" caught fault */
#endif

View File

@ -242,7 +242,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
break;
case CW_USER_DATA:
#ifndef __x86_64__
#ifdef __i386__
/* This is a kludge to work around a version of _cygwin_common_crt0
which overwrote the cxx_malloc field with the local DLL copy.
Hilarity ensues if the DLL is not loaded like while the process

View File

@ -79,10 +79,7 @@ fcntl64 (int fd, int cmd, ...)
return res;
}
#ifdef __x86_64__
EXPORT_ALIAS (fcntl64, fcntl)
EXPORT_ALIAS (fcntl64, _fcntl)
#else
#ifdef __i386__
extern "C" int
_fcntl (int fd, int cmd, ...)
{
@ -121,4 +118,7 @@ _fcntl (int fd, int cmd, ...)
__endtry
return -1;
}
#else
EXPORT_ALIAS (fcntl64, fcntl)
EXPORT_ALIAS (fcntl64, _fcntl)
#endif

View File

@ -23,10 +23,10 @@ HMODULE NO_COPY hntdll;
int NO_COPY sigExeced;
WCHAR windows_system_directory[MAX_PATH];
UINT windows_system_directory_length;
#ifndef __x86_64__
#ifdef __i386__
WCHAR system_wow64_directory[MAX_PATH];
UINT system_wow64_directory_length;
#endif /* !__x86_64__ */
#endif /* __i386__ */
WCHAR global_progname[NT_MAX_PATH];
/* program exit the program */
@ -154,7 +154,7 @@ const int __collate_load_error = 0;
/* This is an exported copy of environ which can be used by DLLs
which use cygwin.dll. */
char **__cygwin_environ;
#ifndef __x86_64__
#ifdef __i386__
char ***main_environ = &__cygwin_environ;
#endif
/* __progname used in getopt error message */
@ -167,7 +167,7 @@ const int __collate_load_error = 0;
/* dll_major */ CYGWIN_VERSION_DLL_MAJOR,
/* dll_major */ CYGWIN_VERSION_DLL_MINOR,
/* impure_ptr_ptr */ NULL,
#ifndef __x86_64__
#ifdef __i386__
/* envptr */ NULL,
#endif
/* malloc */ malloc, /* free */ free,

View File

@ -237,7 +237,7 @@ internal_getgrgid (gid_t gid, cyg_ldap *pldap)
return NULL;
}
#ifndef __x86_64__
#ifdef __i386__
static struct __group16 *
grp32togrp16 (struct __group16 *gp16, struct group *gp32)
{
@ -837,9 +837,7 @@ setgroups32 (int ngroups, const gid_t *grouplist)
return 0;
}
#ifdef __x86_64__
EXPORT_ALIAS (setgroups32, setgroups)
#else
#ifdef __i386__
extern "C" int
setgroups (int ngroups, const __gid16_t *grouplist)
{
@ -855,4 +853,6 @@ setgroups (int ngroups, const __gid16_t *grouplist)
}
return setgroups32 (ngroups, grouplist32);
}
#else
EXPORT_ALIAS (setgroups32, setgroups)
#endif

View File

@ -391,7 +391,7 @@ typedef struct
uint32_t bsize; /* uninitialized data " " */
uint32_t entry; /* entry pt. */
uint32_t text_start; /* base of text used for this file */
#ifndef __x86_64__
#ifdef __i386__
uint32_t data_start; /* base of all data used for this file */
#endif

View File

@ -17,7 +17,7 @@ extern "C" {
#endif
#ifdef __INSIDE_CYGWIN__
#ifndef __x86_64__
#ifdef __i386__
struct __group16
{
char *gr_name;

View File

@ -33,7 +33,7 @@ struct stat
};
#if defined (__INSIDE_CYGWIN__) || defined (_COMPILING_NEWLIB)
#ifndef __x86_64__
#ifdef __i386__
struct __stat32
{
__dev16_t st_dev;

View File

@ -20,7 +20,7 @@ extern "C" {
#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
#ifndef __x86_64__
#ifdef __i386__
/* DEPRECATED INTERFACES. These are restricted to MAX_PATH length.
Don't use in modern applications. They don't exist on x86_64. */
extern int cygwin_win32_to_posix_path_list (const char *, char *)
@ -39,7 +39,7 @@ extern int cygwin_conv_to_posix_path (const char *, char *)
__attribute__ ((__deprecated__));
extern int cygwin_conv_to_full_posix_path (const char *, char *)
__attribute__ ((__deprecated__));
#endif /* !__x86_64__ */
#endif /* __i386__ */
/* Use these interfaces in favor of the above. */
@ -310,7 +310,7 @@ struct per_process
uint32_t dll_minor;
struct _reent **impure_ptr_ptr;
#ifndef __x86_64__
#ifdef __i386__
char ***envptr;
#endif

View File

@ -15,7 +15,7 @@
#define __DIRENT_VERSION 2
#ifndef __x86_64__
#ifdef __i386__
#pragma pack(push,4)
#endif
#define _DIRENT_HAVE_D_TYPE
@ -28,7 +28,7 @@ struct dirent
__uint32_t __d_internal1;
char d_name[NAME_MAX + 1];
};
#ifndef __x86_64__
#ifdef __i386__
#pragma pack(pop)
#endif
@ -40,7 +40,7 @@ struct dirent
#define __DIRENT_COOKIE 0xdede4242
#endif
#ifndef __x86_64__
#ifdef __i386__
#pragma pack(push,4)
#endif
typedef struct __DIR
@ -56,7 +56,7 @@ typedef struct __DIR
void *__fh;
unsigned __flags;
} DIR;
#ifndef __x86_64__
#ifdef __i386__
#pragma pack(pop)
#endif

View File

@ -61,7 +61,7 @@ extern int __dynamically_loaded;
extern "C"
{
#ifndef __x86_64__
#ifdef __i386__
char **environ;
#endif
int _fmode;
@ -114,7 +114,7 @@ _cygwin_crt0_common (MainFunc f, per_process *u)
u->ctors = &__CTOR_LIST__;
u->dtors = &__DTOR_LIST__;
#ifndef __x86_64__
#ifdef __i386__
u->envptr = &environ;
#endif
if (uwasnull)

View File

@ -399,7 +399,7 @@ pthread_wrapper (PVOID arg)
/* Initialize new _cygtls. */
_my_tls.init_thread (wrapper_arg.stackbase - CYGTLS_PADSIZE,
(DWORD (*)(void*, void*)) wrapper_arg.func);
#ifndef __x86_64__
#ifdef __i386__
/* Copy exception list over to new stack. I'm not quite sure how the
exception list is extended by Windows itself. What's clear is that it
always grows downwards and that it starts right at the stackbase.

View File

@ -1065,7 +1065,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, off_t off)
Note that this isn't done in 64 bit environments since apparently
64 bit systems don't support the AT_ROUND_TO_PAGE flag, which is
required to get this right. Too bad. */
#ifndef __x86_64__
#ifdef __i386__
if (!wincap.is_wow64 ()
&& (((off_t) len > fsiz && !autogrow (flags))
|| roundup2 (len, wincap.page_size ())
@ -1228,14 +1228,14 @@ out:
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (mmap64, mmap)
#else
#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. */

View File

@ -225,14 +225,14 @@ getpwuid32 (uid_t uid)
return getpw_cp (temppw);
}
#ifdef __x86_64__
EXPORT_ALIAS (getpwuid32, getpwuid)
#else
#ifdef __i386__
extern "C" struct passwd *
getpwuid (__uid16_t uid)
{
return getpwuid32 (uid16touid32 (uid));
}
#else
EXPORT_ALIAS (getpwuid32, getpwuid)
#endif
extern "C" int
@ -754,7 +754,7 @@ endpwent_filtered (void *pw)
((pw_ent *) pw)->endpwent ();
}
#ifndef __x86_64__
#ifdef __i386__
extern "C" struct passwd *
getpwduid (__uid16_t)
{

View File

@ -3551,7 +3551,7 @@ cygwin_create_path (cygwin_conv_path_t what, const void *from)
return to;
}
#ifndef __x86_64__ /* Disable deprecated functions on x86_64. */
#ifdef __i386__
extern "C" int
cygwin_conv_to_win32_path (const char *path, char *win32_path)
@ -3583,7 +3583,7 @@ cygwin_conv_to_full_posix_path (const char *path, char *posix_path)
MAX_PATH);
}
#endif /* !__x86_64__ */
#endif /* __i386__ */
/* The realpath function is required by POSIX:2008. */
@ -3733,7 +3733,7 @@ env_PATH_to_posix (const void *win32, void *posix, size_t size)
size, ENV_CVT));
}
#ifndef __x86_64__ /* Disable deprecated functions on x86_64. */
#ifdef __i386__
extern "C" int
cygwin_win32_to_posix_path_list_buf_size (const char *path_list)
@ -3761,7 +3761,7 @@ cygwin_posix_to_win32_path_list (const char *posix, char *win32)
CCP_POSIX_TO_WIN_A | CCP_RELATIVE));
}
#endif /* !__x86_64__ */
#endif /* __i386__ */
extern "C" ssize_t
cygwin_conv_path_list (cygwin_conv_path_t what, const void *from, void *to,

View File

@ -1227,7 +1227,7 @@ acl32 (const char *path, int cmd, int nentries, aclent_t *aclbufp)
return res;
}
#ifndef __x86_64__
#ifdef __i386__
extern "C" int
lacl32 (const char *path, int cmd, int nentries, aclent_t *aclbufp)
{
@ -1969,18 +1969,7 @@ aclfromtext32 (char *acltextp, int *aclcnt)
return (aclent_t *) __aclfromtext (acltextp, aclcnt, false);
}
#ifdef __x86_64__
EXPORT_ALIAS (acl32, acl)
EXPORT_ALIAS (facl32, facl)
EXPORT_ALIAS (aclcheck32, aclcheck)
EXPORT_ALIAS (aclsort32, aclsort)
EXPORT_ALIAS (acltomode32, acltomode)
EXPORT_ALIAS (aclfrommode32, aclfrommode)
EXPORT_ALIAS (acltopbits32, acltopbits)
EXPORT_ALIAS (aclfrompbits32, aclfrompbits)
EXPORT_ALIAS (acltotext32, acltotext)
EXPORT_ALIAS (aclfromtext32, aclfromtext)
#else
#ifdef __i386__
typedef struct __acl16 {
int a_type;
__uid16_t a_id;
@ -2066,4 +2055,15 @@ aclfromtext (char *acltextp, int *aclcnt)
{
return (__aclent16_t *) aclfromtext32 (acltextp, aclcnt);
}
#endif /* !__x86_64__ */
#else
EXPORT_ALIAS (acl32, acl)
EXPORT_ALIAS (facl32, facl)
EXPORT_ALIAS (aclcheck32, aclcheck)
EXPORT_ALIAS (aclsort32, aclsort)
EXPORT_ALIAS (acltomode32, acltomode)
EXPORT_ALIAS (aclfrommode32, aclfrommode)
EXPORT_ALIAS (acltopbits32, acltopbits)
EXPORT_ALIAS (aclfrompbits32, aclfrompbits)
EXPORT_ALIAS (acltotext32, acltotext)
EXPORT_ALIAS (aclfromtext32, aclfromtext)
#endif

View File

@ -44,7 +44,7 @@ void uinfo_init ();
#define MAP_UNIX_TO_CYGWIN_ID(id) (UNIX_POSIX_OFFSET \
| ((id) & UNIX_POSIX_MASK))
#ifndef __x86_64__
#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))

View File

@ -1507,16 +1507,16 @@ lseek64 (int fd, off_t pos, int dir)
EXPORT_ALIAS (lseek64, _lseek64)
#ifdef __x86_64__
EXPORT_ALIAS (lseek64, lseek)
EXPORT_ALIAS (lseek64, _lseek)
#else
#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
@ -1623,15 +1623,15 @@ chown32 (const char * name, uid_t uid, gid_t gid)
return chown_worker (name, PC_SYM_FOLLOW, uid, gid);
}
#ifdef __x86_64__
EXPORT_ALIAS (chown32, chown)
#else
#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
@ -1640,15 +1640,15 @@ lchown32 (const char * name, uid_t uid, gid_t gid)
return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid);
}
#ifdef __x86_64__
EXPORT_ALIAS (lchown32, lchown)
#else
#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
@ -1667,14 +1667,14 @@ fchown32 (int fd, uid_t uid, gid_t gid)
return res;
}
#ifdef __x86_64__
EXPORT_ALIAS (fchown32, fchown)
#else
#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 */
@ -1735,7 +1735,7 @@ fchmod (int fd, mode_t mode)
return cfd->fchmod (FILTERED_MODE (mode));
}
#ifndef __x86_64__
#ifdef __i386__
static void
stat64_to_stat32 (struct stat *src, struct __stat32 *dst)
{
@ -1839,10 +1839,7 @@ _fstat64_r (struct _reent *ptr, int fd, struct stat *buf)
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (fstat64, fstat)
EXPORT_ALIAS (_fstat64_r, _fstat_r)
#else
#ifdef __i386__
extern "C" int
fstat (int fd, struct stat *buf)
{
@ -1862,6 +1859,9 @@ _fstat_r (struct _reent *ptr, int fd, struct stat *buf)
ptr->_errno = get_errno ();
return ret;
}
#else
EXPORT_ALIAS (fstat64, fstat)
EXPORT_ALIAS (_fstat64_r, _fstat_r)
#endif
/* fsync: P96 6.6.1.1 */
@ -1996,10 +1996,7 @@ _stat64_r (struct _reent *__restrict ptr, const char *__restrict name,
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (stat64, stat)
EXPORT_ALIAS (_stat64_r, _stat_r)
#else
#ifdef __i386__
extern "C" int
stat (const char *__restrict name, struct stat *__restrict buf)
{
@ -2020,6 +2017,9 @@ _stat_r (struct _reent *__restrict ptr, const char *__restrict name,
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? */
@ -2032,9 +2032,7 @@ lstat64 (const char *__restrict name, struct stat *__restrict buf)
return stat_worker (pc, buf);
}
#ifdef __x86_64__
EXPORT_ALIAS (lstat64, lstat)
#else
#ifdef __i386__
/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
extern "C" int
lstat (const char *__restrict name, struct stat *__restrict buf)
@ -2045,6 +2043,8 @@ lstat (const char *__restrict name, struct stat *__restrict buf)
stat64_to_stat32 (&buf64, (struct __stat32 *) buf);
return ret;
}
#else
EXPORT_ALIAS (lstat64, lstat)
#endif
extern "C" int
@ -3023,15 +3023,15 @@ ftruncate64 (int fd, off_t length)
return res;
}
#ifdef __x86_64__
EXPORT_ALIAS (ftruncate64, ftruncate)
#else
#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 */
@ -3053,15 +3053,15 @@ truncate64 (const char *pathname, off_t length)
return res;
}
#ifdef __x86_64__
EXPORT_ALIAS (truncate64, truncate)
#else
#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
@ -3548,14 +3548,14 @@ seteuid32 (uid_t uid)
return 0;
}
#ifdef __x86_64__
EXPORT_ALIAS (seteuid32, seteuid)
#else
#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 */
@ -3573,14 +3573,14 @@ setuid32 (uid_t uid)
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (setuid32, setuid)
#else
#ifdef __i386__
extern "C" int
setuid (__uid16_t uid)
{
return setuid32 (uid16touid32 (uid));
}
#else
EXPORT_ALIAS (setuid32, setuid)
#endif
extern "C" int
@ -3602,14 +3602,14 @@ setreuid32 (uid_t ruid, uid_t euid)
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (setreuid32, setreuid)
#else
#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. */
@ -3662,14 +3662,14 @@ setegid32 (gid_t gid)
return 0;
}
#ifdef __x86_64__
EXPORT_ALIAS (setegid32, setegid)
#else
#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 */
@ -3682,9 +3682,7 @@ setgid32 (gid_t gid)
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (setgid32, setgid)
#else
#ifdef __i386__
extern "C" int
setgid (__gid16_t gid)
{
@ -3693,6 +3691,8 @@ setgid (__gid16_t gid)
cygheap->user.real_gid = myself->gid;
return ret;
}
#else
EXPORT_ALIAS (setgid32, setgid)
#endif
extern "C" int
@ -3714,14 +3714,14 @@ setregid32 (gid_t rgid, gid_t egid)
return ret;
}
#ifdef __x86_64__
EXPORT_ALIAS (setregid32, setregid)
#else
#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. */

View File

@ -284,14 +284,14 @@ getuid32 (void)
return cygheap->user.real_uid;
}
#ifdef __x86_64__
EXPORT_ALIAS (getuid32, getuid)
#else
#ifdef __i386__
extern "C" __uid16_t
getuid (void)
{
return cygheap->user.real_uid;
}
#else
EXPORT_ALIAS (getuid32, getuid)
#endif
extern "C" gid_t
@ -300,14 +300,14 @@ getgid32 (void)
return cygheap->user.real_gid;
}
#ifdef __x86_64__
EXPORT_ALIAS (getgid32, getgid)
#else
#ifdef __i386__
extern "C" __gid16_t
getgid (void)
{
return cygheap->user.real_gid;
}
#else
EXPORT_ALIAS (getgid32, getgid)
#endif
extern "C" uid_t
@ -316,14 +316,14 @@ geteuid32 (void)
return myself->uid;
}
#ifdef __x86_64__
EXPORT_ALIAS (geteuid32, geteuid)
#else
#ifdef __i386__
extern "C" uid_t
geteuid (void)
{
return myself->uid;
}
#else
EXPORT_ALIAS (geteuid32, geteuid)
#endif
extern "C" gid_t
@ -332,14 +332,14 @@ getegid32 (void)
return myself->gid;
}
#ifdef __x86_64__
EXPORT_ALIAS (getegid32, getegid)
#else
#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 */

View File

@ -160,10 +160,10 @@ extern "C" PVOID dll_dllcrt0 (HMODULE, per_process *);
extern "C" void _pei386_runtime_relocator (per_process *);
#ifndef __x86_64__
#ifdef __i386__
/* dynamically loaded dll initialization for non-cygwin apps */
extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
#endif /* !__x86_64__ */
#endif /* __i386__ */
void __reg1 do_exit (int) __attribute__ ((noreturn));