Commit Graph

160 Commits

Author SHA1 Message Date
Corinna Vinschen 71b4e3b336 Cygwin: get_mem_values: Fix prototype
Incomplete change unsigned long -> size_t was only visible on 32 bit, sigh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:40:18 +02:00
Corinna Vinschen c2fa05899d Cygwin: get_mem_values: Return number of Cygwin pages in arguments
Simplify callers accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:32:42 +02:00
Corinna Vinschen 7b70195f5d Cygwin: get_mem_values: Convert arguments to call-by-reference
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:32:42 +02:00
Corinna Vinschen 630294d373 Cygwin: get_mem_values: Return allocation as size_t values
Use size_t in callers, too.  Fix __small_sprintf format specifiers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:32:42 +02:00
Corinna Vinschen ca2ec0c5cc Revert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm"
This reverts commit 8a32c24a7b.

Replacing page_size() with allocation_granularity() was incorrect.
The values returned by get_mem_values() are # of pages of size
page_size().  Multiplying with allocation_granularity() here
results in values 16 times too big.
2018-08-17 19:16:42 +02:00
Corinna Vinschen e113d12684 Cygwin: /proc/<pid>/stat: Fix time handling
* Use 64 bit timestamps
* Use System boot and process start time to compute starttime value per
  Linux proc.5 description.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-12 22:22:06 +01:00
Corinna Vinschen 01c643e49f Cygwin: Drop HZ usage in favor of MSPERSEC and CLOCKS_PER_SEC
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-12 22:08:42 +01:00
Corinna Vinschen 2af67d21b2 Cygwin: Cleanup time handling
* Redefine NSPERSEC to NS100PERSEC
* Define NSPERSEC as nanosecs per second
* Define USPERSEC as microsecs per second
* Use above constants throughout where appropriate
* Rename to_us to timespec_to_us and inline
* Rename it_bad to timespec_bad and inline

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-07 13:07:44 +01:00
Ken Brown d17c45f200 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::environ
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 6cd1978fc8 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fd
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 911f7d628d cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 571b7689bb cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown be436ad2a3 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::root
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 504959d8fc cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fds
Fix all callers.
2017-10-09 11:44:11 +02:00
Erik M. Bray 5bebfa17c5 Add a /proc/<pid>/environ proc file handler, analogous to /proc/<pid>/cmdline. 2017-01-10 16:24:50 +01:00
Erik M. Bray 8a32c24a7b Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm 2016-11-16 15:58:15 +01:00
Erik M. Bray 6477a48cd1 statm should report memory as multiples of allocation_granularity instead of page_size
that ensures that values in statm mupltiplied by POSIX _SC_PAGESIZE give the correct values
2016-11-16 15:58:08 +01:00
Corinna Vinschen 11dcf9cb5c Open process with PROCESS_QUERY_INFORMATION to fetch maps
Commit ba58e5f lowered permission requirements when opening threads
and processes to {PROCESS,THREAD}_QUERY_LIMITED_INFORMATION.  However,
when creating the /proc/<PID>/maps file, the call to VirtualQueryEx
requires PROCESS_QUERY_INFORMATION access

Note: It seems PROCESS_QUERY_LIMITED_INFORMATION is sufficient starting
with Windows 8.1, but this is neither documented on MSDN, nor is it a
safe bet.  It may have to do with a fixed implementation of the UAC
trust levels.  Let's better follow the docs for now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-01 11:52:30 +02:00
Corinna Vinschen c920bf0b01 Reformat some too-long lines
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 18:00:56 +02:00
Corinna Vinschen 532ecdd36f Add comment to point out missing access right per documentation
In get_mem_values we open the process without PROCESS_VM_READ access
and are *still* able to request working set information, despite
MSDN claiming we need it for this purpose.  Instead of adding this
access right, just add an comment to point this out for now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 18:00:01 +02:00
Corinna Vinschen ba58e5f20c Use PROCESS/THREAD_QUERY_LIMITED_INFORMATION where appropriate
Using PROCESS/THREAD_QUERY_INFORMATION may limit the number of
processes/threads we can inspect depending on their integrity level.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 17:56:16 +02:00
Corinna Vinschen 8dd446a7b1 Drop has_broken_rtl_query_process_debug_information flag 2016-06-24 16:02:40 +02:00
Corinna Vinschen b2867a68b9 Handle up to 63 partitions per drive
Revamp device parsing code.  Introducing support for more partitions
into the shilka-generated parser has the unfortunate side-effect of
raising the size of the DLL by almost 2 Megs.  Therefore we split out
the handling for /dev/sdXY devices into a tiny bit of hand-written
code.

