summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
Commit message (Collapse)AuthorAgeFilesLines
* Throughout, keep function definitions and declarations in sync withCorinna Vinschen2013-11-251-2/+2
| | | | newlib in terms of C99 "restrict" keyword.
* Throughout, drop unnecessary explicit includes of windows header filesCorinna Vinschen2013-11-241-4/+0
| | | | | | | | | | | | included by default. * winlean.h: Add long comment to explain why we have to define certain symbols. (_NORMALIZE_): Define. (_WINNLS_): Drop definition and subsequent undef. (_WINNETWK_): Ditto. (_WINSVC_): Ditto. 2013-11-23 Eric Blake <eblake@redhat.com>
* * path.cc (normalize_posix_path): Don't check existence of / or // dirCorinna Vinschen2013-07-311-5/+8
| | | | in parent dir check.
* * path.cc (normalize_posix_path): Start checking path before ".." atCorinna Vinschen2013-07-181-2/+2
| | | | | dst, rather than at dst_start, otherwise suffer loss of one leading slash in case of UNC paths.
* * path.cc (symlink_native): Fix common prefix search. Enhance comment.Corinna Vinschen2013-07-151-5/+6
|
* * path.cc (find_fast_cwd_pointer): Use gas syntax for assemblerCorinna Vinschen2013-06-281-12/+31
| | | | | description in all comments. Make algorithm work on Windows 8.1 Preview.
* * path.cc (cygwin_conv_path): Handle NULL "from" path gracefully.Corinna Vinschen2013-06-211-0/+6
| | | | | * path.sgml (func-cygwin-conv-path): Document returning EINVAL if "from" is NULL.
* * path.cc (cnt_bs): New inline function.Corinna Vinschen2013-06-171-4/+55
| | | | (symlink_native): Fix creating relative native symlink.
* * path.cc (normalize_posix_path): Fix long-standing problem whichCorinna Vinschen2013-06-121-0/+17
| | | | allows to access files via ".." using an invalid POSIX path.
* * environ.cc (set_winsymlinks): Handle "winsymlinks:nativestrict"Corinna Vinschen2013-05-231-6/+21
| | | | | | | | | | | | | | option. On pre-Vista warn the user if the "winsymlinks:native*" option is set. * globals.cc (enum winsym_t): Add WSYM_nativestrict. * path.cc (symlink_native): Don't create native symlink if target does not exist. Explain why. Improve comments. (symlink_worker): Change AFS symlink handling to WSYM_nativestrict. Handle WSYM_nativestrict throughout. Change condition for bail out to wsym_type == WSYM_nativestrict. Add comment. Fix formatting. * shared_info.h (CURR_USER_MAGIC): Change to reflect change in class user_info. (class user_info): Add member warned_nonativesyms.
* Throughout, (mainly in fhandler*) fix remaining gcc 4.7 mismatchYaakov Selkowitz2013-05-011-5/+5
| | | | | | | | | warnings between regparm definitions and declarations. * smallprint.cc (__small_vswprintf): Conditionalize declaration and setting of l_opt for only x86_64. * spawn.cc (child_info_spawn::worker): Remove unused 'pid' variable. * thread.cc (verifyable_object_isvalid): Temporarily define as non-inline with gcc 4.7+, regardless of target.
* * autoload.cc (CreateSymbolicLink): Define.Corinna Vinschen2013-04-241-52/+148
| | | | | | | | | | | | | | | | | | | | | | | | | * environ.cc (set_winsymlinks): Set allow_winsymlinks. (parse_thing): Change "winsymlinks" to set by function. * globals.cc (enum winsym_t): Define. (allow_winsymlinks): Define as winsym_t. (ro_u_afs): New R/O Unicode string. * mount.cc (fs_info::update): Fix comment. Handle AFS. (fs_names): Add "afs". * mount.h (enum fs_info_type): Add afs. (class fs_info): Implement afs. * path.cc (symlink): Drop third parameter in call to symlink_worker. (symlink_nfs): New function. (symlink_native): New function. (symlink_worker): Drop third argument. Handle native symlink type by calling symlink_native. Move code to handle NFS to symlink_nfs. Fix formatting. Slightly restructure code. * path.h (class path_conv): Add fs_is_afs method. (symlink_worker): Declare here. * security.h: Define privilege constants as unsigned int instead of as unsigned long. * syscalls.cc (mknod_worker): Set third parameter in symlink_worker call to WSYM_lnk. * winsup.h (symlink_worker): Drop declaration here.
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-53/+162
|
* * path.cc (symlink_info::check): Drop PC_KEEP_HANDLE flag forCorinna Vinschen2013-04-121-14/+16
| | | | | unrecognized reparse points as well. Reorganize code and comments handling reparse points for better readability.
* * path.cc (class suffix_scan): Add member namelen.Corinna Vinschen2013-04-031-7/+29
| | | | | | | | | | (suffix_scan::name_len): New method. (suffix_scan::has): Store namelen since we have it already anyway. Add a bit of explanation and a FIXME to comment. (suffix_scan::next): Never attach extra .lnk suffix if resulting filename length exceeds NAME_LEN. (symlink_info::check): Bail out immediately with ENAMETOOLONG if filename length exceeds NAME_LEN.
* Throughout, change __attribute__ ((regparm (N))) to just __regN. Throughout,Christopher Faylor2013-01-211-3/+2
| | | | | | | | | | | | | | | | | | | (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.
* whitespace cleanupChristopher Faylor2012-08-161-2/+2
|
* * path.cc (etc::dir_changed): Revert muto changes since function isCorinna Vinschen2012-07-311-28/+20
| | | | called under lock condition anyway.
* * path.cc (etc::dir_changed): Change `io' to a static NO_COPYCorinna Vinschen2012-07-311-21/+33
| | | | | | variable. Explain why. Add a muto to guard overwriting the changed_h handle by multiple concurrent threads. * path.h (class etc): Drop unused changed_h member.
* * fhandler_termios.cc (fhandler_termios::line_edit): Use special case '%0c'Christopher Faylor2012-07-291-1/+1
| | | | | | | | | handling to print non-printable characters using hex notation. * smallprint.cc (__small_vsprintf): Semi-reimplement printing of non-printable characters in hex but only when padding is specified. * dcrt0.cc (dll_crt0_0): Remove tty_list initialization. * shared.cc (memory_init): Initialize tty_list here. * path.cc (path_conv::check): Remove unneeded parentheses from if check.
* * path.cc (symlink_info::check): Remove unneeded/unused variable.Christopher Faylor2012-07-021-3/+0
|
* * path.cc: Perform some whitespace fixups throughout.Christopher Faylor2012-07-021-21/+22
|
* * path.cc (realpath): Fix comment.Corinna Vinschen2012-06-221-2/+2
|
* * path.cc (realpath): Call mount_info::conv_to_posix_path rather thanCorinna Vinschen2012-06-211-1/+4
| | | | | mount_info::cygdrive_posix_path to convert DOS paths to POSIX paths. Add comment to explain why that's necessary at all.
* * path.cc (find_fast_cwd_pointer): Fix for W8 CP 32 bit.Corinna Vinschen2012-04-271-21/+54
|
* * dtable.cc (fh_alloc): Only disallow opening of nonexistent on-disk device.Christopher Faylor2012-04-211-3/+0
| | | | | | * path.cc (path_conv::check): Remove PATH_KEPT_HANDLE setting. * path.h (path_types): Remove PATH_KEPT_HANDLE. (path_conv::kept_handle): Delete now-unneeded function.
* * dtable.cc (fh_alloc): Keep fh which was flagged as error if it is for anChristopher Faylor2012-04-191-0/+3
| | | | | | | on-disk device and we were stating it. * path.cc (path_conv::check): Set PATH_KEPT_HANDLE. * path.h (path_types): Add PATH_KEPT_HANDLE. (path_conv::kept_handle): Implement.
* * dtable.cc (cygwin_attach_handle_to_fd): Defend against NULL return fromChristopher Faylor2012-04-071-5/+11
| | | | | | | build_fh_*. (dtable::init_std_file_from_handle): Ditto. * mmap.cc (mmap_record::alloc_fh): Ditto. * path.cc (path_conv::check): Ditto.
* * path.c (path_conv::check): Avoid directly referencing fields of the devChristopher Faylor2012-04-061-1/+1
| | | | structure when it can be easily avoided.
* * fhandler_nodevice.cc (fhandler_nodevice::open): Convert EROFS toCorinna Vinschen2012-04-041-2/+5
| | | | | | ENOENT if non-existent file got opened for reading only. Explain why. * path.cc (path_conv::check): Stick to ENOENT if file has been opened for informational purposes only. Add to comment.
* * path.cc (path_conv::check): Convert device type to FH_FS forCorinna Vinschen2012-04-041-0/+13
| | | | | non-existant files on /dev, unless /dev itself doesn't exist on disk. Add comment to explain why.
* * devices.h (FH_CYGDRIVE): Define as DEV_VIRTFS_MAJOR class device.Corinna Vinschen2012-04-021-1/+1
| | | | | | | | | (DEV_CYGDRIVE_MAJOR): Remove. (iscygdrive_dev): Define. * dtable.cc (fh_alloc): Accommodate above change. * path.cc (path_conv::check): Use iscygdrive_dev to check for cygdrive. * syscalls.cc (fhandler_base::set_ino_and_dev): Drop check for DEV_CYGDRIVE_MAJOR from conditional.
* * devices.cc: Regenerate.Corinna Vinschen2012-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * devices.h (device::exists_func): New member function pointer, replacing noexpose. (device::expose): Remove. (device::exists_never): Declare. (device::exists_ptys): Declare. (device::exists_cons): Declare. (device::exists_console): Declare. (device::exists_nt_dev): Declare. (device::exists): Declare. * devices.in (dev_storage): Replace former noexpose values with pointers to matching exists_XXX method. (device::exists_never): New method. (device::exists_ptys): New method. (device::exists_cons): New method. (device::exists_console): New method. (device::exists_nt_dev): New method. (device::exists): New method. * fhandler_dev.cc (fhandler_dev::readdir): Replace call to device::expose with call to device::exists and drop all further existence filtering since it's done in device::exists now. * path.cc (path_conv::check): Replace call to device::expose with call to device::exists.
* (Interim checkin while we work on this)Christopher Faylor2012-03-311-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * devices.cc: Regenerate. * devices.h (device::noexpose): New field. (device::dev_on_fs): Make a bit field. (get_major): Use proper type for declaration. (expose): New field. (ext_dev_storage): Delete declaration. (dev_storage_size): Ditto. (dev_storage): New declaration. (dev_storage_end): Ditto. * devices.in: Mark /dev/ptym*, /dev/com*, /dev/pipe, /dev/fifo, and "/dev" as "no expose". * fhandler.h (fhandler_dev::lastrealpos): Delete declaration. (fhandler_dev::devidx): Declare new field. * fhandler_disk_file.cc: Move fhandler_dev functions into fhandler_dev.cc. * fhandler_dev.cc: Add includes needed for functions moved from fhandler_disk_file.cc. (dev_storage_scan_start): Define place to start listing devices. (dev_storage_size): Define size of array to scan. (fhandler_dev::fhandler_dev): Move here from fhandler_disk_file.cc. (fhandler_dev::opendir): Ditto. (fhandler_dev::readdir): Just check devidx for non-NULL to determine when to go to disk for /dev content. Use dev_storage rather than ext_dev_storage. Iterate over dev_storage using devidx pointer. Use accessor functions rather than raw references to the device struct. Only increment dir->__d_position when we are actually going to be returning something. Add debug_printf for exit. (fhandler_dev::rewinddir): Set devidx as appropriate depending on whether there's a /dev on disk or not. * gendevices: Don't mark dev_storage static but do put it in the _RDATA section. * path.cc (path_conv::check): Use new "device::expose()" function to decide to forbid programs from referencing internal device types.
* * Makefile.in (DLL_OFILES): Add fhandler_dev.o.Corinna Vinschen2012-03-291-11/+5
| | | | | | | | | | | | | | | | | | | | | | | * devices.h (DEV_DEV_MAJOR): Define. (FH_DEV): Redefine in terms of DEV_DEV_MAJOR. (ext_dev_storage): Declare. (dev_storage_size): Declare. (dev_dev_storage): Declare. (dev_dev): Define. (isdev_dev): Define. * devices.in (dev_dev_storage): Activate. (ext_dev_storage): Define as externally available pointer to dev_storage. (dev_storage_size): Define to contain number of dev_storage elements. * dir.cc (rmdir): Handle /dev as always not empty. * dtable.cc (fh_alloc): Handle DEV_DEV_MAJOR. * fhandler.h (fhandler_dev): New class, derived from fhandler_disk_file. (fhandler_union): Add fhandler_dev member. * fhandler_disk_file.cc (class __DIR_mounts): Handle /dev directory to make sure it always exists. * fhandler_dev.cc: New file implementing /dev. * globals.cc (ro_u_dev): New R/O unicode string. * path.cc (path_conv::check): Handle FH_DEV device.
* * path.cc (readlink): Avoid calling strlen() twice.Corinna Vinschen2012-03-081-1/+2
|
* * Throughout, replace usage of w32api's min with MIN from sys/param.h.Corinna Vinschen2012-03-081-1/+2
|
* * cygheap.h (enum fcwd_version_t): Move here from path.cc.Corinna Vinschen2012-03-051-191/+124
| | | | | | | | | | (class fcwd_access_t): Ditto. Only declare methods. (class cwdstuff): Move fast_cwd_ptr and fast_cwd_version from shared DLL section here. * path.cc: Keep fcwd_access_t method definitions. (fcwd_access_t::fast_cwd_version): New method. (find_fast_cwd_pointer): Change comment. Mention test on W8CP. (cwdstuff::init): Initialize fast_cwd_ptr and fast_cwd_version.
* * environ.cc (dos_file_warning): Drop declaration.Corinna Vinschen2012-02-261-6/+0
| | | | | | | | | | | | | | | | | (ignore_case_with_glob): Ditto. (allow_winsymlinks): Ditto. (reset_com): Move definition to globals.cc. (struct parse_thing): Add "detect_bloda" option. * fhandler_serial.cc (fhandler_serial::open): Drop (incorrect) declaration of reset_com. * globals.cc (ignore_case_with_glob): Move definition into C++-only block. (dos_file_warning): Define. (allow_winsymlinks): Define. (reset_com): Define. (detect_bloda): Define. * path.cc (dos_file_warning): Drop definition here. (allow_winsymlinks): Drop definition here.
* Update copyright on all files checked in so far this year.Christopher Faylor2012-01-111-1/+1
| | | | | | | | | | | | | | | | | * fhandler.h: Use #pragma once rather than ifdef guards. (fhandler_console::tc_getpgid): Return our pgid if we have never opened a console. * fork.cc: Rearrange includes to accommodate fhandler.h use of pinfo.h. * sigproc.cc: Ditto. * spawn.cc: Ditto. (child_info_spawn::worker): Query myself->pgid rather than calling expensive function. * thread.h: Use #pragma once rather than ifdef guards. * pinfo.h: Use #pragma once rather than ifdef guards. (pinfo::remember): Don't define if sigproc.h has not been included. (pinfo::reattach): Ditto. * sigproc.h: Use #pragma once rather than ifdef guards. Use different test to see if pinfo.h has been included.
* * path.cc (get_current_dir_name): Avoid memory leak. Don't return PWD contentsChristopher Faylor2012-01-021-10/+9
| | | | if directory doesn't actually exist.
* * cygwin.din (get_current_dir_name): Export.Yaakov Selkowitz2012-01-011-0/+21
| | | | | | * path.cc (get_current_dir_name): New function. * posix.sgml (std-gnu): Add get_current_dir_name. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* * path.cc (struct symlink_info): Add bool argument to declaration ofCorinna Vinschen2011-12-241-17/+29
| | | | | | | | | | check_reparse_point. (symlink_info::check_reparse_point): Add bool argument to indicate remote drive. Handle STATUS_PENDING. Don't evaluate junctions on remote drives. Fix comments. (symlink_info::check): Drop check for is_remote_drive and associated comment here. Add fs.is_remote_drive as second parameter to check_reparse_point call.
* Clean up whitespace.Christopher Faylor2011-12-171-6/+6
|
* * path.cc (conv_path_list): Fix a condition.Corinna Vinschen2011-12-131-25/+16
| | | | (cygwin_conv_path): Revert WIN_A conversion to current locale codeset.
* * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): CallCorinna Vinschen2011-12-131-37/+44
| | | | | | | | | file_get_fnoi instead of NtQueryInformationFile. * path.cc (file_get_fnoi): New helper function to collect a FILE_NETWORK_OPEN_INFORMATION block. (symlink_info::check): Call file_get_fnoi rather than NtQueryInformationFile to collect a FILE_NETWORK_OPEN_INFORMATION block. * path.h (file_get_fnoi): Declare.
* Throughout, remove extra space after function name from debugging output.Christopher Faylor2011-12-031-4/+4
| | | | | | | | | | | | | | | 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.
* * path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.Corinna Vinschen2011-12-021-32/+75
| | | | | | | | | Allow all types of CCP conversions. Accommodate throughout. (cygwin_conv_path): Use current ANSI or OEM codepage for WIN_A conversions, depending on current file API codepage setting. (cygwin_conv_path_list): Allow all CCP conversion types. * include/sys/cygwin.h (CCP_CONVTYPE_MASK): Add to cygwin_conv_path_t enum for convenience.
* * path.cc (path_conv::get_nt_native_path): Avoid dereferencing path when it isChristopher Faylor2011-10-231-2/+8
| | | | NULL.
* * path.cc: Extend two comments. Mention the name RtlpCurDirRefCorinna Vinschen2011-10-181-5/+15
| | | | for reference.