* fhandler.h (class fhandler_dev_tape): Add declaration for
fixup_after_fork and set_close_on_exec. * fhandler_tape.cc (fhandler_dev_tape::open): Create mt_mtx mutex inheritable. (fhandler_dev_tape::close): Close mt_mtx. (fhandler_dev_tape::dup): Duplicate mt_mtx and mt_evt as necessary. (fhandler_dev_tape::fixup_after_fork): New method. (fhandler_dev_tape::set_close_on_exec): New method.
This commit is contained in:
parent
2a770b2a6f
commit
d9c1b93d19
@ -1,3 +1,14 @@
|
|||||||
|
2005-06-22 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler.h (class fhandler_dev_tape): Add declaration for
|
||||||
|
fixup_after_fork and set_close_on_exec.
|
||||||
|
* fhandler_tape.cc (fhandler_dev_tape::open): Create mt_mtx mutex
|
||||||
|
inheritable.
|
||||||
|
(fhandler_dev_tape::close): Close mt_mtx.
|
||||||
|
(fhandler_dev_tape::dup): Duplicate mt_mtx and mt_evt as necessary.
|
||||||
|
(fhandler_dev_tape::fixup_after_fork): New method.
|
||||||
|
(fhandler_dev_tape::set_close_on_exec): New method.
|
||||||
|
|
||||||
2005-06-21 Corinna Vinschen <corinna@vinschen.de>
|
2005-06-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* security.cc (get_initgroups_sidlist): Drop special_pgrp parameter.
|
* security.cc (get_initgroups_sidlist): Drop special_pgrp parameter.
|
||||||
|
@ -636,6 +636,8 @@ class fhandler_dev_tape: public fhandler_dev_raw
|
|||||||
virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||||
|
|
||||||
virtual int dup (fhandler_base *child);
|
virtual int dup (fhandler_base *child);
|
||||||
|
virtual void fixup_after_fork (HANDLE parent);
|
||||||
|
virtual void set_close_on_exec (bool val);
|
||||||
virtual int ioctl (unsigned int cmd, void *buf);
|
virtual int ioctl (unsigned int cmd, void *buf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1218,7 +1218,7 @@ fhandler_dev_tape::open (int flags, mode_t)
|
|||||||
set_errno (ENOENT);
|
set_errno (ENOENT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(mt_mtx = CreateMutex (&sec_all, FALSE, NULL)))
|
if (!(mt_mtx = CreateMutex (&sec_all, TRUE, NULL)))
|
||||||
{
|
{
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
return 0;
|
return 0;
|
||||||
@ -1256,6 +1256,7 @@ fhandler_dev_tape::close (void)
|
|||||||
ret = mt->drive (driveno ())->close (get_handle (), is_rewind_device ());
|
ret = mt->drive (driveno ())->close (get_handle (), is_rewind_device ());
|
||||||
if (mt_evt)
|
if (mt_evt)
|
||||||
CloseHandle (mt_evt);
|
CloseHandle (mt_evt);
|
||||||
|
CloseHandle (mt_mtx);
|
||||||
if (ret)
|
if (ret)
|
||||||
__seterrno_from_win_error (ret);
|
__seterrno_from_win_error (ret);
|
||||||
cret = fhandler_dev_raw::close ();
|
cret = fhandler_dev_raw::close ();
|
||||||
@ -1446,9 +1447,46 @@ int
|
|||||||
fhandler_dev_tape::dup (fhandler_base *child)
|
fhandler_dev_tape::dup (fhandler_base *child)
|
||||||
{
|
{
|
||||||
lock (-1);
|
lock (-1);
|
||||||
|
fhandler_dev_tape *fh = (fhandler_dev_tape *) child;
|
||||||
|
if (!DuplicateHandle (hMainProc, mt_mtx, hMainProc, &fh->mt_mtx, 0, TRUE,
|
||||||
|
DUPLICATE_SAME_ACCESS))
|
||||||
|
{
|
||||||
|
debug_printf ("dup(%s) failed, mutex handle %x, %E",
|
||||||
|
get_name (), mt_mtx);
|
||||||
|
__seterrno ();
|
||||||
|
return unlock (-1);
|
||||||
|
}
|
||||||
|
fh->mt_evt = NULL;
|
||||||
|
if (mt_evt &&
|
||||||
|
!DuplicateHandle (hMainProc, mt_evt, hMainProc, &fh->mt_evt, 0, TRUE,
|
||||||
|
DUPLICATE_SAME_ACCESS))
|
||||||
|
{
|
||||||
|
debug_printf ("dup(%s) failed, event handle %x, %E",
|
||||||
|
get_name (), mt_evt);
|
||||||
|
__seterrno ();
|
||||||
|
return unlock (-1);
|
||||||
|
}
|
||||||
return unlock (fhandler_dev_raw::dup (child));
|
return unlock (fhandler_dev_raw::dup (child));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_dev_tape::fixup_after_fork (HANDLE parent)
|
||||||
|
{
|
||||||
|
fhandler_dev_raw::fixup_after_fork (parent);
|
||||||
|
fork_fixup (parent, mt_mtx, "mt_mtx");
|
||||||
|
if (mt_evt)
|
||||||
|
fork_fixup (parent, mt_evt, "mt_evt");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_dev_tape::set_close_on_exec (bool val)
|
||||||
|
{
|
||||||
|
fhandler_dev_raw::set_close_on_exec (val);
|
||||||
|
set_no_inheritance (mt_mtx, val);
|
||||||
|
if (mt_evt)
|
||||||
|
set_no_inheritance (mt_evt, val);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_dev_tape::ioctl (unsigned int cmd, void *buf)
|
fhandler_dev_tape::ioctl (unsigned int cmd, void *buf)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user