While at it, remove some unused cruft from devices.* and generally
clean up the device class to provide access methods instead of direct
access to members.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 16:56:41 +02:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.

Everything else stays under GPLv3+.

New Linking Exception exempts resulting executables from LGPLv3 section 4.

Add CONTRIBUTORS file to keep track of licensing.

Remove 'Copyright Red Hat Inc' comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 10:09:17 +02:00
Corinna Vinschen 41abcc5825 Revert "Refactor to avoid nonnull checks on "this" pointer."
This reverts commit 0008bdea02.

This patch introduced a regression.  Calling FOO=$(...) in zsh hangs
indefinitely and has to be killed forcefully.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-05 10:30:28 +02:00
Peter Foley 0008bdea02 Refactor to avoid nonnull checks on "this" pointer.
G++ 6.0 asserts that the "this" pointer is non-null for member
functions.
Refactor methods that check if "this" is non-null to resolve this.

winsup/cygwin/ChangeLog:
external.cc (cygwin_internal): Check for a null pinfo before calling
cmdline.
fhandler_dsp.cc (Audio::blockSize): Make static.
fhandler_dsp.cc (Audio_in): add default_buf_info.
fhandler_dsp.cc (Audio_out): Ditto.
fhandler_dsp.cc (Audio_out::buf_info): Refactor method to call
default_buf_info if dev_ is null.
fhandler_dsp.cc (Audio_in::buf_info): Ditto.
fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_out::default_buf_info if audio_out_ is null.
fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_in::default_buf_info if audio_in_ is null.
fhandler_process.cc (format_process_fd): Check if pinfo is null.
fhandler_process.cc (format_process_root): Ditto.
fhandler_process.cc (format_process_cwd): Ditto.
fhandler_process.cc (format_process_cmdline): Ditto.
signal.cc (tty_min::kill_pgrp): Ditto.
signal.cc (_pinfo::kill0): Ditto.
sigproc.cc (pid_exists): Ditto.
sigproc.cc (remove_proc): Ditto.
times.cc (clock_gettime): Ditto.
times.cc (clock_getcpuclockid): Ditto.
path.cc (cwdstuff::override_win32_cwd): Check if old_cwd is null.
path.cc (fcwd_access_t::Free): Factor null check of "this" out to
caller(s).
pinfo.cc (_pinfo::exists): Ditto.
pinfo.cc (_pinfo::fd): Ditto.
pinfo.cc (_pinfo::fds): Ditto.
pinfo.cc (_pinfo::root): Ditto.
pinfo.cc (_pinfo::cwd): Ditto.
pinfo.cc (_pinfo::cmdline): Ditto.
signal.cc (_pinfo::kill): Ditto.
pinfo.cc (_pinfo::commune_request): remove non-null check on "this", as
this method is only called from pinfo.cc after null checks
pinfo.cc (_pinfo::pipe_fhandler): remove non-null check on "this", as
this method is only called from pipe.cc (fhandler_pipe::open) after a null check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-04-04 16:46:51 +02:00
Corinna Vinschen 5aa8817e3a Allow cygwin_conv_path(3) and cygpath(1) to emit /proc/cygdrive prefixed path
* include/sys/cygwin.h (CCP_PROC_CYGDRIVE): New flag.
        * mount.cc (mount_info::cygdrive_posix_path): Take flag values rather
        than just a trailing_slash_p bool.  Emit /proc/cygdrive path if
        CCP_PROC_CYGDRIVE flag is given.
        (mount_info::conv_to_posix_path): Take flag values rather than just
        a keep_rel_p bool.  Rename _p variables.  Print flag value as hex in
        debug_printf.  Call cygdrive_posix_path with flag values.
        * mount.h (mount_info::cygdrive_posix_path): Accommodate above change
        in declaration.
        (mount_info::conv_to_posix_path): Ditto.
        * fhandler_process.cc (format_process_exename): Accommodate change to
        mount_info::conv_to_posix_path.
        * path.cc (cygwin_conv_path): Ditto.

        * cygpath.cc (absolute_flag): Initialize to CCP_RELATIVE to simplify
        expressions.
        (cygdrive_flag): New global flag.
        (long_options): Add --proc-cygdrive option.
        (options): Add -U option.
        (usage): Add description for -U option.
        (do_sysfolders): Or cygdrive_flag to cygwin_conv_path call.
        (do_pathconv): Simply or absolute_flag to conv_func.  Or
        cygdrive_flag to conv_func.
        (do_options): Initalize absolute_flag to CCP_RELATIVE.  Initialize new
        cygdrive_flag.  Set absolute_flag to CCP_ABSOLUTE on -a.  Set
        cygdrive_flag to CCP_PROC_CYGDRIVE on -U.

        * new-features.xml (ov-new2.4): Document cygpath -U option.
        * utils.xml (cygpath): Ditto.
        * path.xml (func-cygwin-path): Add CCP_PROC_CYGDRIVE description.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-06 17:25:48 +01:00
