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:
authorCorinna Vinschen <corinna@vinschen.de>2001-09-12 21:46:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2001-09-12 21:46:37 +0400
commitba94682838272afc87b73833c02aaf6cea40815e (patch)
tree33443e904759c4bb192f674b2e8c30c59641f138 /winsup/cygwin/syscalls.cc
parentc88bb51c3ca08f1cf79dd0215ff5f46817267ddb (diff)
* 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.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index e9ee64d81..d6ef25c58 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -150,7 +150,7 @@ _unlink (const char *ourname)
/* Windows 9x seems to report ERROR_ACCESS_DENIED rather than sharing
violation. So, set lasterr to ERROR_SHARING_VIOLATION in this case
to simplify tests. */
- if (!iswinnt && lasterr == ERROR_ACCESS_DENIED
+ if (wincap.access_denied_on_delete () && lasterr == ERROR_ACCESS_DENIED
&& !win32_name.isremote ())
lasterr = ERROR_SHARING_VIOLATION;
@@ -168,7 +168,8 @@ _unlink (const char *ourname)
bool delete_on_close_ok;
- delete_on_close_ok = !win32_name.isremote () && iswinnt;
+ delete_on_close_ok = !win32_name.isremote ()
+ && wincap.has_delete_on_close ();
/* Attempt to use "delete on close" semantics to handle removing
a file which may be open. */
@@ -609,8 +610,14 @@ _link (const char *a, const char *b)
}
/* Try to make hard link first on Windows NT */
- if (iswinnt)
+ if (wincap.has_hard_links ())
{
+ if (CreateHardLinkA (real_b.get_win32 (), real_a.get_win32 (), NULL))
+ {
+ res = 0;
+ goto done;
+ }
+
HANDLE hFileSource;
WIN32_STREAM_ID StreamId;
@@ -726,7 +733,7 @@ chown_worker (const char *name, unsigned fmode, uid_t uid, gid_t gid)
if (check_null_empty_str_errno (name))
return -1;
- if (!iswinnt) // real chown only works on NT
+ if (!wincap.has_security ()) // real chown only works on NT
res = 0; // return zero (and do nothing) under Windows 9x
else
{
@@ -1093,7 +1100,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
dtype = real_path.get_drive_type ();
if ((atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) ||
- (iswinnt
+ (wincap.can_open_directories ()
&& dtype != DRIVE_NO_ROOT_DIR
&& dtype != DRIVE_UNKNOWN)))
{
@@ -1357,7 +1364,7 @@ _rename (const char *oldpath, const char *newpath)
&& GetLastError () != ERROR_FILE_EXISTS))
goto done;
- if (iswinnt)
+ if (wincap.has_move_file_ex ())
{
if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (),
MOVEFILE_REPLACE_EXISTING))
@@ -1481,7 +1488,7 @@ check_posix_perm (const char *fname, int v)
extern int allow_ntea, allow_ntsec, allow_smbntsec;
/* Windows 95/98/ME don't support file system security at all. */
- if (!iswinnt)
+ if (!wincap.has_security ())
return 0;
/* ntea is ok for supporting permission bits but it doesn't support
@@ -2022,7 +2029,7 @@ extern "C" int
seteuid (uid_t uid)
{
sigframe thisframe (mainthread);
- if (iswinnt)
+ if (wincap.has_security ())
{
char orig_username[UNLEN + 1];
char orig_domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
@@ -2237,7 +2244,7 @@ extern "C" int
setegid (gid_t gid)
{
sigframe thisframe (mainthread);
- if (iswinnt)
+ if (wincap.has_security ())
{
if (gid != (gid_t) -1)
{