ERROR_EOM_OVERFLOW and ERROR_NO_DATA_DETECTED to EIO. Add mappings
for ERROR_NO_MEDIA_IN_DRIVE, ERROR_DEVICE_REQUIRES_CLEANING and
ERROR_DEVICE_DOOR_OPEN.
* fhandler.h (class fhandler_dev_raw): Drop varblkop member.
(fhandler_dev_raw::is_eom): De-virtualize.
(fhandler_dev_raw::is_eof): Ditto.
(class fhandler_dev_tape): Drop lasterr and dp member. Add mt_mtx
member. Drop all private methods formerly used by ioctl.
(fhandler_dev_tape::is_rewind_device): Use get_minor for clarity.
(fhandler_dev_tape::driveno): New method.
(fhandler_dev_tape::drive_init): New method.
(fhandler_dev_tape::clear): Remove method.
(fhandler_dev_tape::is_eom): Ditto.
(fhandler_dev_tape::is_eof): Ditto.
(fhandler_dev_tape::write_file): Ditto.
(fhandler_dev_tape::read_file): Ditto.
(fhandler_dev_tape::_lock): New method.
(fhandler_dev_tape::unlock): New method.
(fhandler_dev_tape::raw_read): New method.
(fhandler_dev_tape::raw_write): New method.
* fhandler_raw.cc (fhandler_dev_raw::is_eom): New method.
(fhandler_dev_raw::is_eof): New method.
(fhandler_dev_raw::open): Allow setting write through option by
using the O_TEXT flag as ... flag.
(fhandler_dev_raw::writebuf): Remove usage of varblkop and other
tape specific code.
(fhandler_dev_raw::raw_read): Ditto.
(fhandler_dev_raw::dup): Ditto.
* fhandler_tape.cc: Rewrite tape operations entirely. Implement
new tape driver classes mtinfo, mtinfo_drive and mtinfo_part.
Reduce fhandler_dev_tape methods to mostly just calling appropriate
mtinfo_drive methods.
(mtinfo_init): New function adding the mtinfo shared memory area.
* mtinfo.h: New file, containing the definition of the new tape
driver classes.
* shared.cc: Include mtinfo.h.
(offsets): Add entry for mtinfo shared memory area.
(memory_init): Call mtinfo_init.
* shared_info.h (shared_locations): Add SH_MTINFO shared location.
* include/cygwin/mtio.h: Change and add various comments. Add GMT_xxx
macros for new generic flags. Add MT_ST_xxx bitfield definitions
for MTSETDRVBUFFER ioctl.
* include/cygwin/version.h: Bump API minor version number.
ERROR_SETMARK_DETECTED to EIO instead of ESPIPE.
Handle ERROR_FILEMARK_DETECTED.
* fhandler_tape.cc (TAPE_FUNC): Add comment that ERROR_BUS_RESET
has still to be handled correctly.
(fhandler_dev_tape::open): Accomodate fact that get.mt_dsreg
also contains density code.
(fhandler_dev_tape::ioctl): Rearrange slightly. Reset devbuf also on
MTNOP, MTWSM, MTSETBLK, MTSETDRVBUFFER, MTSETPART and MTMKPART.
(fhandler_dev_tape::tape_set_pos): Rearrange. Match behaviour to
the Linux tape driver.
(fhandler_dev_tape::tape_status): Call IOCTL_STORAGE_GET_MEDIA_TYPES_EX
if available. Return device type and density code in appropriate
mtget members.
* wincap.h (wincaps::has_ioctl_storage_get_media_types_ex): New element.
* wincap.cc: Implement above element throughout.
* include/cygwin/mtio.h: Add tape device types as returned by
IOCTL_STORAGE_GET_MEDIA_TYPES_EX.
(MT_TAPE_INFO): Use above type codes.
(struct mtget): Change mt_dsreg comment.
* fhandler.h (fhandler_dev_raw::write_file): New method, created
from former static function.
(fhandler_dev_raw::read_file): Ditto.
(reset_devbuf): New inline method.
(class fhandler_dev_tape): Add TAPE_GET_DRIVE_PARAMETERS
member `dp'.
(fhandler_dev_tape::write_file): New method.
(fhandler_dev_tape::read_file): Ditto.
(fhandler_dev_tape::tape_get_feature): Convert to inline method.
(fhandler_dev_tape::tape_error): New method, created from former
static function.
(fhandler_dev_tape::tape_get_blocksize): Remove declaration.
* fhandler_raw.cc (fhandler_dev_raw::write_file): New method, created
from former static function.
(fhandler_dev_raw::read_file): Ditto.
(fhandler_dev_raw::writebuf): Accomodate the fact that no devbuf
exists under variable block size condition.
(fhandler_dev_raw::raw_read): Ditto. Add local p pointer to simplify
pointer arithmetic.
(fhandler_dev_raw::raw_write): Always set devbufend to 0 when starting
with writing. Accomodate the fact that no devbuf exists under
variable block size condition.
* fhandler_tape.cc: Various formatting changes.
(TAPE_FUNC): New macro. Use throughout as tape function loop.
(get_ll): Convert into macro.
(IS_EOM): New macro.
(IS_EOF): New macro.
(fhandler_dev_tape::is_eom): Use IS_EOM macro.
(fhandler_dev_tape::is_eof): Use IS_EOF macro.
(fhandler_dev_tape::write_file): New method.
(fhandler_dev_tape::read_file): New method.
(fhandler_dev_tape::open): Get drive information block here once.
(fhandler_dev_tape::lseek): Remove unneeded duplicate code.
(fhandler_dev_tape::dup): Duplicate drive information block.
(fhandler_dev_tape::ioctl): Remove drvbuf in variable block size mode.
Return ERROR_INVALID_BLOCK_LENGTH instead of ERROR_MORE_DATA if
buffer contains data which would get lost on buffer size changing.
Use absolute tape positioning also if drive only supports logical
block positioning.
(fhandler_dev_tape::tape_error): New method, created from former
static function.
(fhandler_dev_tape::tape_get_pos): Allow logical block reporting.
Workaround tape driver bug.
(fhandler_dev_tape::_tape_set_pos): Reset device buffer and flags
after successful repositioning.
(fhandler_dev_tape::tape_set_pos): Allow logical block positioning.
Workaround tape driver bug.
(fhandler_dev_tape::tape_erase): Use dp instead of calling
GetTapeParameters.
(fhandler_dev_tape::tape_prepare): Ditto.
(fhandler_dev_tape::tape_get_blocksize): Remove.
(fhandler_dev_tape::tape_set_blocksize): Don't call tape_get_blocksize.
Error handling already done in fhandler_dev_tape::ioctl.
(fhandler_dev_tape::tape_status): Remove local `dp' variable.
Accomodate logical tape reporting. Call tape_get_feature instead
of accessing feature words directly.
(fhandler_dev_tape::tape_compression): Use dp instead of calling
GetTapeParameters. Fix resetting datcompression.
calculated mask in debugging output.
* sigproc.h (set_signal_mask): Reflect above change in declaration.
* path.cc (mount_item::build_win32): Take path apart before feeding it to
fnmunge. Throughout, change use of _reent_winsup()-> to _my_tls.locals.
instead. Throughout, remove obsolete MT_SAFE/_CYG_THREAD_FAILSAFE
considerations. Througout, add cygtls.h include.
* Makefile.in (DLL_OFILES): Add cygtls.o. Add some more objects to the
-fomit-frame-pointer list.
* acconfig.h: Remove obsolete settings.
* config.h.in: Ditto.
* bsdlib.cc: Add cygtls.h include.
* configure.in: Remove --enable-extra-threadsafe-checking.
* configure: Regenerate.
* cygtls.h (_local_storage): New struct renamed from _winsup_t (sic).
(_threadinfo:local_clib): Add new field.
(_threadinfo::locals): Ditto.
(_threadinfo::init_thread): Accept second _reent * argument.
(_threadinfo::call): Define as regparm.
(CYGTLS_PADSIZE): Remove unnecessary slop.
(_getreent): Define as a macro.
* thread.h: Remove _CYG_THREAD_FAILSAFE and MT_SAFE stuff.
(_winsup_t): Move to cygtls.h.
(ResourceLocks::ResourceLocks): Eliminate empty constructor.
(MTinterface::reents): Eliminate.
(MTinterface::thread_self_key): Eliminate.
(MTinterface::MTinterface): Eliminate.
* dcrt0.cc: Include stdio.h for _impure_ptr initialization.
(do_global_ctors): Remove run_ctors_p (sic) considerations. Don't call atexit
here.
(__main): Initialize destructors for user here.
(dll_crt0_1): Accept a dummy argument. Don't call init_thread here. Don't set
_impure_ptr here. Call do_global_ctors after more things have been
initialized.
(_dll_crt0): Define zeros buffer as max of needed size of CYGTLS_PADSIZE so
that it can be used for two purposes while minimizing stack usage. Initialize
_impure_ptr specifically, for speed. Call dll_crt0_1 with buffer argument.
(cygwin_dll_init): Call dll_crt0_1 with dummy argument.
* dtable.cc (dtable::find_unused_handle): Remove call to AssertResourceOwner.
* exceptions.cc: Move _threadinfo stuff to new file.
* cygtls.cc: New file.
* gentls_offsets: Accommodate increasing complexity of cygtls.h.
* hires.h (hires_base::~hires_base): Remove.
* init.cc (dll_entry): Remove setting of reents.
* thread.cc: Remove syslog.h include.
(__getreent): Simplify to use _my_tls.
(_reent_winsup): Delete.
(AssertResourceOwner): Delete.
(MTinterface::Init): Remove setting of _clib and _winsup, with all that
entails.
(MTinterface::fixup_after_fork): Ditto.
(pthread::thread_init_wrapper): Ditto. Also remove call to
set_tls_self_pointer.
(pthread::set_tls_self_pointer): Eliminate.
(pthread::get_tls_self_pointer): Just return _my_tls.tid;
(__reent_t::init_clib): Eliminate.
* tlsoffsets.h: Regenerate.
cygerrno.h.
* include/cygwin/config.h (__DYNAMIC_REENT__): Define.
* include/cygwin/version.h: Bump API minor version.
* cygwin.din: Export __getreent
* cygerrno.h: Include errno.h. Fix places where _impure_ptr is used directly
to store the errno value.
* debug.cc (__set_errno): Ditto.
* errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled.
* signal.cc: Rename _reent_clib to _REENT throughout.
* thread.h (reent_clib): Remove prototype.
* thread.cc (reent_clib): Rename reent_clib to __getreent. Return _impure_ptr
until MTinterface is initialized.
(reent_winsup): Fix a possible SEGV when _r == NULL. Return NULL instead.
* MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to keep
signal handling running when fork is called from a thread other than the
mainthread.
EOVERFLOW.
(_sys_errlist): Add entries for EILSEQ and EOVERFLOW.
(strerror): Ditto.
* mmap.cc (map_map): Set errno in case of error.
(mmap64): Remove setting errno explicitely to ENOMEM.
already taken care of that.
* fhandler_console.cc (fhandler_console::open): Initialize handles to NULL.
(fhandler_console::close): Ditto. GNUify non-GNU formatted functions calls
throughout.
SNDCTL_DSP_GETBLKSIZE operation. Remove obsolete 'name' arg from fhandler_*
constructors throughout.
* winsup.h (winsock_active): New macro.
(winsock2_active): Ditto.
* autoload.cc (wsock_init): Use new macros to decide if winsock or winsock2 is
loaded.
(nonexist_wsock32): Dummy function to force winsock load.
(nonexist_ws2_32): Dummy function to force winsock2 load.
* fhandler.h (fhandler_socket::fstat): Declare new method. Currently unused.
* fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Check that
winsock2 is active before trying WSADuplicateSocketA.
(fhandler_socket::fixup_after_fork): Add extra check for winsock2_active.
Otherwise use iffy procedures for Windows 95.
(fhandler_socket::fixup_after_exec): Add debugging.
(fhandler_socket::dup): Add debugging.
(fhandler_socket::fstat): New method.
(fhandler_socket::set_close_on_exec): Attempt to perform iffy stuff on Windows
95.
* errno.cc (_sys_nerr): Work around compiler strangeness.
* pinfo.cc (winpids::add): Add extra element at end of allocated array for
setting to NULL.
(winpids::enumNT): Ditto.
(winpids::init): Don't modify pidlist if it hasn't been allocated
(possibly due to malloc problem).
* environ.cc: Add extern declaration for `pcheck_case'.
(check_case_init): New function.
(struct parse_thing): Add "check_case" option.
* errno.cc (_sys_nerrlist): Add text for ECASECLASH.
(strerror): Add case branch for ECASECLASH.
* fhandler.cc (fhandler_disk_file::open): Check for case clash.
* path.cc: Add global variable `pcheck_case'.
(struct symlink_info): Add member `case_clash' and method `case_check'.
(path_prefix_p_): Call `pathnmatch' instead of `strncasematch'.
(pathnmatch): New funtion.
(pathmatch): Ditto.
(path_conv::check): Add handling for case checking.
(symlink): Check for case clash.
(symlink_info::check): Add parameter for case checking.
Handle case checking.
(symlink_info::case_check): New method.
(chdir): Don't use unconverted path if pcheck_case==PCHECK_STRICT.
* path.h: Add extern declarations for `pathmatch' and
`pathnmatch'.
(enum case_checking): New enumeration type describing
the case checking behaviour of path conversion routines.
(class path_conv): Add member `case_clash'.
* syscalls.cc (_link): Check for case clash.
Windows shortcuts to avoid compiler flag `-fvtable-thunks'.
* shortcut.h: Ditto.
* Makefile.in: Add shortcut.o to DLL_OFILES.
* cygerrno.h: Provide a C interface to `geterrno_from_win_error' for
using in shortcut.c.
* errno.cc (geterrno_from_win_error): Define as extern "C".
* path.cc (struct symlink_info): Remove methods `check_shortcut' and
`check_sysfile'.
(shortcut_header): Move to shortcut.c.
(shortcut_initalized): Ditto.
(create_shortcut_header): Ditto.
(cmp_shortcut_header): Ditto.
(symlink_info::check_shortcut): Ditto. Reorganize as a plain C function.
(symlink_info::check_sysfile): Redefine as a global function using the
same parameter list as `check_shortcut' for clearness.
(symlink_info::check): Change parameter list for calls to
`check_shortcut' and `check_sysfile'.
* fhandler.cc (fhandler_base::fstat): Move to inline method in fhandler.h.
(fhandler_base::set_io_handle): Ditto.
* fhandler.h (fhandler_base): Make some methods inline.
* fhandler_console.cc (fhandler_console::write_normal): Make buffer larger.
* sigproc.h (sigframe::sigframe): Actually use set ebp parameter correctly.
* spawn.cc (spawn_guts): Set dwProcessId when exec'ing. Just exit immediately
after reparenting.
* syscalls.cc: Sprinkle sigframe stuff throughout.
* wait.cc (wait4): Set signal frame here.
* dcrt0.cc (__api_fatal): Don't rely on small_printf to display errors. Always
display problems to the console, if possible.
required.
* errno.cc: Use DWORD to hold Windows errors.
(geterrno_from_win_error): New function.
(seterrno_from_win_error): Use geterrno_from_win_error to convert supplied
windows error (suggested by Corinna Vinschen).
* path.cc (symlink_info): Add error element.
* path.cc (path_conv::check): Remove errno setting. Use new symlink_info errno
element to set path_conv error, where appropriate.
(symlink_info::check): Set error element rather than attempting to manipulate
errno. Add more checks for trailing / and /.. even though they are currently
useless. Avoid setting EINVAL.
* path.cc (normalize_posix_path): Correct check for trailing /.
* *.cc: put winsup.h before other headers (for __INSIDE_CYGWIN__);
use cur_environ() instead of just environ
* times.cc: remove import protections
* glob.c: add winsup.h
* localtime.c: ditto
* smallprint.c: ditto
* Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
interruptible.
(call_handler): Avoid suspending a thread if it owns a mutex. Only set
signal_arrived if the thread was actually interrupted.
(events_init): Initialize module information needed by interruptible().
(sigdelayed): Don't call sig_dispatch_pending since it could screw up
* init.cc (dll_entry): Record module handle of main for use by interruptible().
(proc_subproc): Reorganize handling of terminated child so that the bulk of the
processing comes from the signal thread.
(wait_sig): Force processing of waiting threads if SIGCHLD is not processed.
* sync.cc (muto::release): Set tid == 0 after lock is released or signal
processor will be confused.