Corinna Vinschen 8f4da28eb6 Fix thinko in /proc/<PID>/maps TEB detection on W10 1511
* fhandler_process.cc (thread_info::thread_info): Accommodate the fact
        that TEBs take two pages.
        (thread_info::fill_if_match): Rewrite the method for post W10 1511 TEB
        detection.
        (format_process_maps): Add a state member to region.  Fix the code
        to handle PEB/TEB region since W10 1511.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-03 16:54:29 +01:00
Corinna Vinschen f1ed5bfa83 Fix /proc/<PID>/maps output for PEB and TEBs on W10 1511
* fhandler_process.cc (heap_info::fill_if_match): Return NULL, not 0.
        (thread_info::fill_if_match): Ditto.
        (thread_info::fill_if_match): New method to extract TEB info from
        PEB/TEB region since W10 1511.
        (format_process_maps): Drop outdated FIXME comment.  Add code to handle
        PEB/TEB region since W10 1511.
        * mmap.cc (posix_madvise): Align comment to new W10 1511 version.
        * wincap.h (wincaps::has_new_pebteb_region): New element.
        * wincap.cc: Implement above element throughout.
        (wincap_10_1511): New global wincaps to support Windows 10 since 1511.
        (wincapc::init): Use wincap_10_1511 for W10 builds >= 10586.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-03 13:33:43 +01:00
Corinna Vinschen ef75017378 Fix length returned from sys_cp_wcstombs in case nwc > # of wchars
* strfuncs.cc (sys_cp_wcstombs): Always return number of multibytes
	without trailing NUL as the documentation implies.  Throughout Cygwin,
	fix usage to align to this pattern.
	* fhandler_process.cc (format_process_winexename): Drop trailing NUL
	and LF from output.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-10-22 14:22:07 +02:00
Corinna Vinschen e426213a88 Disable fetching heap info on 64 bit XP/2003
* fhandler_process.cc (heap_info::heap_info): Disable fetching heap info
        on 64 bit XP/2003.  Explain why.
        * wincap.h (wincaps::has_broken_rtl_query_process_debug_information):
        New element.
        * wincap.cc: Implement above element throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-05 12:53:30 +02:00
