diff options
Diffstat (limited to 'winsup/cygwin/winsup.h')
-rw-r--r-- | winsup/cygwin/winsup.h | 77 |
1 files changed, 59 insertions, 18 deletions
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index e40dfb68a..18aaf8a9e 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -1,6 +1,6 @@ /* winsup.h: main Cygwin header file. - Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. This file is part of Cygwin. @@ -14,7 +14,6 @@ details. */ #define __INSIDE_CYGWIN__ -#define alloca __builtin_alloca #define strlen __builtin_strlen #define strcmp __builtin_strcmp #define strcpy __builtin_strcpy @@ -24,7 +23,7 @@ details. */ # define memset __builtin_memset #endif -#define NO_COPY __attribute__((section(".data_cygwin_nocopy"))) +#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy"))) #ifdef __cplusplus @@ -32,6 +31,10 @@ details. */ #define NEW_MACRO_VARARGS #endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#endif + #include <sys/types.h> #include <sys/strace.h> @@ -69,15 +72,18 @@ extern "C" DWORD WINAPI GetLastError (void); enum codepage_type {ansi_cp, oem_cp}; extern codepage_type current_codepage; -extern int cygserver_running; +UINT get_cp (); + +int __stdcall sys_wcstombs(char *, const WCHAR *, int) + __attribute__ ((regparm(3))); + +int __stdcall sys_mbstowcs(WCHAR *, const char *, int) + __attribute__ ((regparm(3))); /* Used to check if Cygwin DLL is dynamically loaded. */ extern int dynamically_loaded; -#define sys_wcstombs(tgt,src,len) \ - WideCharToMultiByte((current_codepage==ansi_cp?CP_ACP:CP_OEMCP),0,(src),-1,(tgt),(len),NULL,NULL) -#define sys_mbstowcs(tgt,src,len) \ - MultiByteToWideChar((current_codepage==ansi_cp?CP_ACP:CP_OEMCP),0,(src),-1,(tgt),(len)) +extern int cygserver_running; #define TITLESIZE 1024 @@ -141,11 +147,25 @@ extern "C" void __stdcall do_exit (int) __attribute__ ((noreturn)); /* UID/GID */ void uinfo_init (void); +#define ILLEGAL_UID16 ((__uid16_t)-1) +#define ILLEGAL_UID ((__uid32_t)-1) +#define ILLEGAL_GID16 ((__gid16_t)-1) +#define ILLEGAL_GID ((__gid32_t)-1) +#define ILLEGAL_SEEK ((__off64_t)-1) + +#define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(__uid32_t)(u16)) +#define gid16togid32(g16) ((g16)==ILLEGAL_GID16?ILLEGAL_GID:(__gid32_t)(g16)) + +extern "C" __uid32_t getuid32 (void); +extern "C" __uid32_t geteuid32 (void); +extern "C" struct passwd *getpwuid32 (__uid32_t); + /* various events */ void events_init (void); void events_terminate (void); void __stdcall close_all_files (void); +BOOL __stdcall check_pty_fds (void); /* Invisible window initialization/termination. */ HWND __stdcall gethwnd (void); @@ -170,7 +190,7 @@ extern int cygwin_finished_initializing; void __stdcall set_std_handle (int); int __stdcall writable_directory (const char *file); -int __stdcall stat_dev (DWORD, int, unsigned long, struct stat *); +int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *); extern BOOL allow_ntsec; unsigned long __stdcall hash_path_name (unsigned long hash, const char *name) __attribute__ ((regparm(2))); @@ -186,20 +206,29 @@ extern "C" char *__stdcall strcasestr (const char *searchee, const char *lookfor /* Time related */ void __stdcall totimeval (struct timeval *dst, FILETIME * src, int sub, int flag); long __stdcall to_time_t (FILETIME * ptr); +void __stdcall to_timestruc_t (FILETIME * ptr, timestruc_t * out); +void __stdcall time_as_timestruc_t (timestruc_t * out); void __stdcall set_console_title (char *); -void set_console_handler (); +void early_stuff_init (); +int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1))); int __stdcall check_null_empty_str (const char *name) __attribute__ ((regparm(1))); int __stdcall check_null_empty_str_errno (const char *name) __attribute__ ((regparm(1))); -int __stdcall __check_null_invalid_struct (const void *s, unsigned sz) __attribute__ ((regparm(1))); -int __stdcall __check_null_invalid_struct_errno (const void *s, unsigned sz) __attribute__ ((regparm(1))); +int __stdcall check_null_str_errno (const char *name) __attribute__ ((regparm(1))); +int __stdcall __check_null_invalid_struct (void *s, unsigned sz) __attribute__ ((regparm(2))); +int __stdcall __check_null_invalid_struct_errno (void *s, unsigned sz) __attribute__ ((regparm(2))); +int __stdcall __check_invalid_read_ptr_errno (const void *s, unsigned sz) __attribute__ ((regparm(2))); #define check_null_invalid_struct(s) \ - __check_null_invalid ((s), sizeof (*(s))) + __check_null_invalid_struct ((s), sizeof (*(s))) #define check_null_invalid_struct_errno(s) \ __check_null_invalid_struct_errno ((s), sizeof (*(s))) +struct iovec; +ssize_t check_iovec_for_read (const struct iovec *, int) __attribute__ ((regparm(2))); +ssize_t check_iovec_for_write (const struct iovec *, int) __attribute__ ((regparm(2))); + #define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__) void __set_winsock_errno (const char *fn, int ln) __attribute__ ((regparm(2))); @@ -209,12 +238,11 @@ extern bool wsock_started; extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn)); extern "C" int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/; extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/; +extern void multiple_cygwin_problem (const char *, unsigned, unsigned); -extern "C" void __malloc_lock (struct _reent *); -extern "C" void __malloc_unlock (struct _reent *); - -extern "C" void __malloc_lock (struct _reent *); -extern "C" void __malloc_unlock (struct _reent *); +class path_conv; +int __stdcall stat_worker (const char *name, struct __stat64 *buf, int nofollow, + path_conv *pc = NULL) __attribute__ ((regparm (3))); /**************************** Exports ******************************/ @@ -250,6 +278,9 @@ extern SYSTEM_INFO system_info; #define STD_RBITS (S_IRUSR | S_IRGRP | S_IROTH) #define STD_WBITS (S_IWUSR) #define STD_XBITS (S_IXUSR | S_IXGRP | S_IXOTH) +#define NO_W ~(S_IWUSR | S_IWGRP | S_IWOTH) +#define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH) +#define NO_X ~(S_IXUSR | S_IXGRP | S_IXOTH) /* The title on program start. */ extern char *old_title; @@ -258,4 +289,14 @@ extern BOOL display_title; extern HANDLE hMainThread; extern HANDLE hMainProc; +extern bool cygwin_testing; +extern unsigned _cygwin_testing_magic; +extern HMODULE cygwin_hmodule; + +extern char almost_null[]; + +#define winsock2_active (wsadata.wVersion >= 512) +#define winsock_active (wsadata.wVersion < 512) +extern struct WSAData wsadata; + #endif /* defined __cplusplus */ |