summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
Commit message (Collapse)AuthorAgeFilesLines
* * syscalls.cc (nt_path_has_executable_suffix): Change storage class ofCorinna Vinschen2010-03-041-7/+16
| | | | | | blessed_executable_suffixes to static. (rename): Revert meaning of old_explicit_suffix. Change the rules for appending a .exe suffix and (yikes!) document them.
* * nlsfuncs.cc (check_codepage): Move from syscalls.cc here.Corinna Vinschen2010-01-241-110/+1
| | | | | | | | | (internal_setlocale): Ditto. (initial_setlocale): Ditto. (setlocale): Ditto. * strfuncs.cc (__sjis_wctomb): Revert previous patch. (__sjis_mbtowc): Ditto. * syscalls.cc: Move setlocale-related functions to nlsfuncs.cc.
* * syscalls.cc (internal_setlocale): Use UTF-8 internally if externalCorinna Vinschen2010-01-171-2/+10
| | | | charset is ASCII.
* * dcrt0.cc (dll_crt0_1): Reset locale to "C" at the last moment beforeCorinna Vinschen2010-01-141-3/+3
| | | | | | calling the application's main. * syscalls.cc (internal_setlocale): Don't reset locale to "C here. Change comment accordingly.
* * cygwin.din (dup3): Export.Corinna Vinschen2010-01-141-12/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (pipe2): Export. * dtable.cc (dtable::dup_worker): Take additional flags parameter. Handle O_CLOEXEC flag. (dtable::dup3): Rename from dup2. Take additional flags parameter. Check for valid flags. Drop check for newfd == oldfd. * dtable.h (dtable::dup_worker): Add flags parameter. (dtable::dup3): Rename from dup2. * fcntl.cc (fcntl64): Add F_DUPFD_CLOEXEC case. * fhandler.h (fhandler_mailslot::get_object_attr): Add flags parameter. * fhandler.cc (fhandler_base::open): Use security attribute with inheritance according to setting of O_CLOEXEC flag. * fhandler_console.cc (fhandler_console::open): Ditto. * fhandler_fifo.cc (sec_user_cloexec): New inline function to create security attribute with inheritance according to setting of O_CLOEXEC flag. (fhandler_fifo::open): Call sec_user_cloexec to fetch security attribute. (fhandler_fifo::wait): Ditto. * fhandler_mem.cc (fhandler_dev_mem::open): Ditto. * fhandler_mailslot.cc (fhandler_mailslot::get_object_attr): Take additional flags parameter. Use security attribute with inheritance according to setting of O_CLOEXEC flag. (fhandler_mailslot::open): Call get_object_attr with flags parameter. * fhandler_registry.cc (fhandler_registry::open): Call set_close_on_exec on real handles to accommodate O_CLOEXEC flag. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * fhandler_tape.cc: Create mutex with inheritance according to setting of O_CLOEXEC flag. * pipe.cc: Replace usage of O_NOINHERIT with O_CLOEXEC. (fhandler_pipe::init): Simplify setting close_on_exec flag. (fhandler_pipe::open): Remove setting close_on_exec flag. (fhandler_pipe::create): Use security attribute with inheritance according to setting of O_CLOEXEC flag. (pipe2): New exported function. * posix_ipc.cc: Throughout, open backing files with O_CLOEXEC flag to follow POSIX semantics. * security.h (sec_none_cloexec): New define. * syscalls.cc (dup): Add missing extern "C" qualifier. Accommodate renaming of dtable::dup2 to dtable::dup3. (dup2): Ditto. Check newfd == oldfd here. (dup3): New function. Check newfd == oldfd here. (open): Set close_on_exec flag according to O_CLOEXEC flag before calling fhandler->open. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* * syscalls.cc (rename): Don't exit prematurely with EROFS when tryingCorinna Vinschen2010-01-131-2/+2
| | | | | to rename an AF_LOCAL socket or when trying to replace an AF_LOCAL socket.
* * dtable.cc (build_fh_name_worker): Remove. Move all functionalityCorinna Vinschen2010-01-121-11/+11
| | | | | | | | | | | | | | | | | | back into build_fh_name. (build_fh_name): Drop unused HANDLE parameter. Drop call to pc.fillin. Remove disabled build_fh_name with UNICODE_STRING name parameter. * dtable.h (build_fh_name): Drop HANDLE parameter from declaration. Remove declaration for build_fh_name with UNICODE_STRING name parameter. * path.cc (path_conv::fillin): Remove. (symlink_info::check): Fix comment. * path.h (path_conv::fillin): Remove declaration. * dir.cc: Accommodate change in build_fh_name parameters throughout. * sec_acl.cc: Ditto. * syscalls.cc: Ditto. * ntea.cc (getxattr_worker): Fix debug output. (setxattr_worker): Ditto. * times.cc (utimens_worker): Ditto.
* Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcessCorinna Vinschen2009-12-181-3/+4
| | | | | | | | | | | | according to context. Throughout, replace hMainThread with GetCurrentThread/NtCurrentThread according to context. * dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to hMainProc. Drop duplication of GetCurrentThread to hMainThread. * dtable.cc (dtable::stdio_init): Remove useless comment. * globals.cc (hMainProc): Remove. (hMainThread): Remove. * ntdll.h (NtCurrentProcess): Define. (NtCurrentThread: Define.
* * syscalls.cc (try_to_bin): Handle remote shares as well. Just renameCorinna Vinschen2009-12-171-72/+77
| | | | | | | files in this case, instead of moving them to the recycler. Create even more unique filename. Add comment to explain filename. (unlink_nt): Remove code returning with EBUSY on remote shares. Set bin_stat to move_to_bin except on NFS. Add comment to explain.
* * globals.cc (ro_u_dll): New R/O unicode string.Corinna Vinschen2009-11-211-0/+6
| | | | | * syscalls.cc (nt_path_has_executable_suffix): Add ro_u_dll to blessed_executable_suffixes array. Explain why.
* * path.cc (symlink_info::check_reparse_point): Always checkCorinna Vinschen2009-11-091-0/+10
| | | | | | | SubstituteName for volume string to recognize volume mount points. Reuse subst when calling sys_wcstombs. * syscalls.cc (rename): Set errno to EBUSY when trying to rename volume mount points. Explain why.
* * globals.cc (ro_u_scr): New R/O unicode string.Corinna Vinschen2009-11-061-20/+30
| | | | | | | | | | (ro_u_sys): Ditto. * syscalls.cc (nt_path_has_suffix): Replace with ... (nt_path_has_executable_suffix): New function checking for explicit executable suffixes. (rename): Call nt_path_has_executable_suffix instead of nt_path_has_suffix. Check oldpath for nt_path_has_executable_suffix as well to set old_explicit_suffix.
* * syscalls.cc (nt_path_has_suffix): New function.Corinna Vinschen2009-11-051-5/+28
| | | | | (rename): Don't append .exe suffix if binary target name has any suffix at all.
* * syscalls.cc (internal_setlocale): Only convert $PATH if there is aCorinna Vinschen2009-10-191-7/+14
| | | | $PATH.
* * include/sys/cygwin.h: Add new cygwin_getinfo_typeCorinna Vinschen2009-10-131-10/+62
| | | | | | | | | | | | | | | | | | CW_SET_EXTERNAL_TOKEN. Add new enum CW_TOKEN_IMPERSONATION, CW_TOKEN_RESTRICTED. * cygheap.h (cyguser): New flags ext_token_is_restricted, curr_token_is_restricted and setuid_to_restricted. * external.cc (cygwin_internal): Add CW_SET_EXTERNAL_TOKEN. * sec_auth.cc (set_imp_token): New function. (cygwin_set_impersonation_token): Call set_imp_token (). * security.h (set_imp_token): New prototype. * spawn.cc (spawn_guts): Use CreateProcessAsUserW if restricted token was enabled by setuid(). Do not create new window station in this case. * syscalls.cc (seteuid32): Add handling of restricted external tokens. Set HANDLE_FLAG_INHERIT for primary token. (setuid32): Set setuid_to_restricted flag. * uinfo.cc (uinfo_init): Do not reimpersonate if restricted token was enabled by setuid (). Initialize user.*_restricted flags.
* * syscalls.cc (seteuid32): Call set_cygwin_privileges on primary tokenCorinna Vinschen2009-10-071-0/+1
| | | | as well.
* * syscalls.cc (internal_setlocale): Add comment.Corinna Vinschen2009-10-041-0/+2
|
* * dcrt0.cc (dll_crt0_1): Drop calls to setlocale/_setlocale_r. JustCorinna Vinschen2009-10-021-8/+20
| | | | | | | call initial_setlocale from here. * syscalls.cc (initial_setlocale): Set internal charset and revert application locale to "C". (setlocale): Don't set Cygwin's internal charset here.
* * syscalls.cc (rename): Fix regression in rename("dir","d/").Eric Blake2009-09-301-11/+10
|
* * cygheap.cc (cygheap_init): Default locale.charset to "UTF-8".Corinna Vinschen2009-09-281-49/+59
| | | | | | | | | | | | | * dcrt0.cc (dll_crt0_1): Call setlocale (LC_CTYPE, "") here, just before resetting application locale to "C". * environ.cc (environ_init): Drop code setting locale here. * syscalls.cc (check_codepage): Break out check for required codepage from internal_setlocale. (internal_setlocale): Just convert CWD and $PATH from old charset to new charset and set internal charset. (setlocale): Change accordingly. Don't require LC_ALL or LC_CTYPE to store old locale value. Always call internal_setlocale if charset changed due to locale environment changes.
* Fix some POSIX-compliance bugs in link, rename, mkdir.Eric Blake2009-09-261-38/+65
| | | | | | | | | | | | * syscalls.cc (link): Delete obsolete comment. Reject directories and missing source up front. (rename): Use correct errno for trailing '.'. Detect empty strings. Allow trailing slash to newpath iff oldpath is directory. * dir.cc (mkdir): Reject dangling symlink with trailing slash. * fhandler_disk_file.cc (fhandler_disk_file::link): Reject trailing slash. * fhandler.cc (fhandler_base::link): Match Linux errno.
* Provide euidaccess, canonicalize_file_name; fix fchmodat.Eric Blake2009-09-251-2/+28
| | | | | | | | | | | * syscalls.cc (fchmodat): lchmod is not yet implemented. (euidaccess): New function. * path.cc (realpath): Update comment. (canonicalize_file_name): New function. * include/cygwin/stdlib.h (canonicalize_file_name): Declare it. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * cygwin.din: Export canonicalize_file_name, eaccess, euidaccess. * posix.sgml: Mention them.
* Fix faccessat(,0) and access() semantics.Eric Blake2009-09-251-2/+2
| | | | | | | | | | | * fhandler.h (fhandler_base::fhaccess): Add parameter. * security.h (check_file_access, check_registry_access): Likewise. * security.cc (check_file_access, check_registry_access) (check_access): Implement new parameter. * fhandler.cc (fhandler_base::fhaccess): Likewise. (device_access_denied): Update caller. * syscalls.cc (access, faccessat): Update callers. * spawn.cc (find_exec, fixup): Likewise.
* Make *at functions more like Linux.Eric Blake2009-09-221-1/+32
| | | | | | * syscalls.cc (faccessat): Fix typo, reject bad flags. (fchmodat, fchownat, fstatat, utimensat, linkat, unlinkat): Reject bad flags.
* Match dup2 and fcntl error values to POSIX.Eric Blake2009-09-221-0/+6
| | | | | | | | * dtable.h (OPEN_MAX_MAX): New macro. * resource.cc (getrlimit) [RLIMIT_NOFILE]: Use it. * dtable.cc (dtable::extend): Likewise. * fcntl.cc (fcntl64): Obey POSIX rule with too-large F_DUPFD. * syscalls.cc (dup2): Likewise.
* * cygheap.h (cwdstuff::get_posix): Convert to const inline method justCorinna Vinschen2009-09-211-5/+14
| | | | | | | | | | | | | | returning pointer to posix path. (cwdstuff::reset_posix): Convert to non-inline method taking a wchar_t pointer. * path.cc (cwdstuff::set): Revert change from 2009-05-13. Set posix to valid incoming path again. (cwdstuff::reset_posix): New implementation setting posix path from incoming wchar_t path. Explain usage. (cwdstuff::get_posix): Drop implementation. (cwdstuff::get): Drop special case to handle empty posix path. * syscalls.cc (internal_setlocale): Store old posix cwd as wide char path. Restore posix cwd using new charset. Explain why.
* * exceptions.cc (sigpacket::process): Give sigwait() processing precedence evenChristopher Faylor2009-09-181-1/+1
| | | | | when a handler is present. * syscalls.cc (getpagesize): Change return to 'int'.
* * syscalls.cc (popen): Reorganize slightly for clarity. Fix a comment.Christopher Faylor2009-08-181-4/+5
|
* * syscalls.cc (popen): Rewrite to accommodate situations where stdin, stdout,Christopher Faylor2009-08-181-48/+73
| | | | or stderr are closed.
* * sigproc.h (wait_for_sigthread): Eliminate parameter.Christopher Faylor2009-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sigproc.cc (wait_for_sigthread): Ditto. Don't synchronize with wait_sig after receiving an event that it is ready to go. (init_sig_pipe): New function. (wait_sig): Call init_sig_pipe to create pipes for communicating signals to this process. Don't send sigCONT signal when initializing. * fork.cc (frok::child): Accommodate wait_for_sigpipe parameter change. * fhandler.h (fhandler_*::write): Make ssize_t/__stdcall. (fhandler_*::write_overlapped): Ditto. (fhandler_*::raw_write): Ditto. (fhandler_*::readv): Ditto. (fhandler_*::writev): Ditto. (fhandler_*::raw_read): Make __stdcall. * fhandler: Accommodate changes to read/write functions throughout. * fhandler_clipboard.cc: Ditto. * fhandler_console.cc: Ditto. * fhandler_dsp.cc: Ditto. * fhandler_fifo.cc: Ditto. * fhandler_mailslot.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_random.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_tty.cc: Ditto. * fhandler_virtual.cc: Ditto. * fhandler_windows.cc: Ditto. * fhandler_zero.cc: Ditto. * syscalls.cc (readv): Use ssize_t as temp variable. * fhandler.cc (fhandler_base::read): Coerce returned len to signed or it will never be treated as < 0. (fhandler_base::wait_overlapped): Minimize calls to GetLastError. Remove duplicate debugging test. Fix error return. * fhandler.h (fhandler_fifo::fifo_name): Declare new function. (fhandler_fifo::close): Ditto. (fhandler_fifo::dup): Ditto. (fhandler_fifo::close_on_exec): Ditto. * fhandler.cc (fhandler_fifo::fifo_name): Define new function. (FIFO_BUF_SIZE): New define. (cnp): Ditto. (fhandler_fifo::open): Rework. Use cnp to open named pipe. Always open write side as a client. Open dummy client when writing and can't connect. (wait): Rework. Implement fifo_wait_for_next_client. Handle signals during connect better. Add new fifo_wait_for_server code which polls (sigh) waiting for server. (fhandler_fifo::raw_read): Handle transition states when one client closes and another is available. (fhandler_fifo::close): Define. (fhandler_fifo::dup): Ditto. (fhandler_fifo::close_on_exec): Ditto.
* * syscalls.cc (internal_setlocale): Fix typo in GBK codepage.Corinna Vinschen2009-07-241-1/+1
|
* * syscalls.cc (unlink_nt): Ignore sharing violation on NFS. AlignCorinna Vinschen2009-07-241-3/+4
| | | | comments.
* * wincap.h (wincaps::has_always_all_codepages): New element.Corinna Vinschen2009-07-201-6/+37
| | | | | | | | | | | | | | | * wincap.cc: Implement above element throughout. * wchar.h (__sjis_mbtowc): Declare. (__eucjp_mbtowc): Ditto. (__gbk_mbtowc): Ditto. (__kr_mbtowc): Ditto. (__big5_mbtowc): Ditto. * syscalls.cc (internal_setlocale): Convert to char * function. Return parameter by default. Return NULL if request to use a charset can't be satisfied due to missing codepage support in the underlying OS. Fix comment. (setlocale): Store original locale. Restore to original locale if internal_setlocale returns NULL.
* * syscalls.cc (unlink_nt): Just return when a sharing violationCorinna Vinschen2009-07-171-1/+13
| | | | occurs on remote filesystems.
* * syscalls.cc (unlink_nt): First remove the R/O DOS attribute withCorinna Vinschen2009-07-161-11/+26
| | | | | FILE_WRITE_ATTRIBUTES access only, then re-open the file for DELETE. Explain why.
* Throughout avoid having to initialize constant UNICODE_STRINGs.Corinna Vinschen2009-07-141-10/+8
| | | | | | | | | | | | | | | | | | | | | | * globals.cc: Define constant UNICODE_STRINGs and store in .rdata section. * fhandler_disk_file.cc: Throughout, use readonly UNICODE_STRINGs rather then initializing local UNICODE_STRING variable where applicable. * fhandler_mem.cc (fhandler_dev_mem::open): Ditto. * flock.cc (inode_t::inode_t): Ditto. * mmap.cc: Ditto. * syscalls.cc: Ditto. * mount.cc (fs_info::update): Ditto. * path.cc: Ditto. * ntdll.h (RtlEqualUnicodePathPrefix): Redefine to take prefix as UNICODE_STRING. (RtlEqualUnicodePathSuffix): Redefine to take suffix as UNICODE_STRING. * fhandler_disk_file.cc: Accommodate throughout. * mount.cc (fs_info::update): Ditto. * path.cc (cwdstuff::set): Ditto. * syscalls.cc: Ditto.
* * select.h: New file split from fhandler.h.Christopher Faylor2009-06-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (select_record::select_record): Define do-nothing constructor for "new" to avoid gratuitous zeroing. (select_info): New base class. (select_pipe_info): New class with methods for dealing with pipes. (select_socket_info): New class with methods for dealing with sockets. (select_serial_info): Dummy class for serial. (select_mailslot_info): Dummy class for mailslots. (select_stuff): Define device_specific_* as actual classes rather than void *. * dtable.h (dtable::select_read): Accommodate return value change to 'bool' and argument change to "select_stuff". (dtable::select_write): Ditto. (dtable::select_except): Ditto. * dtable.cc (dtable::select_read): Accommodate return value change to 'bool' and argument change to "select_stuff". (dtable::select_write): Ditto. (dtable::select_except): Ditto. * fhandler.h: Excise select-related classes. (fhandler_*::select_read): Change argument to select_stuff. (fhandler_*::select_write): Ditto. (fhandler_*::select_except): Ditto. * select.cc (UNIX_FD_ZERO): Use memset rather than bzero. (select_stuff::test_and_set): Change return type to bool. Allocate select_record on entry and let fhandler_*::select_* operate on the start.next field of select_stuff. (pipeinf): Delete. (select_pipe_info::select_pipe_info): New constructor. Allocates event for controlling pipe waits. (select_pipe_info::~select_pipe_info): New destructor. Destroy event. Stop thread. (select_pipe_info::add_watch_handle): New function. (thread_pipe): Wait for the hEvent part of any overlapped pipes before peeking. (start_thread_pipe): Don't allocate device_specific_pipe stuff here. Assume that it has been allocated earlier. (pipe_cleanup): Rely on select_pipe_info destructor to clean up pipe paraphenalia. (fhandler_*::select_*): Derive select_record from new select_stuff argument. (fhandler_pipe::select_*): Ditto. Allocate pipe-specific field if not already allocated. (serialinf): Delete. (thread_serial): serialinf -> select_serial_info. (fhandler_base::ready_for_read): Rewrite to accommodate change in argument to fhandler_*::select_*. (socketinf): Delete. (thread_socket): socketinf -> select_socket_info. (mailslotinf): Delete. (thread_mailslot): mailslotinf -> select_mailslot_info.
* * cygheap.cc (cygheap_init): Set Cygwin default locale values.Corinna Vinschen2009-05-141-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cygheap.h (struct cygheap_locale): New structure. (struct user_heap_info): Add cygheap_locale member locale. * dcrt0.cc (dll_crt0_1): Revert to calling _setlocale_r so that only the applications locale is reverted to "C". * environ.cc (environ_init): Remove unused got_lc variable. * fhandler.h (class dev_console): Remove now unsed locale variables. * fhandler_console.cc (fhandler_console::get_tty_stuff): Remove setting dev_console's locale members. (dev_console::con_to_str): Use internal locale settings. Default to __ascii_wctomb if charset is "ASCII". (fhandler_console::write_normal): Ditto. * strfuncs.cc (__ascii_wctomb): Drop declaration. (__db_wctomb): Use fixed value 2 instead of not necessarily matching MB_CUR_MAX. (__eucjp_wctomb): Use 3 instead of MB_CUR_MAX. (sys_cp_wcstombs): Remove special case for "C" locale. (sys_wcstombs): Implement here. Use internal locale data stored on cygheap. (sys_cp_mbstowcs): Remove special case for "C" locale. (sys_mbstowcs): Implement here. Use internal locale data stored on cygheap. * syscalls.cc (internal_setlocale): New function to set cygheap locale data and to reset CWD posix path. (setlocale): Just call internal_setlocale from here if necessary. * wchar.h (__ascii_wctomb): Declare. (sys_wcstombs): Don't define inline, just declare. (sys_mbstowcs): Ditto.
* * cygheap.h (cwdstuff): Convert to class. Make posix and dir private.Corinna Vinschen2009-05-131-1/+19
| | | | | | | | | | | | | | | | | | (cwdstuff::get_posix): New method. (cwdstuff::reset_posix): New method. * dcrt0.cc (dll_crt0_1): Call setlocale rather than _setlocale_r. * environ.cc (environ_init): Ditto. Prefer "C" locale over current codepage default locale. * path.cc (chdir): Use cwdstuff::get_posix method instead of accessing cwdstuff::posix directly. (cwdstuff::set): Defer creating posix path to first usage. (cwdstuff::get_posix): Create posix path if it's empty, and return it. (cwdstuff::get): Create posix path if it's empty. * strfuncs.cc (sys_cp_wcstombs): Use UTF-8 conversion in the "C" locale. (sys_cp_mbstowcs): Ditto. * syscalls.cc (gen_full_path_at): Fetch CWD posix path locked. (setlocale): Implement here. Reset CWD posix path.
* * ntdll.h (STATUS_LOCK_NOT_GRANTED): Define.Corinna Vinschen2009-04-161-2/+12
| | | | | * syscalls.cc (unlink_nt): Handle STATUS_LOCK_NOT_GRANTED same as STATUS_SHARING_VIOLATION. Add lengthy comment to explain why.
* * syscalls.cc (try_to_bin): Use tmp_pathbuf buffer to allocate infobufCorinna Vinschen2009-04-091-10/+8
| | | | rather than using the stack.
* * syscalls.cc (try_to_bin): Fix alignment of infobuf.Corinna Vinschen2009-04-091-1/+3
|
* * syscalls.cc (pathconf): Fix memory leak.Corinna Vinschen2009-03-271-5/+7
|
* * syscalls.cc (open): Handle O_DIRECTORY flag.Corinna Vinschen2009-02-111-0/+6
| | | | | * include/fcntl.h: Add SUSv4 flags O_DIRECTORY, O_EXEC and O_SEARCH. * include/cygwin/version.h: Bump API minor number.
* * syscalls.cc (enum bin_status): New type.Corinna Vinschen2009-01-121-41/+111
| | | | | | | | | | | (try_to_bin): Return bin_status. Rename win32_path to pc. Rename h to fh. Rename fh to tmp_fh. Add code to set delete dispostion and more code to replace file moved to bin by another, temporary file. Add comments to explain why. (unlink_nt): Replace move_to_bin with bin_stat. Only set bin_stat to move_to_bin for non-remote files. As a last resort, call try_to_bin if setting delete-on-close failed. Only re-set R/O DOS attribute and only close handle if it's still valid.
* * ntdll.h: Reorder NT status flags. Fix a case difference. AddCorinna Vinschen2009-01-071-13/+43
| | | | | | | | | | STATUS_CANNOT_DELETE flag. * syscalls.cc (unlink_nt): Change initial NtOpenFile to request FILE_SHARE_DELETE sharing mode. Change comment accordingly. If setting delete disposition failed with STATUS_CANNOT_DELETE, try to delete using delete-on-close. Explain why. Rearrange setting R/O DOS attribute after trying to delete. Simplify comment.
* Remove unneeded header files from source files throughout. Update copyrightsChristopher Faylor2009-01-031-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | where appropriate. * globals.cc: New file for generic global variables. * mkglobals_h: New file to generate globals.h. * mkstatic: New Script used to build a (currently non-working) static libcygwin_s.a. * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. (globals.h): New target. Generate globals.h. * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator is allowed in _cygtls. * dcrt0.cc: Move most globals to globals.cc. * init.cc: Ditto. * environ.cc (strip_title_path): Remove now-unneeded extern. * fhandler_serial.cc (fhandler_serial::open): Ditto. * pinfo.cc: Ditto. (commune_process): Ditto. * shared.cc: Ditto. * glob.cc: Ditto. * strace.cc: Ditto. * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. * path.cc (stat_suffixes): Move here. * security.h: Add forward class path_conv declaration. * smallprint.cc (__small_vsprintf): Make a true c++ function. (__small_sprintf): Ditto. (small_printf): Ditto. (console_printf): Ditto. (__small_vswprintf): Ditto. (__small_swprintf): Ditto. * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm. (hExeced): Move to globals.cc * strfuncs.cc (current_codepage): Ditto. (active_codepage): Ditto. * sync.cc (lock_process::locker): Move here from dcrt0.cc. * syscalls.cc (stat_suffixes): Move to path.cc. * tty.cc (tty::create_master): Uncapitalize fatal warning for consistency. * winsup.h: Include globals.h to declare most of the grab bag list of globals which were previously defined here. * mount.h: Move USER_* defines back to shared_info.h. * speclib: Force temporary directory cleanup.
* * syscalls.cc (gen_full_path_at): Use isabspath instead of isdirsepCorinna Vinschen2008-12-151-1/+1
| | | | to recognize absolute path.
* Remove unneeded whitespace.Christopher Faylor2008-11-261-8/+8
| | | | | | | | | | | | | | | | * fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be set to ENXIO when opening a fifo write/nonblocking. * environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv here and conditionalize it on create_upcaseenv. (ucenv): Delete. (environ_init): Fix compiler warning by moving create_upcaseenv test to ucenv. Don't bother checking for child_proc_info when calling ucenv since it is assumed to be NULL at the point where the function is called. * path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing with devices since the device handler passes in a translated MS-DOS path. * sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which causes a compiler error. * fhandler_netdrive.cc: Update copyright.
* * Makefile.in (DLL_OFILES): Add setlsapwd.o.Corinna Vinschen2008-11-261-11/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cygserver.h (CYGWIN_SERVER_VERSION_API): Bump. (request_code_t): Define CYGSERVER_REQUEST_SETPWD request type. * cygserver_msg.h (client_request_msg::retval): Use default value of -1 for retval if msglen is 0. * cygserver_sem.h (client_request_sem::retval): Ditto. * cygserver_shm.h (client_request_shm::retval): Ditto. * cygserver_setpwd.h: New file. * external.cc (cygwin_internal): Implement new CW_SET_PRIV_KEY type. * sec_auth.cc (open_local_policy): Make externally available. Get ACCESS_MASK as argument. (create_token): Accommodate change to open_local_policy. (lsaauth): Ditto. (lsaprivkeyauth): New function fetching token by retrieving password stored in Cygwin or Interix LSA private data area and calling LogonUser with it. * security.h (lsaprivkeyauth): Declare. (open_local_policy): Declare. * setlsapwd.cc: New file implementing setting LSA private data password using LsaStorePrivateData or by calling cygserver if available. * syscalls.cc (seteuid32): Add workaround to get the original token when switching back to the original privileged user, even if setgroups group list is still active. Add long comment to explain why. Call lsaprivkeyauth first, only if that fails call lsaauth or create_token. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_SET_PRIV_KEY.