Corinna Vinschen 185784962a * fhandler.h (class fhandler_process): Add fd_type member.
* fhandler_process.cc (process_tab): Fix indentation.
	(fhandler_process::exists): Rely on format_process_fd returning file
	type in fd_type.
	(struct process_fd_t): Add fd_type member.
	(fhandler_process::fill_filebuf): Allow format_process_fd to set
	this->fd_type member.
	(format_process_fd): Fix path evaluation to allow recognizing trailing
	path components.  Fix check for file descriptor path component.  Return
	virt_symlink in fd_type if no trailing path compenents exist, return
	virt_fsdir otherwise and copy full resulting path into destbuf.
	* path.cc (path_conv::check): If /proc/$PID/fd symlink has trailing
	path components, reparse resulting path as if it's the incoming path.
	Add comment to wail over the outdated and hackish check method, and to
	explain what we do here.
2015-01-22 13:46:12 +00:00
Corinna Vinschen 54338f169f * fhandler_proc.cc (fhandler_proc::readdir): Set dirent d_type.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
	* fhandler_procnet.cc (fhandler_procnet::readdir): Ditto.
	* fhandler_procsys.cc (fhandler_procsys::readdir): Ditto.
	* fhandler_procsysvipc.cc (fhandler_procsysvipc::readdir): Ditto.
	*  fhandler_virtual.h (virt_ftype_to_dtype): Define new inline function
	to generate dirent d_type from virtual_ftype_t.
2014-10-09 13:24:37 +00:00
Corinna Vinschen 2bf7d695ea * fhandler_process.cc (format_process_statm): Fix output of dirty
pages.  Add linefeed.
2014-10-08 15:25:52 +00:00
Corinna Vinschen 9c9f0ee802 * fhandler_process.cc (get_mem_values): Rearrange code slightly to
avoid resource leakage (CID 59973).
	(format_process_stat): Drop temporary variable wcmd and avoid
	string copy without length check (CID 60050).
	(format_process_status): Ditto (CID 60051).
