Commit Graph

4043 Commits

Author SHA1 Message Date
Corinna Vinschen a7197550f3 * autoload.cc (CharToOemA): Remove.
(CharNextExA): Define.
	* environ.cc (codepage_init): Un-static.  Set active_codepage to
	active codepage.  Default to ansi regardless of buf pointer.
	* fhandler.h (dev_console::get_console_cp): New method.
	(dev_console::con_to_str): Change declaration according to new
	implementation.
	(dev_console::str_to_con): Ditto.
	* fhandler_console.cc (cp_convert): Remove.
	(dev_console::con_to_str): Redefine to take WCHAR as incoming console
	char.
	(dev_console::get_console_cp): Return correct codepage according to
	alternate_charset_active setting.
	(dev_console::str_to_con): Redefine to create WCHAR buffer for console
	output.
	(fhandler_console::read): Read console input as WCHARs.
	(base_chars): Fix typo in comment.
	(fhandler_console::char_command): Save and restore console output
	buffer using UNICODE functions.
	(fhandler_console::write_normal): Convert to write output in UNICODE.
	Use CharNextExA to recognize multibyte characters in input.  Workaround
	problem with UTF-8 and MultiByteToWideChar.  Simplify the loop for
	printing "normal" characters.
	* strfuncs.cc (active_codepage): New variable to store active codepage.
	(get_cp): Call codepage_init() if active_codepage is uninitialized.
	Just return active_codepage.
	(is_cp_multibyte): New function.
	* winsup.h (active_codepage): Declare.
	(codepage_init): Declare.
	(is_cp_multibyte): Declare.
2008-02-05 17:37:10 +00:00
Corinna Vinschen 340e2fa504 * smallprint.cc (__small_vsprintf): Use HEAP_NOTHEAP for type.
* strfuncs.cc (sys_wcstombs_alloc): Guard use of ccalloc
	to !__OUTSIDE_CYGWIN__ for use in cygserver.
	(sys_mbstowcs_alloc): Ditto.
2008-02-04 12:00:19 +00:00
Corinna Vinschen 301d14d242 * miscfuncs.cc (cygwin_wcsncasecmp): Never access more than n
characters.
	(cygwin_strncasecmp): Ditto.  Fix for strings longer than n.
2008-02-01 13:11:57 +00:00
Corinna Vinschen c69d873f31 * string.h: Re-enable inline strcasematch and strncasematch
implementations and rename to ascii_strcasematch/ascii_strncasematch.
	* dcrt0.cc: Replace str[n]casematch with ascii_str[n]casematch where
	applicable.
	* environ.cc: Ditto.
	* fhandler_process.cc: Ditto.
	* hookapi.cc: Ditto.
	* path.cc: Ditto.
	* spawn.cc: Ditto.
	* strace.cc: Ditto.
	* syscalls.cc: Ditto.
	* uinfo.cc: Ditto.
	* winf.cc: Ditto.
2008-02-01 12:37:51 +00:00
Corinna Vinschen 1597484cb5 * dcrt0.cc (dll_crt0_1): Use GetCommandLineW and convert to current
codepage.
	* environ.cc (set_file_api_mode): Always set file api to ANSI if not
	using the OEM codepage.
	(codepage_init): Allow "utf8" codepage.
	* fhandler_clipboard.cc (set_clipboard): Convert clipbuf to void and
	cast as needed.  Always convert input to wide char and write
	CF_UNICODETEXT to clipboard.
	(fhandler_dev_clipboard::read): Read CF_UNICODETEXT from clipboard and
	convert to current codepage if CYGWIN_NATIVE format is not available.
	* fhandler_console.cc: Drop redundant undef.
	* smallprint.cc (__small_vsprintf): Convert PWCHAR and UNICODE_STRING
	to current codepage for printing.
	* strfuncs.cc: Use PWCHAR throughout.
	(get_cp): Return CP_UTF8 for utf8_cp codepage setting.
	(sys_wcstombs): Allow NULL target buffer.
	(sys_wcstombs_alloc): New function.
	(sys_mbstowcs_alloc): Ditto.
	* winsup.h (codepage_type): Add utf8_cp.
	(HEAP_NOTHEAP): Define.
	(sys_wcstombs_alloc): Declare.
	(sys_mbstowcs_alloc): Declare.
2008-01-31 20:26:01 +00:00
Corinna Vinschen 8e87af7ed0 * cygheap.h (struct cwdstuff): Add dir member to store cwd handle.
(cwdstuff::get_handle): New method.
	* path.cc (cwdstuff::set): When doit is true, always try to get
	directory handle.  Fail if duplicating handle fails.  Store handle
	in dir.  Fix potential SEGV when setting drive_length.
2008-01-31 14:18:49 +00:00
Corinna Vinschen cb8686370b * path.cc: Fix Samba version in comment. 2008-01-28 12:19:30 +00:00
Corinna Vinschen ca74821574 * path.cc (fs_info::update): Fix old-style Samba test to support
recent as well as upcoming Samba releases.
2008-01-24 17:29:29 +00:00
Corinna Vinschen 4a96b0aa85 * ntdll.h (struct _FILE_FS_OBJECTID_INFORMATION): Define.
* path.cc (struct smb_extended_info): Define.
	(fs_info::update): Request object id info to get Samba information.
	Set flags according to new implementation.
	* path.h (struct fs_info): Add samba_version to status_flags.
	Implement flags() and samba_version() using IMPLEMENT_STATUS_FLAG.
