2000-02-17 20:38:33 +01:00
|
|
|
/* winsup.h: main Cygwin header file.
|
|
|
|
|
2005-02-20 05:25:33 +01:00
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
2011-02-22 10:17:57 +01:00
|
|
|
2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
2004-01-14 16:45:37 +01:00
|
|
|
#ifdef DEBUGIT
|
|
|
|
#define spf(a, b, c) small_printf (a, b, c)
|
|
|
|
#else
|
|
|
|
#define spf(a, b, c) do {} while (0)
|
|
|
|
#endif
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define __INSIDE_CYGWIN__
|
|
|
|
|
2002-02-15 18:06:40 +01:00
|
|
|
#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
|
2003-05-11 02:10:11 +02:00
|
|
|
#define NO_COPY_INIT __attribute__((section(".data_cygwin_nocopy")))
|
2011-11-03 18:47:33 +01:00
|
|
|
#define _RDATA __attribute__ ((section(".rdata")))
|
2001-08-22 19:50:22 +02:00
|
|
|
|
2004-09-10 10:30:51 +02:00
|
|
|
#define EXPORT_ALIAS(sym,symalias) extern "C" __typeof (sym) symalias __attribute__ ((alias(#sym)));
|
|
|
|
|
2008-11-12 12:04:27 +01:00
|
|
|
#define WINVER 0x0601
|
2006-10-17 15:55:05 +02:00
|
|
|
#define _NO_W32_PSEUDO_MODIFIERS
|
2002-09-06 06:21:30 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/strace.h>
|
|
|
|
|
* Makefile.in (DLL_OFILES): Add getopt.o and iruserok.o.
* cygwin.din: Export __check_rhosts_file, __rcmd_errstr, optarg,
opterr, optind, optopt, optreset, getopt, getopt_long, iruserok
and ruserok.
* getopt.c: Moved from lib to here. Define opt* variables as
dllexport.
* iruserok.c: Moved from lib to here. Rearrange function order.
Prefer using 64/32 bit functions.
* syscalls.cc (shell_fp): Define as struct __sFILE64.
(getusershell): Use fopen64 instead of fopen.
* winsup.h: Add declarations for seteuid32, fopen64,
cygwin_gethostbyname and cygwin_inet_addr.
* include/getopt.h: Declare opt* variables dllimport.
* include/cygwin/version.h: Bump API minor number.
2003-09-10 21:13:05 +02:00
|
|
|
/* Declarations for functions used in C and C++ code. */
|
2003-03-09 22:51:00 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2009-01-03 06:12:22 +01:00
|
|
|
__uid32_t getuid32 ();
|
|
|
|
__uid32_t geteuid32 ();
|
|
|
|
int seteuid32 (__uid32_t);
|
|
|
|
__gid32_t getegid32 (void);
|
|
|
|
struct passwd *getpwuid32 (__uid32_t);
|
|
|
|
struct passwd *getpwnam (const char *);
|
|
|
|
struct __sFILE64 *fopen64 (const char *, const char *);
|
|
|
|
struct hostent *cygwin_gethostbyname (const char *name);
|
2008-05-20 17:39:26 +02:00
|
|
|
/* Don't enforce definition of in_addr_t. */
|
2009-01-03 06:12:22 +01:00
|
|
|
uint32_t cygwin_inet_addr (const char *cp);
|
|
|
|
int fcntl64 (int fd, int cmd, ...);
|
2003-03-09 22:51:00 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-15 00:40:06 +01:00
|
|
|
/* Note that MAX_PATH is defined in the windows headers */
|
|
|
|
/* There is also PATH_MAX and MAXPATHLEN.
|
2008-02-14 17:47:11 +01:00
|
|
|
PATH_MAX is from Posix and does include the trailing NUL.
|
2003-11-15 00:40:06 +01:00
|
|
|
MAXPATHLEN is from Unix.
|
|
|
|
|
2008-03-12 18:04:10 +01:00
|
|
|
Thou shalt *not* use CYG_MAX_PATH anymore. Use NT_MAX_PATH or
|
|
|
|
dynamic allocation instead when accessing real files. Use
|
|
|
|
MAX_PATH in case you need a convenient small buffer when creating
|
|
|
|
names for synchronization objects or named pipes. */
|
2003-11-15 00:40:06 +01:00
|
|
|
#define CYG_MAX_PATH (MAX_PATH)
|
|
|
|
|
2008-02-14 17:47:11 +01:00
|
|
|
/* There's no define for the maximum path length the NT kernel can handle.
|
|
|
|
That's why we define our own to use in path length test and for path
|
|
|
|
buffer sizes. As MAX_PATH and PATH_MAX, this is defined including the
|
|
|
|
trailing 0. Internal buffers and internal path routines should use
|
|
|
|
NT_MAX_PATH. PATH_MAX as defined in limits.h is the maximum length of
|
2008-03-12 13:41:50 +01:00
|
|
|
application provided path strings we handle. */
|
|
|
|
#define NT_MAX_PATH 32768
|
2008-02-14 17:47:11 +01:00
|
|
|
|
2011-04-19 12:02:06 +02:00
|
|
|
/* This definition allows to define wide char strings using macros as
|
|
|
|
parameters. See the definition of __CONCAT in newlib's sys/cdefs.h
|
|
|
|
and accompanying comment. */
|
|
|
|
#define __WIDE(a) L ## a
|
|
|
|
#define _WIDE(a) __WIDE(a)
|
|
|
|
|
2003-03-09 22:51:00 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2001-09-06 07:17:22 +02:00
|
|
|
extern const char case_folded_lower[];
|
2000-10-19 05:12:44 +02:00
|
|
|
#define cyg_tolower(c) (case_folded_lower[(unsigned char)(c)])
|
2001-09-06 07:17:22 +02:00
|
|
|
extern const char case_folded_upper[];
|
2000-10-19 05:12:44 +02:00
|
|
|
#define cyg_toupper(c) (case_folded_upper[(unsigned char)(c)])
|
|
|
|
|
2001-04-24 17:25:31 +02:00
|
|
|
#ifndef MALLOC_DEBUG
|
2000-09-06 23:03:10 +02:00
|
|
|
#define cfree newlib_cfree_dont_use
|
2001-04-24 17:25:31 +02:00
|
|
|
#endif
|
2000-09-06 23:03:10 +02:00
|
|
|
|
2010-08-30 03:57:37 +02:00
|
|
|
#include "winlean.h"
|
* Makefile.in: Build wincap.o.
* wincap.cc: New file.
* wincap.h: Ditto.
* autoload.cc: Add dynamic load statement for `CreateHardLinkA'.
* dcrt0.cc (os_being_run): Eliminated.
(osname): Ditto.
(iswinnt): Ditto.
(set_os_type): Ditto.
(dll_crt0_1): Call wincap.init() instead of set_os_type().
(_dll_crt0): Ditto.
* environ.cc (set_chunksize): New function.
(parse_thing): `forkchunk' setting now invokes function `set_chunksize'.
* fork.cc (chunksize): Eliminated. Moved to be member of wincap.
* host_dependent.h: Removed.
* syscalls.cc (_link): Try using `CreateHardLinkA' first, if available.
* cygheap.cc, dcrt0.cc, delqueue.cc, dir.cc,
environ.cc, fhandler.cc, fhandler.h, fhandler_console.cc,
fhandler_mem.cc, fork.cc, mmap.cc, net.cc, pinfo.cc, pinfo.h,
security.cc, syscalls.cc, sysconf.cc, syslog.cc, thread.cc,
times.cc, tty.cc, uinfo.cc, uname.cc, winsup.h: Use new wincap
capability check throughout.
* winsup.h: Include wincap.h. Eliminate extern declarations of
`os_being_run' and `iswinnt'. Eliminate `os_type" definition.
* include/cygwin/version.h: Bump version to 1.3.4.
2001-09-12 19:46:37 +02:00
|
|
|
#include "wincap.h"
|
|
|
|
|
2000-07-27 19:30:51 +02:00
|
|
|
/* The one function we use from winuser.h most of the time */
|
|
|
|
extern "C" DWORD WINAPI GetLastError (void);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2008-01-31 21:26:01 +01:00
|
|
|
/* Used as type by sys_wcstombs_alloc and sys_mbstowcs_alloc. For a
|
|
|
|
description see there. */
|
|
|
|
#define HEAP_NOTHEAP -1
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* Used to check if Cygwin DLL is dynamically loaded. */
|
|
|
|
|
2002-06-26 07:29:41 +02:00
|
|
|
extern int cygserver_running;
|
2000-07-22 18:43:54 +02:00
|
|
|
|
2008-03-02 23:51:19 +01:00
|
|
|
#define _MT_SAFE // DELETEME someday
|
2003-07-02 05:16:00 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
#define TITLESIZE 1024
|
2000-07-02 12:17:44 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
#include "debug.h"
|
|
|
|
|
2009-04-07 14:13:37 +02:00
|
|
|
#include <wchar.h>
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/**************************** Convenience ******************************/
|
|
|
|
|
2004-04-13 11:04:22 +02:00
|
|
|
/* Used to define status flag accessor methods */
|
|
|
|
#define IMPLEMENT_STATUS_FLAG(type,flag) \
|
2009-07-16 11:56:25 +02:00
|
|
|
type flag (type val) { return (type) (status.flag = (val)); } \
|
2004-04-13 11:04:22 +02:00
|
|
|
type flag () const { return (type) status.flag; }
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* Used when treating / and \ as equivalent. */
|
2007-08-16 12:41:45 +02:00
|
|
|
#define iswdirsep(ch) \
|
|
|
|
({ \
|
|
|
|
WCHAR __c = (ch); \
|
|
|
|
((__c) == L'/' || (__c) == L'\\'); \
|
|
|
|
})
|
|
|
|
|
2003-01-09 09:22:05 +01:00
|
|
|
#define isdirsep(ch) \
|
2000-02-17 20:38:33 +01:00
|
|
|
({ \
|
|
|
|
char __c = (ch); \
|
|
|
|
((__c) == '/' || (__c) == '\\'); \
|
|
|
|
})
|
|
|
|
|
|
|
|
/* Convert a signal to a signal mask */
|
2008-02-15 18:53:11 +01:00
|
|
|
#define SIGTOMASK(sig) (1 << ((sig) - 1))
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2006-03-13 22:10:14 +01:00
|
|
|
#define set_api_fatal_return(n) do {extern int __api_fatal_exit_val; __api_fatal_exit_val = (n);} while (0)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
#undef issep
|
|
|
|
#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)
|
|
|
|
|
2007-08-16 12:41:45 +02:00
|
|
|
/* Every path beginning with / or \, as well as every path being X:
|
|
|
|
or starting with X:/ or X:\ */
|
|
|
|
#define isabspath_u(p) \
|
|
|
|
((p)->Length && \
|
|
|
|
(iswdirsep ((p)->Buffer[0]) || \
|
|
|
|
((p)->Length > sizeof (WCHAR) && iswalpha ((p)->Buffer[0]) \
|
|
|
|
&& (p)->Buffer[1] == L':' && \
|
|
|
|
((p)->Length == 2 * sizeof (WCHAR) || iswdirsep ((p)->Buffer[2])))))
|
|
|
|
|
|
|
|
#define iswabspath(p) \
|
|
|
|
(iswdirsep (*(p)) || (iswalpha (*(p)) && (p)[1] == L':' && (!(p)[2] || iswdirsep ((p)[2]))))
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
#define isabspath(p) \
|
2000-06-18 00:05:19 +02:00
|
|
|
(isdirsep (*(p)) || (isalpha (*(p)) && (p)[1] == ':' && (!(p)[2] || isdirsep ((p)[2]))))
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/******************** Initialization/Termination **********************/
|
|
|
|
|
2000-09-08 04:56:55 +02:00
|
|
|
class per_process;
|
2000-02-17 20:38:33 +01:00
|
|
|
/* cygwin .dll initialization */
|
2000-12-09 04:29:33 +01:00
|
|
|
void dll_crt0 (per_process *) __asm__ ("_dll_crt0__FP11per_process");
|
2000-07-01 06:40:20 +02:00
|
|
|
extern "C" void __stdcall _dll_crt0 ();
|
2009-01-03 06:12:22 +01:00
|
|
|
void dll_crt0_1 (void *);
|
|
|
|
void dll_dllcrt0_1 (void *);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* dynamically loaded dll initialization */
|
2000-09-08 04:56:55 +02:00
|
|
|
extern "C" int dll_dllcrt0 (HMODULE, per_process *);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2010-05-07 23:25:19 +02:00
|
|
|
void _pei386_runtime_relocator (per_process *);
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* dynamically loaded dll initialization for non-cygwin apps */
|
|
|
|
extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
|
2003-09-23 06:02:07 +02:00
|
|
|
void __stdcall do_exit (int) __attribute__ ((regparm (1), noreturn));
|
2000-02-17 20:38:33 +01:00
|
|
|
|
winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
(COMPILE_CC): Likewise for $(nostdinc).
winsup/cygwin/ChangeLog:
* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
(libstdcxx_wrapper_CFLAGS): Add flags for new module.
(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
* cxx.cc: Include "cygwin-cxx.h".
(operator new): Tweak prototype for full standards compliance.
(operator new[]): Likewise.
(operator new (nothrow)): New fallback function.
(operator new[] (nothrow), operator delete (nothrow),
operator delete[] (nothrow)): Likewise.
(default_cygwin_cxx_malloc): New struct of pointers to the above,
for final last-resort fallback default.
* cygwin-cxx.h: New file.
(struct per_process_cxx_malloc): Define.
(default_cygwin_cxx_malloc): Declare extern.
* cygwin.din (__wrap__ZdaPv): Export new wrapper.
(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Likewise.
* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
* libstdcxx_wrapper.cc: New file.
(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
malloc operators and their overrides.
* winsup.h (default_cygwin_cxx_malloc): Declare extern.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
declare here.
(struct per_process::forkee): Rename and repurpose from this ...
(struct per_process::cxx_malloc): ... to this.
* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
(WEAK): Define shorthand helper macro.
(__cygwin_cxx_malloc): Define and populate with weak references
to whatever libstdc++ malloc operators will be visible at final
link time for Cygwin apps and dlls.
(_cygwin_crt0_common): Always look up cygwin DLL's internal
per_process data, and don't test for (impossible) failure. Inherit
any members of __cygwin_cxx_malloc that we don't have overrides
for from the DLL's default and store the resulting overall set of
overrides back into the DLL's global per_process data.
2009-07-07 22:12:44 +02:00
|
|
|
/* libstdc++ malloc operator wrapper support. */
|
|
|
|
extern struct per_process_cxx_malloc default_cygwin_cxx_malloc;
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* UID/GID */
|
2005-07-05 05:16:46 +02:00
|
|
|
void uinfo_init ();
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2002-05-29 17:04:29 +02:00
|
|
|
#define ILLEGAL_UID16 ((__uid16_t)-1)
|
|
|
|
#define ILLEGAL_UID ((__uid32_t)-1)
|
|
|
|
#define ILLEGAL_GID16 ((__gid16_t)-1)
|
Change internal gid datatype from __gid16_t to __gid32_t
throughout.
* cygwin.din: Export new symbols chown32, fchown32, getegid32,
getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32,
setgid32, setegid32, getgrent32.
* grp.cc (grp32togrp16): New static function.
(getgrgid32): New function.
(getgrnam32): Ditto.
(getgrent32): Ditto.
(getgroups32): Change name of internal function from getgroups.
(getgroups32): New function.
(initgroups32): Ditto.
* syscalls.cc (chown32): Ditto.
(lchown32): Ditto.
(fchown32): Ditto.
(setegid32): Ditto.
(setgid32): Ditto.
* uinfo.cc (getgid32): Ditto.
(getegid32): Ditto.
* include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam().
Declare getgrgid32() and getgrnam32() instead. Declare getgid32().
2002-05-28 16:10:55 +02:00
|
|
|
#define ILLEGAL_GID ((__gid32_t)-1)
|
2003-04-01 18:11:41 +02:00
|
|
|
#define ILLEGAL_SEEK ((_off64_t)-1)
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 14:38:51 +01:00
|
|
|
|
2002-05-29 17:04:29 +02:00
|
|
|
#define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(__uid32_t)(u16))
|
|
|
|
#define gid16togid32(g16) ((g16)==ILLEGAL_GID16?ILLEGAL_GID:(__gid32_t)(g16))
|
|
|
|
|
2005-03-16 22:52:06 +01:00
|
|
|
/* Convert LARGE_INTEGER into long long */
|
|
|
|
#define get_ll(pl) (((long long) (pl).HighPart << 32) | (pl).LowPart)
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* various events */
|
2005-07-05 05:16:46 +02:00
|
|
|
void events_init ();
|
|
|
|
void events_terminate ();
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2005-07-05 04:05:07 +02:00
|
|
|
void __stdcall close_all_files (bool = false);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* debug_on_trap support. see exceptions.cc:try_to_debug() */
|
|
|
|
extern "C" void error_start_init (const char*);
|
2001-04-30 05:09:19 +02:00
|
|
|
extern "C" int try_to_debug (bool waitloop = 1);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2008-03-27 02:50:40 +01:00
|
|
|
void ld_preload ();
|
|
|
|
const char *find_first_notloaded_dll (class path_conv &);
|
2005-08-11 18:30:48 +02:00
|
|
|
|
2004-02-12 04:01:58 +01:00
|
|
|
extern bool cygwin_finished_initializing;
|
2000-07-15 04:48:11 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/**************************** Miscellaneous ******************************/
|
|
|
|
|
|
|
|
void __stdcall set_std_handle (int);
|
2002-02-25 18:47:51 +01:00
|
|
|
int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2007-08-16 12:41:45 +02:00
|
|
|
__ino64_t __stdcall hash_path_name (__ino64_t hash, PUNICODE_STRING name) __attribute__ ((regparm(2)));
|
|
|
|
__ino64_t __stdcall hash_path_name (__ino64_t hash, PCWSTR name) __attribute__ ((regparm(2)));
|
2003-05-11 23:52:09 +02:00
|
|
|
__ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2)));
|
2000-10-17 01:55:58 +02:00
|
|
|
void __stdcall nofinalslash (const char *src, char *dst) __attribute__ ((regparm(2)));
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2011-10-25 18:35:58 +02:00
|
|
|
void *hook_or_detect_cygwin (const char *, const void *, WORD&, HANDLE h = NULL) __attribute__ ((regparm (3)));
|
2005-07-17 02:51:03 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* Time related */
|
2005-02-20 12:44:32 +01:00
|
|
|
void __stdcall totimeval (struct timeval *, FILETIME *, int, int);
|
|
|
|
long __stdcall to_time_t (FILETIME *);
|
|
|
|
void __stdcall to_timestruc_t (FILETIME *, timestruc_t *);
|
|
|
|
void __stdcall time_as_timestruc_t (timestruc_t *);
|
2008-04-24 11:59:54 +02:00
|
|
|
void __stdcall timespec_to_filetime (const struct timespec *, FILETIME *);
|
2005-02-20 12:44:32 +01:00
|
|
|
void __stdcall timeval_to_filetime (const struct timeval *, FILETIME *);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2005-08-11 18:30:48 +02:00
|
|
|
/* Console related */
|
2000-02-17 20:38:33 +01:00
|
|
|
void __stdcall set_console_title (char *);
|
2006-03-16 03:57:37 +01:00
|
|
|
void init_console_handler (bool);
|
2005-08-11 18:30:48 +02:00
|
|
|
|
2003-09-12 08:41:53 +02:00
|
|
|
void init_global_security ();
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-04-03 04:53:25 +02:00
|
|
|
void __set_winsock_errno (const char *fn, int ln) __attribute__ ((regparm(2)));
|
2008-04-07 18:15:45 +02:00
|
|
|
#define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-08-22 19:50:22 +02:00
|
|
|
extern bool wsock_started;
|
|
|
|
|
2000-09-08 04:56:55 +02:00
|
|
|
/* Printf type functions */
|
2011-05-28 20:17:09 +02:00
|
|
|
extern "C" void vapi_fatal (const char *, va_list ap) __attribute__ ((noreturn));
|
|
|
|
extern "C" void api_fatal (const char *, ...) __attribute__ ((noreturn));
|
2009-01-03 06:12:22 +01:00
|
|
|
int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/;
|
|
|
|
int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/;
|
|
|
|
int __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...) /*__attribute__ ((regparm (2)))*/;
|
|
|
|
int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/;
|
|
|
|
void multiple_cygwin_problem (const char *, unsigned, unsigned);
|
2000-09-08 04:56:55 +02:00
|
|
|
|
2005-05-10 22:56:07 +02:00
|
|
|
extern "C" void vklog (int priority, const char *message, va_list ap);
|
|
|
|
extern "C" void klog (int priority, const char *message, ...);
|
2005-12-17 05:36:39 +01:00
|
|
|
bool child_copy (HANDLE, bool, ...);
|
2005-05-10 22:56:07 +02:00
|
|
|
|
* devices.cc: New file.
* devices.gperf: New file.
* devices.shilka: New file.
* cygwin-gperf: New file.
* cygwin-shilka: New file.
* fhandler_fifo.cc: New file.
* fhandler_nodevice.cc : New file. Reorganize headers so that path.h precedes
fhandler.h throughout. Remove device argument and unit arguments from fhandler
constructors throughout. Remove pc arguments to fhandler functions and use
internal pc element instead, throughout. Use dev element in pc throughout.
Use major/minor elements rather than units and device numbers previously in
fhandler class. Use correct methods for fhandler file names rather than
directly accessing file name variables, throughout.
* Makefile.in (DLL_OFILES): Add devices.o, fhandler_fifo.o
* dcrt0.cc (dll_crt0_1): Call device::init.
* devices.h: Renumber devices based on more Linux-like major/minor numbers.
Add more devices. Declare standard device storage.
(device): Declare struct.
* dir.cc (opendir): Use new 'build_fh_name' to construct a fhandler_* type.
* dtable.cc (dtable::get_debugger_info): Ditto.
(cygwin_attach_handle_to_fd): Ditto.
(dtable::release): Remove special FH_SOCKET case in favor of generic
"need_fixup_before" test.
(dtable::init_std_file_from_handle): Use either build_fh_dev or build_fh_name
to build standard fhandler.
(dtable::build_fh_name): Renamed from dtable::build_fhandler_from_name. Move
out of dtable class. Don't accept a path_conv argument. Just build it here
and pass it to:
(build_fh_pc): Renamed from dtable::build_fhandler. Move out of dtable class.
Use intrinsic device type in path_conv to create new fhandler.
(build_fh_dev): Renamed from dtable::build_fhandler. Move out of dtable class.
Simplify arguments to just take new 'device' type and a name. Just return
pointer to fhandler rather than trying to insert into dtable.
(dtable::dup_worker): Accommodate above build_fh name changes.
(dtable::find_fifo): New (currently broken) function.
(handle_to_fn): Use strechr for efficiency.
* dtable.h: Reflect above build_fh name changes and argument differences.
(fhandler_base *&operator []): Return self rather than copy of self.
* fhandler.cc (fhandler_base::operator =): Use pc element to set normalized
path.
(fhandler_base::set_name): Ditto.
(fhandler_base::raw_read): Use method to access name.
(fhandler_base::write): Correctly use get_output_handle rather than get_handle.
(handler_base::device_access_denied): New function.
(fhandler_base::open): Eliminate pc argument and use pc element of
fhandler_base throughout.
(fhandler_base::fstat): Detect if device is based in filesystem and use
fstat_fs to calculate stat, if so.
(fhandler_base::fhandler_base): Eliminate handling of file names and, instead,
just free appropriate component from pc.
(fhandler_base::opendir): Remove path_conv parameter.
* fhandler.h: Remove all device flags.
(fhandler_base::pc): New element.
(fhandler_base::set_name): Change argument to path_conv.
(fhandler_base::error): New function.
(fhandler_base::exists): New function.
(fhandler_base::pc_binmode): New function.
(fhandler_base::dev): New function.
(fhandler_base::open_fs): New function.
(fhandler_base::fstat_fs): New function.
(fhandler_base::fstat_by_name): New function.
(fhandler_base::fstat_by_handle): New function.
(fhandler_base::isfifo): New function.
(fhandler_base::is_slow): New function.
(fhandler_base::is_auto_device): New function.
(fhandler_base::is_fs_special): New function.
(fhandler_base::device_access_denied): New function.
(fhandler_base::operator DWORD&): New operator.
(fhandler_base::get_name): Return normalized path from pc.
(fhandler_base::get_win32_name): Return windows path from pc.
(fhandler_base::isdevice): Renamed from is_device.
(fhandler_base::get_native_name): Return device format.
(fhandler_fifo): New class.
(fhandler_nodevice): New class.
(select_stuff::device_specific): Remove array.
(select_stuff::device_specific_pipe): New class element.
(select_stuff::device_specific_socket): New class element.
(select_stuff::device_specific_serial): New class element.
(select_stuff::select_stuff): Initialize new elements.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Move to base class
from fhandler_disk_file.
(fhandler_base::fstat_by_name): Ditto.
(fhandler_base::fstat_by_name): Ditto.
(fhandler_disk_file::open): Move most functionality into
fhandler_base::open_fs.
(fhandler_base::open_fs): New function.
(fhandler_disk_file::close): Move most functionality into
fhandler_base::close_fs.
(fhandler_base::close_fs): New function.
* fhandler_mem.cc (fhandler_dev_mem::open): Use device name in debugging
output.
* fhandler_socket.cc (fhandler_socket::set_connect_secret): Copy standard
urandom device into appropriate place.
(fhandler_socket::accept): Reflect change in fdsock return value.
* fhandler_tty.cc: See "throughouts" above.
* net.cc: Accommodate fdsock change throughout.
(fdsock): Return success or failure, accept fd argument and device argument.
* path.cc (symlink_info::major): New element.
(symlink_info::minor): New element.
(symlink_info::parse_device): Declare new function.
(fs_info::update): Accommodate changes in path_conv class.
(path_conv::fillin): Ditto.
(path_conv::return_and_clear_normalized_path): Eliminate.
(path_conv::set_normalized_path): New function.
(path_conv::path_conv): Set info in dev element. Use path_conv methods Check
for FH_FS rather than FH_BAD to indicate when to fill in filesystem stuff.
where appropriate rather than direct access. Use set_normalized_path to set
normalized path.
(windows_device_names): Eliminate.
(get_dev): Ditto.
(get_raw_device_number): Ditto.
(get_device_number): Ditto.
(win32_device_name): Call new device name parser to do most of the heavy
lifting.
(mount_info::conv_to_win32_path): Fill in dev field as appropriate.
(symlink_worker): Handle new device files.
(symlink_info::check): Ditto.
(symlink_info::parse_device): Define new function.
* path.h (executable_states): Move here from fhandler.h.
(fs_info): Rename variables to *_storage and create methods for accessing same.
(path_conv): Add dev element, remove devn and unit and adjust inline methods to
accommodate.
(set_normalized_path): Declare new function.
* pinfo.cc (_pinfo::commune_recv): Add broken support for handling fifos.
(_pinfo::commune_send): Ditto.
* pipe.cc (fhandler_pipe::close): check for existence of handle before closing
it.
(handler_pipe::create): Rename from make_pipe. Change arguments to accept
fhandler_pipe array. Accommodate fifos.
(pipe): Rework to deal with fhandler_pipe::create changes.
(_pipe): Ditto.
* select.cc: Use individual device_specific types throughout rather than
indexing with obsolete device number.
(set_bits): Use is_socket call rather than checking device number.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(conv_to_win32_path): Reflect addition of device argument.
* syscalls.cc (mknod_worker): New function.
(open): Use build_fh_name to build fhandler.
(chown_worker): Detect if this is an 'auto' device rather than an on-filesystem
device and handle appropriately.
(chmod_device): New function.
(chmod): Detect if this is an 'auto' device rather than an on-filesystem device
and handle appropriately. Use chmod_device to set mode of in-filesystem
devices.
(stat_worker): Eliminate path_conv argument. Call build_fh_name to construct
fhandler. Use fh->error() rather than pc->error to detect errors in fhandler
construction.
(access_worker): New function pulled from access. Accommodate in-filesystem
devices.
(access): Use access_worker.
(fpathconf): Detect if this is an 'auto' device rather than an on-filesystem
device and handle appropriately.
(mknod_worker): New function.
(mknod32): New function.
(chroot): Free normalized path -- assuming it was actually cmalloced.
* tty.cc (create_tty_master): Tweak for new device class.
(tty::common_init): Ditto.
* winsup.h (stat_worker): Remove.
(symlink_worker): Declare.
* exceptions.cc (set_process_mask): Just call sig_dispatch_pending and don't
worry about pending_signals since sig_dispatch_pending should always do the
right thing now.
(sig_handle): Reorganize SIGCONT handling to more closely conform to SUSv3.
* pinfo.h: Move __SIG enum to sigproc.h.
(PICOM_FIFO): New enum element.
(_pinfo): Remove 'thread2signal' stuff throughout class.
(_pinfo::commune_send): Make varargs.
(_pinfo::sigtodo): Eliminate.
(_pinfo::thread2signal): Ditto.
* signal.cc (kill_worker): Eliminate call to setthread2signal.
* sigproc.cc (local_sigtodo): Eliminate.
(getlocal_sigtodo): Ditto.
(sigelem): New class.
(pending_signals): New class.
(sigqueue): New variable, start of sigqueue linked list.
(sigcatch_nonmain): Eliminate.
(sigcatch_main): Eliminate.
(sigcatch_nosync): Eliminate.
(sigcomplete_nonmain): Eliminate.
(pending_signals): Eliminate.
(sig_clear): Call signal thread to clear pending signals, unless already in
signal thread.
(sigpending): Call signal thread to get pending signals.
(sig_dispatch_pending): Eliminate use of pending_signals and just check
sigqueue.
(sigproc_terminate): Eliminate all of the obsolete semaphore stuff. Close
signal pipe handle.
(sig_send): Eliminate all of the obsolete semaphore stuff and use pipe to send
signals.
(getevent): Eliminate.
(pending_signals::add): New function.
(pending_signals::del): New function.
(pending_signals::next): New function.
(wait_sig): Eliminate all of the obsolete semaphore stuff. Use pipe to
communicate and maintain a linked list of signals.
* sigproc.h: Move __SIG defines here. Add __SIGPENDING.
(sig_dispatch_pending): Remove "C" specifier.
(sig_handle): Accept a mask argument.
* thread.cc: Remove signal handling considerations throughout.
2003-09-25 02:37:18 +02:00
|
|
|
int symlink_worker (const char *, const char *, bool, bool)
|
|
|
|
__attribute__ ((regparm (3)));
|
|
|
|
|
2003-11-06 14:58:45 +01:00
|
|
|
class path_conv;
|
|
|
|
|
2007-07-26 19:30:54 +02:00
|
|
|
int __stdcall stat_worker (path_conv &pc, struct __stat64 *buf) __attribute__ ((regparm (2)));
|
2003-12-03 10:55:42 +01:00
|
|
|
|
2007-07-26 19:30:54 +02:00
|
|
|
__ino64_t __stdcall readdir_get_ino (const char *path, bool dot_dot) __attribute__ ((regparm (2)));
|
2006-01-27 22:50:42 +01:00
|
|
|
|
2005-12-07 12:16:47 +01:00
|
|
|
/* mmap functions. */
|
2006-07-25 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Bump DLL version to 1.7.0.
2006-07-25 Corinna Vinschen <corinna@vinschen.de>
* select.h: Remove.
* fhandler_socket.cc: Don't include select.h.
* select.cc: Ditto.
2006-07-25 Corinna Vinschen <corinna@vinschen.de>
* cygtls.h: Drop socket related includes.
(struct _local_storage): Remove exitsock and exitsock_sin. Add
select_sockevt.
* cygtls.cc: Accomodate above change throughout.
* fhandler.h (class fhandler_socket): Make wsock_evt public.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate
reordering members.
(fhandler_socket::evaluate_events): Drop FD_CONNECT event as soon as
it gets read once. Never remove FD_WRITE event here.
(fhandler_socket::wait_for_events): Wait 50 ms instead of INFINITE for
socket events.
(fhandler_socket::accept): Fix conditional. Set wsock_events members
of accepted socket to useful start values.
(fhandler_socket::recv_internal): Always drop FD_READ/FD_OOB events from
wsock_events after the call to WSARecvFrom.
(fhandler_socket::send_internal): Drop FD_WRITE event from wsock_events
if the call to WSASendTo fails with WSAEWOULDBLOCK. Fix return value
condition.
* select.cc (struct socketinf): Change to accomodate using socket event
handling.
(peek_socket): Use event handling for peeking socket.
(thread_socket): Ditto.
(start_thread_socket): Ditto.
(socket_cleanup): Same here.
* tlsoffsets.h: Regenerate.
2006-07-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_socket): Rearrange slightly to keep
event handling methods and members together. Drop owner status flag.
Split wait method. Rename event handling methods for readability.
* fhandler_socket.cc (struct wsa_event): Add owner field.
(LOCK_EVENTS): New macro.
(UNLOCK_EVENTS): Ditto.
(fhandler_socket::init_events): rename from prepare.
(fhandler_socket::evaluate_events): First half of former wait method.
Do everything but wait. Allow specifiying whether or not events from
event_mask should be erased from wsock_events->events. Simplify
OOB handling. Allow sending SIGURG to any process (group).
(fhandler_socket::wait_for_events): Second half of former wait method.
Call evaluate_events and wait in a loop if socket is blocking.
(fhandler_socket::release_events): Rename from release.
(fhandler_socket::connect): Accomodate above name changes.
(fhandler_socket::accept): Ditto.
(fhandler_socket::recv_internal): Ditto.
(fhandler_socket::send_internal): Ditto.
(fhandler_socket::close): Ditto.
(fhandler_socket::fcntl): Always set owner to given input value on
F_SETOWN. Handle F_GETOWN.
* net.cc (fdsock): Accomodate above name changes.
2006-07-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::wait): Set Winsock errno to
WSAEWOULDBLOCK instead of WSAEINPROGRESS.
2006-07-18 Brian Ford <Brian.Ford@FlightSafety.com>
Corinna Vinschen <corinna@vinschen.de>
* winsup.h (mmap_region_status): New enum.
(mmap_is_attached_or_noreserve_page): Adjust prototype and rename
as below.
* mmap.cc (mmap_is_attached_or_noreserve_page): Rename
mmap_is_attached_or_noreserve. Add region length parameter.
Return enum above.
* exceptions.cc (_cygtls::handle_exceptions): Accomodate above.
* fhandler.cc (fhandler_base::raw_read): Call above for NOACCESS
errors and retry on success to allow reads into untouched
MAP_NORESERVE buffers.
2006-07-18 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (posix_openpt): Export.
* tty.cc (posix_openpt): New function.
* include/cygwin/stdlib.h (posix_openpt): Declare.
* include/cygwin/version.h: Bump API minor number.
2006-07-14 Corinna Vinschen <corinna@vinschen.de>
* security.cc (get_token_group_sidlist): Always add the interactive
group to the token. Add comment. Create logon_id group SID by
copying it from incoming group list.
(create_token): Add subauth_token parameter. Use information in
subauth_token if present. Tweak SourceIdentifier if subauth_token
is present for debugging purposes.
* security.h (create_token): Add subauth_token parameter in declaration.
* syscalls.cc (seteuid32): Call subauth first. Call create_token
regardless. Use subauth token in call to create_token if subauth
succeeded.
2006-07-13 Corinna Vinschen <corinna@vinschen.de>
* include/netinet/in.h: Update copyright.
2006-07-13 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::wait): Rework function so that
WaitForMultipleObjects is really only called when necessary.
2006-07-12 Corinna Vinschen <corinna@vinschen.de>
* include/netdb.h: Declare rcmd, rcmd_af, rexec, rresvport,
rresvport_af, iruserok, iruserok_sa, ruserok.
2006-07-12 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in (DLL_OFILES): Drop iruserok.o. Add rcmd.o.
* autoload.cc (rcmd): Drop definition.
* cygwin.din: Export bindresvport, bindresvport_sa, iruserok_sa,
rcmd_af, rresvport_af.
* net.cc (cygwin_rcmd): Remove.
(last_used_bindresvport): Rename from last_used_rrecvport.
(cygwin_bindresvport_sa): New function implementing bindresvport_sa.
(cygwin_bindresvport): New function implementing bindresvport.
(cygwin_rresvport): Remove.
* include/cygwin/version.h: Bump API minor number.
* include/netinet/in.h: Declare bindresvport and bindresvport_sa.
* libc/iruserok.c: Remove file.
* libc/rcmd.cc: New file implementing rcmd, rcmd_af, rresvport,
rresvport_af, iruserok_sa, iruserok and ruserok.
2006-07-12 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::getsockname): Return valid
result for unbound sockets.
2006-07-11 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Handle
wsock_mtx and wsock_evt on fork, thus handling close_on_exec correctly.
(fhandler_socket::fixup_after_exec): Drop misguided attempt to handle
close_on_exec here.
(fhandler_socket::dup): Call fixup_after_fork with NULL parent.
Add comment.
(fhandler_socket::set_close_on_exec): Handle wsock_mtx and wsock_evt.
2006-07-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_socket): Add wsock_mtx, wsock_evt
and wsock_events members. Remove closed status flag, add listener
status flag. Accomodate new implementation of socket event handling
methods. Declare recv* and send* functions ssize_t as the POSIX
equivalents.
(fhandler_socket::recv_internal): Declare.
(fhandler_socket::send_internal): Ditto.
* fhandler_socket.cc (EVENT_MASK): Define mask of selected events.
(fhandler_socket::fhandler_socket): Initialize new members.
(fhandler_socket::af_local_setblocking): Don't actually set the
socket to blocking mode. Keep sane event selection.
(fhandler_socket::af_local_unsetblocking): Don't actually set the
socket to previous blocking setting, just remember it.
(struct wsa_event): New structure to keep event data per shared
socket.
(NUM_SOCKS): Define number of shared sockets concurrently handled by
all active Cygwin processes.
(wsa_events): New shared datastructure keeping all wsa_event records.
(socket_serial_number): New shared variable to identify shared sockets.
(wsa_slot_mtx): Global mutex to serialize wsa_events access.
(search_wsa_event_slot): New static function to select a new wsa_event
slot for a new socket.
(fhandler_socket::prepare): Rewrite. Prepare event selection
per new socket.
(fhandler_socket::wait): Rewrite. Wait for socket events in thread
safe and multiple process safe.
(fhandler_socket::release): Rewrite. Close per-socket descriptor
mutex handle and event handle.
(fhandler_socket::dup): Duplicate wsock_mtx and wsock_evt. Fix
copy-paste error in debug output.
(fhandler_socket::connect): Accomodate new event handling.
(fhandler_socket::listen): Set listener flag on successful listen.
(fhandler_socket::accept): Accomodate new event handling.
(fhandler_socket::recv_internal): New inline method centralizing
common recv code.
(fhandler_socket::recvfrom): Call recv_internal now.
(fhandler_socket::recvmsg): Ditto. Streamline copying from iovec
to WSABUF.
(fhandler_socket::send_internal): New inline method centralizing
common send code.
(fhandler_socket::sendto): Call send_internal now.
(fhandler_socket::sendmsg): Ditto. Streamline copying from iovec
to WSABUF.
(fhandler_socket::close): Call release now.
(fhandler_socket::ioctl): Never actually switch to blocking mode.
Just keep track of the setting.
* net.cc (fdsock): Call prepare now.
(cygwin_connect): Revert again to event driven technique.
(cygwin_accept): Ditto.
* poll.cc (poll): Don't call recvfrom on a listening socket.
Remove special case for failing recvfrom.
* include/sys/socket.h: Declare recv* and send* functions ssize_t as
requested by POSIX.
2006-07-07 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_inet_ntop): Fix data type of forth parameter.
2006-07-06 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/in6.h (struct in6_addr): Fix typo.
2006-07-06 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Export in6addr_any, in6addr_loopback, freeaddrinfo,
gai_strerror, getaddrinfo, getnameinfo.
* fhandler_socket.cc: Include cygwin/in6.h.
(get_inet_addr): Accomodate AF_INET6 usage.
(fhandler_socket::connect): Ditto.
(fhandler_socket::listen): Ditto.
(fhandler_socket::sendto): Ditto.
* net.cc: Include cygwin/in6.h.
(in6addr_any): Define.
(in6addr_loopback): Define.
(cygwin_socket): Accomodate AF_INET6 usage.
(socketpair): Bind socketpairs only to loopback for security.
(inet_pton4): New static function.
(inet_pton6): Ditto.
(cygwin_inet_pton): New AF_INET6 aware inet_pton implementation.
(inet_ntop4): New static function.
(inet_ntop6): Ditto.
(cygwin_inet_ntop): New AF_INET6 aware inet_ntop implementation.
(ga_aistruct): New static function.
(ga_clone): Ditto.
(ga_echeck): Ditto.
(ga_nsearch): Ditto.
(ga_port): Ditto.
(ga_serv): Ditto.
(ga_unix): Ditto.
(gn_ipv46): Ditto.
(ipv4_freeaddrinfo): Ditto.
(ipv4_getaddrinfo): Ditto.
(ipv4_getnameinfo): Ditto.
(gai_errmap_t): New structure holding error code - error string mapping.
(cygwin_gai_strerror): New function implementing gai_strerror.
(w32_to_gai_err): New static function.
(get_ipv6_funcs): Ditto.
(load_ipv6_funcs): Ditto.
(cygwin_freeaddrinfo): New function implementing freeaddrinfo.
(cygwin_getaddrinfo): New function implementing getaddrinfo.
(cygwin_getnameinfo): New function implementing getnameinfo.
* include/netdb.h: Include stdint.h and cygwin/socket.h. Define
data types and macros used by getaddrinfo and friends. Declare
freeaddrinfo, gai_strerror, getaddrinfo and getnameinfo.
* include/cygwin/in.h: Add IPv6 related IPPROTOs. Remove definition
of struct sockaddr_in6. Include cygwin/in6.h instead.
* include/cygwin/in6.h: New header file defining IPv6 releated
data types and macros.
* include/cygwin/socket.h: Enable AF_INET6 and PF_INET6. Add
IPv6 related socket options.
* include/cygwin/version.h: Bump API minor number.
2006-07-06 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (DsGetDcNameA): Define.
(NetGetAnyDCName): Define.
* security.cc: Include dsgetdc.h.
(DsGetDcNameA): Declare.
(DS_FORCE_REDISCOVERY): Define.
(get_logon_server): Add bool parameter to control rediscovery of DC.
Use DsGetDcNameA function if supported, NetGetDCName/NetGetAnyDCName
otherwise.
(get_server_groups): Rediscover DC if get_user_groups fails and
try again.
(get_reg_security): Use correct error code macro when testing
RegGetKeySecurity return value.
* security.h (get_logon_server): Remove default vaue from wserver
parameter. Add rediscovery parameter.
* uinfo.cc (cygheap_user::env_logsrv): Accomodate rediscovery parameter
in call to get_logon_server.
2006-07-25 21:23:23 +02:00
|
|
|
enum mmap_region_status
|
|
|
|
{
|
|
|
|
MMAP_NONE,
|
|
|
|
MMAP_RAISE_SIGBUS,
|
|
|
|
MMAP_NORESERVE_COMMITED
|
|
|
|
};
|
|
|
|
mmap_region_status mmap_is_attached_or_noreserve (void *addr, size_t len);
|
2011-05-16 11:55:18 +02:00
|
|
|
bool is_mmapped_region (caddr_t start_addr, caddr_t end_address);
|
2003-11-06 15:33:16 +01:00
|
|
|
|
2005-12-20 21:34:28 +01:00
|
|
|
inline bool flush_file_buffers (HANDLE h)
|
|
|
|
{
|
|
|
|
return (GetFileType (h) != FILE_TYPE_PIPE) ? FlushFileBuffers (h) : true;
|
|
|
|
}
|
2005-12-20 21:19:55 +01:00
|
|
|
#define FlushFileBuffers flush_file_buffers
|
2005-08-19 16:56:48 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/**************************** Exports ******************************/
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
int cygwin_select (int , fd_set *, fd_set *, fd_set *,
|
|
|
|
struct timeval *to);
|
|
|
|
int cygwin_gethostname (char *__name, size_t __len);
|
|
|
|
};
|
|
|
|
|
|
|
|
/*************************** Unsorted ******************************/
|
|
|
|
|
|
|
|
#define WM_ASYNCIO 0x8000 // WM_APP
|
|
|
|
|
|
|
|
|
2000-04-08 06:13:12 +02:00
|
|
|
#define STD_RBITS (S_IRUSR | S_IRGRP | S_IROTH)
|
|
|
|
#define STD_WBITS (S_IWUSR)
|
|
|
|
#define STD_XBITS (S_IXUSR | S_IXGRP | S_IXOTH)
|
2002-05-02 06:13:48 +02:00
|
|
|
#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)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
|
2009-01-03 06:12:22 +01:00
|
|
|
extern "C" char _data_start__, _data_end__, _bss_start__, _bss_end__;
|
|
|
|
extern "C" void (*__CTOR_LIST__) (void);
|
|
|
|
extern "C" void (*__DTOR_LIST__) (void);
|
2006-12-12 17:27:32 +01:00
|
|
|
|
2012-03-19 18:49:40 +01:00
|
|
|
#ifndef NO_GLOBALS_H
|
2009-01-03 06:12:22 +01:00
|
|
|
#include "globals.h"
|
2012-03-19 18:49:40 +01:00
|
|
|
|
|
|
|
extern inline void clear_procimptoken ()
|
2006-12-12 17:27:32 +01:00
|
|
|
{
|
|
|
|
if (hProcImpToken)
|
|
|
|
{
|
2006-12-13 12:18:39 +01:00
|
|
|
HANDLE old_procimp = hProcImpToken;
|
2006-12-12 17:27:32 +01:00
|
|
|
hProcImpToken = NULL;
|
2006-12-13 12:18:39 +01:00
|
|
|
CloseHandle (old_procimp);
|
2006-12-12 17:27:32 +01:00
|
|
|
}
|
|
|
|
}
|
2012-03-19 18:49:40 +01:00
|
|
|
#endif /*NO_GLOBALS_H*/
|
2000-08-02 18:28:18 +02:00
|
|
|
#endif /* defined __cplusplus */
|