2014-05-20 11:20:02 +00:00
Corinna Vinschen 1ca20a1cd2 Introduce reading passwd/group entries from SAM/AD. Introduce
/etc/nsswitch.conf file to configure it.
	* Makefile.in (DLL_OFILES): Add ldap.o.
	* autoload.cc: Import ldap functions from wldap32.dll.
	(DsEnumerateDomainTrustsW): Import.
	(NetGroupGetInfo): Import.
	* cygheap.h (class cygheap_domain_info): New class to keep global
	domain info.
	(class cygheap_pwdgrp): New class to keep passwd/group caches and
	configuration info from /etc/nssswitch.conf.
	(struct init_cygheap): Add cygheap_domain_info member "dom" and
	cygheap_pwdgrp member "pg".
	* cygtls.h (struct _local_storage): Remove unused member "res".
	Rearrange slightly, Add members pwbuf and grbuf to implement non-caching
	passwd/group fetching from SAM/AD.  Make pw_pos and pw_pos unsigned.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Add RFC 2307
	uid/gid mapping.
	* fhandler_process.cc: Drop including pwdgrp.h.
	* fhandler_procsysvipc.cc: Ditto.
	* fhandler_registry.cc (fhandler_registry::fstat): Set key uid/gid
	to ILLEGAL_UID/ILLEGAL_GID rather than UNKNOWN_UID/UNKNOWN_GID.
	* grp.cc (group_buf): Drop.
	(gr): Drop.
	(pwdgrp::parse_group): Fill pg_grp.
	(pwdgrp::read_group): Remove.
	(pwdgrp::init_grp): New method.
	(pwdgrp::prep_tls_grbuf): New method.
	(pwdgrp::find_group): New methods.
	(internal_getgrsid): Convert to call new pwdgrp methods.
	(internal_getgrnam): Ditto.
	(internal_getgrgid): Ditto.
	(getgrgid_r): Drop 2nd parameter from internal_getgrgid call.
	(getgrgid32): Ditto.
	(getgrnam_r): Ditto for internal_getgrnam.
	(getgrnam32): Ditto.
	(getgrent32): Convert to call new pwdgrp methods.
	(internal_getgrent): Remove.
	(internal_getgroups): Simplify, especially drop calls to
	internal_getgrent.
	* ldap.cc: New file implementing cyg_ldap class for LDAP access to AD
	and RFC 2307 server.
	* ldap.h: New header, declaring cyg_ldap class.
	* passwd.cc (passwd_buf): Drop.
	(pr): Drop.
	(pwdgrp::parse_passwd): Fill pg_pwd.
	(pwdgrp::read_passwd): Remove.
	(pwdgrp::init_pwd): New method.
	(pwdgrp::prep_tls_pwbuf): New method.
	(find_user): New methods.
	(internal_getpwsid): Convert to call new pwdgrp methods.
	(internal_getpwnam): Ditto.
	(internal_getpwuid): Ditto.
	(getpwuid32): Drop 2nd parameter from internal_getpwuid call.
	(getpwuid_r): Ditto.
	(getpwnam): Ditto for internal_getpwnam.
	(getpwnam_r): Ditto.
	(getpwent): Convert to call new pwdgrp methods.
	* path.cc (class etc): Remove all methods.
	* path.h (class etc): Drop.
	* pinfo.cc (pinfo_basic::pinfo_basic): Set gid to ILLEGAL_GID rather
	than UNKNOWN_GID.
	(pinfo_init): Ditto.
	* pwdgrp.h (internal_getpwnam): Drop 2nd parameter from declaration.
	(internal_getpwuid): Ditto.
	(internal_getgrgid): Ditto.
	(internal_getgrnam): Ditto.
	(internal_getgrent): Drop declaration.
	(enum fetch_user_arg_type_t): New type.
	(struct fetch_user_arg_t): New type.
	(struct pg_pwd): New type.
	(struct pg_grp): New type.
	(class pwdgrp): Rework to provide functions for file and db requests
	and caching.
	(class ugid_cache_t): New class to provide RFC 2307 uid map caching.
	(ugid_cache): Declare.
	* sec_acl.cc: Drop including pwdgrp.h.
	* sec_auth.cc: Drop including dsgetdc.h and pwdgrp.h.
	(get_logon_server): Convert third parameter to ULONG flags argument
	to allow arbitrary flags values in DsGetDcNameW call and change calls
	to this function throughout.  Use cached account domain name rather
	than calling GetComputerNameW.
	(get_unix_group_sidlist): Remove.
	(get_server_groups): Drop call to get_unix_group_sidlist.
	(verify_token): Rework token group check without calling
	internal_getgrent.
	* sec_helper.cc (cygpsid::pstring): New methods, like string() but
	return pointer to end of string.
	(cygsid::getfromstr): Add wide character implementation.
	(get_sids_info): Add RFC 2307 uid/gid mapping for Samba shares.
	* security.cc: Drop including pwdgrp.h.
	* security.h (DEFAULT_UID): Remove.
	(UNKNOWN_UID): Remove.
	(UNKNOWN_GID): Remove.
	(uinfo_init): Move here from winsup.h.
	(ILLEGAL_UID): Ditto.
	(ILLEGAL_GID): Ditto.
	(UNIX_POSIX_OFFSET): Define.  Add lengthy comment.
	(UNIX_POSIX_MASK): Ditto.
	(MAP_UNIX_TO_CYGWIN_ID): Ditto.
	(ILLEGAL_UID16): Move here from winsup.h.
	(ILLEGAL_GID16): Ditto.
	(uid16touid32): Ditto.
	(gid16togid32): Ditto.
	(sid_id_auth): New convenience macro for SID component access.
	(sid_sub_auth_count): Ditto.
	(sid_sub_auth): Ditto.
	(sid_sub_auth_rid): Ditto.
	(cygpsid::pstring): Declare.
	(cygsid::getfromstr): Declare wide character variant.
	(cygsid::operator=): Ditto.
	(cygsid::operator*=): Ditto.
	(get_logon_server): Change declaration according to source code.
	* setlsapwd.cc (setlsapwd): Drop 2nd parameter from internal_getpwnam
	call.
	* shared.cc (memory_init): Call cygheap->pg.init in first process.
	* syscalls.cc: Drop including pwdgrp.h.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Ditto.
	* uinfo.cc (internal_getlogin): Drop gratuitious internal_getpwuid
	call.  Fix debug output.  Overwrite user gid in border case of a
	missing passwd file while a group file exists.
	(pwdgrp::add_line): Allocate memory on cygheap.
	(pwdgrp::load): Remove.
	(ugid_cache): Define.
	(cygheap_pwdgrp::init): New method.
	(cygheap_pwdgrp::nss_init_line): New method.
	(cygheap_pwdgrp::_nss_init): New method.
	(cygheap_domain_info::init): New method.
	(logon_sid): Define.
	(get_logon_sid): New function.
	(pwdgrp::add_account_post_fetch): New method.
	(pwdgrp::add_account_from_file): New methods.
	(pwdgrp::add_account_from_windows): New methods.
	(pwdgrp::check_file): New method.
	(pwdgrp::fetch_account_from_line): New method.
	(pwdgrp::fetch_account_from_file): New method.
	(pwdgrp::fetch_account_from_windows): New method.
	* winsup.h: Move aforementioned macros and declarations to security.h.