2008-01-22 17:43:22 +00:00
Corinna Vinschen 755f6f8f65 * fhandler_disk_file.cc (fhandler_disk_file::link): Open file with
READ_CONTROL for Vista/Longhorn's sake.
2008-01-21 14:51:55 +00:00
Corinna Vinschen ebe9d9b2ea * Makefile.in (install-libs): Overwrite newlib's libg.a with symlink
to libcygwin.a.
2008-01-15 17:42:10 +00:00
Corinna Vinschen 8b5f4dbabc * Makefile.in (DLL_OFILES): Remove memmem.o.
* memmem.cc: Remove in favor of newlib implementation.
2008-01-15 13:45:42 +00:00
Corinna Vinschen 094f2e6fca * fhandler.h: Update copyright.
* include/limits.h: Ditto.
2008-01-07 16:51:54 +00:00
Christopher Faylor 43fb5c93b1 * fhandler.h (fhandler_base::is_tty): Make bool.
(fhandler_serial::is_tty): Ditto.
(fhandler_termios::is_tty): Ditto.
(fhandler_base::is_slow): Return bool value.
(fhandler_socket::is_slow): Ditto.
(fhandler_serial::is_slow): Ditto.
(fhandler_console::is_slow): Ditto.
(fhandler_tty_common::is_slow): Ditto.
(fhandler_tty_master::is_slow): Ditto.
(fhandler_dev_null::is_slow): Ditto.
2008-01-06 18:37:20 +00:00
Christopher Faylor eaf70af08a * include/limits.h (TTY_NAME_MAX): Increase size to same as linux to allow for
(at least) null terminating byte for "/dev/console".
2008-01-06 18:31:35 +00:00
Christopher Faylor e1ab5e688c * tty.cc: Update copyright.
* pipe.cc: Ditto.
2008-01-01 19:07:36 +00:00
Christopher Faylor 8528ecbde8 * newsym: First stab at understanding data as well as functions.
* pipe.cc (fhandler_pipe::init): Move more intelligence here.
(fhandler_pipe::create): Simplify based on above change.

* tty.cc (tty_list::allocate): Remove non-NT code.
2008-01-01 18:51:23 +00:00
Dave Korn b918632a2a * cygwin.din (_f_llrint, _f_llrintf, _f_llrintl, _f_lrint, _f_lrintf,
_f_lrintl, _f_rint, _f_rintf, _f_rintl):  Export fast *rint* functions.
	(lrint, lrintf, rint, rintf):  Redirect exports to alias _f_ versions.
	(llrint, llrintf, llrintl, lrintl, rintl):  Add exports aliasing _f_*
	versions likewise.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR):  Bump.
2007-12-30 21:12:08 +00:00
Corinna Vinschen 04cb518d64 * fhandler.h (class fhandler_dev_random): Add dummy_offset member.
* fhandler_random.cc (fhandler_dev_random::lseek): Fake seeking
	capability as on Linux.
2007-12-22 13:26:47 +00:00
Corinna Vinschen 39962e28d0 * libc/memmem.cc (memmem): Fix bug when searching for empty string. 2007-12-20 10:11:37 +00:00
Corinna Vinschen c6bfc3d4bc * cygwin.din: Export wcpcpy, wcpncpy.
* include/cygwin/version.h: Bump API minor number.
2007-12-19 17:38:18 +00:00
Christopher Faylor 634a41403c * dtable.cc (POSIX_NAMED_PIPE): New define.
(POSIX_NAMED_PIPE_LEN): Ditto.
(dtable::add_archetype): Use crealloc_abort.
(dtable::init_std_file_from_handle): Specifically detect pipe stdin/stdout.
Pass name to build_fh_dev so that proper name is recorded.  Use binmode of fh
if it is set before using get_default_mode.  Set proper read/write access when
calling init().
(handle_to_fn): Handle pipes.
* fhandler.cc (fhandler_base::wait_overlapped): Add some debugging.
* fhandler.h (fhandler_base::set_name): Default to just setting the path_conv
name.
(fhandler_pipe::init): Declare.
* pipe.cc (struct pipesync): New struct.
(getov_result): New function.  Blocks and retrieves the result of an overlay
I/O operation.
(pipe_handler): New function.
(pipesync::pipesync): New function.  Initializer for pipesync struct.
(handler_pipe::init): Define.  Detects attempts to set up a "native" pipe
fhandler and creates a thread which accepts input from or output to the
non-cygwin pipe, creating a cygwin pipe wrapper around the non-cygwin pipe.
(fhandler_pipe::create): Add pipe-specific flags to call to init().
* exceptions.cc (ctrl_c_handler): Lock process while we determine what to do.
2007-12-16 21:21:23 +00:00
Corinna Vinschen b4d71b77ba * include/cygwin/socket.h: Include sys/uio.h instead of cygwin/uio.h.
* include/cygwin/uio.h: Remove.
2007-12-14 12:12:32 +00:00
Corinna Vinschen cce64750b2 * dtable.cc (dtable::set_file_pointers_for_exec): Reenable. Fix
comment.
	* spawn.cc (spawn_guts): Call cygheap->fdtab.set_file_pointers_for_exec
	only for non-Cygwin processes.
