Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/include')
-rw-r--r--winsup/cygwin/include/a.out.h236
-rw-r--r--winsup/cygwin/include/asm/byteorder.h10
-rw-r--r--winsup/cygwin/include/bits/wordsize.h7
-rw-r--r--winsup/cygwin/include/cygwin/acl.h10
-rw-r--r--winsup/cygwin/include/cygwin/config.h22
-rw-r--r--winsup/cygwin/include/cygwin/cygwin_dll.h16
-rw-r--r--winsup/cygwin/include/cygwin/grp.h18
-rw-r--r--winsup/cygwin/include/cygwin/if.h4
-rw-r--r--winsup/cygwin/include/cygwin/ipc.h3
-rw-r--r--winsup/cygwin/include/cygwin/msg.h26
-rw-r--r--winsup/cygwin/include/cygwin/sem.h24
-rw-r--r--winsup/cygwin/include/cygwin/shm.h29
-rw-r--r--winsup/cygwin/include/cygwin/signal.h176
-rw-r--r--winsup/cygwin/include/cygwin/socket.h13
-rw-r--r--winsup/cygwin/include/cygwin/stat.h62
-rw-r--r--winsup/cygwin/include/cygwin/stdlib.h8
-rw-r--r--winsup/cygwin/include/cygwin/sysproto.h2
-rw-r--r--winsup/cygwin/include/cygwin/time.h4
-rw-r--r--winsup/cygwin/include/cygwin/types.h45
-rw-r--r--winsup/cygwin/include/cygwin/version.h8
-rw-r--r--winsup/cygwin/include/fcntl.h21
-rw-r--r--winsup/cygwin/include/fts.h10
-rw-r--r--winsup/cygwin/include/ftw.h6
-rw-r--r--winsup/cygwin/include/glob.h6
-rw-r--r--winsup/cygwin/include/inttypes.h5
-rw-r--r--winsup/cygwin/include/io.h7
-rw-r--r--winsup/cygwin/include/limits.h28
-rw-r--r--winsup/cygwin/include/mntent.h6
-rw-r--r--winsup/cygwin/include/stdint.h40
-rw-r--r--winsup/cygwin/include/sys/cygwin.h45
-rw-r--r--winsup/cygwin/include/sys/dirent.h23
-rw-r--r--winsup/cygwin/include/sys/resource.h2
-rw-r--r--winsup/cygwin/include/sys/socket.h9
-rw-r--r--winsup/cygwin/include/sys/strace.h5
34 files changed, 551 insertions, 385 deletions
diff --git a/winsup/cygwin/include/a.out.h b/winsup/cygwin/include/a.out.h
index 1ccc3f425..ad9b5a56f 100644
--- a/winsup/cygwin/include/a.out.h
+++ b/winsup/cygwin/include/a.out.h
@@ -1,6 +1,6 @@
/* a.out.h
- Copyright 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -14,22 +14,25 @@ details. */
#ifdef __cplusplus
extern "C" {
#endif
+
+#include <stdint.h>
+
#define COFF_IMAGE_WITH_PE
#define COFF_LONG_SECTION_NAMES
-/*** coff information for Intel 386/486. */
+/*** coff information for Intel 386/486 and AMD64. */
/********************** FILE HEADER **********************/
struct external_filehdr {
- short f_magic; /* magic number */
- short f_nscns; /* number of sections */
- unsigned long f_timdat; /* time & date stamp */
- unsigned long f_symptr; /* file pointer to symtab */
- unsigned long f_nsyms; /* number of symtab entries */
- short f_opthdr; /* sizeof(optional hdr) */
- short f_flags; /* flags */
+ uint16_t f_magic; /* magic number */
+ uint16_t f_nscns; /* number of sections */
+ uint32_t f_timdat; /* time & date stamp */
+ uint32_t f_symptr; /* file pointer to symtab */
+ uint32_t f_nsyms; /* number of symtab entries */
+ uint16_t f_opthdr; /* sizeof(optional hdr) */
+ uint16_t f_flags; /* flags */
};
/* Bits for f_flags:
@@ -50,6 +53,7 @@ struct external_filehdr {
#define I386MAGIC 0x14c
#define I386PTXMAGIC 0x154
#define I386AIXMAGIC 0x175
+#define AMD64MAGIC 0x8664
/* This is Lynx's all-platform magic number for executables. */
@@ -70,14 +74,14 @@ struct external_filehdr {
typedef struct
{
- unsigned short magic; /* type of file */
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW bdry*/
- unsigned long dsize; /* initialized data " " */
- unsigned long bsize; /* uninitialized data " " */
- unsigned long entry; /* entry pt. */
- unsigned long text_start; /* base of text used for this file */
- unsigned long data_start; /* base of data used for this file=
+ uint16_t magic; /* type of file */
+ uint16_t vstamp; /* version stamp */
+ uint32_t tsize; /* text size in bytes, padded to FW bdry*/
+ uint32_t dsize; /* initialized data " " */
+ uint32_t bsize; /* uninitialized data " " */
+ uint32_t entry; /* entry pt. */
+ uint32_t text_start; /* base of text used for this file */
+ uint32_t data_start; /* base of data used for this file=
*/
}
AOUTHDR;
@@ -103,16 +107,16 @@ AOUTHDR;
struct external_scnhdr {
char s_name[8]; /* section name */
- unsigned long s_paddr; /* physical address, offset
+ uint32_t s_paddr; /* physical address, offset
of last addr in scn */
- unsigned long s_vaddr; /* virtual address */
- unsigned long s_size; /* section size */
- unsigned long s_scnptr; /* file ptr to raw data for section */
- unsigned long s_relptr; /* file ptr to relocation */
- unsigned long s_lnnoptr; /* file ptr to line numbers */
- unsigned short s_nreloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of line number entries*/
- unsigned long s_flags; /* flags */
+ uint32_t s_vaddr; /* virtual address */
+ uint32_t s_size; /* section size */
+ uint32_t s_scnptr; /* file ptr to raw data for section */
+ uint32_t s_relptr; /* file ptr to relocation */
+ uint32_t s_lnnoptr; /* file ptr to line numbers */
+ uint16_t s_nreloc; /* number of relocation entries */
+ uint16_t s_nlnno; /* number of line number entries*/
+ uint32_t s_flags; /* flags */
};
#define SCNHDR struct external_scnhdr
@@ -136,10 +140,10 @@ struct external_scnhdr {
*/
struct external_lineno {
union {
- unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */
- unsigned long l_paddr; /* (physical) address of line number */
+ uint32_t l_symndx; /* function name symbol index, iff l_lnno 0 */
+ uint32_t l_paddr; /* (physical) address of line number */
} l_addr;
- unsigned short l_lnno; /* line number */
+ uint16_t l_lnno; /* line number */
};
#define LINENO struct external_lineno
@@ -156,13 +160,13 @@ struct external_syment
union {
char e_name[E_SYMNMLEN];
struct {
- unsigned long e_zeroes;
- unsigned long e_offset;
+ uint32_t e_zeroes;
+ uint32_t e_offset;
} e;
} e;
- unsigned long e_value;
- unsigned short e_scnum;
- unsigned short e_type;
+ uint32_t e_value;
+ uint16_t e_scnum;
+ uint16_t e_type;
char e_sclass[1];
char e_numaux[1];
};
@@ -174,46 +178,46 @@ struct external_syment
union external_auxent {
struct {
- unsigned long x_tagndx; /* str, un, or enum tag indx */
+ uint32_t x_tagndx; /* str, un, or enum tag indx */
union {
struct {
- unsigned short x_lnno; /* declaration line number */
- unsigned short x_size; /* str/union/array size */
+ uint16_t x_lnno; /* declaration line number */
+ uint16_t x_size; /* str/union/array size */
} x_lnsz;
- unsigned long x_fsize; /* size of function */
+ uint32_t x_fsize; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
- unsigned long x_lnnoptr;/* ptr to fcn line # */
- unsigned long x_endndx; /* entry ndx past block end */
+ uint32_t x_lnnoptr; /* ptr to fcn line # */
+ uint32_t x_endndx; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
char x_dimen[E_DIMNUM][2];
} x_ary;
} x_fcnary;
- unsigned short x_tvndx; /* tv index */
+ uint16_t x_tvndx; /* tv index */
} x_sym;
union {
char x_fname[E_FILNMLEN];
struct {
- unsigned long x_zeroes;
- unsigned long x_offset;
+ uint32_t x_zeroes;
+ uint32_t x_offset;
} x_n;
} x_file;
struct {
- unsigned long x_scnlen; /* section length */
- unsigned short x_nreloc; /* # relocation entries */
- unsigned short x_nlinno; /* # line numbers */
- unsigned long x_checksum; /* section COMDAT checksum */
- unsigned short x_associated;/* COMDAT associated section index */
+ uint32_t x_scnlen; /* section length */
+ uint16_t x_nreloc; /* # relocation entries */
+ uint16_t x_nlinno; /* # line numbers */
+ uint32_t x_checksum; /* section COMDAT checksum */
+ uint16_t x_associated; /* COMDAT associated section index */
char x_comdat[1]; /* COMDAT selection number */
} x_scn;
struct {
- unsigned long x_tvfill; /* tv fill value */
- unsigned short x_tvlen; /* length of .tv */
+ uint32_t x_tvfill; /* tv fill value */
+ uint16_t x_tvlen; /* length of .tv */
char x_tvran[2][2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
@@ -244,6 +248,20 @@ struct external_reloc {
#ifndef _PE_H
#define _PE_H
+#define IMAGE_FILE_MACHINE_I386 0x014c
+#define IMAGE_FILE_MACHINE_AMD64 0x8664
+
+#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
+#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
+
+#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
+#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
+#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
+
+#define IMAGE_SUBSYSTEM_NATIVE 1
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
+
/* NT specific file attributes */
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
@@ -320,43 +338,43 @@ struct external_reloc {
#ifdef COFF_IMAGE_WITH_PE
-/* The filehdr is only weired in images */
+/* The filehdr is only weird in images */
#undef FILHDR
struct external_PE_filehdr
{
/* DOS header fields */
- unsigned short e_magic; /* Magic number, 0x5a4d */
- unsigned short e_cblp; /* Bytes on last page of file, 0x90 */
- unsigned short e_cp; /* Pages in file, 0x3 */
- unsigned short e_crlc; /* Relocations, 0x0 */
- unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */
- unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */
- unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */
- unsigned short e_ss; /* Initial (relative) SS value, 0x0 */
- unsigned short e_sp; /* Initial SP value, 0xb8 */
- unsigned short e_csum; /* Checksum, 0x0 */
- unsigned short e_ip; /* Initial IP value, 0x0 */
- unsigned short e_cs; /* Initial (relative) CS value, 0x0 */
- unsigned short e_lfarlc; /* File address of relocation table, 0x40 */
- unsigned short e_ovno; /* Overlay number, 0x0 */
- char e_res[4][2]; /* Reserved words, all 0x0 */
- unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */
- unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
- char e_res2[10][2]; /* Reserved words, all 0x0 */
- unsigned long e_lfanew; /* File address of new exe header, 0x80 */
+ uint16_t e_magic; /* Magic number, 0x5a4d */
+ uint16_t e_cblp; /* Bytes on last page of file, 0x90 */
+ uint16_t e_cp; /* Pages in file, 0x3 */
+ uint16_t e_crlc; /* Relocations, 0x0 */
+ uint16_t e_cparhdr; /* Size of header in paragraphs, 0x4 */
+ uint16_t e_minalloc; /* Minimum extra paragraphs needed, 0x0 */
+ uint16_t e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */
+ uint16_t e_ss; /* Initial (relative) SS value, 0x0 */
+ uint16_t e_sp; /* Initial SP value, 0xb8 */
+ uint16_t e_csum; /* Checksum, 0x0 */
+ uint16_t e_ip; /* Initial IP value, 0x0 */
+ uint16_t e_cs; /* Initial (relative) CS value, 0x0 */
+ uint16_t e_lfarlc; /* File address of relocation table, 0x40 */
+ uint16_t e_ovno; /* Overlay number, 0x0 */
+ char e_res[4][2]; /* Reserved words, all 0x0 */
+ uint16_t e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */
+ uint16_t e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
+ char e_res2[10][2]; /* Reserved words, all 0x0 */
+ uint32_t e_lfanew; /* File address of new exe header, 0x80 */
char dos_message[16][4]; /* other stuff, always follow DOS header */
- unsigned int nt_signature; /* required NT signature, 0x4550 */
+ uint32_t nt_signature; /* required NT signature, 0x4550 */
/* From standard header */
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- unsigned long f_timdat; /* time & date stamp */
- unsigned long f_symptr; /* file pointer to symtab */
- unsigned long f_nsyms; /* number of symtab entries */
- unsigned short f_opthdr; /* sizeof(optional hdr) */
- unsigned short f_flags; /* flags */
+ uint16_t f_magic; /* magic number */
+ uint16_t f_nscns; /* number of sections */
+ uint32_t f_timdat; /* time & date stamp */
+ uint32_t f_symptr; /* file pointer to symtab */
+ uint32_t f_nsyms; /* number of symtab entries */
+ uint16_t f_opthdr; /* sizeof(optional hdr) */
+ uint16_t f_flags; /* flags */
};
@@ -368,37 +386,39 @@ struct external_PE_filehdr
typedef struct
{
- unsigned short magic; /* type of file */
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW bdry*/
- unsigned long dsize; /* initialized data " " */
- unsigned long bsize; /* uninitialized data " " */
- unsigned long entry; /* entry pt. */
- unsigned long text_start; /* base of text used for this file */
- unsigned long data_start; /* base of all data used for this file */
+ uint16_t magic; /* type of file */
+ uint16_t vstamp; /* version stamp */
+ uint32_t tsize; /* text size in bytes, padded to FW bdry*/
+ uint32_t dsize; /* initialized data " " */
+ uint32_t bsize; /* uninitialized data " " */
+ uint32_t entry; /* entry pt. */
+ uint32_t text_start; /* base of text used for this file */
+#ifndef __x86_64__
+ uint32_t data_start; /* base of all data used for this file */
+#endif
/* NT extra fields; see internal.h for descriptions */
- unsigned long ImageBase;
- unsigned long SectionAlignment;
- unsigned long FileAlignment;
- unsigned short MajorOperatingSystemVersion;
- unsigned short MinorOperatingSystemVersion;
- unsigned short MajorImageVersion;
- unsigned short MinorImageVersion;
- unsigned short MajorSubsystemVersion;
- unsigned short MinorSubsystemVersion;
+ uintptr_t ImageBase;
+ uint32_t SectionAlignment;
+ uint32_t FileAlignment;
+ uint16_t MajorOperatingSystemVersion;
+ uint16_t MinorOperatingSystemVersion;
+ uint16_t MajorImageVersion;
+ uint16_t MinorImageVersion;
+ uint16_t MajorSubsystemVersion;
+ uint16_t MinorSubsystemVersion;
char Reserved1[4];
- unsigned long SizeOfImage;
- unsigned long SizeOfHeaders;
- unsigned long CheckSum;
- unsigned short Subsystem;
- unsigned short DllCharacteristics;
- unsigned long SizeOfStackReserve;
- unsigned long SizeOfStackCommit;
- unsigned long SizeOfHeapReserve;
- unsigned long SizeOfHeapCommit;
- unsigned long LoaderFlags;
- unsigned long NumberOfRvaAndSizes;
+ uint32_t SizeOfImage;
+ uint32_t SizeOfHeaders;
+ uint32_t CheckSum;
+ uint16_t Subsystem;
+ uint16_t DllCharacteristics;
+ uintptr_t SizeOfStackReserve;
+ uintptr_t SizeOfStackCommit;
+ uintptr_t SizeOfHeapReserve;
+ uintptr_t SizeOfHeapCommit;
+ uint32_t LoaderFlags;
+ uint32_t NumberOfRvaAndSizes;
/* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
@@ -406,7 +426,11 @@ typedef struct
#undef AOUTSZ
+#ifdef __x86_64__
+#define AOUTSZ (AOUTHDRSZ + 212)
+#else
#define AOUTSZ (AOUTHDRSZ + 196)
+#endif
#undef E_FILNMLEN
#define E_FILNMLEN 18 /* # characters in a file name */
diff --git a/winsup/cygwin/include/asm/byteorder.h b/winsup/cygwin/include/asm/byteorder.h
index 4887016ac..4f5d7cb59 100644
--- a/winsup/cygwin/include/asm/byteorder.h
+++ b/winsup/cygwin/include/asm/byteorder.h
@@ -1,6 +1,6 @@
/* asm/byteorder.h
- Copyright 1996, 1998, 2000, 2001, 2006, 2009, 2011 Red Hat, Inc.
+ Copyright 1996, 1998, 2001, 2006, 2009, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@@ -34,11 +34,7 @@ _ELIDABLE_INLINE uint16_t __ntohs(uint16_t);
_ELIDABLE_INLINE uint32_t
__ntohl(uint32_t x)
{
- __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
- "rorl $16,%0\n\t" /* swap words */
- "xchgb %b0,%h0" /* swap higher bytes */
- :"=q" (x)
- : "0" (x));
+ __asm__("bswap %0" : "=r" (x) : "0" (x));
return x;
}
@@ -52,7 +48,7 @@ _ELIDABLE_INLINE uint16_t
__ntohs(uint16_t x)
{
__asm__("xchgb %b0,%h0" /* swap bytes */
- : "=q" (x)
+ : "=Q" (x)
: "0" (x));
return x;
}
diff --git a/winsup/cygwin/include/bits/wordsize.h b/winsup/cygwin/include/bits/wordsize.h
index 38e14f85f..b0ee337f8 100644
--- a/winsup/cygwin/include/bits/wordsize.h
+++ b/winsup/cygwin/include/bits/wordsize.h
@@ -2,5 +2,10 @@
#ifndef _WORDSIZE_H
#define _WORDSIZE_H 1
-#define __WORDSIZE 32
+#ifdef __x86_64__
+# define __WORDSIZE 64
+# define __WORDSIZE_COMPAT32 1
+#else
+# define __WORDSIZE 32
+#endif
#endif /*_WORDSIZE_H*/
diff --git a/winsup/cygwin/include/cygwin/acl.h b/winsup/cygwin/include/cygwin/acl.h
index 6083b5332..9a62e325e 100644
--- a/winsup/cygwin/include/cygwin/acl.h
+++ b/winsup/cygwin/include/cygwin/acl.h
@@ -59,24 +59,20 @@ extern "C" {
#define OTHER OTHER_OBJ
#ifdef __INSIDE_CYGWIN__
+#ifndef __x86_64__
typedef struct __acl16 {
int a_type;
__uid16_t a_id;
mode_t a_perm;
} __aclent16_t;
+#endif
+#endif
-typedef struct __acl32 {
- int a_type;
- __uid32_t a_id;
- mode_t a_perm;
-} __aclent32_t;
-#else
typedef struct acl {
int a_type; /* entry type */
uid_t a_id; /* UID | GID */
mode_t a_perm; /* permissions */
} aclent_t;
-#endif
#ifndef __INSIDE_CYGWIN__
int _EXFUN(acl,(const char *path, int cmd, int nentries, aclent_t *aclbufp));
diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index f330ca4ab..cd73388d5 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -4,7 +4,7 @@
sys/config.h before. This way we can manaage our configuration
setting without bothering newlib.
- Copyright 2003, 2007, 2008, 2009, 2010, 2012 Red Hat, Inc.
+ Copyright 2003, 2007, 2008, 2009, 2010, 2012, 2013 Red Hat, Inc.
Written by C. Vinschen.
This file is part of Cygwin.
@@ -38,11 +38,31 @@ extern "C" {
we might as well just use it here. */
#ifdef _COMPILING_NEWLIB
+#ifdef __x86_64__
+#include "../tlsoffsets64.h"
+/* We would like to use just "%gs:8", but on x86_64 gcc uses pc-relative
+ addressing and translates "gs:8" into the wrong addressing mode. */
+static inline char *___getreent (void)
+{
+ register char *ret;
+ __asm __volatile__ ("movq %%gs:8,%0" : "=r" (ret));
+ return ret + tls_local_clib;
+}
+#define __getreent() ((struct _reent *) ___getreent())
+#else
#include "../tlsoffsets.h"
extern char *_tlsbase __asm__ ("%fs:4");
#define __getreent() (struct _reent *)(_tlsbase + tls_local_clib)
+#endif
#endif /* _COMPILING_NEWLIB */
+#ifdef __x86_64__
+# define __SYMBOL_PREFIX
+#else
+# define __SYMBOL_PREFIX "_"
+#endif
+#define _SYMSTR(x) __SYMBOL_PREFIX #x
+
#define __FILENAME_MAX__ 4096 /* Keep in sync with PATH_MAX in limits.h. */
/* The following block of macros is required to build newlib correctly for
diff --git a/winsup/cygwin/include/cygwin/cygwin_dll.h b/winsup/cygwin/include/cygwin/cygwin_dll.h
index 7abf5bd97..d3da87ddd 100644
--- a/winsup/cygwin/include/cygwin/cygwin_dll.h
+++ b/winsup/cygwin/include/cygwin/cygwin_dll.h
@@ -1,6 +1,6 @@
/* cygwin_dll.h
- Copyright 1998, 1999, 2000, 2001, 2009, 2011 Red Hat, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2009, 2011, 2012, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -26,8 +26,8 @@ details. */
CDECL_BEGIN \
int WINAPI Entry (HINSTANCE h, DWORD reason, void *ptr); \
typedef int (*mainfunc) (int, char **, char **); \
- extern int cygwin_attach_dll (HMODULE, mainfunc); \
- extern void cygwin_detach_dll (DWORD); \
+ extern PVOID cygwin_attach_dll (HMODULE, mainfunc); \
+ extern void cygwin_detach_dll (PVOID); \
CDECL_END \
\
static HINSTANCE storedHandle; \
@@ -35,12 +35,14 @@ static DWORD storedReason; \
static void* storedPtr; \
int __dynamically_loaded; \
\
-static int __dllMain (int a, char **b, char **c) \
+static int __dllMain (int a __attribute__ ((unused)), \
+ char **b __attribute__ ((unused)), \
+ char **c __attribute__ ((unused))) \
{ \
return Entry (storedHandle, storedReason, storedPtr); \
} \
\
-static DWORD dll_index; \
+static PVOID dll_index; \
\
int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
{ \
@@ -56,7 +58,7 @@ int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
storedPtr = ptr; \
__dynamically_loaded = (ptr == NULL); \
dll_index = cygwin_attach_dll (h, &__dllMain); \
- if (dll_index == (DWORD) -1) \
+ if (dll_index == (PVOID) -1) \
ret = 0; \
} \
break; \
@@ -67,7 +69,7 @@ int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
if (ret) \
{ \
cygwin_detach_dll (dll_index); \
- dll_index = (DWORD) -1; \
+ dll_index = (PVOID) -1; \
} \
} \
break; \
diff --git a/winsup/cygwin/include/cygwin/grp.h b/winsup/cygwin/include/cygwin/grp.h
index b990b25ac..056c5f618 100644
--- a/winsup/cygwin/include/cygwin/grp.h
+++ b/winsup/cygwin/include/cygwin/grp.h
@@ -19,6 +19,7 @@ extern "C" {
#endif
#ifdef __INSIDE_CYGWIN__
+#ifndef __x86_64__
struct __group16
{
char *gr_name;
@@ -26,19 +27,12 @@ struct __group16
__gid16_t gr_gid;
char **gr_mem;
};
+#endif
-struct __group32
-{
- char *gr_name;
- char *gr_passwd;
- __gid32_t gr_gid;
- char **gr_mem;
-};
-
-struct __group32 * getgrgid32 (__gid32_t gid);
-struct __group32 * getgrnam32 (const char *name);
-__gid32_t getgid32 ();
-__gid32_t getegid32 ();
+struct group * getgrgid32 (gid_t gid);
+struct group * getgrnam32 (const char *name);
+gid_t getgid32 ();
+gid_t getegid32 ();
#endif
extern int getgrouplist (const char *, gid_t, gid_t *, int *);
diff --git a/winsup/cygwin/include/cygwin/if.h b/winsup/cygwin/include/cygwin/if.h
index aa0c02b29..2cd6ac5f3 100644
--- a/winsup/cygwin/include/cygwin/if.h
+++ b/winsup/cygwin/include/cygwin/if.h
@@ -1,6 +1,6 @@
/* cygwin/if.h
- Copyright 1996, 2000, 2001, 2007, 2012 Red Hat, Inc.
+ Copyright 1996, 2000, 2001, 2007, 2012, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -16,7 +16,7 @@ extern "C" {
#endif /* __cplusplus */
#include <sys/types.h>
-#include <sys/socket.h>
+#include <cygwin/socket.h>
/* Standard interface flags. */
#define IFF_UP 0x1 /* interface is up */
diff --git a/winsup/cygwin/include/cygwin/ipc.h b/winsup/cygwin/include/cygwin/ipc.h
index 783778822..c660d960a 100644
--- a/winsup/cygwin/include/cygwin/ipc.h
+++ b/winsup/cygwin/include/cygwin/ipc.h
@@ -1,6 +1,6 @@
/* sys/ipc.h
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2012, 2013 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
This file is part of Cygwin.
@@ -13,6 +13,7 @@ details. */
#define _CYGWIN_IPC_H
#include <sys/types.h>
+#include <stdint.h>
#ifdef __cplusplus
extern "C"
diff --git a/winsup/cygwin/include/cygwin/msg.h b/winsup/cygwin/include/cygwin/msg.h
index 8679786dd..c737971ea 100644
--- a/winsup/cygwin/include/cygwin/msg.h
+++ b/winsup/cygwin/include/cygwin/msg.h
@@ -1,6 +1,6 @@
/* sys/msg.h
- Copyright 2002 Red Hat Inc.
+ Copyright 2002, 2012, 2013 Red Hat Inc.
Written by Conrad Scott <conrad.scott@dsl.pipex.com>
This file is part of Cygwin.
@@ -32,11 +32,11 @@ extern "C"
/* Used for the number of messages in the message queue.
*/
-typedef unsigned long msgqnum_t;
+typedef uint32_t msgqnum_t;
/* Used for the number of bytes allowed in a message queue.
*/
-typedef unsigned long msglen_t;
+typedef uint32_t msglen_t;
struct msqid_ds
{
@@ -66,27 +66,27 @@ struct msqid_ds
*/
struct msginfo
{
- long msgmax; /* Maximum number of bytes per
+ int32_t msgmax; /* Maximum number of bytes per
message. */
- long msgmnb; /* Maximum number of bytes on any one
+ int32_t msgmnb; /* Maximum number of bytes on any one
message queue. */
- long msgmni; /* Maximum number of message queues,
+ int32_t msgmni; /* Maximum number of message queues,
system wide. */
- long msgtql; /* Maximum number of messages, system
+ int32_t msgtql; /* Maximum number of messages, system
wide. */
- long msgssz; /* Size of a message segment, must be
+ int32_t msgssz; /* Size of a message segment, must be
small power of 2 greater than 4. */
- long msgseg; /* Number of message segments */
- long msg_spare[2];
+ int32_t msgseg; /* Number of message segments */
+ int32_t msg_spare[2];
};
/* Buffer type for msgctl (MSG_INFO, ...) as used by ipcs(8).
*/
struct msg_info
{
- long msg_ids; /* Number of allocated queues. */
- long msg_num; /* Number of messages, system wide. */
- long msg_tot; /* Size in bytes of messages, system wide. */
+ int32_t msg_ids; /* Number of allocated queues. */
+ int32_t msg_num; /* Number of messages, system wide. */
+ int32_t msg_tot; /* Size in bytes of messages, system wide. */
};
#endif /* _KERNEL */
diff --git a/winsup/cygwin/include/cygwin/sem.h b/winsup/cygwin/include/cygwin/sem.h
index af7a42f36..71592e52f 100644
--- a/winsup/cygwin/include/cygwin/sem.h
+++ b/winsup/cygwin/include/cygwin/sem.h
@@ -1,6 +1,6 @@
/* sys/sem.h
- Copyright 2002 Red Hat Inc.
+ Copyright 2002, 2012, 2013 Red Hat Inc.
Written by Conrad Scott <conrad.scott@dsl.pipex.com>
This file is part of Cygwin.
@@ -67,23 +67,23 @@ struct sembuf
*/
struct seminfo
{
- long semmni; /* Maximum number of unique semaphore
+ int32_t semmni; /* Maximum number of unique semaphore
sets, system wide. */
- long semmns; /* Maximum number of semaphores,
+ int32_t semmns; /* Maximum number of semaphores,
system wide. */
- long semmsl; /* Maximum number of semaphores per
+ int32_t semmsl; /* Maximum number of semaphores per
semaphore set. */
- long semopm; /* Maximum number of operations per
+ int32_t semopm; /* Maximum number of operations per
semop call. */
- long semmnu; /* Maximum number of undo structures,
+ int32_t semmnu; /* Maximum number of undo structures,
system wide. */
- long semume; /* Maximum number of undo entries per
+ int32_t semume; /* Maximum number of undo entries per
undo structure. */
- long semvmx; /* Maximum semaphore value. */
- long semaem; /* Maximum adjust-on-exit value. */
- long semmap; /* # of entries in semaphore map */
- long semusz; /* size in bytes of undo structure */
- long sem_spare[2];
+ int32_t semvmx; /* Maximum semaphore value. */
+ int32_t semaem; /* Maximum adjust-on-exit value. */
+ int32_t semmap; /* # of entries in semaphore map */
+ int32_t semusz; /* size in bytes of undo structure */
+ int32_t sem_spare[2];
};
/* Buffer type for semctl (SEM_INFO, ...) as used by ipcs(8).
diff --git a/winsup/cygwin/include/cygwin/shm.h b/winsup/cygwin/include/cygwin/shm.h
index 2c882012c..c58599379 100644
--- a/winsup/cygwin/include/cygwin/shm.h
+++ b/winsup/cygwin/include/cygwin/shm.h
@@ -1,6 +1,6 @@
/* sys/shm.h
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2012, 2013 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
This file is part of Cygwin.
@@ -40,12 +40,12 @@ extern "C"
/* Unsigned integer used for the number of current attaches.
*/
-typedef unsigned int shmatt_t;
+typedef uint32_t shmatt_t;
struct shmid_ds
{
struct ipc_perm shm_perm; /* Operation permission structure. */
- size_t shm_segsz; /* Size of segment in bytes. */
+ uint32_t shm_segsz; /* Size of segment in bytes. */
pid_t shm_lpid; /* Process ID of last operation. */
pid_t shm_cpid; /* Process ID of creator. */
shmatt_t shm_nattch;/* Number of current attaches. */
@@ -69,17 +69,20 @@ struct shmid_ds
*/
struct shminfo
{
- long shmmax; /* Maximum size in bytes of a shared
+ int32_t shmmax; /* Maximum size in bytes of a shared
memory segment. */
- long shmmin; /* Minimum size in bytes of a shared
+ int32_t shmmin; /* Minimum size in bytes of a shared
memory segment. */
- long shmmni; /* Maximum number of shared memory
+ int32_t shmmni; /* Maximum number of shared memory
segments, system wide. */
- long shmseg; /* Maximum number of shared memory
+ int32_t shmseg; /* Maximum number of shared memory
segments attached per process. */
- long shmall; /* Maximum number of bytes of shared
- memory, system wide. */
- long shm_spare[4];
+ int32_t shmall; /* Maximum number of bytes of shared
+ memory, system wide.
+ Note that XSI IPC shared memory allocation is
+ restricted to a bit less than 2 Gigs, even on
+ 64 bit, so using an int32_t here is sufficient. */
+ int32_t shm_spare[4];
};
/* Buffer type for shmctl (SHM_INFO, ...) as used by ipcs(8).
@@ -87,9 +90,9 @@ struct shminfo
struct shm_info
{
#define shm_ids used_ids
- long used_ids; /* Number of allocated segments. */
- long shm_tot; /* Size in bytes of allocated segments. */
- long shm_atts; /* Number of attached segments, system
+ int32_t used_ids; /* Number of allocated segments. */
+ int32_t shm_tot; /* Size in bytes of allocated segments. */
+ int32_t shm_atts; /* Number of attached segments, system
wide. */
};
#endif /* _KERNEL */
diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h
index 268b5eb74..3d74c9c8d 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -12,53 +12,144 @@
#ifndef _CYGWIN_SIGNAL_H
#define _CYGWIN_SIGNAL_H
+#include <bits/wordsize.h>
+
#ifdef __cplusplus
extern "C" {
#endif
+
+#ifdef __x86_64__
+
+struct _uc_fpxreg {
+ __uint16_t significand[4];
+ __uint16_t exponent;
+ __uint16_t padding[3];
+};
+
+struct _uc_xmmreg {
+ __uint32_t element[4];
+};
+
struct _fpstate
{
- unsigned long cw;
- unsigned long sw;
- unsigned long tag;
- unsigned long ipoff;
- unsigned long cssel;
- unsigned long dataoff;
- unsigned long datasel;
- unsigned char _st[80];
- unsigned long nxst;
+ __uint16_t cwd;
+ __uint16_t swd;
+ __uint16_t ftw;
+ __uint16_t fop;
+ __uint64_t rip;
+ __uint64_t rdp;
+ __uint32_t mxcsr;
+ __uint32_t mxcr_mask;
+ struct _uc_fpxreg st[8];
+ struct _uc_xmmreg xmm[16];
+ __uint32_t padding[24];
};
struct ucontext
{
- unsigned long cr2;
- unsigned long dr0;
- unsigned long dr1;
- unsigned long dr2;
- unsigned long dr3;
- unsigned long dr6;
- unsigned long dr7;
+ __uint64_t p1home;
+ __uint64_t p2home;
+ __uint64_t p3home;
+ __uint64_t p4home;
+ __uint64_t p5home;
+ __uint64_t p6home;
+ __uint32_t cr2;
+ __uint32_t mxcsr;
+ __uint16_t cs;
+ __uint16_t ds;
+ __uint16_t es;
+ __uint16_t fs;
+ __uint16_t gs;
+ __uint16_t ss;
+ __uint32_t eflags;
+ __uint64_t dr0;
+ __uint64_t dr1;
+ __uint64_t dr2;
+ __uint64_t dr3;
+ __uint64_t dr6;
+ __uint64_t dr7;
+ __uint64_t rax;
+ __uint64_t rcx;
+ __uint64_t rdx;
+ __uint64_t rbx;
+ __uint64_t rsp;
+ __uint64_t rbp;
+ __uint64_t rsi;
+ __uint64_t rdi;
+ __uint64_t r8;
+ __uint64_t r9;
+ __uint64_t r10;
+ __uint64_t r11;
+ __uint64_t r12;
+ __uint64_t r13;
+ __uint64_t r14;
+ __uint64_t r15;
+ __uint64_t rip;
+ struct _fpstate fpregs;
+ __uint64_t vcx;
+ __uint64_t dbc;
+ __uint64_t btr;
+ __uint64_t bfr;
+ __uint64_t etr;
+ __uint64_t efr;
+ __uint8_t _internal;
+ __uint64_t oldmask;
+};
+
+#else /* !x86_64 */
+
+struct _uc_fpreg
+{
+ __uint16_t significand[4];
+ __uint16_t exponent;
+};
+
+struct _fpstate
+{
+ __uint32_t cw;
+ __uint32_t sw;
+ __uint32_t tag;
+ __uint32_t ipoff;
+ __uint32_t cssel;
+ __uint32_t dataoff;
+ __uint32_t datasel;
+ struct _uc_fpreg _st[8];
+ __uint32_t nxst;
+};
+
+struct ucontext
+{
+ __uint32_t cr2;
+ __uint32_t dr0;
+ __uint32_t dr1;
+ __uint32_t dr2;
+ __uint32_t dr3;
+ __uint32_t dr6;
+ __uint32_t dr7;
struct _fpstate fpstate;
- unsigned long gs;
- unsigned long fs;
- unsigned long es;
- unsigned long ds;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long ebp;
- unsigned long eip;
- unsigned long cs;
- unsigned long eflags;
- unsigned long esp;
- unsigned long ss;
- unsigned char _internal;
- unsigned long oldmask;
+ __uint32_t gs;
+ __uint32_t fs;
+ __uint32_t es;
+ __uint32_t ds;
+ __uint32_t edi;
+ __uint32_t esi;
+ __uint32_t ebx;
+ __uint32_t edx;
+ __uint32_t ecx;
+ __uint32_t eax;
+ __uint32_t ebp;
+ __uint32_t eip;
+ __uint32_t cs;
+ __uint32_t eflags;
+ __uint32_t esp;
+ __uint32_t ss;
+ __uint8_t _internal;
+ __uint32_t oldmask;
};
-#define __COPY_CONTEXT_SIZE ((unsigned) &((struct ucontext *) 0)->_internal)
+#endif /* !x86_64 */
+
+#define __COPY_CONTEXT_SIZE ((size_t) (uintptr_t) &((struct ucontext *) 0)->_internal)
typedef union sigval
{
@@ -208,7 +299,13 @@ enum
perform notification */
};
+#if __WORDSIZE == 64
+typedef __uint64_t sigset_t;
+#else
+/* FIXME: We should probably raise the # of signals for 32 bit as well.
+ Unfortunately this is an ABI change so requires some forethought. */
typedef __uint32_t sigset_t;
+#endif
typedef void (*_sig_func_ptr)(int);
@@ -274,10 +371,15 @@ struct sigaction
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
+#if __WORDSIZE == 64
+#define NSIG 65 /* signal 0 implied */
+#else
+#define NSIG 33 /* signal 0 implied */
+#endif
+
/* Real-Time signals per SUSv3. RT_SIGMAX is defined as 8 in limits.h */
#define SIGRTMIN 32
-#define SIGRTMAX ((SIGRTMIN) + 0)
-#define NSIG 33 /* signal 0 implied */
+#define SIGRTMAX (NSIG - 1)
#define SIG_HOLD ((_sig_func_ptr)2) /* Signal in signal mask */
diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h
index eec7962e8..5ed83bef9 100644
--- a/winsup/cygwin/include/cygwin/socket.h
+++ b/winsup/cygwin/include/cygwin/socket.h
@@ -1,7 +1,7 @@
/* cygwin/socket.h
- Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2012
- Red Hat, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2012,
+ 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -55,8 +55,8 @@ struct sockaddr_storage {
struct ucred {
pid_t pid;
- __uid32_t uid;
- __gid32_t gid;
+ uid_t uid;
+ gid_t gid;
};
struct linger {
@@ -302,6 +302,11 @@ struct OLD_msghdr
#define TCP_MAXSEG 2
#endif
+/* SUS symbolic values for the second parm to shutdown(2) */
+#define SHUT_RD 0 /* == Win32 SD_RECEIVE */
+#define SHUT_WR 1 /* == Win32 SD_SEND */
+#define SHUT_RDWR 2 /* == Win32 SD_BOTH */
+
/* The various priorities. */
#define SOPRI_INTERACTIVE 0
#define SOPRI_NORMAL 1
diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h
index 13c1e3bed..ed96fafd9 100644
--- a/winsup/cygwin/include/cygwin/stat.h
+++ b/winsup/cygwin/include/cygwin/stat.h
@@ -16,7 +16,26 @@ details. */
extern "C" {
#endif
+struct stat
+{
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ timestruc_t st_atim;
+ timestruc_t st_mtim;
+ timestruc_t st_ctim;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ timestruc_t st_birthtim;
+};
+
#if defined (__INSIDE_CYGWIN__) || defined (_COMPILING_NEWLIB)
+#ifndef __x86_64__
struct __stat32
{
__dev16_t st_dev;
@@ -34,49 +53,14 @@ struct __stat32
__blkcnt32_t st_blocks;
long st_spare4[2];
};
+#endif
-struct __stat64
-{
- __dev32_t st_dev;
- __ino64_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- __uid32_t st_uid;
- __gid32_t st_gid;
- __dev32_t st_rdev;
- _off64_t st_size;
- timestruc_t st_atim;
- timestruc_t st_mtim;
- timestruc_t st_ctim;
- blksize_t st_blksize;
- __blkcnt64_t st_blocks;
- timestruc_t st_birthtim;
-};
-
-extern int fstat64 (int fd, struct __stat64 *buf);
-extern int stat64 (const char *file_name, struct __stat64 *buf);
-extern int lstat64 (const char *file_name, struct __stat64 *buf);
+extern int fstat64 (int fd, struct stat *buf);
+extern int stat64 (const char *file_name, struct stat *buf);
+extern int lstat64 (const char *file_name, struct stat *buf);
#endif
-struct stat
-{
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
- off_t st_size;
- timestruc_t st_atim;
- timestruc_t st_mtim;
- timestruc_t st_ctim;
- blksize_t st_blksize;
- blkcnt_t st_blocks;
- timestruc_t st_birthtim;
-};
-
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h
index 7159368f9..3abe00ef3 100644
--- a/winsup/cygwin/include/cygwin/stdlib.h
+++ b/winsup/cygwin/include/cygwin/stdlib.h
@@ -1,6 +1,6 @@
/* stdlib.h
- Copyright 2005, 2006, 2007, 2008, 2009, 2011 Red Hat Inc.
+ Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2013 Red Hat Inc.
This file is part of Cygwin.
@@ -18,6 +18,12 @@ extern "C"
{
#endif
+__uint32_t arc4random(void);
+void arc4random_addrandom(unsigned char *, int);
+void arc4random_buf(void *, size_t);
+void arc4random_stir(void);
+__uint32_t arc4random_uniform(__uint32_t);
+
const char *getprogname (void);
void setprogname (const char *);
diff --git a/winsup/cygwin/include/cygwin/sysproto.h b/winsup/cygwin/include/cygwin/sysproto.h
index 3d183a94b..838555002 100644
--- a/winsup/cygwin/include/cygwin/sysproto.h
+++ b/winsup/cygwin/include/cygwin/sysproto.h
@@ -1,6 +1,6 @@
/* cygwin/sysproto.h
- Copyright 2003, 2005 Red Hat, Inc.
+ Copyright 2003, 2005, 2012, 2013 Red Hat, Inc.
This file is part of Cygwin.
diff --git a/winsup/cygwin/include/cygwin/time.h b/winsup/cygwin/include/cygwin/time.h
index d1b7670bc..3dbc372a3 100644
--- a/winsup/cygwin/include/cygwin/time.h
+++ b/winsup/cygwin/include/cygwin/time.h
@@ -26,10 +26,10 @@ time_t __cdecl timegm (struct tm *);
#ifndef __STRICT_ANSI__
-extern int daylight __asm__ ("__daylight");
+extern int daylight __asm__ (_SYMSTR (_daylight));
#ifndef __timezonefunc__
-extern long timezone __asm__ ("__timezone");
+extern long timezone __asm__ (_SYMSTR (_timezone));
#endif
#endif /*__STRICT_ANSI__*/
diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h
index cbb4b4492..54c0c5ba5 100644
--- a/winsup/cygwin/include/cygwin/types.h
+++ b/winsup/cygwin/include/cygwin/types.h
@@ -19,6 +19,7 @@ extern "C"
#include <stdint.h>
#include <endian.h>
+#include <bits/wordsize.h>
#ifndef __timespec_t_defined
#define __timespec_t_defined
@@ -32,68 +33,72 @@ typedef struct timespec timestruc_t;
#ifndef __off_t_defined
#define __off_t_defined
+/* Based on the newlib definitions. */
+#if __WORDSIZE == 64
+typedef _off_t off_t;
+#else
typedef _off64_t off_t;
+#endif
#endif /*__off_t_defined*/
typedef __loff_t loff_t;
#ifndef __dev_t_defined
#define __dev_t_defined
-typedef short __dev16_t;
-typedef unsigned long __dev32_t;
-typedef __dev32_t dev_t;
+typedef __int16_t __dev16_t;
+typedef __uint32_t dev_t;
#endif /*__dev_t_defined*/
#ifndef __blksize_t_defined
#define __blksize_t_defined
-typedef long blksize_t;
+typedef __int32_t blksize_t;
#endif /*__blksize_t_defined*/
#ifndef __blkcnt_t_defined
#define __blkcnt_t_defined
-typedef long __blkcnt32_t;
-typedef long long __blkcnt64_t;
-typedef __blkcnt64_t blkcnt_t;
+typedef __int32_t __blkcnt32_t;
+typedef __int64_t blkcnt_t;
#endif /*__blkcnt_t_defined*/
#ifndef __fsblkcnt_t_defined
#define __fsblkcnt_t_defined
+/* Keep as is. 32 bit on i386, 64 bit on x86_64. */
typedef unsigned long fsblkcnt_t;
#endif /* __fsblkcnt_t_defined */
#ifndef __fsfilcnt_t_defined
#define __fsfilcnt_t_defined
+/* Keep as is. 32 bit on i386, 64 bit on x86_64. */
typedef unsigned long fsfilcnt_t;
#endif /* __fsfilcnt_t_defined */
#ifndef __uid_t_defined
#define __uid_t_defined
typedef unsigned short __uid16_t;
-typedef unsigned long __uid32_t;
-typedef __uid32_t uid_t;
+typedef __uint32_t uid_t;
#endif /*__uid_t_defined*/
#ifndef __gid_t_defined
#define __gid_t_defined
typedef unsigned short __gid16_t;
-typedef unsigned long __gid32_t;
-typedef __gid32_t gid_t;
+typedef __uint32_t gid_t;
#endif /*__gid_t_defined*/
#ifndef __ino_t_defined
#define __ino_t_defined
-typedef unsigned long __ino32_t;
-typedef unsigned long long __ino64_t;
-typedef __ino64_t ino_t;
+#ifndef __x86_64__
+typedef __uint32_t __ino32_t;
+#endif
+typedef __uint64_t ino_t;
#endif /*__ino_t_defined*/
/* Generic ID type, must match at least pid_t, uid_t and gid_t in size. */
#ifndef __id_t_defined
#define __id_t_defined
-typedef unsigned long id_t;
+typedef __uint32_t id_t;
#endif /* __id_t_defined */
-#if defined (__INSIDE_CYGWIN__)
+#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 */
@@ -102,14 +107,6 @@ struct __flock32 {
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
};
-
-struct __flock64 {
- short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
- short l_whence; /* flag to choose starting offset */
- _off64_t l_start; /* relative offset, in bytes */
- _off64_t l_len; /* length, in bytes; 0 means lock to EOF */
- pid_t l_pid; /* returned with F_GETLK */
-};
#endif
struct flock {
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 7284c58ef..77c684242 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -1,7 +1,7 @@
/* version.h -- Cygwin version numbers and accompanying documentation.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
+ 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@@ -432,12 +432,16 @@ details. */
261: Export memrchr.
262: Export getmntent_r.
263: Export cfsetspeed.
+ 264: Consistently export strtold
+ 265: Export __b64_ntop, __b64_pton.
+ 266: Export arc4random, arc4random_addrandom, arc4random_buf,
+ arc4random_stir, arc4random_uniform.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 263
+#define CYGWIN_VERSION_API_MINOR 266
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
diff --git a/winsup/cygwin/include/fcntl.h b/winsup/cygwin/include/fcntl.h
index 9c3ddf926..fe8a1fc42 100644
--- a/winsup/cygwin/include/fcntl.h
+++ b/winsup/cygwin/include/fcntl.h
@@ -1,6 +1,6 @@
/* fcntl.h
- Copyright 1996, 1998, 2000, 2001, 2005, 2006, 2009, 2010 Red Hat, Inc.
+ Copyright 1996, 1998, 2000, 2001, 2005, 2006, 2009, 2010, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -14,12 +14,29 @@ details. */
#include <sys/fcntl.h>
#define O_NDELAY _FNDELAY
-/* sys/fcntl defines values up to 0x40000 (O_NOINHERIT). */
+/* sys/_default_fcntl.h defines values up to 0x40000 (O_NOINHERIT). */
#define _FDIRECT 0x80000
#define _FNOFOLLOW 0x100000
#define _FDIRECTORY 0x200000
#define _FEXECSRCH 0x400000
+/* F_LCK_MANDATORY: Request mandatory locks for this file descriptor.
+
+ Cygwin extension to fcntl file locking mechanism. By default, fcntl file
+ locks are advisory locks. This works nicely as long as only Cygwin
+ processes interact. If you have the requirement to interact with native
+ Windows applications which use Windows mandatory file locking, your have
+ to use mandatory locking as well. The command
+
+ fcntl (fd, F_LCK_MANDATORY, 1)
+
+ switches subsequent F_GETLK, F_SETLK, F_SETLKW calls to mandatory locking
+ for this file descriptor and subsequently duplicated ones WITHIN THE SAME
+ PROCESS. Note that mandatory locks are NOT inherited by child processes,
+ nor do they survive an execve call. This fully corresponds to Windows
+ mandatory locking semantics. */
+#define F_LCK_MANDATORY 0x99
+
/* POSIX-1.2008 requires this flag and allows to set it to 0 if its
functionality is not required. */
#define O_TTY_INIT 0
diff --git a/winsup/cygwin/include/fts.h b/winsup/cygwin/include/fts.h
index d4900bb24..57e9096b4 100644
--- a/winsup/cygwin/include/fts.h
+++ b/winsup/cygwin/include/fts.h
@@ -41,7 +41,7 @@ typedef struct {
struct _ftsent *fts_cur; /* current node */
struct _ftsent *fts_child; /* linked list of children */
struct _ftsent **fts_array; /* sort array */
- __dev32_t fts_dev; /* starting device # */
+ dev_t fts_dev; /* starting device # */
char *fts_path; /* path for this descent */
int fts_rfd; /* fd for root */
int fts_pathlen; /* sizeof(path) */
@@ -88,8 +88,8 @@ typedef struct _ftsent {
u_short fts_pathlen; /* strlen(fts_path) */
u_short fts_namelen; /* strlen(fts_name) */
- __ino64_t fts_ino; /* inode */
- __dev32_t fts_dev; /* device */
+ ino_t fts_ino; /* inode */
+ dev_t fts_dev; /* device */
nlink_t fts_nlink; /* link count */
#define FTS_ROOTPARENTLEVEL -1
@@ -123,11 +123,7 @@ typedef struct _ftsent {
#define FTS_SKIP 4 /* discard node */
u_short fts_instr; /* fts_set() instructions */
-#ifdef __INSIDE_CYGWIN__
- struct __stat64 *fts_statp; /* stat(2) information */
-#else
struct stat *fts_statp; /* stat(2) information */
-#endif
char *fts_name; /* file name */
FTS *fts_fts; /* back pointer to main FTS */
} FTSENT;
diff --git a/winsup/cygwin/include/ftw.h b/winsup/cygwin/include/ftw.h
index 4f53bf5d6..c0025a7c6 100644
--- a/winsup/cygwin/include/ftw.h
+++ b/winsup/cygwin/include/ftw.h
@@ -55,15 +55,9 @@ struct FTW {
};
__BEGIN_DECLS
-#ifdef __INSIDE_CYGWIN__
-int ftw(const char *, int (*)(const char *, const struct __stat64 *, int), int);
-int nftw(const char *, int (*)(const char *, const struct __stat64 *, int,
- struct FTW *), int, int);
-#else
int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
int nftw(const char *, int (*)(const char *, const struct stat *, int,
struct FTW *), int, int);
-#endif
__END_DECLS
#endif /* !_FTW_H */
diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h
index 93f2d7e94..35745196b 100644
--- a/winsup/cygwin/include/glob.h
+++ b/winsup/cygwin/include/glob.h
@@ -61,14 +61,8 @@ typedef struct {
void (*gl_closedir)(void *);
struct dirent *(*gl_readdir)(void *);
void *(*gl_opendir)(const char *);
-#if defined (__INSIDE_CYGWIN__)
- int (*gl_lstat) __P((const char *, struct __stat64 *));
- int (*gl_stat) __P((const char *, struct __stat64 *));
-#else
-
int (*gl_lstat) __P((const char *, struct stat *));
int (*gl_stat) __P((const char *, struct stat *));
-#endif
} glob_t;
/* Believed to have been introduced in 1003.2-1992 */
diff --git a/winsup/cygwin/include/inttypes.h b/winsup/cygwin/include/inttypes.h
index cc1d8970a..eb60e79e4 100644
--- a/winsup/cygwin/include/inttypes.h
+++ b/winsup/cygwin/include/inttypes.h
@@ -14,13 +14,14 @@ details. */
#include <stdint.h>
#define __need_wchar_t
#include <stddef.h>
+#include <bits/wordsize.h>
/* C99 requires that in C++ the following macros should be defined only
if requested. */
#if !defined (__cplusplus) || defined (__STDC_FORMAT_MACROS) \
|| defined (__INSIDE_CYGWIN__)
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define __PRI64 "l"
#define __PRIFAST "l"
#define __PRIPTR "l"
@@ -144,7 +145,7 @@ details. */
/* fscanf() macros for signed integers */
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define __SCN64 "l"
#define __SCNFAST "l"
#define __SCNPTR "l"
diff --git a/winsup/cygwin/include/io.h b/winsup/cygwin/include/io.h
index de9f39e0a..517f871fe 100644
--- a/winsup/cygwin/include/io.h
+++ b/winsup/cygwin/include/io.h
@@ -18,9 +18,10 @@ extern "C" {
/*
* Function to return a Win32 HANDLE from a fd.
*/
-extern long get_osfhandle(int);
-extern int setmode (int __fd, int __mode);
-int access(const char *__path, int __amode);
+extern long _get_osfhandle(int);
+#define get_osfhandle(i) _get_osfhandle(i)
+extern int _setmode (int __fd, int __mode);
+#define setmode(f,m) _setmode((f),(m))
#ifdef __cplusplus
};
diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h
index 20723ab1d..e093d283d 100644
--- a/winsup/cygwin/include/limits.h
+++ b/winsup/cygwin/include/limits.h
@@ -1,7 +1,7 @@
/* limits.h
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2011, 2012 Red Hat, Inc.
+ 2011, 2012, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -12,6 +12,7 @@ details. */
#ifndef _LIMITS_H___
#include <features.h>
+#include <bits/wordsize.h>
#ifndef _MACH_MACHLIMITS_H_
@@ -24,15 +25,15 @@ details. */
/* Number of bits in a `char'. */
#undef CHAR_BIT
-#define CHAR_BIT 8
+#define CHAR_BIT __CHAR_BIT__
/* Number of bits in a `long'. */
#undef LONG_BIT
-#define LONG_BIT 32
+#define LONG_BIT (__SIZEOF_LONG__ * __CHAR_BIT__)
/* Number of bits in a `int'. */
#undef WORD_BIT
-#define WORD_BIT 32
+#define WORD_BIT (__SIZEOF_INT__ * __CHAR_BIT__)
/* Maximum length of a multibyte character. */
#ifndef MB_LEN_MAX
@@ -89,14 +90,14 @@ details. */
/* Minimum and maximum values a `signed long int' can hold.
(Same as `int'). */
#ifndef __LONG_MAX__
-#ifndef __alpha__
-#define __LONG_MAX__ 2147483647L
-#else
+#if __WORDSIZE == 64
#define __LONG_MAX__ 9223372036854775807L
+#else
+#define __LONG_MAX__ 2147483647L
# endif /* __alpha__ */
#endif
#undef LONG_MIN
-#define LONG_MIN (-LONG_MAX-1)
+#define LONG_MIN (-LONG_MAX-1L)
#undef LONG_MAX
#define LONG_MAX __LONG_MAX__
@@ -221,9 +222,9 @@ details. */
#define PTHREAD_DESTRUCTOR_ITERATIONS 1
/* Maximum number of data keys that can be created by a process. */
-/* Tls has 64 items for pre win2000 - and we don't want to use them all :] */
+/* Tls has 1088 items - and we don't want to use them all :] */
#undef PTHREAD_KEYS_MAX
-#define PTHREAD_KEYS_MAX 32
+#define PTHREAD_KEYS_MAX 1024
/* Minimum size in bytes of thread stack storage. */
/* Actually the minimum stack size is somewhat of a split personality.
@@ -242,9 +243,14 @@ details. */
/* #define PTHREAD_THREADS_MAX unspecified */
/* Maximum number of realtime signals reserved for application use. */
-/* FIXME: We only support one realtime signal but _POSIX_RTSIG_MAX is 8. */
+/* FIXME: We only support one realtime signal in 32 bit mode, but
+ _POSIX_RTSIG_MAX is 8. */
#undef RTSIG_MAX
+#if __WORDSIZE == 64
+#define RTSIG_MAX 33
+#else
#define RTSIG_MAX 1
+#endif
/* Maximum number of semaphores that a process may have. */
/* Windows allows any arbitrary number of semaphores per process. */
diff --git a/winsup/cygwin/include/mntent.h b/winsup/cygwin/include/mntent.h
index db87904ef..5a0c13054 100644
--- a/winsup/cygwin/include/mntent.h
+++ b/winsup/cygwin/include/mntent.h
@@ -33,9 +33,7 @@ struct mntent *getmntent_r (FILE *, struct mntent *, char *, int);
int endmntent (FILE *__filep);
#endif
-#ifdef __CYGWIN__
-/* Only include paths.h if building for Cygwin. This avoids including
- newlib headers when building the native tools in winsup/utils. */
+#ifndef _NOMNTENT_MACROS
#include <paths.h>
@@ -52,7 +50,7 @@ int endmntent (FILE *__filep);
#define MOUNTED _PATH_MOUNTED
#endif
-#endif /* __CYGWIN__ */
+#endif /* !_NOMNTENT_MACROS */
#ifdef __cplusplus
};
diff --git a/winsup/cygwin/include/stdint.h b/winsup/cygwin/include/stdint.h
index 3c8a50d83..b670884a7 100644
--- a/winsup/cygwin/include/stdint.h
+++ b/winsup/cygwin/include/stdint.h
@@ -11,6 +11,8 @@ details. */
#ifndef _STDINT_H
#define _STDINT_H
+#include <bits/wordsize.h>
+
/* Exact-width integer types */
#ifndef __int8_t_defined
@@ -18,7 +20,7 @@ details. */
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef long int64_t;
#else
typedef long long int64_t;
@@ -31,7 +33,7 @@ typedef unsigned short uint16_t;
#define __uint32_t_defined
typedef unsigned int uint32_t;
#endif
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef unsigned long uint64_t;
#else
typedef unsigned long long uint64_t;
@@ -42,7 +44,7 @@ typedef unsigned long long uint64_t;
typedef signed char int_least8_t;
typedef short int_least16_t;
typedef int int_least32_t;
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef long int_least64_t;
#else
typedef long long int_least64_t;
@@ -51,7 +53,7 @@ typedef long long int_least64_t;
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef unsigned long uint_least64_t;
#else
typedef unsigned long long uint_least64_t;
@@ -60,7 +62,7 @@ typedef unsigned long long uint_least64_t;
/* Fastest minimum-width integer types */
typedef signed char int_fast8_t;
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef long int_fast16_t;
typedef long int_fast32_t;
typedef long int_fast64_t;
@@ -71,7 +73,7 @@ typedef long long int_fast64_t;
#endif
typedef unsigned char uint_fast8_t;
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef unsigned long uint_fast16_t;
typedef unsigned long uint_fast32_t;
typedef unsigned long uint_fast64_t;
@@ -85,13 +87,13 @@ typedef unsigned long long uint_fast64_t;
#ifndef __intptr_t_defined
#define __intptr_t_defined
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef long intptr_t;
#else
typedef int intptr_t;
#endif
#endif
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef unsigned long uintptr_t;
#else
typedef unsigned int uintptr_t;
@@ -99,7 +101,7 @@ typedef unsigned int uintptr_t;
/* Greatest-width integer types */
-#ifdef __x86_64__
+#if __WORDSIZE == 64
typedef long intmax_t;
typedef unsigned long uintmax_t;
#else
@@ -157,7 +159,7 @@ typedef unsigned long long uintmax_t;
/* Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN (-128)
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define INT_FAST16_MIN (-__I64(9223372036854775807) - 1)
#define INT_FAST32_MIN (-__I64(9223372036854775807) - 1)
#else
@@ -167,7 +169,7 @@ typedef unsigned long long uintmax_t;
#define INT_FAST64_MIN (-__I64(9223372036854775807) - 1)
#define INT_FAST8_MAX (127)
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define INT_FAST16_MAX (__I64(9223372036854775807))
#define INT_FAST32_MAX (__I64(9223372036854775807))
#else
@@ -177,7 +179,7 @@ typedef unsigned long long uintmax_t;
#define INT_FAST64_MAX (__I64(9223372036854775807))
#define UINT_FAST8_MAX (255)
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define UINT_FAST16_MAX (__U64(18446744073709551615))
#define UINT_FAST32_MAX (__U64(18446744073709551615))
#else
@@ -188,9 +190,9 @@ typedef unsigned long long uintmax_t;
/* Limits of integer types capable of holding object pointers */
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define INTPTR_MIN (-__I64(9223372036854775807) - 1)
-#define INTPTR_MAX (__I64(9223372036854775807)
+#define INTPTR_MAX (__I64(9223372036854775807))
#define UINTPTR_MAX (__U64(18446744073709551615))
#else
#define INTPTR_MIN (-2147483647 - 1)
@@ -207,7 +209,7 @@ typedef unsigned long long uintmax_t;
/* Limits of other integer types */
#ifndef PTRDIFF_MIN
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define PTRDIFF_MIN (-9223372036854775807L - 1)
#define PTRDIFF_MAX (9223372036854775807L)
#else
@@ -224,7 +226,7 @@ typedef unsigned long long uintmax_t;
#endif
#ifndef SIZE_MAX
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define SIZE_MAX (18446744073709551615UL)
#else
#define SIZE_MAX (4294967295U)
@@ -258,7 +260,7 @@ typedef unsigned long long uintmax_t;
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define INT64_C(x) x ## L
#else
#define INT64_C(x) x ## LL
@@ -267,7 +269,7 @@ typedef unsigned long long uintmax_t;
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## U
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define UINT64_C(x) x ## UL
#else
#define UINT64_C(x) x ## ULL
@@ -275,7 +277,7 @@ typedef unsigned long long uintmax_t;
/* Macros for greatest-width integer constant expressions */
-#ifdef __x86_64__
+#if __WORDSIZE == 64
#define INTMAX_C(x) x ## L
#define UINTMAX_C(x) x ## UL
#else
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
index ac7b2336a..354d0eb4c 100644
--- a/winsup/cygwin/include/sys/cygwin.h
+++ b/winsup/cygwin/include/sys/cygwin.h
@@ -1,7 +1,7 @@
/* sys/cygwin.h
Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010, 2011, 2012 Red Hat, Inc.
+ 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -14,6 +14,7 @@ details. */
#include <sys/types.h>
#include <limits.h>
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -21,8 +22,9 @@ extern "C" {
#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
+#ifndef __x86_64__
/* DEPRECATED INTERFACES. These are restricted to MAX_PATH length.
- Don't use in modern applications. */
+ Don't use in modern applications. They don't exist on x86_64. */
extern int cygwin_win32_to_posix_path_list (const char *, char *)
__attribute__ ((deprecated));
extern int cygwin_win32_to_posix_path_list_buf_size (const char *)
@@ -39,6 +41,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__ */
/* Use these interfaces in favor of the above. */
@@ -200,7 +203,7 @@ CW_TOKEN_RESTRICTED = 1
};
#define CW_NEXTPID 0x80000000 /* or with pid to get next one */
-unsigned long cygwin_internal (cygwin_getinfo_types, ...);
+uintptr_t cygwin_internal (cygwin_getinfo_types, ...);
/* Flags associated with process_state */
enum
@@ -255,12 +258,14 @@ struct per_process
/* The offset of these 3 values can never change. */
/* magic_biscuit is the size of this class and should never change. */
- unsigned long magic_biscuit;
- unsigned long dll_major;
- unsigned long dll_minor;
+ uint32_t magic_biscuit;
+ uint32_t dll_major;
+ uint32_t dll_minor;
struct _reent **impure_ptr_ptr;
+#ifndef __x86_64__
char ***envptr;
+#endif
/* Used to point to the memory machine we should use. Usually these
point back into the dll, but they can be overridden by the user. */
@@ -284,10 +289,10 @@ struct per_process
/* For future expansion of values set by the app. */
void (*premain[4]) (int, char **, struct per_process *);
- /* non-zero of ctors have been run. Inherited from parent. */
- int run_ctors_p;
+ /* non-zero if ctors have been run. Inherited from parent. */
+ int32_t run_ctors_p;
- DWORD unused[7];
+ DWORD_PTR unused[7];
/* Pointers to real operator new/delete functions for forwarding. */
struct per_process_cxx_malloc *cxx_malloc;
@@ -298,7 +303,11 @@ struct per_process
DWORD api_minor; /* linked with */
/* For future expansion, so apps won't have to be relinked if we
add an item. */
- DWORD unused2[3];
+#ifdef __x86_64__
+ DWORD_PTR unused2[5];
+#else
+ DWORD_PTR unused2[3];
+#endif
void *pseudo_reloc_start;
void *pseudo_reloc_end;
void *image_base;
@@ -310,7 +319,7 @@ struct per_process
#endif
struct _reent *impure_ptr;
};
-#define per_process_overwrite ((unsigned) &(((struct per_process *) NULL)->threadinterface))
+#define per_process_overwrite offsetof (struct per_process, threadinterface)
#ifdef _PATH_PASSWD
extern HANDLE cygwin_logon_user (const struct passwd *, const char *);
@@ -335,11 +344,11 @@ 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 _SYS_TYPES_H
-typedef unsigned short __uid16_t;
-typedef unsigned short __gid16_t;
-typedef unsigned long __uid32_t;
-typedef unsigned long __gid32_t;
+#ifndef __uid_t_defined
+typedef __uint16_t __uid16_t;
+typedef __uint16_t __gid16_t;
+typedef __uint32_t uid_t;
+typedef __uint32_t gid_t;
#endif
struct external_pinfo
@@ -367,8 +376,8 @@ struct external_pinfo
DWORD process_state;
/* Only available if version >= EXTERNAL_PINFO_VERSION_32_BIT */
- __uid32_t uid32;
- __gid32_t gid32;
+ uid_t uid32;
+ gid_t gid32;
/* Only available if version >= EXTERNAL_PINFO_VERSION_32_LP */
char *progname_long;
diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h
index bcb1a2488..027fa8f73 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -1,6 +1,7 @@
/* Posix dirent.h for WIN32.
- Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2010, 2012 Red Hat, Inc.
+ Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2010, 2012,
+ 2013 Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@@ -16,38 +17,50 @@
#define __DIRENT_VERSION 2
+#ifndef __x86_64__
#pragma pack(push,4)
+#endif
#define _DIRENT_HAVE_D_TYPE
struct dirent
{
- long __d_version; /* Used internally */
- __ino64_t d_ino;
+ uint32_t __d_version; /* Used internally */
+ ino_t d_ino;
unsigned char d_type;
unsigned char __d_unused1[3];
__uint32_t __d_internal1;
char d_name[NAME_MAX + 1];
};
+#ifndef __x86_64__
#pragma pack(pop)
+#endif
#define d_fileno d_ino /* BSD compatible definition */
+#ifdef __x86_64__
+#define __DIRENT_COOKIE 0xcdcd8484
+#else
#define __DIRENT_COOKIE 0xdede4242
+#endif
+#ifndef __x86_64__
#pragma pack(push,4)
+#endif
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 '*' */
- long __d_position; /* used by telldir/seekdir */
+ __int32_t __d_position; /* used by telldir/seekdir */
int __d_fd;
- unsigned __d_internal;
+ uintptr_t __d_internal;
void *__handle;
void *__fh;
unsigned __flags;
} DIR;
+#ifndef __x86_64__
#pragma pack(pop)
+#endif
DIR *opendir (const char *);
DIR *fdopendir (int);
diff --git a/winsup/cygwin/include/sys/resource.h b/winsup/cygwin/include/sys/resource.h
index d487a272d..d9419d150 100644
--- a/winsup/cygwin/include/sys/resource.h
+++ b/winsup/cygwin/include/sys/resource.h
@@ -34,7 +34,7 @@ extern "C" {
#define RLIMIT_NLIMITS 7 /* upper bound of RLIMIT_* defines */
#define RLIM_NLIMITS RLIMIT_NLIMITS
-#define RLIM_INFINITY (0xffffffffUL)
+#define RLIM_INFINITY (~0UL)
#define RLIM_SAVED_MAX RLIM_INFINITY
#define RLIM_SAVED_CUR RLIM_INFINITY
diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h
index 8a16be822..2d66abb26 100644
--- a/winsup/cygwin/include/sys/socket.h
+++ b/winsup/cygwin/include/sys/socket.h
@@ -1,7 +1,7 @@
/* sys/socket.h
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2009, 2010
- Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2009, 2010,
+ 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -21,11 +21,6 @@ extern "C"
{
#endif
-/* SUS symbolic values for the second parm to shutdown(2) */
-#define SHUT_RD 0 /* == Win32 SD_RECEIVE */
-#define SHUT_WR 1 /* == Win32 SD_SEND */
-#define SHUT_RDWR 2 /* == Win32 SD_BOTH */
-
#ifndef __INSIDE_CYGWIN_NET__
int accept (int, struct sockaddr *__peer, socklen_t *);
int accept4 (int, struct sockaddr *__peer, socklen_t *, int flags);
diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h
index c58b45cda..164af1e50 100644
--- a/winsup/cygwin/include/sys/strace.h
+++ b/winsup/cygwin/include/sys/strace.h
@@ -1,7 +1,7 @@
/* sys/strace.h
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
- 2010, 2011 Red Hat, Inc.
+ 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@@ -29,6 +29,7 @@ details. */
#define _SYS_STRACE_H
#include <stdarg.h>
+#include <sys/types.h>
#ifdef __cplusplus
@@ -49,7 +50,7 @@ public:
void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((regparm(3)))*/;
void vprntf (unsigned, const char *func, const char *, va_list ap) /*__attribute__ ((regparm(3)))*/;
void wm (int message, int word, int lon) __attribute__ ((regparm(3)));
- void write_childpid (unsigned long) __attribute__ ((regparm (3)));
+ void write_childpid (pid_t) __attribute__ ((regparm (3)));
bool attached () const {return _active == 3;}
bool active () const {return _active & 1;}
unsigned char& active_val () {return _active;}