Browse Source
* 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.Z-emcb-cygwin_daemon
11 changed files with 368 additions and 12 deletions
@ -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); |
|||
} |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 */ |
|||
@ -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 */ |
|||
Loading…
Reference in new issue