summaryrefslogtreecommitdiffstats
path: root/winsup/utils
Commit message (Collapse)AuthorAgeFilesLines
* Cygwin: winlean.h: remove most of the extended memory APIKen Brown2020-10-102-2/+0
| | | | | | | | | | | | | | | | | | | Cherry pick of c1f7c4d1b6d7424d7081fd382ac83a631b7671ff. This was added as a temporary measure in commit e18f7f99 because it wasn't yet in the mingw-w64 headers. With one exception, it is now in the current release of the headers (version 8.0.0), so we don't need it in winlean.h. The exception is that VirtualAlloc2 is declared conditionally in <w32api/memoryapi.h>, but the compilation of Cygwin requires it to always be declared, even though it will only be executed on systems that support it. So retain the declaration in winlean.h. And add "WINAPI" to the declaration, as in memoryapi.h. Add a check that version >= 8 of the mingw-w64 headers is intalled. Also revert commit 3d136011, which was a related temporary workaround.
* Cygwin: strace: ignore GCC exceptionscygwin-3_1_7-releaseKen Brown2020-08-201-0/+8
| | | | | | | Any C++ app that calls 'throw' on 64-bit Cygwin results in an exception of type STATUS_GCC_THROW (0x20474343) generated by the C++ runtime. Don't pollute the strace output by printing information about this and other GCC exceptions.
* Cygwin: Use documented QueryWorkingSetEx() in dumperJon Turney2020-08-071-29/+7
| | | | | In dumper, use the documented QueryWorkingSetEx(), rather than the undocumented NtQueryVirtualMemory() with MemoryWorkingSetExInformation.
* Cygwin: utils: build with -Wimplicit-fallthrough=4 -WerrorCorinna Vinschen2020-08-072-2/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: convert usage() to proper noreturn function throughoutCorinna Vinschen2020-08-0723-111/+55
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: cygcheck: avoid GCC warning concatenating stringsCorinna Vinschen2020-08-071-1/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: refresh tzmapCorinna Vinschen2020-08-072-58/+91
| | | | | | | | - update path to Unicode windowsZones.xml file - drop Windows XP considerations - regenerate tzmap.h Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Speed up dumperJon Turney2020-07-311-9/+4
| | | | | | | | Stop after we've written the dump in response to the initial breakpoint EXCEPTION_DEBUG_EVENT we recieve for attaching to the process. (rather than bogusly sitting there for 20 seconds waiting for more debug events from a stopped process after we've already written the dump).
* Cygwin: Remove synchronization event from dumperJon Turney2020-07-311-12/+0
| | | | | The use of the 'cygwin_error_start_event' for synchronization with dumper was removed from the DLL in commit 8abeff1e (April 2001).
* Cygwin: Add --nokill dumper optionJon Turney2020-07-311-1/+19
| | | | | Add --nokill option to dumper, for compatibility with minidumper, and to assist with testing.
* Cygwin: Decorate NtQueryVirtualMemory() to fix 32-bit buildJon Turney2020-07-281-1/+1
| | | | | | | Decorate NtQueryVirtualMemory() with NTAPI (for stdcall) to fix 32-bit build. Reported-by: Takashi Yano <takashi.yano@nifty.ne.jp>
* Cygwin: Use MEMORY_WORKING_SET_EX_INFORMATION in dumperJon Turney2020-07-212-4/+61
| | | | | | | | | | | | | Use the (undocumented) MEMORY_WORKING_SET_EX_INFORMATION in dumper to determine if a MEM_IMAGE region is unsharable, and hence has been modified. After this, we will end up dumping memory regions where: - state is MEM_COMMIT (i.e. is not MEM_RESERVE or MEM_FREE), and -- type is MEM_PRIVATE and protection allows reads (i.e. not a guardpage), or -- type is MEM_IMAGE and attribute is non-sharable (i.e. it was WC, got written to, and is now a RW copy)
* Cygwin: Don't dump non-writable image regionsJon Turney2020-07-211-0/+6
| | | | | | | | | | | | | | | After this, we will end up dumping memory regions where: - state is MEM_COMMIT (i.e. is not MEM_RESERVE or MEM_FREE), and -- type is MEM_PRIVATE and protection allows reads (i.e. not a guardpage), or -- type is MEM_IMAGE and protection allows writes Making this decision based on the current protection isn't 100% correct, because it may have been changed using VirtualProtect(). But we don't know how to determine if a region is shareable. (As a practical matter, anything which gets us the stack (MEM_PRIVATE) and .data/.bss (RW MEM_IMAGE) is going to be enough for 99% of cases)
* Cygwin: Drop excluded regions list from dumperJon Turney2020-07-212-61/+4
| | | | Drop excluded regions, now it's always empty
* Cygwin: Remove reading of PE for section flags from dumperJon Turney2020-07-214-114/+3
|
* Cygwin: Show details of all memory regions in dumper debug outputJon Turney2020-07-211-21/+80
|
* Cygwin: Make dumper scan more than first 4GB of VM on x86_64Jon Turney2020-07-121-2/+2
| | | | | It's unclear that we need an end address here at all, or can just rely on VirtualQueryEx() failing when we reach the end of memory regions.
* Cygwin: Add a new win32_pstatus data type for modules on x86_64Jon Turney2020-07-121-0/+4
| | | | | | | Also take a bit more care with sizes in other data types to ensure they are the same on x86 and x86_64. Add some explanatory comments.
* Cygwin: Update ELF target used by dumper on x86_64Jon Turney2020-07-121-2/+8
| | | | | | Like [1], but actually making the effort to be 'usable' and 'tested'. [1] https://cygwin.com/pipermail/cygwin/2019-October/242815.html
* Cygwin: utils: override definition of PMEM_EXTENDED_PARAMETERCorinna Vinschen2020-04-072-0/+2
| | | | | | | | | | PMEM_EXTENDED_PARAMETER is defined in the local winlean.h as long as mingw-w64 doesn't define it (in winnt.h). ntdll.h needs the definition for declaring NtMapViewOfSectionEx. cygpath.cc and ps.cc both include ntdll.h but not winlean.h, so they complain about the missing definition. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Update dumper for bfd API changesJon Turney2020-02-272-8/+26
| | | | | | | | | Update dumper for bfd API changes in binutils 2.34 libbfd doesn't guarantee API stability, so we've just been lucky this hasn't broken more often. See binutils commit fd361982.
* Cygwin: ps: fix compiler warning in ttynamCorinna Vinschen2020-02-261-9/+10
| | | | | | | | | | | | | | | The helper function ttynam creates a tty name by using sprintf wrongly on a pretty short buffer. The foramt string only specifies a minimum field length, not a maximum field length, so gcc-9.2.0 complains: ps.cc:101:23: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=] Fix this thoroughly by specifying a maximum field width as well as by using snprintf with a fixed buffer length. Also, drop using a static buffer in favor of using a buffer in the caller. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* regtool: allow /proc/registry{,32,64}/ registry path prefixBrian Inglis2019-11-131-3/+14
| | | | | The user can supply the registry path prefix /proc/registry{,32,64}/ to use path completion.
* Cygwin: pty: Prevent the helper process from exiting by Ctrl-C.Takashi Yano2019-09-141-0/+1
|
* Cygwin: pty: add pseudo console support.Takashi Yano2019-08-291-1/+13
| | | | | | | - Support pseudo console in PTY. Pseudo console is a new feature in Windows 10 1809, which provides console APIs on virtual terminal. With this patch, native console applications can work in PTYs such as mintty, ssh, gnu screen or tmux.
* Cygwin: ldd: Try harder to get dll namesMark Geisert2019-08-152-2/+44
| | | | | | Borrow a trick from strace to lessen occurrences of "??? => ???" in ldd output. Specifically, if the module name isn't found in the usual place in the mapped image, use the file handle we have to look up the name.
* Cygwin: ps: fix a compiler warningCorinna Vinschen2019-08-121-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: suppress GCC 8.3 errors with -Warray-boundsKen Brown2019-07-161-0/+2
|
* Cygwin: Build cygwin-console-helper with correct compilerMark Geisert2019-06-271-1/+1
|
* Cygwin: Use correct string conversionMark Geisert2019-06-271-2/+2
| | | | | Correct the string conversion calls so both argv elements get converted at full precision.
* cygcheck: expand common_apps listYaakov Selkowitz2019-06-041-1/+16
| | | | | | | | | An increasing number of tools are being included in Windows which have the same names as those included in Cygwin packages. Indicating which one is first in PATH can be helpful in diagnosing behavioural discrepencies between them. Also, fix the alphabetization of ssh.
* get and convert boot time once and use as neededBrian Inglis2019-03-251-9/+16
|
* default ps -W process start time to system boot time when inaccessible, 0, -1Brian Inglis2019-03-251-0/+11
|
* Cygwin: strace: print windows and cygwin pid in event outputCorinna Vinschen2019-03-231-13/+36
| | | | | | | | | | | | | | strace only printed the Windows PID in event output so far. Especially now that Windows and Cygwin PID are decoupled, the strace user might like to see the Cygwin pid in event output as well. However, at process startup, the process might not have a Cygwin PID yet. To mitigate this, always print the Windows PID and only add the Cygwin pid if it exists. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: ps: simplify codeCorinna Vinschen2019-03-121-47/+18
| | | | | | | | | Always use NtQuerySystemInformation(SystemProcessIdInformation). This drops two code paths calling NtQueryInformationProcess or GetModuleFileNameExW and only requires to open the process to fetch system time info. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: ps: show *all* processes in ps -W outputCorinna Vinschen2019-03-121-32/+51
| | | | | | | | | | | | | | | There's a long-standing bug in ps -W. It only shows processes which ps can open with PROCESS_QUERY_LIMITED_INFORMATION permissions. However, that fails for a lot of system processes. Due to that, output is basically restricted to processes in the same session, as well as Cygwin processes... which isn't *quite* what ps -W was supposed to do. Basically we only need to open the process to fetch the image name. If that fails, utilize the undocumented SystemProcessIdInformation info class introduced with Windows Vista, which allows to fetch the image name by specifying the PID. Restructure the code a bit. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: MOUNT_BINARY -> MOUNT_TEXTCorinna Vinschen2019-02-182-9/+8
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: kill: revert erroneously removed optind correctionCorinna Vinschen2019-02-181-1/+4
| | | | | | | | When recognizing a negative pid, optind is off by one. The code correcting this has been erroneously removed by commit 8de660271fe75a6993f1c9888d24b824bb7f999d. Revert that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fix typoCorinna Vinschen2019-02-021-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: kill(1): introduce a -W optionCorinna Vinschen2019-02-021-19/+39
| | | | | | Allow to kill processes using Windows PIDs on the command line. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: kill(1): revert casts required for 32 bit to avoid spurious warningsCorinna Vinschen2019-02-021-2/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: kill(1): disallow killing process using raw Windows PIDCorinna Vinschen2019-02-021-19/+22
| | | | | | | | | This may end up killing the wrong process. Only allow Cygwin PID. Slightly clean up code: Remove outdated W95 considerations. Fix a bug in commandline argument processing. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: path_conv: decouple path_types from mount typesCorinna Vinschen2019-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove another unfortunate amalgamation: Mount flags (MOUNT_xxx) are converted to path_types (PATH_xxx) and mixed with non-mount path_types flags in the same storage, leading to a tangled, pell-mell usage of mount flags and path flags in path_conv and symlink_info. - There's also the case of PC_NONULLEMPTY. It's used in exactly one place with a path_conv constructor only used in this single place, just to override the automatic PC_NULLEMPTY addition when calling the other path_conv constructors. Crazily, PC_NONULLEMPTY is a define, no path_types flag, despite its name. - It doesn't help that the binary flag exists as mount and path flag, while the text flag only exists as path flag. This leads to mount code using path flags to set text/binary. Very confusing is the fact that a text mount/path flag is not actually required; the mount code sets the text flag on non binary mounts anyway, so there are only two states. However, to puzzle people a bit more, path_conv::binary wrongly implies there's a third, non-binary/non-text state. Clean up this mess: - Store path flags separately from mount flags in path_conv and symlink_info classes and change all checks and testing inline methods accordingly. - Make PC_NONULLEMPTY a simple path_types flag and drop the redundant path_check constructor. - Clean up the definition of pathconv_arg, path_types, and mount flags. Use _BIT expression, newly define in cygwin/bits.h. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add lsattr and chattr toolsCorinna Vinschen2018-12-263-1/+652
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* setfacl: Rename the option --file to --set-file, as on LinuxKen Brown2018-08-171-2/+3
| | | | Retain --file as an undocumented option for backwards compatibility.
* Cygwin: utils: ps: use fputs to print fixed stringsCorinna Vinschen2018-08-091-3/+3
| | | | | | Avoid gcc warning "format not a string literal and no format arguments" Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: strace: fix format stringCorinna Vinschen2018-08-081-1/+1
| | | | | | | %ll is long valid for mingw builds. Use this rather than %I64 to avoid a gcc warning Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: change 3rd readlink param to size_tCorinna Vinschen2018-08-082-5/+5
| | | | | | Avoid gcc warnings Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utils: cygcheck: fix filesystem output formatCorinna Vinschen2018-08-081-5/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* POSIX Asynchronous I/O support: other filesMark Geisert2018-07-251-1/+1
| | | | | | Updates to misc files to integrate AIO into the Cygwin source tree. Much of it has to be done when adding any new syscalls. There are some updates to limits.h for AIO-specific limits. And some doc mods.