2007-12-14 11:32:40 +00:00
Corinna Vinschen d1f3668837 * poll.cc (poll): Return count of fds with events instead of total
event count.
2007-12-13 10:57:08 +00:00
Corinna Vinschen 5642c35aae * string.h: Guard cygwin internal string function definitions with
__INSIDE_CYGWIN__.
2007-12-13 10:33:55 +00:00
Corinna Vinschen 1feea0bfd7 * dcrt0.cc: Include string.h.
(initial_env): Use small_printf's %P specifier.
	* dll_init.cc (dll_list::alloc): Use PATH_MAX instead of CYG_MAX_PATH
	for path name buffer size.
	* dll_init.h (struct dll): Ditto.
	* environ.cc: Include string.h.
	(win_env::add_cache): Use temporary local buffer for path conversion.
	(posify): Ditto.
	* exceptions.cc (try_to_debug): Use CreateProcessW to allow long path
	names.
	* miscfuncs.cc: Drop unused implementations of strcasematch and
	strncasematch.
	(ch_case_eq): Drop.
	(strcasestr): Drop.
	(cygwin_wcscasecmp): New function.
	(cygwin_wcsncasecmp): New function.
	(cygwin_strcasecmp): New function.
	(cygwin_strncasecmp): New function.
	(cygwin_wcslwr): New function.
	(cygwin_wcsupr): New function.
	(cygwin_strlwr): New function.
	(cygwin_strupr): New function.
	* ntdll.h (RtlDowncaseUnicodeString): Declare.
	(RtlUpcaseUnicodeString): Declare.
	(RtlInt64ToHexUnicodeString): Fix typo in comment.
	* string.h: Disable not NLS aware implementations of strcasematch
	and strncasematch.
	(cygwin_strcasecmp): Declare.
	(strcasecmp): Define as cygwin_strcasecmp.
	(cygwin_strncasecmp): Declare.
	(strncasecmp): Define as cygwin_strncasecmp.
	(strcasematch):Define using cygwin_strcasecmp.
	(strncasematch):Define using cygwin_strncasecmp.
	(cygwin_strlwr): Declare.
	(strlwr): Define as cygwin_strlwr.
	(cygwin_strupr): Declare.
	(strupr): Define as cygwin_strupr.
	* wchar.h: New file.
	* wincap.cc (wincapc::init): Use "NT" as fix OS string.
	* winsup.h (strcasematch): Drop declaration.
	(strncasematch): Ditto.
	(strcasestr): Ditto.
2007-12-12 12:12:24 +00:00
Corinna Vinschen 5c80ea0230 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix R/O bit
handling on filesystems without ACL support.
2007-12-11 18:57:44 +00:00
Corinna Vinschen ea5bc3721f * localtime.cc (tzset): Guard by a muto for thread safety. 2007-12-11 16:14:24 +00:00
Dave Korn 3623cfa399 * cygheap.cc (_csbrk): Don't request zero bytes from VirtualAlloc,
as windows treats that as an invalid parameter and returns an error.
2007-12-11 15:16:19 +00:00
Corinna Vinschen 4b93ac1f7f * localtime.cc (tzset): Call tzsetwall only if it hasn't been
called before.
2007-12-11 15:01:31 +00:00
Corinna Vinschen 041337fd90 * include/sys/cygwin.h: Include limits.h. 2007-12-07 09:37:14 +00:00
Corinna Vinschen 36093cfbbf * dcrt0.cc (initial_env): Use PATH_MAX instead of CYG_MAX_PATH for path
name buffer size.
	(dll_crt0_1): Allocate new_argv0 with PATH_MAX size.
	* exceptions.cc (debugger_command): Set size to 2 * PATH_MAX + 20;
	(error_start_init): Use PATH_MAX instead of CYG_MAX_PATH for path
	name buffer size.
	* external.cc (fillout_pinfo): Always fill out ep.progname 0-terminated.
	Fill out ep.progname_long.
	* fhandler_process.cc (fhandler_process::fill_filebuf): Allocate
	buffer for executable filename with PATH_MAX size.
	* pinfo.cc: Throughout use PATH_MAX instead of CYG_MAX_PATH.
	* pinfo.h (class _pinfo): Set progname size to PATH_MAX.
	* smallprint.cc: Include limits.h.  Use PATH_MAX instead of CYG_MAX_PATH
	for path name buffer size.
	* strace.cc (strace::vsprntf): Ditto.
	* include/sys/cygwin.h (EXTERNAL_PINFO_VERSION_32_LP): Define.
	(EXTERNAL_PINFO_VERSION): Set to EXTERNAL_PINFO_VERSION_32_LP.
	(struct external_pinfo): Add progname_long member.
	* include/sys/dirent.h: Correctly include limits.h instead of
	sys/limits.h.
2007-12-06 18:24:06 +00:00
Corinna Vinschen 27114d3aff * fhandler_tty.cc (fhandler_tty_slave::open): Use MAX_PATH instead of
CYG_MAX_PATH for event name buffer size.
	(fhandler_pty_master::setup): Use MAX_PATH instead of CYG_MAX_PATH for
	mutex name buffer size.
	* netdb.cc: Drop old comment.
	(open_system_file): Set path buffer size to MAX_PATH instead of
	CYG_MAX_PATH.  Drop conversion to posix path.  Open file using win32
	path.

	Fix typo in ChangeLog.
