* Makefile.in (CYGWIN_START): Define as crt0.o. Add to TARGET_LIBS.
* fhandler.h (fhandler_virtual::fstat): Remove useless declaration. * fhandler_virtual.cc: Remove _COMPILING_NEWLIB define. * ipc.cc (ftok): Use stat64. * syscalls.cc (_fstat64): Remove alias. (_fstat): Ditto. (_stat): Ditto. (_fstat64_r): New function. (_fstat_r): Ditto. (_stat64_r): Ditto. (stat_r): Ditto. * crt0.o: New file, moved from newlib. * include/sys/param.h: Ditto. * include/sys/utime.h: Ditto. * include/sys/utmp.h: Ditto. * include/sys/dirent.h: Ditto. Expose different struct dirent, dependening of the environment.
This commit is contained in:
parent
01859fc441
commit
194d9eb318
@ -1,3 +1,23 @@
|
||||
2003-05-12 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* Makefile.in (CYGWIN_START): Define as crt0.o. Add to TARGET_LIBS.
|
||||
* fhandler.h (fhandler_virtual::fstat): Remove useless declaration.
|
||||
* fhandler_virtual.cc: Remove _COMPILING_NEWLIB define.
|
||||
* ipc.cc (ftok): Use stat64.
|
||||
* syscalls.cc (_fstat64): Remove alias.
|
||||
(_fstat): Ditto.
|
||||
(_stat): Ditto.
|
||||
(_fstat64_r): New function.
|
||||
(_fstat_r): Ditto.
|
||||
(_stat64_r): Ditto.
|
||||
(stat_r): Ditto.
|
||||
* crt0.o: New file, moved from newlib.
|
||||
* include/sys/param.h: Ditto.
|
||||
* include/sys/utime.h: Ditto.
|
||||
* include/sys/utmp.h: Ditto.
|
||||
* include/sys/dirent.h: Ditto. Expose different struct dirent,
|
||||
dependening of the environment.
|
||||
|
||||
2003-05-11 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
Replace ino_t by __ino64_t throughout.
|
||||
|
@ -123,6 +123,7 @@ DEF_FILE:=cygwin.def
|
||||
DLL_ENTRY:=@DLL_ENTRY@
|
||||
|
||||
LIBGMON_A:=libgmon.a
|
||||
CYGWIN_START:=crt0.o
|
||||
GMON_START:=gcrt0.o
|
||||
|
||||
# Some things want these from libc, but they have their own static
|
||||
@ -237,7 +238,7 @@ PWD:=${shell pwd}
|
||||
SUBLIBS:=libpthread.a $(PWD)/libm.a libc.a
|
||||
EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a
|
||||
INSTOBJS:=automode.o binmode.o textmode.o
|
||||
TARGET_LIBS:=$(LIB_NAME) $(SUBLIBS) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
|
||||
TARGET_LIBS:=$(LIB_NAME) $(SUBLIBS) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
|
||||
.PHONY: all force dll_ofiles install all_target install_target all_host install_host \
|
||||
install install-libs install-headers -lgcc
|
||||
|
||||
|
56
winsup/cygwin/crt0.c
Normal file
56
winsup/cygwin/crt0.c
Normal file
@ -0,0 +1,56 @@
|
||||
/* crt0.c.
|
||||
|
||||
Copyright 2001 Red Hat, Inc.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of the
|
||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifdef __PPC__
|
||||
/* For the PowerPC, we want to make this function have its structured
|
||||
exception table exception function point to something we control. */
|
||||
|
||||
extern void __cygwin_exception_handler();
|
||||
extern void mainCRTStartup(void) __attribute__((__exception__(__cygwin_exception_handler)));
|
||||
#endif
|
||||
|
||||
/* In the following ifdef'd i386 code, the FPU precision is set to 80 bits
|
||||
and all FPU exceptions are masked. The former is needed to make long
|
||||
doubles work correctly. The latter causes the FPU to generate NaNs and
|
||||
Infinities instead of signals for certain operations.
|
||||
*/
|
||||
|
||||
#ifdef __i386__
|
||||
#define FPU_RESERVED 0xF0C0
|
||||
#define FPU_DEFAULT 0x033f
|
||||
|
||||
/* For debugging on *#!$@ windbg. bp for breakpoint. */
|
||||
int __cygwin_crt0_bp = 0;
|
||||
#endif
|
||||
|
||||
extern int main (int argc, char **argv);
|
||||
|
||||
void
|
||||
mainCRTStartup ()
|
||||
{
|
||||
#ifdef __i386__
|
||||
if (__cygwin_crt0_bp)
|
||||
asm volatile ("int3");
|
||||
|
||||
{
|
||||
volatile unsigned short cw;
|
||||
|
||||
/* Get Control Word */
|
||||
__asm__ volatile ("fnstcw %0" : "=m" (cw) : );
|
||||
|
||||
/* mask in */
|
||||
cw &= FPU_RESERVED;
|
||||
cw |= FPU_DEFAULT;
|
||||
|
||||
/* set cw */
|
||||
__asm__ volatile ("fldcw %0" :: "m" (cw));
|
||||
}
|
||||
#endif
|
||||
|
||||
cygwin_crt0 (main);
|
||||
}
|
@ -1126,7 +1126,6 @@ class fhandler_virtual : public fhandler_base
|
||||
int dup (fhandler_base * child);
|
||||
int open (path_conv *, int flags, mode_t mode = 0);
|
||||
int close (void);
|
||||
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3)));
|
||||
virtual bool fill_filebuf ();
|
||||
void fixup_after_exec (HANDLE);
|
||||
};
|
||||
|
@ -22,7 +22,6 @@ details. */
|
||||
#include "cygheap.h"
|
||||
#include <assert.h>
|
||||
|
||||
#define _COMPILING_NEWLIB
|
||||
#include <dirent.h>
|
||||
|
||||
fhandler_virtual::fhandler_virtual (DWORD devtype):
|
||||
|
97
winsup/cygwin/include/sys/dirent.h
Normal file
97
winsup/cygwin/include/sys/dirent.h
Normal file
@ -0,0 +1,97 @@
|
||||
/* Posix dirent.h for WIN32.
|
||||
|
||||
Copyright 2001 Red Hat, Inc.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of the
|
||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
/* Including this file should not require any Windows headers. */
|
||||
|
||||
#ifndef _SYS_DIRENT_H
|
||||
#define _SYS_DIRENT_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define __DIRENT_VERSION 2
|
||||
|
||||
#pragma pack(push,4)
|
||||
#ifdef __INSIDE_CYGWIN__
|
||||
struct dirent
|
||||
{
|
||||
long d_version; /* Used since Cygwin 1.3.3. */
|
||||
__ino64_t d_ino; /* still junk but with more bits */
|
||||
long d_fd; /* File descriptor of open directory.
|
||||
Used since Cygwin 1.3.3. */
|
||||
__ino32_t old_d_ino; /* Just for compatibility, it's junk */
|
||||
char d_name[256]; /* FIXME: use NAME_MAX? */
|
||||
};
|
||||
#else
|
||||
#ifdef __CYGWIN_USE_BIG_TYPES__
|
||||
struct dirent
|
||||
{
|
||||
long d_version;
|
||||
ino_t d_ino;
|
||||
long d_fd;
|
||||
unsigned long old_d_ino;
|
||||
char d_name[256];
|
||||
};
|
||||
#else
|
||||
struct dirent
|
||||
{
|
||||
long d_version;
|
||||
long d_reserved[2];
|
||||
long d_fd;
|
||||
ino_t d_ino;
|
||||
char d_name[256];
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
#pragma pack(pop)
|
||||
|
||||
#define __DIRENT_COOKIE 0xdede4242
|
||||
|
||||
typedef struct __DIR
|
||||
{
|
||||
/* This is first to set alignment in non _COMPILING_NEWLIB case. */
|
||||
unsigned long __d_cookie;
|
||||
struct dirent *__d_dirent;
|
||||
char *__d_dirname; /* directory name with trailing '*' */
|
||||
_off_t __d_position; /* used by telldir/seekdir */
|
||||
unsigned long __d_dirhash; /* hash of directory name for use by
|
||||
readdir */
|
||||
union
|
||||
{
|
||||
#ifdef __INSIDE_CYGWIN__
|
||||
struct
|
||||
{
|
||||
void *__handle;
|
||||
void *__fh;
|
||||
} __d_data;
|
||||
#endif
|
||||
char __d_filler[16];
|
||||
} __d_u;
|
||||
} DIR;
|
||||
|
||||
DIR *opendir (const char *);
|
||||
struct dirent *readdir (DIR *);
|
||||
void rewinddir (DIR *);
|
||||
int closedir (DIR *);
|
||||
|
||||
int dirfd (DIR *);
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
off_t telldir (DIR *);
|
||||
void seekdir (DIR *, off_t loc);
|
||||
#endif
|
||||
|
||||
int scandir (const char *__dir,
|
||||
struct dirent ***__namelist,
|
||||
int (*select) (const struct dirent *),
|
||||
int (*compar) (const struct dirent **, const struct dirent **));
|
||||
|
||||
int alphasort (const struct dirent **__a, const struct dirent **__b);
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#endif
|
51
winsup/cygwin/include/sys/param.h
Normal file
51
winsup/cygwin/include/sys/param.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* sys/param.h
|
||||
|
||||
Copyright 2001 Red Hat, Inc.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of the
|
||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef _SYS_PARAM_H
|
||||
#define _SYS_PARAM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
/* Linux includes limits.h, but this is not universally done. */
|
||||
#include <limits.h>
|
||||
|
||||
/* Max number of open files. The Posix version is OPEN_MAX. */
|
||||
/* Number of fds is virtually unlimited in cygwin, but we must provide
|
||||
some reasonable value for Posix conformance */
|
||||
#define NOFILE 8192
|
||||
|
||||
/* Max number of groups; must keep in sync with NGROUPS_MAX in limits.h */
|
||||
#define NGROUPS 16
|
||||
|
||||
/* Ticks/second for system calls such as times() */
|
||||
/* FIXME: is this the appropriate value? */
|
||||
#define HZ 1000
|
||||
|
||||
/* Max hostname size that can be dealt with */
|
||||
/* FIXME: is this the appropriate value? */
|
||||
#define MAXHOSTNAMELEN 64
|
||||
|
||||
/* This is defined to be the same as MAX_PATH which is used internally.
|
||||
The Posix version is PATH_MAX. */
|
||||
#define MAXPATHLEN (260 - 1 /*NUL*/)
|
||||
|
||||
/* Some autoconf'd packages check for endianness. When cross-building we
|
||||
can't run programs on the target. Fortunately, autoconf supports the
|
||||
definition of byte order in sys/param.h (that's us!).
|
||||
The values here are the same as used in gdb/defs.h (are the more
|
||||
appropriate values?). */
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
|
||||
/* All known win32 systems are little endian. */
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0L
|
||||
#endif
|
||||
|
||||
#endif
|
30
winsup/cygwin/include/sys/utime.h
Normal file
30
winsup/cygwin/include/sys/utime.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* sys/utime.h
|
||||
|
||||
Copyright 2001 Red Hat, Inc.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of the
|
||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef _SYS_UTIME_H
|
||||
#define _SYS_UTIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
struct utimbuf
|
||||
{
|
||||
time_t actime;
|
||||
time_t modtime;
|
||||
};
|
||||
|
||||
int _EXFUN(utime, (const char *__path, struct utimbuf *__buf));
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_UTIME_H */
|
68
winsup/cygwin/include/sys/utmp.h
Normal file
68
winsup/cygwin/include/sys/utmp.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* sys/utmp.h
|
||||
|
||||
Copyright 2001 Red Hat, Inc.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of the
|
||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef UTMP_H
|
||||
#define UTMP_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <paths.h>
|
||||
|
||||
#define UTMP_FILE _PATH_UTMP
|
||||
#define WTMP_FILE _PATH_WTMP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UT_LINESIZE 16
|
||||
#define UT_NAMESIZE 16
|
||||
#define UT_HOSTSIZE 256
|
||||
#define UT_IDLEN 2
|
||||
#define ut_name ut_user
|
||||
|
||||
struct utmp
|
||||
{
|
||||
short ut_type;
|
||||
pid_t ut_pid;
|
||||
char ut_line[UT_LINESIZE];
|
||||
char ut_id[UT_IDLEN];
|
||||
time_t ut_time;
|
||||
char ut_user[UT_NAMESIZE];
|
||||
char ut_host[UT_HOSTSIZE];
|
||||
long ut_addr;
|
||||
};
|
||||
|
||||
#define RUN_LVL 1
|
||||
#define BOOT_TIME 2
|
||||
#define NEW_TIME 3
|
||||
#define OLD_TIME 4
|
||||
|
||||
#define INIT_PROCESS 5
|
||||
#define LOGIN_PROCESS 6
|
||||
#define USER_PROCESS 7
|
||||
#define DEAD_PROCESS 8
|
||||
|
||||
extern struct utmp *_getutline (struct utmp *);
|
||||
extern struct utmp *getutent (void);
|
||||
extern struct utmp *getutid (struct utmp *);
|
||||
extern struct utmp *getutline (struct utmp *);
|
||||
extern void endutent (void);
|
||||
extern void pututline (struct utmp *);
|
||||
extern void setutent (void);
|
||||
extern void utmpname (const char *);
|
||||
|
||||
void login (struct utmp *);
|
||||
int logout (char *);
|
||||
int login_tty (int);
|
||||
void logwtmp (char *, char *, char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* UTMP_H */
|
@ -21,8 +21,8 @@ extern "C"
|
||||
key_t
|
||||
ftok (const char *path, int id)
|
||||
{
|
||||
struct stat statbuf;
|
||||
if (stat (path, &statbuf))
|
||||
struct __stat64 statbuf;
|
||||
if (stat64 (path, &statbuf))
|
||||
{
|
||||
/* stat set the appropriate errno for us */
|
||||
return (key_t) -1;
|
||||
|
@ -1033,8 +1033,16 @@ fstat64 (int fd, struct __stat64 *buf)
|
||||
return res;
|
||||
}
|
||||
|
||||
extern "C" int _fstat64 (int fd, _off64_t pos, int dir)
|
||||
__attribute__ ((alias ("fstat64")));
|
||||
extern "C" int
|
||||
_fstat64_r (struct _reent *ptr, int fd, struct __stat64 *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
set_errno (0);
|
||||
if ((ret = fstat64 (fd, buf)) == -1 && get_errno () != 0)
|
||||
ptr->_errno = get_errno ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
fstat (int fd, struct __stat32 *buf)
|
||||
@ -1046,8 +1054,16 @@ fstat (int fd, struct __stat32 *buf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int _fstat (int fd, _off64_t pos, int dir)
|
||||
__attribute__ ((alias ("fstat")));
|
||||
extern "C" int
|
||||
_fstat_r (struct _reent *ptr, int fd, struct __stat32 *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
set_errno (0);
|
||||
if ((ret = fstat (fd, buf)) == -1 && get_errno () != 0)
|
||||
ptr->_errno = get_errno ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* fsync: P96 6.6.1.1 */
|
||||
extern "C" int
|
||||
@ -1133,9 +1149,6 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow,
|
||||
return res;
|
||||
}
|
||||
|
||||
extern "C" int _stat (int fd, _off64_t pos, int dir)
|
||||
__attribute__ ((alias ("stat")));
|
||||
|
||||
extern "C" int
|
||||
stat64 (const char *name, struct __stat64 *buf)
|
||||
{
|
||||
@ -1144,6 +1157,17 @@ stat64 (const char *name, struct __stat64 *buf)
|
||||
return stat_worker (name, buf, 0);
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
_stat64_r (struct _reent *ptr, const char *name, struct __stat64 *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
set_errno (0);
|
||||
if ((ret = stat64 (name, buf)) == -1 && get_errno () != 0)
|
||||
ptr->_errno = get_errno ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
stat (const char *name, struct __stat32 *buf)
|
||||
{
|
||||
@ -1154,6 +1178,17 @@ stat (const char *name, struct __stat32 *buf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
_stat_r (struct _reent *ptr, const char *name, struct __stat32 *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
set_errno (0);
|
||||
if ((ret = stat (name, buf)) == -1 && get_errno () != 0)
|
||||
ptr->_errno = get_errno ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
|
||||
extern "C" int
|
||||
lstat64 (const char *name, struct __stat64 *buf)
|
||||
|
Loading…
Reference in New Issue
Block a user