summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* * path.cc (allow_winsymlinks): Revert default to create system bitCorinna Vinschen2008-07-161-1/+1
| | | | symlinks for speed.
* Add case-sensitivity.Corinna Vinschen2008-07-161-169/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unconditionally handle mount points case-sensitive. Unconditionally handle virtual paths case-sensitive. Unconditionally handle registry paths case-insensitive. Otherwise, accommodate case-sensitivity of given path throughout. * cygheap.cc (cygheap_root::set): Get additional caseinsensitive parameter and store it. * cygheap.h (struct cygheap_root_mount_info): Add member caseinsensitive. * dlfcn.cc (get_full_path_of_dll): Drop PC_NOFULL parameter from call to path_conv::check. * environ.cc (pcheck_case): Remove. (check_case_init): Remove. (known): Drop "check_case" option. * exceptions.cc (open_stackdumpfile): Add comment. * fhandler.cc (fhandler_base::get_default_fmode): Call pathmatch instead of strcasematch. * fhandler_disk_file.cc: Accommodate case-sensitivity of given path throughout. (__DIR_mounts::check_mount): Unconditionally check virtual paths case-sensitive. (fhandler_disk_file::link): Drop case clash handling. (fhandler_disk_file::open): Ditto. (fhandler_disk_file::readdir_helper): Drop managed mount code. * mount.cc: Remove managed mount code and datastructures. (struct opt): Remove "managed" option. Add "posix=0" and "posix=1" options. (fillout_mntent): Remove "managed" output. Add "posix" output. * path.cc (struct symlink_info): Remove case_clash member and case_check method. (pcheck_case): Remove. (path_prefix_p): Take additional bool parameter "caseinsensitive". (pathnmatch): Ditto. (pathmatch): Ditto. (mkrelpath): Ditto. (fs_info::update): Set caseinsensitive flag according to file system name and FILE_CASE_SENSITIVE_SEARCH flag. Add comment. (tfx_chars_managed): Remove. (transform_chars): Drop "managed" parameter. Always use tfx_chars. (get_nt_native_path): Drop "managed" parameter. Make sure drive letters are always upper case. (getfileattr): Change second parameter to denote caseinsensitivity. (path_conv::check): Initialize caseinsensitive to OBJ_CASE_INSENSITIVE. Set caseinsensitive according to global obcaseinsensitive flag, file system case sensitivity and MOUNT_NOPOSIX mount flag. Drop case_clash and all the related code. (symlink_worker): Drop case clash handling. (symlink_info::set): Drop setting case_clash. (symlink_info::case_check): Remove. (cwdstuff::set): Add comment. (etc::init): Take path_conv instead of PUNICODE_STRING as parameter to allow case sensitivity. * path.h (enum pathconv_arg): Drop PC_SYM_IGNORE. (enum case_checking): Remove. (enum path_types): Drop PATH_ENC, add PATH_NOPOSIX flag. (struct fs_info): Add caseinsensitive flag and accessor methods. (class path_conv): Add caseinsensitive member and define objcaseinsensitive method. Drop case_clash member and isencoded method. (pathmatch): Change prototype according to above change. (pathnmatch): Ditto. (path_prefix_p): Ditto. (get_nt_native_path): Ditto. (class etc): Ditto. (fnunmunge): Remove prototype. * shared.cc (shared_info::init_obcaseinsensitive): Initialize obcaseinsensitive flag from obcaseinsensitive registry value. (shared_info::initialize): Call init_obcaseinsensitive here by the first process creating the shared memory. * shared_info.h (mount_item::fnmunge): Remove. (shared_info::obcaseinsensitive): Rename from obcaseinsensitivity. (shared_info::init_obcaseinsensitive): Declare. * syscalls.cc (try_to_bin): Add comment. * include/sys/mount.h (MOUNT_ENC): Remove flag. (MOUNT_NOPOSIX): Add flag.
* Throughout drop allow_ntsec and allow_smbntsec handling.Corinna Vinschen2008-07-141-4/+3
| | | | | | | | | | | | | | | | * environ.cc (set_ntsec): Remove. (set_smbntsec): Remove. (known): Remove ntsec and smbntsec options. * external.cc (check_ntsec): Return true if no filename is given. * mount.cc (oopts): Add "acl" and "noacl" options. Set MOUNT_NOACL flag accordingly. (fillout_mntent): Handle MOUNT_NOACL flag. * path.h (enum path_types): Add PATH_NOACL. * security.cc (allow_ntsec): Remove. (allow_smbntsec): Remove. * security.h (allow_ntsec): Drop declaration. (allow_smbntsec): Drop declaration. * include/sys/mount.h (MOUNT_NOACL): Define.
* * path.cc (path_conv::is_binary): Fix test. Add comment.Corinna Vinschen2008-07-021-2/+4
|
* * path.cc (get_nt_native_path): Drop considerations for DOS devices.Corinna Vinschen2008-06-111-5/+10
| | | | | | Keep relative paths relative. (cygwin_conv_path): Don't try to skip native NT prefixes on relative paths.
* * path.cc (symlink_info::check): Reorder test for nfs symlinks.Corinna Vinschen2008-05-241-1/+1
|
* * fhandler_disk_file.cc (fhandler_disk_file::opendir): Don't try toCorinna Vinschen2008-05-231-4/+5
| | | | | | | use FileIdBothDirectoryInformation on NFS shares. Fix comment to explain why. * path.cc (symlink_info::check): Reinstantiate no_ea. Use in erroneously changed condition.
* * mount.cc (mount_info::from_fstab): Use cygwin_hmodule rather than trying toChristopher Faylor2008-05-231-2/+0
| | | | | find handle based on cygwin1.dll. * path.cc (symlink_info::check): Remove unused variable.
* * path.cc (symlink_info::check): Define eabuf and easize outside ofCorinna Vinschen2008-05-231-3407/+3406
| | | | | loop. Set to NULL on first STATUS_EAS_NOT_SUPPORTED. Align comments. Fix formatting.
* * path.cc (symlink_info::check): Don't pass EaBuffer to NtCreateFile if it hasChristopher Faylor2008-05-231-3432/+3444
| | | | | | indicated that it isn't appropriate. * ntdll.h (STATUS_EAS_NOT_SUPPORTED): Define. * winsup.h: Remove __builtin* defines.
* * path.cc (cygwin_conv_path): Define tp before setting up faul handler.Corinna Vinschen2008-05-221-2/+2
| | | | | | * syscalls.cc: Ditto, throughout. (gen_full_path_at): Add bool parameter to allow NULL pathname. (futimesat): Allow NULL pathname as GLIBC.
* * fhandler_disk_file.cc (get_ino_by_handle): Rename pfai to fai.Corinna Vinschen2008-05-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | (fhandler_base::fstat_by_handle): Drop fai_size and pfai in favor of static struct fai_buf. Restructure. (fhandler_base::fstat_by_name): Drop fvi_size and pfvi. Drop fdi_size and pfdi in favor of static struct fdi_buf. Drop redundant test for existance. Use FileDirectoryInformation class instead of FileBothDirectoryInformation. Drop call to NtQueryVolumeInformationFile in favor of using pc.fs_serial_number (). Fix FileId information given to fstat_helper. (fhandler_disk_file::fstatvfs): Drop fvi_size, pfvi, fai_size and pfai. Drop getting FileFsVolumeInformation and FileFsAttributeInformation in favor of using the related path_conv info. (fhandler_disk_file::opendir): Fix comment. (fhandler_disk_file::readdir): Ditto. Use FileDirectoryInformation class instead of FileBothDirectoryInformation. * path.cc (fs_info::update): Store MaximumComponentNameLength in new member name_len. * path.h (struct fs_info): Use ULONG rather than DWORD. Add member name_len to store MaximumComponentNameLength. Add accessor methods. (path_conv::fs_name_len): New method.
* * fhandler.h (dirent_states): Add dirent_nfs_d_ino state and add it toCorinna Vinschen2008-05-211-2/+3
| | | | | | | | | | | | dirent_info_mask. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set dirent_nfs_d_ino flag for NFS shares. Explain why. (fhandler_disk_file::readdir): Use FileNamesInformation instead of FileBothDirectoryInformation info class on NFS clients not supporting the FileIdBothDirectoryInformation info class. Use local pointers to accommodate different offsets. * path.cc (symlink_info::check): Don't test directories for symlinks on NFS shares. Enhance comment.
* * path.cc (symlink_worker): Fix EA buffer size info given toCorinna Vinschen2008-05-201-5/+4
| | | | | | NtCreateFile. (symlink_info::check_nfs_symlink): Get 64K buffer for EA buffer. Change EA buffer size info given to NtQueryEaFile accordingly.
* * path.cc (symlink_info::check_shortcut): Minimize requested fileCorinna Vinschen2008-05-201-5/+6
| | | | | | | access flags. (symlink_info::check_sysfile): Ditto. Add missing `else'. (symlink_info::check): Only retry to open file if first try failed with access denied.
* * path.cc (fs_info::update): Re-add opening the unsplitted pathCorinna Vinschen2008-05-201-0/+2
| | | | for fillout_mntent's sake.
* * Makefile.in (DLL_OFILES): Add nfs.o.Corinna Vinschen2008-05-201-145/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fhandler.cc (fhandler_base::open): Open files on NFS shares with correct access flags and EAs. * fhandler.h (fhandler_base::fstat_by_nfs_ea): Declare. * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): New method. (fhandler_base::fstat_by_handle): Call fstat_by_nfs_ea for files on NFS shares. (fhandler_disk_file::fchmod): Use NFS specific method to set mode for files on NFS shares. Don't overrule errno from call to set_file_attribute with errno from NtSetInformationFile call. (fhandler_disk_file::fchown): Add comment. * mount.cc (fillout_mntent): Accommodate change in second parameter to fs_info::update. * nfs.cc: New file. * nfs.h: New file. * path.cc (fs_info::update): Take handle instead of bool as second parameter. Use that handle if it's not NULL. Only close handle if it has been opened here. Use static defined buffers instead of alloca'd buffers. (path_conv::check): Call symlink_info::check with reference to fs. Don't call fs.update here if file exists. (conv_path_list): Prefer tmp_pathbuf buffer over using alloca. (symlink_worker): Use NFS specific method to create symlinks on NFS shares. Prefer tmp_pathbuf buffer over using alloca. (symlink_info::check_shortcut): Reopen file from incoming handle with necessary FILE_GENERIC_READ flag. Prefer tmp_pathbuf buffer over using alloca. (symlink_info::check_sysfile): Ditto. (symlink_info::check_reparse_point): Use tmp_pathbuf buffer to allocate REPARSE_DATA_BUFFER. (symlink_info::check_nfs_symlink): New method. (enum symlink_t): Remove. (symlink_info::check): Don't use NtQueryAttributesFile. Rather, open file with necessary access flags and call NtQueryInformationFile. Fix error handling in case file can't be opened. For existing files, call fs_info::update here. Restructure symlink checking to accommodate the fact that the file is already open. Add case for NFS symlinks. * path.h (fs_info::update): Take handle instead of bool as second parameter.
* * path.cc (path_conv::check): Free wide_path and normalized_path ifCorinna Vinschen2008-05-201-0/+4
| | | | | | necessary. * path.h (path_conv::path_conv): Set wide_path, normalized_path and normalized_path_size to 0 in all constructors.
* * path.cc (path_conv::set_normalized_path): Drop strip_tail argument.Corinna Vinschen2008-05-131-42/+7
| | | | | | | | | | | | | Never strip trailing dots and spaces. * (path_conv::check): Accomodate above change. * path.h (path_conv::operator=): Ditto * dtable.cc (build_fh_dev): Ditto. * fhandler.h (fhandler_base::set_name): Ditto. * path.cc (transform_chars): Disable converting trailing dots and spaces. * path.cc (path_conv::check): Remove two disabled code snippets.
* * mount.cc (is_unc_share): Allow \\?\ prefix as well. Enhance comment.Corinna Vinschen2008-04-301-10/+6
| | | | | | | | | | | (mount_info::from_fstab): Remove patch from 2008-04-29. * mount.cc (mount_info::conv_to_posix_path): Simplify test for native UNC path. * path.cc (normalize_win32_path): Ditto. (symlink_worker): Ditto. (symlink_info::posixify): Ditto. (cygwin_conv_path): Ditto.
* * path.cc (symlink_info::check): Avoid special handling forCorinna Vinschen2008-04-281-13/+7
| | | | | STATUS_BUFFER_OVERFLOW when calling NtQueryDirectoryFile. * strace.cc (strace::vprntf): Use bigger buffer.
* * cygwin.din: Sort.Corinna Vinschen2008-04-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (faccessat): Export. (fchmodat): Export. (fchownat): Export. (fstatat): Export. (futimesat): Export. (linkat): Export. (mkdirat): Export. (mkfifoat): Export. (mknodat): Export. (openat): Export. (readlinkat): Export. (renameat): Export. (symlinkat): Export. (unlinkat): Export. * path.cc (readlink): Align definition to POSIX. * syscalls.cc (gen_full_path_at): New static function. (faccessat): Implement. (fchmodat): Implement. (fchownat): Implement. (fstatat): Implement. (futimesat): Implement. (linkat): Implement. (mkdirat): Implement. (mkfifoat): Implement. (mknodat): Implement. (openat): Implement. (readlinkat): Implement. (renameat): Implement. (symlinkat): Implement. (unlinkat): Implement. * include/cygwin/version.h: Bump API minor number.
* * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): FixCorinna Vinschen2008-04-141-2/+2
| | | | | thinko in UNC path handling. * path.cc (symlink_worker): Fix typo in comment. Fix UNC path handling.
* * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): SimplifyCorinna Vinschen2008-04-131-13/+1
| | | | | | | | | | | | | | | code which checks for symlinks. Fix problem with UNC paths. * environ.cc (struct parse_thing): Remove transparent_exe option. * syscalls.cc (transparent_exe): Remove. (unlink): Always add stat_suffixes, drop transparent_exe check. (open): Ditto. (link): Ditto. (pathconf): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::link): Ditto. * fhandler_process.cc (fhandler_process::fill_filebuf): Always remove .exe suffix. * path.cc (realpath): Never attach known_suffix.
* Add miscfuncs.h to files as needed throughout.Christopher Faylor2008-04-071-1648/+5
| | | | | | | | | | | | * mount.cc: New file. * path.cc: Move mount-specific stuff into mount.cc. Move common stuff into miscfuncs.cc. Remove unneeded includes. * miscfuncs.cc: Move some common path functions here. * miscfuncs.h: New file. * winsup.h: Move miscelleneous functions to miscfuncs.h. * dcrt0.cc: Remove unneeded includes. * Makefile.in (DLL_OFILES): Add mount.o. * include/cygwin/config.h: Fix a minor typo.
* * path.cc (struct opt): Rename "system" to "nouser".Corinna Vinschen2008-04-061-1/+1
| | | | * postinsatll: Ditto.
* * postinstall: New script.Corinna Vinschen2008-04-051-193/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.in (sysconfdir): Define. (install): Create $(sysconfdir)/postinstall dir. Install postinstall script into it. * path.cc: Add temorary comments to note later function removal. (conv_fstab_spaces): New inline function to handle \040 to space conversion. (struct opt): Add "system" and "user" mount options. (mount_info::from_fstab_line): Only allow # to start a comment at the beginning of the line. Call conv_fstab_spaces on native_path and posix_path fields. Don't enforce system mounts in /etc/fstab. Drop last argument in call to add_item. (mount_info::from_fstab): Create a default cygdrive entry. Load user mount points from fstab.<username> instead of fstab.<sid>. (mount_info::read_mounts): Drop last argument in call to add_item. (mount_info::add_reg_mount): Remove. (mount_info::del_reg_mount): Remove. (mount_info::write_cygdrive_info): Rename from mount_info::write_cygdrive_info_to_registry. Don't write to registry. Disallow to overwrite a system cygdrive prefix. (mount_info::remove_cygdrive_info_from_registry): Remove. (mount_info::get_cygdrive_info): Just fetch current cygdrive prefix and flags. (mount_info::add_item): Drop last argument. Don't write to registry. Disallow to overwrite a system mount point. (mount_info::del_item): Drop last argument. Don't write to registry. Disallow to remove a system mount point. (mount): Enforce user mount. (cygwin_umount): Ditto. * shared_info.h (mount_info::add_item): Drop last argument. (mount_info::del_item): Ditto. (mount_info::add_reg_mount): Remove. (mount_info::del_reg_mount): Remove. (mount_info::write_cygdrive_info): Rename from mount_info::write_cygdrive_info_to_registry. (mount_info::remove_cygdrive_info_from_registry): Remove.
* * path.cc (mount_info::from_fstab_line): Simplify.Corinna Vinschen2008-04-031-13/+20
| | | | (mount_info::from_fstab): Create a default root dir.
* * path.cc (mount_info::from_fstab): Get module path name of the CygwinCorinna Vinschen2008-04-031-1/+2
| | | | DLL, not the path of the application.
* * path.cc (mount_info::init): First try to fetch mount points fromCorinna Vinschen2008-04-021-0/+198
| | | | | | | | | | | | | | fstab files. Fallback to registry if none exists. (skip_ws): New inline function. (find_ws): Ditto. (struct opt): New structure for mount options. (read_flags): New static function to convert a mount flags string into a flag value. (mount_info::from_fstab_line): New method to create a mount table entry from a fstab line. (mount_info::from_fstab): New method to read fstab file. * shared_info.h (mount_info::from_fstab_line): Declare. (mount_info::from_fstab): Declare.
* * path.cc (enum symlink_t): Rename from shortcut_t.Corinna Vinschen2008-04-021-2/+2
|
* * path.cc (symlink_info::check_reparse_point): Use NtFsControlFileCorinna Vinschen2008-04-021-24/+47
| | | | | | | | | to read reparse points. (enum shortcut_t): New type. (symlink_info::check): Convert sym_check to shortcut_t. Use shortcut_t enum values throughout. Check reparse point before checking for sysfile shortcut. Open reparse points with READ_CONTROL only to accommodate special Vista reparse points. Add comments.
* * smallprint.cc (__small_vswprintf): Fix uninitialized usage of `w'.Corinna Vinschen2008-03-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revamp advisory file locking to avoid cross reference pointers as well as to allow BSD flock semantics. More agressively delete unused nodes and sync objects. * fhandler.h (fhandler_base::ino): Rename from namehash. Fix comment. (fhandler_base::node): Remove. (fhandler_base::unique_id): Add. (fhandler_base::del_my_locks): New method. (get_ino): Rename from get_namehash. Change usage throughout Cygwin. (get_unique_id): New method. * fhandler.cc (fhandler_base::close): Call own del_my_locks method. Fix comment. (fhandler_base::fhandler_base): Accommodate new and changed members. (fhandler_base::fixup_after_fork): Call del_my_locks. (fhandler_base::fixup_after_exec): Ditto for files with close-on-exec flag set. * fhandler_disk_file.cc (get_ino_by_handle): Rename from readdir_get_ino_by_handle. Accommodate throughout. (fhandler_base::open_fs): Fill ino with inode number if FS has good inodes. Allocate a LUID and store in unique_id to recognize file descriptors referencing the same file object. * flock.cc: Drop flock TODO comments. Use explicit types __dev32_t and __ino64_t instead of dev_t and ino_t. (LOCK_OBJ_NAME_LEN): Change to reflect longer lf_id length. (get_obj_handle_count): New method. (lockf_t::lf_id): Change type to long long. (inode_t::get_lock_obj_handle_count): Drop in favor of static function get_obj_handle_count. (inode_t::del_locks): Remove. (inode_t::get): Add create_if_missing flag argument. (inode_t::del_my_locks): Reimplement to handle POSIX and BSD flock locks. Return if node can be deleted or not. (inode_t::~inode_t): Ditto. Close handles to i_dir and i_mtx. (fixup_lockf_after_fork): Remove. (fhandler_base::del_my_locks): New method. (fixup_lockf_after_exec): Check if node can be deleted. (inode_t::get): Only create node if create_if_missing is set. Lock the returned node here before unlocking the node list. (inode_t::get_all_locks_list): Accommodate new lf_id length. (inode_t::create_lock_obj): Ditto. (lockf_t::open_lock_obj): Ditto. Change return type to bool. De-const. Set lf_obj instead of returning a handle. (lockf_t::del_lock_obj): Call SetEvent only if new incoming parameters allow it. Explain how it's supposed to work. (fhandler_disk_file::lock): Only fetch file length in SEEK_END case. Use NtQueryInformationFile(FileStandardInformation) instead of calling fstat_by_handle. Always unlock node before returning. Use fhandler's unique id to create lf_id for BSD flock locks. Rely on node lock from inode_t::get. Call del_lock_obj on removed locks here to allow explicit unlocking. Delete node if no lock exists on the file anymore. (lf_setlock): Get file handle as additional parameter. Handle the fact that lf_getblock now always opens the attached event object. Reactivate erroneously applied patch which deactivates setting thread priority. Additionally handle blocking on BSD flock locks. (lf_clearlock): Get file handle as additional parameter. (lf_getlock): Close event handle opened by lf_getblock. (lf_getblock): Open potentially blocking event object here and check its signal state if it's a BSD flock lock. (lf_wakelock): Get file handle as additional parameter. * fork.cc (frok::child): Drop call to fixup_lockf_after_fork. * ntdll.h (struct _EVENT_BASIC_INFORMATION): Define. (enum _EVENT_INFORMATION_CLASS): Define. (NtQueryEvent): Declare. * fhandler.h (fhandler_base::fs_flags): Remove. (fhandler_base::set_fs_flags): Remove. (fhandler_base::get_fs_flags): Remove. * fhandler.cc (fhandler_base::write): Check for sparse file using pc.fs_flags(). * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Ditto. The return of the volume serial number in fs_info. * fhandler.h (get_dev): New method. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop call to NtQueryVolumeInformationFile(FileFsVolumeInformation). Just use get_dev() method. * fhandler_fifo.cc (fhandler_fifo::open) Use device ID and inode number to generate fifo name. * path.h (fs_info::sernum): New member. (fs_info::serial_number): New method. (path_conv::fs_serial_number): New method. * path.cc (fs_info::update): Fetch volume serial number and store in sernum.
* * dtable.cc: Define various device-related string constants as wide characterChristopher Faylor2008-03-221-3/+3
| | | | | | | | | | | | | | | | | | | | | constants. (dtable::init_std_file_from_handle): Reorganize pipe handling to try to catch special tty case. (build_fh_name_worker): Declare for common use. (build_fh_name): Define char version. (build_fh_name): Define (currently unused) UNICODE_STRING version. (decode_tty): Detect if pipe is actually a cygwin tty, returning the tty name in the buffer. (handle_to_fn): Reorganize to use wide characters. * dtable.h (build_fh_name): Declare (currently unused) UNICODE_STRING version. * fhandler_tty.cc (fhandler_pty_master::setup): Use fhandler_pipe::create_selectable to create a pipe with a given name. * pipe.cc (pipe_handler): Make returned handle inheritable. (fhandler_pipe::create_selectable): Take an optional name. Use a standard cygwin introducer for the name. * path.cc (path_conv::check): Make first argument const. * path.h (path_conv::check): Ditto for declaration. (path_conv::path_conv): Ditto for UNICODE_STRING version.
* * fcntl.cc (fcntl_worker): Protect with a 'myfault'.Corinna Vinschen2008-03-141-1/+1
| | | | | | | | | | * path.cc (normalize_posix_path): Treat X:/ as Win32 path, too. * smallprint.cc (__wrn): New static function. (__small_vswprintf): New function to generate WCHAR strings. (__small_swprintf): Ditto. * winsup.h (__small_swprintf): Declare. (__small_vswprintf): Declare.
* * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): DisableCorinna Vinschen2008-03-121-14/+74
| | | | | | | | | | | | | | | | | | | | munging. Convert all chars in the 0xf0xx area to it's ascii equivalent. * path.cc (normalize_posix_path): Don't treat "X:foo" as windows path, only "a:\foo". (tfx_chars): New transformation table for special DOS chars. (tfx_chars_managed): Ditto, plus transformation of uppercase ASCII chars. (transform_chars): New function. (get_nt_native_path): Make static. Call transform_chars for all valid FS paths. Get additional flag if file is managed or not. Accommodate throughout. (getfileattr): Get additional flag if file is managed or not. Accommodate throughout. (path_conv::check): Disable special handling for trailing dots and spaces. (mount_item::build_win32): Disable code for managed paths. (mount_info::conv_to_posix_path): Ditto. * path.h (get_nt_native_path): Remove declaration.
* * winsup.h (NT_MAX_PATH): Revert ill-advised change to 32767.Corinna Vinschen2008-03-121-58/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accommodate change throughout. * cygwin.din (cygwin_conv_path): Export. (cygwin_conv_path_list): Export. (cygwin_create_path): Export. * dcrt0.cc (dll_crt0_1): Use cygwin_conv_path. * dtable.cc (handle_to_fn): Ditto. Don't expect UNICODE_STRING being 0-terminated. * environ.cc (env_plist_to_posix): New helper function. (env_plist_to_win32): Ditto. (env_path_to_posix): Ditto. (env_path_to_win32): Ditto. (return_MAX_PATH): Remove. (conv_envvars): Use new helper functions. Drop removed members. (win_env::operator =): Accommodate removal of path length functions. (win_env::add_cache): Accommodate new env helper function API. (posify): Ditto. * environ.h (struct win_env): Ditto. Remove path length function pointers since they are unused. * path.cc (warn_msdos): Use cygwin_conv_path. (getfileattr): Use new tmp_pathbuf::u_get method. (fillout_mntent): Ditto. (symlink_info::check): Ditto. (path_conv::check): Use sizeof (WCHAR) instead of constant 2. (symlink_info::check_reparse_point): Ditto. (conv_path_list): Get max size of target string as argument. Call cygwin_conv_path as helper function. (cygwin_conv_path): New function. (cygwin_create_path): New function. (cygwin_conv_to_win32_path): Just call cygwin_conv_path with size set to MAX_PATH. (cygwin_conv_to_full_win32_path): Ditto. (cygwin_conv_to_posix_path): Ditto. (cygwin_conv_to_full_posix_path): Ditto. (conv_path_list_buf_size): Add FIXME comment. (env_PATH_to_posix): Rename from env_win32_to_posix_path_list. Add size argument as required for env helper functions. (cygwin_win32_to_posix_path_list): Call conv_path_list with size set to MAX_PATH. (cygwin_posix_to_win32_path_list): Ditto. (cygwin_conv_path_list): New function. (cwdstuff::get): Fix length argument in call to sys_wcstombs. * spawn.cc (find_exec): Use cygwin_conv_path_list. * tls_pbuf.h (tmp_pathbuf::u_get: New method. * uinfo.cc (cygheap_user::ontherange): Allocate temporary path buffers using tmp_pathbuf. Use cygwin_conv_path. * winf.cc (av::unshift): Use cygwin_conv_path. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h: Comment out old cygwin32_XXX API. Mark old path handling API as deprecated. (cygwin_conv_path_t): Typedef. Define values. (cygwin_conv_path): Declare. (cygwin_create_path): Declare. (cygwin_conv_path_list): Declare.
* * path.cc (cwdstuff::set): Make sure drive_length is 0 for virtualCorinna Vinschen2008-03-111-3/+5
| | | | | | paths. Add comments. * spawn.cc (spawn_guts): Don't allow to start a native Win32 application from a long path or a virtual path. Print an error message to stderr.
* * fhandler_disk_file.cc (DIR_BUF_SIZE): Define required space for fileCorinna Vinschen2008-03-081-15/+25
| | | | | | | | | | | | | | | name in terms of sizeof(WCHAR). (fhandler_disk_file::readdir_helper): Convert *all* of fname. * path.cc (fillout_mntent): Use tmp_pathbuf for path buffer. (symlink_worker): Ditto. (SCAN_JUSTCHECKTHIS): New state for suffix_scan to define that only the actual name gets cheked and a suffix is never attached. (suffix_scan::has): If filename + suffix would be > NAME_MAX, start in SCAN_JUSTCHECKTHIS state. (suffix_scan::next): Add case for SCAN_JUSTCHECKTHIS. (symlink_info::check): Use tmp_pathbuf for path buffer. Goto file_not_symlink in case of invalid file name. (realpath): Use tmp_pathbuf for path buffer.
* * Makefile.in (DLL_OFILES): Add tls_pbuf.o.Corinna Vinschen2008-03-071-36/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * autoload.cc (CreateDesktopW): Replace CreateDesktopA. (CreateWindowStationW): Replace CreateWindowStationA. (GetUserObjectInformationW): Replace GetUserObjectInformationA. * cygheap.h (cwdstuff::get): Assume default buffer size NT_MAX_PATH. * cygtls.cc (_cygtls::remove): Free temporary TLS path buffers. * cygtls.h (TP_NUM_C_BUFS): Define. (TP_NUM_W_BUFS): Define. (class tls_pathbuf): New class to store pointers to thread local temporary path buffers. (_local_storage::pathbufs): New member. * environ.cc (win_env::add_cache): Use temporary TLS path buffer instead of stack based buffer. (posify): Get temporary outenv buffer from calling function. (environ_init): Create temporary TLS path buffer for posify. (build_env): Create Windows environment block as WCHAR buffer. * environ.h (build_env): Change declaration accordingly. * external.cc (sync_winenv): Accommodate build_env change. * fhandler_console.cc (fhandler_console::need_invisible): Use GetUserObjectInformationW and CreateWindowStationW. * fhandler_process.cc (format_process_maps): Use temporary TLS path buffer instead of stack based buffer. * fork.cc (frok::parent): Convert to use CreateProcessW. * path.cc: Throughout use temporary TLS path buffers instead of stack based buffer. Replace checks for CYG_MAX_PATH by checks for NT_MAX_PATH. (getfileattr): New function to replace GetFileAttributesA. (normalize_win32_path): Remove Win32 and NT long path prefixes. (getwd): Assume PATH_MAX + 1 buffer per SUSv3. * path.h (class path_conv): Set path buffer to size NT_MAX_PATH. (iswdrive): Define. * pinfo.cc (commune_process): Use temporary TLS path buffer instead of stack based buffer. * registry.cc (get_registry_hive_path): Ditto. (load_registry_hive): Ditto. * spawn.cc (spawn_guts): Convert to use CreateProcessW and CreateProcessAsUserW. (av::fixup): Open/close file using NtOpenFile/NtClose. * syscalls.cc (mknod_worker): Allow PATH_MAX file name. (mknod32): Ditto. (getusershell): Ditto. * tls_pbuf.cc: New file implementing tls_pathbuf and tmp_pathbuf methods. * tls_pbuf.h: New header for files using tmp_pathbuf. * tlsoffsets.h: Regenerate. * winsup.h (NT_MAX_PATH): Define as 32767 to avoid USHORT overflow.
* * child_info.h (~child_info_spawn): Check moreinfo->myself_pinfo forCorinna Vinschen2008-03-051-1/+3
| | | | | | | | | | | NULL before closing. * spawn.cc (spawn_guts): Don't close moreinfo->myself_pinfo explicitely in case of failing CloseProcess. * fhandler.cc (fhandler_base::open_): Return EISDIR when trying to create a directory. * path.cc (path_conv::check): If input path had a trailing dir separator, tack it on to the native path if directory doesn't exist.
* * path.cc (cwdstuff::set): Revert error handling change in caseCorinna Vinschen2008-02-201-13/+9
| | | | DuplicateHandle fails, because it breaks Vista/Longhorn workaround.
* Perform whitespace cleanup throughout.Christopher Faylor2008-02-151-19/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dcrt0.cc (signal_shift_subtract): Eliminate ancient backwards compatibility. (check_sanity_and_sync): Ditto. * winsup.h (SIGTOMASK): Ditto. Just use constant in signal calculation. * include/cygwin/version: Remove backwards signal mask compatibility define. * path.cc (symlink_info::check_sysfile): Cosmetic change. * registry.cc (get_registry_hive_path): Remove unneeded variable. * exceptions.cc (handle_sigsuspend): Eliminate thread signal mask and use either main sigmask or current thread sigmask. (set_process_mask): Ditto. (sighold): Ditto. (sigrelse): Ditto. (sigset): Ditto. (set_process_mask_delta): Ditto. (_cygtls::call_signal_handler): Ditto. * fhandler_process.cc (format_process_status): Ditto. * fhandler_termios.cc (fhandler_termios::bg_check): Ditto. * pinfo.h (class pinfo): Ditto. * select.cc (pselect): Ditto. * signal.cc (sigprocmask): Ditto. (abort): Ditto. (sigpause): Ditto. (sigsend): Ditto. (wait_sig): Ditto. * thread.h (pthread::parent_tls): New member. * thread.cc (pthread::pthread): Record parent_tls here. (pthread::thread_init_wrapper): Initialize sigmask from parent thread.
* * cygheap.cc (cwcsdup): New function.Corinna Vinschen2008-02-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | (cwcsdup1): New function. * cygheap.h (cygheap_user::get_windows_id): New method returning PWCHAR. (cwcsdup): Declare. (cwcsdup1): Declare. * registry.cc (get_registry_hive_path): Use WCHAR instead of char throughout. (load_registry_hive): Ditto. * registry.h (get_registry_hive_path): Change declaration accordingly. (load_registry_hive): Ditto. * sec_helper.cc (cygpsid::string): New method returning PWCHAR. * security.h (cygpsid::string): Declare. * syscalls.cc (seteuid32): Convert local name var to WCHAR. * uinfo.cc (cygheap_user::env_userprofile): Convert local name buffers to WCHAR. Call sys_wcstombs_alloc to generate puserprof buffer. * winsup.h: Fix comment. (NT_MAX_PATH): New definition for maximum internal path length. Use throughout where appropriate. * include/limits.h (PATH_MAX): Set to 4096 as on Linux.
* * string.h: Re-enable inline strcasematch and strncasematchCorinna Vinschen2008-02-011-15/+16
| | | | | | | | | | | | | | | 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.
* * cygheap.h (struct cwdstuff): Add dir member to store cwd handle.Corinna Vinschen2008-01-311-31/+31
| | | | | | | (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.
* * path.cc: Fix Samba version in comment.Corinna Vinschen2008-01-281-1/+1
|
* * path.cc (fs_info::update): Fix old-style Samba test to supportCorinna Vinschen2008-01-241-8/+9
| | | | recent as well as upcoming Samba releases.
* * ntdll.h (struct _FILE_FS_OBJECTID_INFORMATION): Define.Corinna Vinschen2008-01-221-8/+43
| | | | | | | | * 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.
* * autoload.cc (GetModuleFileNameExW): Replace definition ofCorinna Vinschen2007-12-031-1/+1
| | | | | | | | | | | | | | 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.