* fhandler.cc (fhandler_base::open): Move some filesystem specific stuff.

(fhandler_disk_file::open): Accept some filesystem specific stuff.
* sigproc.cc (wait_for_sigthread): Become slightly more thread safe.
(sig_send): Don't assume that signal thread is ready.
This commit is contained in:
Christopher Faylor 2003-02-21 04:33:53 +00:00
parent d4806224b6
commit 5cd8241242
4 changed files with 38 additions and 27 deletions

View File

@ -1,3 +1,11 @@
2003-02-19 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::open): Move some filesystem specific
stuff.
(fhandler_disk_file::open): Accept some filesystem specific stuff.
* sigproc.cc (wait_for_sigthread): Become slightly more thread safe.
(sig_send): Don't assume that signal thread is ready.
2003-02-20 Corinna Vinschen <corinna@vinschen.de>
* wincap.h (wincap): Remove unnecessary definition of

View File

@ -455,36 +455,28 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode)
x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
file_attributes, 0);
syscall_printf ("%p = CreateFile (%s, %p, %p, %p, %p, %p, 0)",
x, get_win32_name (), access, shared, &sa,
creation_distribution, file_attributes);
if (x == INVALID_HANDLE_VALUE)
{
if (!wincap.can_open_directories () && pc && pc->isdir ())
{
if (flags & (O_CREAT | O_EXCL) == (O_CREAT | O_EXCL))
set_errno (EEXIST);
else if (flags & (O_WRONLY | O_RDWR))
set_errno (EISDIR);
else
set_nohandle (true);
}
{
if (flags & (O_CREAT | O_EXCL) == (O_CREAT | O_EXCL))
set_errno (EEXIST);
else if (flags & (O_WRONLY | O_RDWR))
set_errno (EISDIR);
else
set_nohandle (true);
}
else if (GetLastError () == ERROR_INVALID_HANDLE)
set_errno (ENOENT);
set_errno (ENOENT);
else
__seterrno ();
__seterrno ();
if (!get_nohandle ())
goto done;
}
goto done;
}
/* Attributes may be set only if a file is _really_ created.
This code is now only used for ntea here since the files
security attributes are set in CreateFile () now. */
if (flags & O_CREAT && get_device () == FH_DISK
&& GetLastError () != ERROR_ALREADY_EXISTS
&& !allow_ntsec && allow_ntea)
set_file_attribute (has_acls (), get_win32_name (), mode);
syscall_printf ("%p = CreateFile (%s, %p, %p, %p, %p, %p, 0)",
x, get_win32_name (), access, shared, &sa,
creation_distribution, file_attributes);
set_io_handle (x);
set_flags (flags, pc ? pc->binmode () : 0);

View File

@ -400,6 +400,14 @@ fhandler_disk_file::open (path_conv *real_path, int flags, mode_t mode)
return 0;
}
/* Attributes may be set only if a file is _really_ created.
This code is now only used for ntea here since the files
security attributes are set in CreateFile () now. */
if (flags & O_CREAT
&& GetLastError () != ERROR_ALREADY_EXISTS
&& !allow_ntsec && allow_ntea)
set_file_attribute (has_acls (), get_win32_name (), mode);
/* Set newly created and truncated files as sparse files. */
if ((real_path->fs_flags () & FILE_SUPPORTS_SPARSE_FILES)
&& (get_access () & GENERIC_WRITE) == GENERIC_WRITE

View File

@ -170,10 +170,12 @@ out:
void __stdcall
wait_for_sigthread ()
{
assert (wait_sig_inited);
(void) WaitForSingleObject (wait_sig_inited, INFINITE);
(void) ForceCloseHandle (wait_sig_inited);
sigproc_printf ("wait_sig_inited %p", wait_sig_inited);
HANDLE hsig_inited = wait_sig_inited;
assert (hsig_inited);
(void) WaitForSingleObject (hsig_inited, INFINITE);
wait_sig_inited = NULL;
(void) ForceCloseHandle1 (hsig_inited, wait_sig_inited);
}
/* Get the sync_proc_subproc muto to control access to
@ -654,7 +656,8 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception)
{
if (no_signals_available ())
goto out; // Either exiting or not yet initializing
assert (!wait_sig_inited);
if (wait_sig_inited)
wait_for_sigthread ();
wait_for_completion = p != myself_nowait;
p = myself;
}