2007-12-05 16:50:18 +00:00
Corinna Vinschen 5224a7bbf3 * fhandler_registry.cc: Use NAME_MAX + 1 instead of CYG_MAX_PATH
throughout for subkey name buffer size.
	* fhandler_socket.cc (search_wsa_event_slot): Use MAX_PATH instead of
	CYG_MAX_PATH for mutext name buffer size.
	(fhandler_socket::init_events): Ditto.
	* fhandler_virtual.cc (fhandler_virtual::opendir): Check path length
	against PATH_MAX instead of against CYG_MAX_PATH.
	* registry.cc (get_registry_hive_path): Use PATH_MAX instead of
	CYG_MAX_PATH for registry value path buffer size.
	* shared.cc (open_shared): Use MAX_PATH instead of CYG_MAX_PATH
	for shared memory name buffer size.
	* thread.cc (semaphore::semaphore): Use MAX_PATH instead of CYG_MAX_PATH
	for semaphore name buffer size.
	* uinfo.cc (cygheap_user::env_userprofile): Use PATH_MAX instead of
	CYG_MAX_PATH for temporary path name buffer size.
	* winf.h (LINE_BUF_CHUNK): Define as MAX_PATH * 2.
	* include/sys/dirent.h: Include sys/limits.h.  Define name buffer sizes
	using NAME_MAX.
2007-12-05 15:10:20 +00:00
Corinna Vinschen 8c7c7178c7 Add missing ChangeLog entry. 2007-12-05 12:32:30 +00:00
Corinna Vinschen 814066b912 * autoload.cc (GetModuleFileNameExW): Replace definition of
GetModuleFileNameExA.
	* fhandler_process.cc (format_process_maps): Change modname type to
	WCHAR.  Set buffer sizes to PATH_MAX.  Call GetModuleFileNameExW
	instead of GetModuleFileNameExA.  Call mount_info::conv_to_posix_path
	instead of cygwin_conv_to_full_posix_path.  Set posix_modname to
	modname if that call fails.
	(format_process_stat): Set cmd buffer size to NAME_MAX + 1.  Simplify
	setting cmd to process name.
	(format_process_status): Ditto.
	* path.cc (mount_info::conv_to_posix_path): Call sys_wcstombs
	correctly.
2007-12-03 14:13:03 +00:00
Corinna Vinschen 268e8d00e9 * include/cygwin/time.h: Remove redundant #endif. 2007-12-03 11:34:59 +00:00
Corinna Vinschen a7b76a4eb3 * include/cygwin/time.h (daylight): Declare as extern symbol referring
_daylight variable.
	(timezone): Only define if __timezonefunc__ is undefined.
2007-12-01 13:49:45 +00:00
Corinna Vinschen cf632a487b * Makefile.in (OBSOLETE_FUNCTIONS): Add timezone.
* include/cygwin/time.h: Drop conditional timezone definitions.
	(timezone): Declare as extern symbol referring _timezone variable.