2014-02-09 19:44:56 +00:00
Corinna Vinschen 340854dda8 * fhandler_process.cc (format_process_ctty): Fix random content of
/proc/$PID/ctty if the process has no controlling tty.  Set to just
	"\n" instead.
2013-10-16 15:14:22 +00:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Christopher Faylor 6e75c72b89 Throughout, change __attribute__ ((regparm (N))) to just __regN. Throughout,
(mainly in fhandler*) start fixing gcc 4.7.2 mismatch between regparm
definitions and declarations.
* gendef: Define some functions to take @ declaration to accommodate _regN
defines which use __stdcall.
* gentls_offsets: Define __regN macros as empty.
* autoload.cc (wsock_init): Remove unneeded regparm attribute.
* winsup.h (__reg1): Define.
(__reg2): Define.
(__reg3): Define.
* advapi32.cc (DuplicateTokenEx): Coerce some initializers to avoid warnings
from gcc 4.7.2.
* exceptions.cc (status_info): Declare struct to use NTSTATUS.
(cygwin_exception::dump_exception): Coerce e->ExceptionCode to NTSTATUS.
* fhandler_clipboard.cc (cygnativeformat): Redefine as UINT to avoid gcc 4.7.2
warnings.
(fhandler_dev_clipboard::read): Ditto.
2013-01-21 04:34:52 +00:00
Christopher Faylor 46f5dd5958 whitespace cleanup 2012-08-16 23:34:45 +00:00
Corinna Vinschen f5e3a51ca0 Fix copyright. 2012-03-27 18:31:09 +00:00
Corinna Vinschen cd24077999 * fhandler_process.cc (process_tab): Add entry for mountinfo.
(format_process_mountstuff): New function, derived from
	format_process_mounts.  Only open another user's user_info shared
	memory area if the process is owned by another user.  Actually
	access the opened shared user_info to get the right mount table.
	For other users, don't print remote cygdrive mount points.  Print
	mountinfo or mounts output depending on the bool mountinfo argument.
	(format_process_mounts): Just call format_process_mountstuff with
	mountinfo set to false.
	(format_process_mountinfo): Ditto with mountinfo set to true.

	* new-features.sgml (ov-new1.7.11): Add mountinfo.
2012-03-27 18:30:28 +00:00
Corinna Vinschen 3a24189bba * external.cc (cygwin_internal): Implement CW_ALLOC_DRIVE_MAP,
CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
	* fhandler_process.cc: Include mount.h.
	(get_volume_path_names_for_volume_name): Move to mount.cc.
	(struct dos_drive_mappings): Ditto.
	* mount.cc (get_volume_path_names_for_volume_name): Move here.
	(dos_drive_mappings::dos_drive_mappings): Ditto.
	(dos_drive_mappings::fixup_if_match): Ditto.
	(dos_drive_mappings::~dos_drive_mappings): Ditto.
	* mount.h (class dos_drive_mappings): Declare her.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_ALLOC_DRIVE_MAP,
	CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
	* include/cygwin/version.h: Bump API minor number.
