Corinna Vinschen [Thu, 31 Oct 2013 14:26:42 +0000 (14:26 +0000)]
* devices.in (dev_cygdrive_storage): Revert mapping to \Device\Null.
(dev_storage): Ditto for /dev.
* devices.cc: Regenerate.
* fhandler.cc (fhandler_base::open_null): New method to open a fake
\Device\Null handler.
(fhandler_base::open): Fix formatting. Change O_ACCMODE test to a
switch statement. Simplify a test which still tested for a now unused
create_disposition.
* fhandler.h (fhandler_base::open_null): Declare.
(fhandler_netdrive::close): Declare.
* fhandler_dev.cc (fhandler_dev::open): Open fake \Device\Null handle
by just calling new open_null method.
* fhandler_disk_file.cc (fhandler_cygdrive::open): Ditto.
* fhandler_netdrive.cc (fhandler_netdrive::open): Call open_null
rather than setting nohandle.
(fhandler_netdrive::close): New method.
* fhandler_registry.cc (fetch_hkey): Fix token in RegOpenUserClassesRoot
call. Create valid key for HKEY_CURRENT_CONFIG by mapping to real key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current.
(fhandler_registry::open): Set nohandle only when using pseudo registry
handle.
* fhandler_virtual.cc (fhandler_virtual::opendir): Call open rather
than just setting nohandle here.
* fhandler_virtual::fstatvfs): Set ST_RDONLY fs flag.
* globals.cc (ro_u_null): New readonly UNICODE_STRING for \Device\Null.
* path.h (path_conv::set_path): Revert previous change caring for
wide_path.
Corinna Vinschen [Wed, 30 Oct 2013 15:53:05 +0000 (15:53 +0000)]
Implement malloc_stats for nano.
* libc/stdlib/nano-mallocr.c (RONECALL): New parameter macro.
(sbrk_start): New variable.
(current_mallinfo, free_list): Forward declaration of data.
(chunk): Define size as long type.
(mallinfo): Synchronize with latest malloc.h.
(nano_*): Forward declaration of functions.
(get_chunk_from_ptr): Defined to static inline.
(nano_mallinfo): Implement this function.
(nano_malloc_stats): Implement this function.
Corinna Vinschen [Wed, 30 Oct 2013 09:44:47 +0000 (09:44 +0000)]
* devices.in (dev_cygdrive_storage): Map to \Device\Null.
(dev_storage): Map /dev and /dev/windows to \Device\Null.
* devices.cc: Regenerate.
* dir.cc (opendir): Create unique id. Explain why.
* fhandler.h (fhandler_dev::get_dev): Implement inline.
(fhandler_cygdrive::close): Drop declaration.
(fhandler_cygdrive::get_dev): Implement inline.
(fhandler_windows::get_hwnd): Ditto.
(fhandler_windows::set_close_on_exec): Drop declaration.
(fhandler_windows::fixup_after_fork): Ditto.
* fhandler_dev.cc (fhandler_dev::open): Call fhandler_disk_file::open
without O_CREAT flag. Explain why. Create \Device\Null handle if
/dev/ doesn't actually exist.
(fhandler_dev::close): Drop nohandle case.
(fhandler_dev::fstatvfs): Drop nohandle check. Test for fs_got_fs
instead. Set ST_RDONLY fs flag for simulated /dev.
(fhandler_dev::opendir): If /dev doesn't exist, call open() to create
fake \Device\Null handle. Don't set nohandle. Set dir_exists
correctly.
(fhandler_dev::rewinddir): Call fhandler_disk_file::rewinddir only if
/dev is a real directory.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): If called for
the cygdrive dir, call open() to create fake \Device\Null handle.
Only attach __DIR_mounts buffer to dir if not called for cygdrive dir.
Don't set nohandle.
(fhandler_cygdrive::open): Create \Device\Null handle.
(fhandler_cygdrive::close): Remove.
(fhandler_cygdrive::fstatvfs): Set ST_RDONLY fs flag.
* fhandler_windows.cc (fhandler_windows::open): Create \Device\Null
handle.
(fhandler_windows::read): Don't add io_handle to WFMO handle array.
Change subsequent test for return value accordingly. Fix test for
"message arrived".
(fhandler_windows::set_close_on_exec): Remove.
(fhandler_windows::fixup_after_fork): Remove.
* path.h (path_conv::set_path): Make sure wide_path is NULL when
setting a new path.
* select.cc (peek_windows): Use correct hWnd value, not io_handle.
(fhandler_windows::select_read): Don't use io_handle as wait object.
(fhandler_windows::select_write): Ditto.
(fhandler_windows::select_except): Ditto.
Corinna Vinschen [Sat, 26 Oct 2013 09:37:34 +0000 (09:37 +0000)]
* exception.h (_exception_list): Drop redefinition for x86_64.
* include/exceptions.h: Disable content for x86_64 since it's not
using frame based exception handling anymore.
Corinna Vinschen [Fri, 25 Oct 2013 18:40:57 +0000 (18:40 +0000)]
* flock.cc (fhandler_base::lock): Only refuse to lock nohandle and
old-style console devices when called to perform BSD flock locking.
Add a FIXME to comment and align description.
* ntdll.h (THREADINFOCLASS): Following MSDN, rename throughout from
THREAD_INFORMATION_CLASS.
Corinna Vinschen [Fri, 25 Oct 2013 16:16:50 +0000 (16:16 +0000)]
* devices.in (dev_storage): Map /dev/clipboard to \Device\Null.
* devices.cc: Regenerate.
* fhandler.h (fhandler_dev_clipboard::open): Drop declaration.
* fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Drop call to
open. Set private members to 0 and call fhandler_base::dup.
(fhandler_dev_clipboard::open): Remove so that default
fhandler_base::open is used to open \Device\Null.
(set_clipboard): Drop gratuitios call to RegisterClipboardFormatW.
(fhandler_dev_clipboard::close): Call fhandler_base::close from here.
Corinna Vinschen [Fri, 25 Oct 2013 15:04:24 +0000 (15:04 +0000)]
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Drop gratuitios
handling of membuffer. It's NULL anyway.
(fhandler_dev_clipboard::lseek): Set membuffer to NULL after freeing
it to avoid subsequent crashes when accessing invalid pointer.
Corinna Vinschen [Fri, 25 Oct 2013 12:21:59 +0000 (12:21 +0000)]
* devices.in (dev_storage): Map /dev/random and /dev/urandom to
\Device\Null.
* devices.cc: Regenerate.
* fhandler.h (fhandler_dev_random::open): Drop declaration.
(fhandler_dev_random::close): Ditto.
(fhandler_dev_random::crypt_gen_random): Convert to static method.
* fhandler_random.cc (fhandler_dev_random::open): Remove so that default
fhandler_base::open is used to open \Device\Null.
(fhandler_dev_random::close): Ditto.
* fhandler_socket.cc (entropy_source): Delete.
(fhandler_socket::af_local_set_secret): Remove entropy_source code and
call fhandler_dev_random::crypt_gen_random directly instead.
Corinna Vinschen [Thu, 24 Oct 2013 17:51:41 +0000 (17:51 +0000)]
* fhandler.h (fhandler_dev_zero::lseek): Convert to inline method.
(class fhandler_dev_random): Drop dummy_offset.
(fhandler_dev_random::lseek): Convert to inline method.
(fhandler_dev_dsp::lseek): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::lseek): Drop here.
* fhandler_random.cc (fhandler_dev_random::open): Drop setting
dummy_offset.
(fhandler_dev_random::lseek): Drop here.
* fhandler_tape.cc (fhandler_dev_tape::lseek): Make no-op, but keep
old code for reference.
* fhandler_zero.cc (fhandler_dev_zero::lseek): Drop here.
Corinna Vinschen [Thu, 24 Oct 2013 09:41:17 +0000 (09:41 +0000)]
* devices.in (dev_storage): Map /dev/zero and /dev/full to \Device\Null.
* devices.cc: Regenerate.
* dtable.h (struct dtable): Make fhandler_base friend, rather
than fhandler_disk_file.
* fhandler.cc (fhandler_base::open_with_arch): Create unique id.
(fhandler_base::cleanup): Call del_my_locks.
(fhandler_base::fcntl): Handle F_GETLK, F_SETLK and F_SETLKW.
* fhandler.h (fhandler_base::get_dev): Return real device number.
(fhandler_base::set_unique_id): New inline method.
(fhandler_disk_file::lock): Drop declaration.
(fhandler_disk_file::get_dev): New method, return pc.fs_serial_number.
(fhandler_dev_zero::open): Drop declaration.
* fhandler_disk_file.cc (fhandler_disk_file::close): Move
del_my_locks call to fhandler_base::open_with_arch.
(fhandler_disk_file::fcntl): Move handling of locking commands to
fhandler_base::fcntl.
(fhandler_base::open_fs): Drop call to NtAllocateLocallyUniqueId.
* fhandler_zero.cc (fhandler_dev_zero::open): Remove so that default
fhandler_base::open is used to open \Device\Null.
* flock.cc (fixup_lockf_after_exec): Finding a single fhandler is
enough here.
(fhandler_base::lock): Replace fhandler_disk_file::lock. Refuse to lock
nohandle devices. Handle read/write test using POSIX flags. Explain
why. Never fail on SEEK_CUR or SEEK_END, rather assume position 0,
just as Linux.
* net.cc (fdsock): Create unique id.
Corinna Vinschen [Wed, 23 Oct 2013 10:04:43 +0000 (10:04 +0000)]
* libc/include/stdio.h (funopen): Change prototype of
__readfn and __writefn parameter to match new definition of
FILE's _read and _write methods.
(_funopen_r): Ditto.
(funopen): Ditto.
(_funopen_r): Ditto.
* libc/include/sys/config.h (_READ_WRITE_BUFSIZE_TYPE) Define
as type int if not already defined. Add comment to explain.
* libc/include/sys/reent.h: Include stddef.h.
(struct __sFILE): Change type of last parameter in declaration
of _read and _write methods to _READ_WRITE_BUFSIZE_TYPE.
(struct __sFILE64): Ditto.
* libc/stdio/local.h (__sread): Declare with last parameter set
to _READ_WRITE_BUFSIZE_TYPE.
(__seofread): Ditto.
(__swrite): Ditto.
(__swrite64): Ditto.
* libc/stdio/fvwrite.c (__sfvwrite_r): Change type of local
variables w and s to _READ_WRITE_RETURN_TYPE.
* libc/stdio/fflush.c (__sflush_r): Change type of local variables
n and t to _READ_WRITE_BUFSIZE_TYPE and _READ_WRITE_RETURN_TYPE.
Add local variables flags to keep _flags value.
* libc/stdio/fmemopen.c (fmemreader): Align to above change.
(fmemwriter): Ditto.
* libc/stdio/fopencookie.c (fcreader): Ditto.
(fcwriter): Ditto.
* libc/stdio/funopen.c (funread): Ditto.
(funwrite): Ditto.
(funreader): Ditto.
(funwriter): Ditto.
* libc/stdio/open_memstream.c (memwriter): Ditto.
* libc/stdio/stdio.c (__sread): Ditto.
(__seofread): Ditto.
(__swrite): Ditto.
* libc/stdio64/stdio64.c (__swrite64): Ditto.
* fhandler.h (fhandler_base::cleanup): Mark as extern rather than inline.
* fhandler_base.cc (fhandler_base::cleanup): Define.
* fhandler_tty.cc (fhandler_pty_slave::cleanup): Call fhandler_base::cleanup.
(fhandler_pty_master::cleanup): Ditto.
Corinna Vinschen [Tue, 15 Oct 2013 14:00:37 +0000 (14:00 +0000)]
* autoload.cc (CryptAcquireContextW): Remove.
(CryptGenRandom): Remove.
(CryptReleaseContext): Remove.
(SystemFunction036): Define. Add comment to explain that this is
actually the RtlGenRandom function.
* fhandler.h (class fhandler_dev_random): Drop crypt_prov member.
(fhandler_dev_random::fhandler_dev_random): Define inline.
(fhandler_dev_random::dup): Drop declaration.
* fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Remove
here.
(fhandler_dev_random::crypt_gen_random): Use RtlGenRandom to drop
dependency to old Crypto API.
(fhandler_dev_random::read): Implement an enhanced version of reading
random bytes from RtlGenRandom for the sake of a better /dev/random
emulation.
(fhandler_dev_random::close): Just return 0 since crypt_prov doesn't
exisyt anymore.
(fhandler_dev_random::dup): Drop entirely for the same reason.
* arm/cpu-init/rdimon-aem.S: Disable for M class cores.
* arm/crt0.S: Don't call _rdimon_hw_init_hook for non-A class cores.
* arm/cpu-init/Makefile.in (CPU_INIT_OBJS): Use CFLAGS.
Jeff Johnston [Tue, 1 Oct 2013 18:08:46 +0000 (18:08 +0000)]
2013-10-01 Petr Hosek <phosek@chromium.org>
* configure.host: Disable new posix_spawn function for all
users of posix dir except Cygwin.
* libc/posix/Makefile.am: Add support for new posix_spawn function.
* libc/posix/Makefile.in: Regenerate.
* libc/posix/posix_spawn.c: New file.
* libc/include/spawn.h: Ditto.
* libc/include/search.h (__compar_fn_t): Add typedef.
(tdelete, tfind, tsearch): Use it.
* libc/include/stdlib.h (__compar_fn_t): Add typedef.
(bsearch, qsort): Use it.
Corinna Vinschen [Sat, 31 Aug 2013 10:21:48 +0000 (10:21 +0000)]
* heap.cc (RAISEHEAP_SIZE): New definition.
(user_heap_info::sbrk): Make failed commit an error condition again.
Only reserve RAISEHEAP_SIZE sized chunk for further heap reservations
by default.
* cygheap.h (user_heap_info::sbrk): Declare new function.
(user_heap_info::init): Ditto.
* heap.cc (user_heap_info::init): Rename from heap_init(). Avoid explictly
using cygheap->user_heap.
(sbrk): Use user_heap_info method via cygheap->user_heap.
(user_heap_info::sbrk): Renamed from sbrk(). Eliminate explicit use of
cygheap->user_heap. Change some pointer arithmetic to use (char *) for
consistency.
* shared.cc (shared_info::initialize): Change heap_init call to
cygheap->user_heap.init.
Corinna Vinschen [Fri, 30 Aug 2013 20:01:10 +0000 (20:01 +0000)]
* heap.cc (sbrk): Add a FIXME comment to VirtualFree call. Fix memory
reservation and commit strategy when more memory is requested than
available on the heap. Release newly reserved memory if commiting
it fails. Add more comments to explain what we do.
Corinna Vinschen [Mon, 26 Aug 2013 16:14:40 +0000 (16:14 +0000)]
* mtinfo.h (class mtinfo_part): Change type of block numbers to int64_t.
(mtinfo_part::initialize): Ditto for nblock parameter in declaration.
(class mtinfo_drive): Change type of block number to int64_t. Change
all parameters indicating a block number to int64_t in method
declarations.
* fhandler_tape.cc (mtinfo_part::initialize): Ditto in definition.
(mtinfo_drive::get_pos): Ditto. Replace low and high with a
ULARGE_INTEGER and use it's components in call to GetTapePosition.
Store full value in block.
(mtinfo_drive::_set_pos): Change type of count parameter to int64_t.
Change call to SetTapePosition accordingly.
(mtinfo_drive::set_pos): Change type of count parameter to int64_t.
Change local variables holding block numbers accordingly.
(mtinfo_drive::get_status): Don't bail out early if fetching media
parameters fails.
(mtinfo_drive::ioctl): Add explicit cast matching receiving type in
MTTELL and MTIOCPOS calls.
Corinna Vinschen [Wed, 21 Aug 2013 20:28:12 +0000 (20:28 +0000)]
* fhandler_tape.cc (mtinfo_drive::create_partitions): Allow partitioning
of drives supporting select partitions.
(mtinfo_drive::get_status): Fill in current partition and number of
partitions on tape into mt_resid.
* include/cygwin/mtio.h (struct mtget): Align mt_resid comment to
aforementioned change.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
Corinna Vinschen [Tue, 20 Aug 2013 20:17:14 +0000 (20:17 +0000)]
* fhandler_tape.cc (mtinfo_drive::create_partitions): Fix long-standing
bug disabling creation of two partitions on drives supporting initiator
partitions.
(mtinfo_drive::set_blocksize): Update media information after setting
blocksize succeeded.
(mtinfo_drive::get_status): Fetch fresh media information.
opcodes/
* micromips-opc.c (micromips_opcodes): Replace "dext" and "dins"
macro entries with "dextm", "dextu", "dinsm" and "dinsu" aliases.
Use +H rather than +C for the real "dext".
* mips-opc.c (mips_builtin_opcodes): Likewise.
gas/
* config/tc-mips.c (report_bad_range, report_bad_field): Delete.
(macro): Remove M_DEXT and M_DINS handling.
gas/testsuite/
* gas/mips/ext-ill.l, gas/mips/mips64r2-ill.l: Expect DEXT and DINS
error messages to have the same form as the EXT and INS ones.
* gas/mips/micromips-insn32.d, gas/mips/micromips-noinsn32.d,
gas/mips/micromips-trap.d, gas/mips/micromips.d,
gas/mips/micromips@mips64r2.d, gas/mips/mips64r2.d: Expect
"dext" and "dins" instead of "dextm", "dextu", "dinsm" and "dinsu".
Corinna Vinschen [Mon, 19 Aug 2013 16:21:29 +0000 (16:21 +0000)]
* lc_msg.h: Regenerate.
* nlsfuncs.cc (__get_lcid_from_locale): Update list of Script-only
locales to Windows 8.
(__set_charset_from_locale): Take locales added with Windows 8 and 8.1
into account.