2007-12-01 13:04:43 +00:00
Corinna Vinschen d8a5f04695 * fhandler_tape.cc (mtinfo::initialize): Use MAX_PATH instead of
CYG_MAX_PATH.
	* fhandler_tty.cc (fhandler_pty_master::ptsname): Set buffer size to
	TTY_NAME_MAX.
	* syscalls.cc (ttyname): Eliminate the `+ 1' from the name buffer size
	since TTY_NAME_MAX already counts the trailing NUL.
	* libc/bsdlib.cc (openpty): Set pts buffer size to TTY_NAME_MAX.
2007-11-28 16:45:34 +00:00
Corinna Vinschen 023a2fa789 * fhandler_socket.cc (fhandler_socket::recv_internal): Add MSG_WAITALL
handling.  Use explicit flag values instead of MSG_WINMASK.
	(fhandler_socket::send_internal): Use explicit flag values instead of
	MSG_WINMASK.
	* include/cygwin/socket.h (MSG_WINMASK): Remove definition.
	(MSG_WAITALL): Define.
2007-11-28 15:54:17 +00:00
Corinna Vinschen 547ad329b6 * posix_ipc.cc (ipc_names): Rename max_len to prefix_len. Store
the prefix len in it.
	(check_path): Take length parameter.  Use this length insetad of
	calling strlen.  Allow PATH_MAX length paths.
	(ipc_mutex_init): Use MAX_PATH instead of CYG_MAX_PATH.
	(ipc_cond_init): Ditto.
	(shm_open): Allocate local name buffer not bigger than necessary.  Call
	check_path with additional length argument.
	(shm_unlink): Ditto.
	(mq_open): Ditto.
	(mq_unlink): Ditto.
	(sem_open): Ditto.
	(sem_unlink): Ditto.
2007-11-27 17:04:19 +00:00
Corinna Vinschen a1591d3be7 Drop old SetResourceLock stuff in favor of mutos.
* dcrt0.cc (_reslock): Remove.
	(__cygwin_user_data): Accommodate removal of resourcelocks member.
	(dll_crt0_0): Don't initialize resourcelocks.
	* exceptions.cc (_cygtls::signal_exit): Drop resourcelocks handling.
	* mmap.cc (mmap_guard): New muto.
	(LIST_LOCK): Define.
	(LIST_UNLOCK): Define.
	(mmap_list::search_record): Remove.
	(mmap_list::try_map): Include code for anonymous case from
	mmap_list::search_record.
	(mmap_is_attached_or_noreserve): Access bookkeeping lists in a thread
	safe way.
	(mmap64): Replace SetResourceLock/ReleaseResourceLock by
	LIST_LOCK/LIST_UNLOCK.  Lock at the latest possible point.
	(munmap): Replace SetResourceLock/ReleaseResourceLock by
	LIST_LOCK/LIST_UNLOCK.
	(msync): Ditto.
	(mprotect): Ditto.
	* thread.cc (ResourceLocks::Lock): Remove.
	(SetResourceLock): Remove.
	(ReleaseResourceLock): Remove.
	(ResourceLocks::Init): Remove.
	(ResourceLocks::Delete): Remove.
	* thread.h (SetResourceLock): Drop declaration.
	(ReleaseResourceLock): Ditto.
	(class ResourceLocks): Drop definition.
	* include/sys/cygwin.h (class ResourceLocks): Drop forward declaration.
	(struct per_process): Replace resourcelocks with additional unused2
	element.
	(per_process_overwrite): Accommodate above change.
2007-11-27 14:45:14 +00:00
Corinna Vinschen 230a3c86d1 * mmap.cc: Convert usage of dynamically growing cmalloced arrays to
cmalloced linked lists throughout.
	(class mmap_record): Add LIST_ENTRY element.
	(mmap_record::match): New method, taking over match algorithm from
	list::search_record.
	(class mmap_list): Rename from class list.  Add LIST_ENTRY.  Convert
	recs to a LIST_HEAD.  Drop nrecs and maxrecs members.
	(mmap_list::get_record): Drop entirely.
	(mmap_list::free_recs): Drop entirely.
	(mmap_list::del_record): Take mmap_record to delete as parameter.
	(mmap_list::search_record): Convert to mmap_record::match.
	(class mmap_areas): Rename from class map.  Convert lists to LIST_HEAD.
	(mmap_areas::get_list): Drop entirely.
	(mmap_areas::del_list): Take mmap_list to delete as parameter.
	(mprotect): Fix indentation.
2007-11-27 10:09:05 +00:00
Christopher Faylor ee4388c420 Change many cygheap allocation routines to their *_abort analogs.
* cygheap.cc (cmalloc_abort): New function.
(crealloc_abort): Ditto.
(ccalloc_abort): Ditto.
2007-11-26 21:30:49 +00:00
Christopher Faylor 32cba6cb3a * cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL. 2007-11-23 16:37:05 +00:00
Christopher Faylor a3ba550800 * dllfixdbg: Eliminate extra objcopy step. 2007-11-08 14:36:49 +00:00
Corinna Vinschen 4bc605814c * dllfixdbg: Pass --only-keep-debug to objcopy, instead of
selecting the sections manually.
2007-11-08 12:06:32 +00:00
Corinna Vinschen de32ab54d8 * thread.cc (pthread_key_create): Drop check for incoming valid object. 2007-11-06 15:48:34 +00:00
Corinna Vinschen 03abe23b1a * shm.cc: Include sync.h
(struct shm_shmid_list): Add ref_count member.
	(struct shm_attached_list): Remove hdl and size members.  Add a parent
	member pointing to referenced shm_shmid_list entry.
	(shm_guard): New muto.
	(SLIST_LOCK): Define.
	(SLIST_UNLOCK): Define.
	(fixup_shms_after_fork): Use hdl and size members of parent
	shm_shmid_list entry.
	(shmat): Access sequential bookkeeping lists in a thread safe way.
	Accommodate change in list element layout.  Align comments.
	(shmctl): Ditto.
	(shmdt): Ditto.
	(shmget): Ditto.
2007-11-06 13:29:53 +00:00
Corinna Vinschen 5c8426d50e * shm.cc (shmctl): On IPC_RMID don't unmap views and don't close handle
if the map is still referenced to emulate Linux and BSD behaviour.
2007-11-05 15:25:55 +00:00
Corinna Vinschen 92beb4638f * shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem
as well as connected shm_attached_list entry.
2007-11-05 10:15:31 +00:00
Corinna Vinschen 6eedb2be6d * net.cc (load_ipv6_funcs): Use MAX_PATH instead of CYG_MAX_PATH.
(cygwin_getaddrinfo): Simplify formatting.
	(cygwin_getnameinfo): Ditto.
2007-10-31 16:06:01 +00:00
Corinna Vinschen 15346b6950 * external.cc (get_cygdrive_info): Make inline.
(get_cygdrive_prefixes): Remove.
	(cygwin_internal): Call get_cygdrive_info with NULL flag parameters
	instead of get_cygdrive_prefixes.
	* path.cc (mount_info::get_cygdrive_info): Allow NULL flag parameters.
2007-10-31 13:23:33 +00:00
Corinna Vinschen 101f07b907 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Don't remove
write bits for directories with R/O attribute.
	(fhandler_base::fhaccess): Don't shortcircuit R/O attribute with W_OK
	scenarios for directories.
2007-10-30 12:32:16 +00:00
Corinna Vinschen 09ecdc8504 * cygheap.h (struct cwdstuff): Drop hash member. Drop get_hash,
get_initial, and fixup_after_exec declarations.
	Convert win32 to UNICODE_STRING.
	(cwdstuff::get_drive): Convert win32 path in current codepage.
	(cwdstuff::set): Take native NT path.
	* ntdll.h (struct _TEB): Typedef.
	* path.cc (mount_info::conv_to_posix_path): Add variant taking
	wide char DOS paths.
	(symlink_info::posixify): Simplify concatenating cwd and relative path.
	(hash_path_name): Drop special relative path handling.
	(chdir): Drop special "drive only" handling.  Call cwdstuff::set with
	native path.
	(cwdstuff::get_hash): Remove.
	(windows_system_directory): Remove.
	(_upp): Remove.
	(get_user_proc_parms): Make inline.  Get PEB pointer by calling
	NtCurrentTeb.
	(cwdstuff::init): Simplify.
	(cwdstuff::set): Rework to handle incoming native NT path.  Workaround
	a Vista problem with CWD handle in the user process parameter block.
	(cwdstuff::get): Simplify locking.  Accommodate type change of win32.
	* shared_info.h (mount_info): Add declaration for new conv_to_posix_path
	method.
	* strfuncs.cc (sys_wcstombs): Return correct length of created
	multi-byte string.
2007-10-23 16:26:28 +00:00
Corinna Vinschen 6788155fe2 * fhandler_disk_file.cc (__DIR_mounts::eval_ino): Make fname big enough
to allow multibyte chars.
2007-10-19 12:22:49 +00:00
Corinna Vinschen f3257492c4 * fhandler.cc (fhandler_base::open): Open native symlinks with
FILE_OPEN_REPARSE_POINT flag.  Fix typo in comment.
2007-10-18 12:40:27 +00:00
Corinna Vinschen 5b69737250 * include/sys/param.h (MAXPATHLEN): Define as PATH_MAX. 2007-10-18 10:42:43 +00:00
Corinna Vinschen 6ce2c24121 * fhandler.cc (is_at_eof): Rewrite using NT functions.
(off_current): New static variable.
	(off_append): Ditto.
	(fhandler_base::raw_write): Use NtWriteFile.  Accommodate O_APPEND here.
	(fhandler_base::write): Drop O_APPEND hack.  Use NT functions.
	(fhandler_base::lseek): Rewrite using NT functions.
	* fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Add space in
	debug output.
	(fhandler_disk_file::ftruncate): Ditto.
	* ntdll.h (STATUS_DISK_FULL): Define.
	(FILE_USE_FILE_POINTER_POSITION): Define.
	(FILE_WRITE_TO_END_OF_FILE): Define.
2007-10-15 08:25:38 +00:00
Corinna Vinschen fc7290fd39 * ntdll.h (STATUS_END_OF_FILE): Define.
* path.cc (symlink_info::check_shortcut): Use NT function to get file
	size.  Reintroduce checking file size before reading it.  Eliminiate
	close_it label.
	(symlink_info::check_sysfile): Check for EOF condition.
2007-10-13 11:06:43 +00:00
Corinna Vinschen 2da0e37519 * path.cc (basename): Return pointer into the path argument itself.
Shrink buf to 4 bytes.  Use buf only for border cases.
	(dirname): Ditto.
2007-10-11 16:26:19 +00:00
Corinna Vinschen 044b62c767 * path.cc (struct symlink_info): Change size of contents member to
be able to keep SYMLINK_MAX sized strings.
	(symlink_worker): Rework for long path names.  When writing windows
	shortcuts, store pathname additionally "hidden" after the actual
	shortcut data to workaround size limitations of the description field.
	(symlink_info::check_shortcut): Drop file name parameter.  Drop max
	file size check.  Use NT functions.  Use appended full path if
	available, description otherwise.  Check symlink string length for
	not exceeding SYMLINK_MAX.  Don't close file here.
	(symlink_info::check_sysfile): Drop file name parameter.  Use NT
	functions.  Check symlink string length for not exceeding SYMLINK_MAX.
	Don't close file here.
	(symlink_info::check_reparse_point): Drop file name parameter.  Drop
	useless length checks.  Allow SYMLINK_MAX length symlink strings.
	Don't close file here.
	(symlink_info::posixify): Allow SYMLINK_MAX length symlink strings.
	(symlink_info::check): Turn around checking for symlink file attributes.
	Use NT functions.  Close symlink file here.
	* include/limits.h (PATH_MAX): Define as 32760.  Change comment.
	(SYMLINK_MAX): Define as PATH_MAX - 1.
2007-10-10 16:54:09 +00:00
Corinna Vinschen 4797f5bca3 * fhandler_socket.cc (fhandler_socket::bind): Open file for deletion,
too.  Don't write to file and especially don't close handle if file
	couldn't be created.  Set delete disposition if writing failed,
	instead of calling unlink_nt.
2007-10-10 16:07:46 +00:00
Corinna Vinschen b75971ef8a * ntdll.h (struct _FILE_COMPRESSION_INFORMATION): Align with definition
in w32api / MSDN.
	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Accommodate
	change to struct _FILE_COMPRESSION_INFORMATION.
2007-09-27 09:35:06 +00:00
Corinna Vinschen dfbd95d35d * termios.cc (setspeed): Support new baud rates introduced 2007-02-05. 2007-09-26 08:57:35 +00:00
Corinna Vinschen 1ceec140c0 * ntdll.h (STATUS_OBJECT_NAME_INVALID): Define. 2007-09-20 15:14:13 +00:00
Corinna Vinschen 4090f565a8 * mmap.cc (fh_disk_file): Delete as global static variable and...
(mmap64): ...define as local pointer to make mmap thread-safe.
	Accommodate throughout.  Only initialize fh_disk_file after file could
	be opened with GENERIC_EXECUTE access.  Call fstat_by_handle instead of
	fstat to avoid overhead.
2007-09-18 15:59:50 +00:00
Corinna Vinschen d81b646dc3 * security.cc (set_file_sd): Open file with FILE_OPEN_FOR_BACKUP_INTENT
too.
2007-09-18 14:36:29 +00:00
Corinna Vinschen 6c8c58e7f4 * path.cc (symlink_info::check): Check for STATUS_OBJECT_NAME_INVALID.
Add comment.
2007-09-18 11:05:44 +00:00
Corinna Vinschen 8e34786463 * fhandler.cc (fhandler_base::open): Partly revert change from
2007-08-24:  Call has_acls to avoid permission problems getting
	a handle to a file on a remote share.  Add comment.
2007-09-17 16:48:14 +00:00
Brian Dessent 1515ce296a * include/cygwin/config.h: Conditionalize inline __getreent()
definition on _COMPILING_NEWLIB.
2007-09-08 10:51:37 +00:00
Brian Dessent 6e08b2f7f8 * include/cygwin/config.h (__getreent): Define inline version. 2007-09-07 00:44:27 +00:00
Brian Dessent 1eb76b8f84 * include/sys/stdio.h (_flockfile): Don't try to lock a FILE
that has the __SSTR flag set.
	(_ftrylockfile): Likewise.
	(_funlockfile): Likewise.
2007-09-06 18:47:44 +00:00
Corinna Vinschen 70650b2db4 * syscalls.cc (open): Don't follow symlinks if O_EXCL is given. 2007-08-24 14:55:56 +00:00
Corinna Vinschen a888c0799c * ntdll.h (STATUS_NO_SUCH_FILE): Define.
* path.cc (get_nt_native_path): Reset upath.Length to 0 on each
	invocation.
	(symlink_info::check): Use NT native functions.
2007-08-23 07:43:24 +00:00
Corinna Vinschen e1e4b104b6 * uinfo.cc (pwdgrp::load): Use NT native functions. 2007-08-21 17:38:27 +00:00
Corinna Vinschen 2e9fe498f2 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Rewrite checking
for executable file magic using a thread safe method and re-enable this
	code.
2007-08-21 15:37:10 +00:00
Corinna Vinschen f5f0ae3e26 * syscalls.cc (unlink_nt): Drop one local FILE_BASIC_INFORMATION struct. 2007-08-21 12:39:53 +00:00
Corinna Vinschen 1b61bf152b * ntdll.h (NtNotifyChangeDirectoryFile): Declare.
(NtQueryAttributesFile): Move to maintain alphabetical order of
	declarations.  Add comment to note that timestamp information returned
	by NtQueryAttributesFile is unreliable.
	* path.h (etc::changed_h): Move here.
	(etc::fn): Change type to OBJECT_ATTRIBUTES.
	(etc::last_modified): Change type to LARGE_INTEGER.
	(etc::init): Take PUNICODE_STRING as second argument.
	* path.cc: Accomodate above changes.
	(etc::test_file_change): Use NT native functions.
	(etc::dir_changed): Ditto.
	* uinfo.cc (pwdgrp::load): Call etc::init with NT native path.
2007-08-21 12:37:40 +00:00
Corinna Vinschen 66e36b7987 * fhandler_disk_file.cc: Change debugging output througout to print
the NT status consistently.  Use UNICODE path information if available.
2007-08-21 12:09:38 +00:00
Corinna Vinschen 891b6e885e * hookapi.cc (ld_preload): Call LoadLibraryW.
* path.h (path_conv::get_wide_win32_path_len): Define.
2007-08-20 15:41:08 +00:00
Corinna Vinschen 876da7fb74 * fhandler.cc (rootdir): Delete.
* winsup.h (rootdir): Drop declaration.
2007-08-20 15:16:27 +00:00
Corinna Vinschen decbb5d387 * path.cc (fillout_mntent): Append backslash to drive-only paths before
calling fs_info::update.
	* path.h (fs_info::clear): Simplify.
	(fs_info::fs_info): Add constructor.
2007-08-19 15:55:06 +00:00
Corinna Vinschen 5b62123cf6 * spawn.cc (spawn_guts): Fix typo in comment. 2007-08-17 20:22:24 +00:00
Corinna Vinschen e0bdf94f32 * autoload.cc (CloseDesktop): Define.
(CreateDesktopA): Define.
	(SetThreadDesktop): Define.
	* spawn.cc (spawn_guts): When starting a process under another user
	account, don't open up permissions on current window station and
	desktop.  Instead, if not in interactive session, create a new per-user
	window station plus default desktop and use that for the child process.
2007-08-17 19:58:57 +00:00
Corinna Vinschen f4c963630e * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Handle S_IFSOCK
mode bit by setting the SYSTEM attribute.
	* fhandler_socket.cc (fhandler_socket::fchmod): Add S_IFSOCK mode bit
	when calling fhandler_disk_file::fchmod.  Don't set attributes here.
2007-08-16 16:59:25 +00:00
Corinna Vinschen 29992bf3da * path.h (path_conv::operator char *): Delete.
(path_conv::operator const char *): Delete.
	* dlfcn.cc: Throughout, replace path_conv::operator char * and
	path_conv::operator const char * by call to path_conv::get_win32
	for easier transition to UNICODE_PATHs.
	* fhandler_socket.cc: Ditto.
	* hookapi.cc: Ditto.
	* path.cc: Ditto.
	* spawn.cc: Ditto.
	* syscalls.cc: Ditto.
	* uinfo.cc: Ditto.
2007-08-16 15:07:42 +00:00
Corinna Vinschen 29fec364c0 * dir.cc (readdir_worker): Convert w32name to PUNICODE_STRING.
* sec_acl.cc (getacl): Convert debug output to print native NT path.
	* security.cc (set_file_attribute): Ditto.
	* syscalls.cc (try_to_bin): Ditto and fix buggy debug statement.
2007-08-16 14:46:23 +00:00
Corinna Vinschen dec9daad4a * ntdll.h (RtlAcquirePebLock): Declare.
(RtlReleasePebLock): Declare.
	* path.cc (cwdstuff::set): Change PEB only while it's locked.
2007-08-16 14:30:53 +00:00
Corinna Vinschen bd61a7f7b9 * fhandler.h (fhandler_base::get_namehash): Use NT native path.
* fhandler_disk_file.cc (readdir_get_ino): Ditto in call to
	hash_path_name.
2007-08-16 14:10:06 +00:00
Corinna Vinschen 855e63eb4b * ntdll.h (RtlCreateUnicodeStringFromAsciiz): Fix declaration.
(RtlUpcaseUnicodeChar): Declare.
	* path.cc (hash_path_name): Split into three functions, taking
	the path as char *, PWCSTR, or PUNICODE_STRING.  Move implementation
	into PUNICODE_STRING-based function.  Drop old drive-relative path
	consideration.
	* winsup.h (iswdirsep): Like isdirsep but for WCHARs.
	(isabspath_u): Like isabspath, for PUNICODE_STRINGs.
	(iswabspath): Like isabspath, for PWCHARs.
	(hash_path_name): Add new declarations.
2007-08-16 10:41:45 +00:00
Corinna Vinschen c4bd837700 * path.cc (get_nt_native_path): Allow to convert special paths which
have no native NT path representation for simplified debug output.
	* syscalls.cc: Convert debug output to print native NT path.
	(unlink): Drop redundant debug output.
2007-08-15 16:27:09 +00:00
Corinna Vinschen 6d70255fe8 * fhandler_disk_file.cc (fhandler_disk_file::link): Drop superfluous
test for trailing dot.
	* path.h (path_conv::operator []): Remove.
2007-08-15 15:31:19 +00:00
Corinna Vinschen d85bcb4542 * fhandler_socket.cc (get_inet_addr): Use NT native functions for
accessing the file representing the local socket.
	(fhandler_socket::bind): Ditto.
	* ntdll.h: Declare NtReadFile.
2007-08-15 15:17:05 +00:00
Corinna Vinschen 3b98bacfd6 * path.cc (symlink_info::check): In case of ERROR_SHARING_VIOLATION and
ERROR_ACCESS_DENIED, try to get file attributes by using directory
	functions.
2007-08-14 16:19:13 +00:00
Corinna Vinschen cb8e4b58f5 * path.cc (fs_info::update): Correctly handle the volume root directory. 2007-08-14 15:54:45 +00:00
Corinna Vinschen 4a971ce403 * fhandler.h (fhandler_base::pc): Make public.
* fhandler_disk_file.cc (fhandler_disk_file::link): Drop extern
	declaration of stat_suffixes.  Use NT native path in debug output.
	(fhandler_base::utimes_fs): Simplify closeit case.  Use close_fs
	to close newly opened file handle.
	(fhandler_base::open_fs): Use NT native path in debug output.
	* path.cc: Throughout drop extern declaration of stat_suffixes.
	* path.h (stat_suffixes): Declare.
	* sec_acl.cc (acl_worker): Drop extern declaration of stat_suffixes.
	* times.cc (utimes_worker): Take path_conv as parameter instead of
	single-byte pathnam, drop nofollow argument, accommodate throughout.
	Compare UNICODE paths when enumerating file descriptors.  Fix
	formatting.  Use NT native path in debug output.
2007-08-14 14:48:52 +00:00
Corinna Vinschen 7d2ade3341 * mmap.cc: Call NtClose instead of CloseHandle throughout.
(CreateMapping): Drop unused last argument.  Accommodate throughout.
	(mmap64): Re-open file with execute permissions using NtOpenFile.
2007-08-13 19:44:31 +00:00