2011-12-22 12:25:10 +00:00
Corinna Vinschen 3a03267d6d * fhandler_process.cc: Drop unneeded includes. 2011-12-22 11:25:44 +00:00
Corinna Vinschen 177dc6c7f6 Throughout use wincap.allocation_granularity instead of getpagesize.
Throughout use wincap.page_size instead of getsystempagesize.
	Throughout use "status" as variable name to hold NTSTATUS values.
	* fhandler_mem.cc: Check for NT_SUCCESS rather than for STATUS_SUCCESS.
	Fix debug_printf output.  Rectify long statements.  Fix comment
	formatting.
	* fhandler_proc.cc: Ditto.
	(format_proc_swaps): Drop useless test for ERROR_PROC_NOT_FOUND.
	* fhandler_process.cc: Ditto as in fhandler_mem.cc.
	(get_process_state): Rearrange allocation loop.  Use malloc/realloc.
	(get_mem_values): Fix potential NULL pointer usage.  Drop unused
	variable.
	* pinfo.cc (winpids::enum_processes): Handle low memory gracefully.
	* sec_auth.cc (get_priv_list): Drop local variable ret.
	* shared.cc (memory_init): Drop outdated call to getpagesize.
	* syscalls.cc (getsystempagesize): Remove.
	* sysconf.cc: Check for NT_SUCCESS rather than for STATUS_SUCCESS.
	(sysinfo): Constify sizeof_stodi.  Drop useless test for
	ERROR_PROC_NOT_FOUND.
	* thread.cc (pthread_getattr_np): Cast pointers to uintptr_t rather
	than to int for pointer arithmetic.
	* winsup.h (getsystempagesize): Drop declaration.
2011-12-22 11:02:36 +00:00
Corinna Vinschen e74758408e Don't leave Windows 2000 behind.
* autoload.cc (GetSystemWow64DirectoryW): Define.
	(GetVolumePathNamesForVolumeNameW): Define.
	* fhandler_process.cc (get_volume_path_names_for_volume_name): New
	static function to workaround missing GetVolumePathNamesForVolumeNameW
	function in Windows 2000.
	(dos_drive_mappings::dos_drive_mappings): Call
	get_volume_path_names_for_volume_name instead of
	GetVolumePathNamesForVolumeNameW.
2011-12-14 20:23:27 +00:00
Corinna Vinschen 01ba99e8cd * fhandler_process.cc (dos_drive_mappings): Partially rewrite to
handle volumes mounted into juntion points correctly.
2011-12-12 21:38:08 +00:00
Corinna Vinschen 735415570a * fhandler_process.cc (dos_drive_mappings::dos_drive_mappings): Fully
resolve symbolic links returned by QueryDosDeviceW.  Explain why.
2011-12-12 17:27:18 +00:00
Christopher Faylor b9aa81491f Throughout, remove extra space after function name from debugging output.
Throughout, change syscalls to report on return values using new %R format
option.
* smallprint.cc (__small_vsprintf): Add parsing for %R to report on return
values and possible errno from syscalls.
* errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
* fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use
shorter name to reduce debuggging output.
* select.cc (start_thread_pipe): Ditto.
(start_thread_serial): Ditto.
(start_thread_socket): Ditto.
(start_thread_mailslot): Ditto.
* sigproc.cc (talktome): Ditto.
2011-12-03 21:43:27 +00:00
Corinna Vinschen a9cc13a8e0 * fhandler_process.cc (dos_drive_mappings::fixup_if_match): Convert
native NT network paths into DOS UNC paths.
2011-10-15 19:13:57 +00:00