* 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:
Corinna Vinschen
2003-05-12 11:06:27 +00:00
parent 01859fc441
commit 194d9eb318
11 changed files with 368 additions and 12 deletions

View 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

View 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

View 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 */

View 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 */