* 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.
This commit is contained in:
Corinna Vinschen
2001-09-12 17:46:37 +00:00
parent c88bb51c3c
commit ba94682838
31 changed files with 707 additions and 246 deletions

View File

@@ -34,7 +34,6 @@ details. */
#include "shared_info.h"
#include "cygwin_version.h"
#include "dll_init.h"
#include "host_dependent.h"
#define MAX_AT_FILE_LEVEL 10
@@ -155,94 +154,6 @@ do_global_ctors (void (**in_pfunc)(), int force)
atexit (do_global_dtors);
}
/* remember the type of Win32 OS being run for future use. */
os_type NO_COPY os_being_run;
char NO_COPY osname[40];
bool iswinnt;
/* set_os_type: Set global variable os_being_run with type of Win32
operating system being run. This information is used internally
to manage the inconsistency in Win32 API calls between Win32 OSes. */
/* Cygwin internal */
static void
set_os_type ()
{
OSVERSIONINFO os_version_info;
const char *os;
memset (&os_version_info, 0, sizeof os_version_info);
os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
GetVersionEx (&os_version_info);
iswinnt = 0;
switch (os_version_info.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
os_being_run = winNT;
os = "NT";
iswinnt = 1;
break;
case VER_PLATFORM_WIN32_WINDOWS:
if (os_version_info.dwMinorVersion == 0)
{
os_being_run = win95;
os = "95";
}
else if (os_version_info.dwMinorVersion < 90)
{
os_being_run = win98;
os = "98";
}
else /* os_version_info.dwMinorVersion == 90 */
{
os_being_run = winME;
os = "ME";
}
break;
default:
os_being_run = unknown;
os = "??";
break;
}
__small_sprintf (osname, "%s-%d.%d", os, os_version_info.dwMajorVersion,
os_version_info.dwMinorVersion);
}
host_dependent_constants NO_COPY host_dependent;
/* Constructor for host_dependent_constants. */
void
host_dependent_constants::init ()
{
extern DWORD chunksize;
/* fhandler_disk_file::lock needs a platform specific upper word
value for locking entire files.
fhandler_base::open requires host dependent file sharing
attributes. */
switch (os_being_run)
{
case winNT:
win32_upper = 0xffffffff;
shared = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
break;
case winME:
case win98:
case win95:
case win32s:
win32_upper = 0x00000000;
shared = FILE_SHARE_READ | FILE_SHARE_WRITE;
chunksize = 32 * 1024 * 1024;
break;
default:
api_fatal ("unrecognized system type");
}
}
/*
* Replaces -@file in the command line with the contents of the file.
* There may be multiple -@file's in a single command line
@@ -544,7 +455,7 @@ static NO_COPY STARTUPINFO si;
child_info_fork NO_COPY *child_proc_info = NULL;
static MEMORY_BASIC_INFORMATION sm;
#define CYGWIN_GUARD ((iswinnt) ? PAGE_GUARD : PAGE_NOACCESS)
#define CYGWIN_GUARD ((wincap.has_page_guard ()) ? PAGE_GUARD : PAGE_NOACCESS)
// __inline__ void
extern void
@@ -649,7 +560,7 @@ dll_crt0_1 ()
do_global_ctors (&__CTOR_LIST__, 1);
/* Set the os_being_run global. */
set_os_type ();
wincap.init ();
check_sanity_and_sync (user_data);
/* Nasty static stuff needed by newlib -- point to a local copy of
@@ -722,9 +633,6 @@ dll_crt0_1 ()
ProtectHandle (hMainProc);
ProtectHandle (hMainThread);
/* Initialize the host dependent constants object. */
host_dependent.init ();
/* Initialize the cygwin subsystem if this is the first process,
or attach to shared data structures if it's already running. */
memory_init ();
@@ -888,8 +796,8 @@ _dll_crt0 ()
strace.microseconds ();
#endif
/* Set the os_being_run global. */
set_os_type ();
/* Set the os capabilities. */
wincap.init ();
main_environ = user_data->envptr;
*main_environ = NULL;