Commit Graph

4387 Commits

Author SHA1 Message Date
Christopher Faylor 66a83f3eac Remove unneeded header files from source files throughout. Update copyrights
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.
2009-01-03 05:12:22 +00:00
Christopher Faylor 258776ce91 Year-end rollover. 2009-01-03 02:27:46 +00:00
Christopher Faylor 944c817a60 * speclib: Rewrite completely in perl. Avoid multiple nm calls. 2009-01-02 06:57:14 +00:00
Christopher Faylor feb2075569 * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 191. 2008-12-31 21:47:45 +00:00
Christopher Faylor ecd5bc4ea8 * glob_pattern_p.cc: New file.
* Makefile.in (DLL_OFILES): Add glob_pattern_p.o.
* glob.h: Add declaration for glob_pattern_p.
* pinfo.cc (pinfo::thisproc): Remove __stdcall attribute.
2008-12-31 21:33:34 +00:00
Christopher Faylor 0c94c057a4 * include/bits/wordsize.h: New linux-compatibility header. 2008-12-31 04:12:44 +00:00
Christopher Faylor b837af5478 * exceptions.cc (try_to_debug): Avoid creating a huge buffer on the stack. 2008-12-30 18:18:09 +00:00
Christopher Faylor 5829832825 * mount.cc: Change comment.
(smb_extended_info): Move here from path.cc.
(fs_info::update): Ditto.
(mount_info::create_root_entry): Delay conversion to slashes and use passed in
buffer to figure out fs type.
* path.cc (smb_extended_info): Move.
(fs_info::update): Ditto.
* mount.h: New file.  Move mount information here.
* path.h: (fs_info::update): Move.
* shared_info.h (mount_item): Ditto.
2008-12-25 15:55:31 +00:00
Christopher Faylor 58402a3f63 * path.cc (symlink_info::check_shortcut): Ensure that symlink handle is closed
on successful return.
2008-12-24 16:34:38 +00:00
Christopher Faylor 9a8597c13a * fhandler.h (fhandler_base_setup_overlapped): Add new argument.
(fhandler_base::get_overlapped_buffer): Declare new function.
(fhandler_base::set_overlapped): Ditto.
(fhandler_pipe::overlapped): New variable.
(fhandler_pipe::get_overlapped): Rework to return contents of overlapped
variable.
(fhandler_pipe::set_overlapped): Set overlapped variable based on argument.
(fhandler_fifo::get_overlapped_buffer): Return pointer to io_status.
* fhandler.cc (handler_base::setup_overlapped): Set to overlapped pointer to
NULL if new doit parameter is false.  Otherwise set up overlapped event as
usual.
(fhandler_base::wait_overlapped): Return inres if this isn't an overlapped
operation.
(fhandler_base::read_overlapped): Remove inappropriate asserts.
* pipe.cc (fhandler_pipe::fhandler_pipe): Zero overlapped element.
(struct pipesync): Delete.
(getov_result): Ditto.
(pipe_handler): Ditto.
(pipesync::pipesync): Ditto.
(fhandler_pipe::init): Don't set up pipesync thread.  Just pass opened_properly
flag along to overlapped setup.
2008-12-23 18:22:33 +00:00
Christopher Faylor 6ef31d2336 * pipe.cc (getov_result): Minor cleanup. 2008-12-22 19:18:00 +00:00
Christopher Faylor 91ad1942a2 * pipe.cc (getov_result): Add parameters to facilitate better EOF checking.
(pipe_handler): Pass extra arguments to getov_result.
2008-12-21 01:54:32 +00:00
Christopher Faylor 0cf888799b * fhandler.cc (fhandler_base::wait_overlapped): Reorganize to eliminate gotos
and to hopefully eliminate one race when a signal is detected or there is a
WFMO error.
2008-12-20 19:20:00 +00:00
Christopher Faylor 9ac421686a * pinfo.h (pinfo::thisproc): Declare. Rename from set_myself.
* pinfo.cc (pinfo::thisproc): Define.  Rename from set_myself.  Set procinfo to
NULL to avoid confusing subsequent init.
(pinfo_init): Accommodate set_myself -> pinfo::thisproc rename.
* dcrt0.cc (child_info_fork::handle_fork): Ditto.
(child_info_spawn::handle_spawn): Ditto.
2008-12-20 17:32:31 +00:00
Corinna Vinschen e9982f2a2b * pwdgrp.h (pwdgrp::refresh): Fix indentation.
* uinfo.cc (pwdgrp::load): Open file synchronized to avoid truncated
	read.  Drop local variable off.
2008-12-20 09:35:18 +00:00
Christopher Faylor 1af6bb97a4 * pinfo.cc (pinfo_basic): New class.
(pinfo_basic::pinfo_basic): Define constructor for new class.
(myself): Initialize from myself_initial.
(set_myself): Set pid and progname from already myself_initial.
* strace.cc (strace::strace): Split apart strace::hello.  Send notification to
strace as early as possible.
(strace::hello): Just send clause which describes the current process.  This
can now be preceded by early initialization strace output.
* include/sys/strace.h (strace::strace): Declare new constructor.
2008-12-19 19:09:51 +00:00
Corinna Vinschen 887eb76fca * fhandler_registry.cc (perf_data_files): New table.
(PERF_DATA_FILE_COUNT): New constant.
	(fhandler_registry::exists): Add check for HKEY_PERFORMANCE_DATA
	value names.
	(fhandler_registry::fstat): For HKEY_PERFORMANCE_DATA, return
	default values only.
	(fhandler_registry::readdir): For HKEY_PERFORMANCE_DATA, list
	names from perf_data_files only.
	(fhandler_registry::fill_filebuf): Use larger buffer to speed up
	access to HKEY_PERFORMANCE_DATA values.  Remove check for possible
	subkey.  Add RegCloseKey ().
	(open_key): Replace goto by break, remove label.  Do not try to
	open subkey of HKEY_PERFORMANCE_DATA.  Add missing RegCloseKey ()
	after open subkey error.
2008-12-19 14:31:40 +00:00
Corinna Vinschen 292c99741d * path.cc (path_conv::check): Handle incoming DOS paths non-POSIXy,
always case-insensitive, always ignoring ACLs.
2008-12-19 12:15:33 +00:00
Corinna Vinschen a4fc1198a4 * fhandler_disk_file.cc: Set 4th parameter of NtQueryDirectoryFile to
NULL throughout.
	(fhandler_disk_file::facl): Fix a condition so that fstat_by_handle
	is actually used.
	(fhandler_disk_file::readdir): Don't print debug message on a simple
	STATUS_NO_MORE_FILES status code.
2008-12-18 18:54:25 +00:00
Corinna Vinschen dc7dfa3a82 * path.cc (symlin_info::check): Set 4th parameter of
NtQueryDirectoryFile to NULL instead of 0 since it's a pointer.
	Simplify label and break from loop handling in symlink evaluation
	conditional expression.  Drop a now useless break statement.  Fix
	behaviour when searching for `foo' and then finding a `foo.lnk'
	which is no shortcut.
2008-12-18 15:37:19 +00:00
Corinna Vinschen 2cc8b9e014 * fhandler_registry.cc (DEFAULT_VALUE_NAME): Remove constant.
(encode_regname): Encode empty (default) name to "@".
	Encode "@" to "%40".  Change error return to -1.
	(decode_regname): Decode "@" to empty name.  Decode "%40" to "@".
	(fhandler_registry::exists): Skip check for keys if name is empty.
	Remove check for DEFAULT_VALUE_NAME, now handled by decode_regname ().
	(fhandler_registry::readdir): Remove check for empty name, now
	handled by encode_regname ().
	(fhandler_registry::open): Remove check for DEFAULT_VALUE_NAME.
	(fhandler_registry::open_key): Fail with ENOENT if key name is empty.
2008-12-16 09:20:05 +00:00
Corinna Vinschen 1348f65bb9 * syscalls.cc (gen_full_path_at): Use isabspath instead of isdirsep
to recognize absolute path.
2008-12-15 20:53:18 +00:00
Corinna Vinschen 658fe9ec36 * sec_auth.cc (open_local_policy): Set lsa handle to
INVALID_HANDLE_VALUE when LsaOpenPolicy fails.  Explain why.
2008-12-15 20:25:44 +00:00
Corinna Vinschen 63a89e8464 * setlsapwd.cc (setlsapwd): Simplify code. Only try to call cygserver
if opening local policy fails.  Don't treat removing non-existant
	private data as error.
2008-12-15 18:07:35 +00:00
Corinna Vinschen 85fd77a145 * setlsapwd.cc (setlsapwd): Explicitely erase password buffer content
after usage.
2008-12-15 17:39:39 +00:00
Corinna Vinschen 6452986601 * fhandler_registry.cc (fhandler_registry::exists): Handle EACCES.
(fhandler_registry::open): Ditto.
2008-12-15 12:51:46 +00:00
Corinna Vinschen f8a41da921 * cygwin.din: Export fgetwc, fgetws, fputwc, fputws, fwide, getwc,
getwchar, putwc, putwchar, ungetwc.
	* posix.sgml: Move above functions (add missing) into "implemented
	SUSv3" section.
	* include/cygwin/version.h: Bump api minor number.
2008-12-15 12:40:29 +00:00
Corinna Vinschen 305b19d738 * fhandler.h (class fhandler_registry): Declare dup method.
* fhandler_registry.cc (fhandler_registry::exists): Fix missing
	parenthesis.
	(fhandler_registry::dup): New method.
2008-12-15 12:33:27 +00:00
Christopher Faylor ec4eb70c33 * fhandler_disk_file.cc (readdir_get_ino): Don't complain about MS-DOS paths
since the function could be fed one by an internal call.
2008-12-14 06:01:46 +00:00
Christopher Faylor 9fe25af7a6 * cygheap.cc (cygheap_user::~cygheap_user): Remove unneeded if 0'ed code.
* fhandler_registry.cc (fhandler_registry::exists): Recode goto as if/else to
avoid a gcc4 compiler warning.
(fhandler_registry::open): Ditto.  Use one goto rather than two.
* gentls_offsets: Fix compiler warning in generated output.
* tlsoffsets.h: Regenerate.
* mount.cc (fillout_mntent): slashify native paths returned via getmntent.
2008-12-13 21:05:31 +00:00
Corinna Vinschen 373e8a118b * resolv.h: #include <netinet/in.h> for sockaddr_in typedef. 2008-12-09 16:09:46 +00:00
Corinna Vinschen d27ebea923 * fhandler_registry.cc (encode_regname): Add Parameter add_val.
Append "%val" if add_val is set.
	(decode_regname): Remove trailing "%val". Change returncode accordingly.
	(__DIR_hash): New class.
	(d_hash): New macro.
	(key_exists): New function.
	(fhandler_registry::exists): Remove encode of registry name before path
	compare, decode file part of path instead.  Skip checks for keys if
	trailing "%val" detected.
	(fhandler_registry::fstat): Change check of return value of
	decode_regname ().
	(fhandler_registry::readdir): Allocate __DIR_hash.  Record key names in
	hash table. Append "%val" if key with same name exists. Fix error
	handling of encode_regname ().  Set dirent.d_type.
	(fhandler_registry::closedir): Delete __DIR_hash.
	(fhandler_registry::open): Don't open key if trailing "%val" detected
	by decode_regname ().
	(open_key): Ditto.
2008-12-08 11:45:18 +00:00
Corinna Vinschen e1984134be * libc/minires.c (open_sock): Set non blocking and close on exec.
(res_ninit): Set id pseudo-randomly.
	(res_nsend): Do not set close on exec. Initialize server from id.
	Flush socket. Tighten rules for answer acceptance.
	(res_nmkquery): Update id using current data.
2008-12-03 16:37:53 +00:00
Corinna Vinschen 1a3e844b43 * fhandler_registry.cc (must_encode): Fix condition changed for testing. 2008-12-02 11:44:58 +00:00
Corinna Vinschen 651d8393c8 * fhandler_registry.cc (must_encode): New function.
(encode_regname): Ditto.
	(decode_regname): Ditto.
	(fhandler_registry::exists): Encode name before path compare.
	(fhandler_registry::fstat): Pass decoded name to win32 registry call.
	(fhandler_registry::readdir): Return encoded name to user.
	(fhandler_registry::open): Store decoded name into value_name.
	(open_key): Pass decoded name to win32 registry call.
2008-12-02 11:40:13 +00:00
Christopher Faylor 4ff5152887 * exceptions.c (sigpacket::process): Set tls on return since it is assumed to
be set to a valid value by the caller.
2008-11-29 02:41:38 +00:00
Christopher Faylor 412ec1f444 * include/cygwin/version.h: Bump api minor number to 189 to flag the
implementation of dirent.d_type.
2008-11-29 01:39:53 +00:00
Christopher Faylor d92ed436e3 * exceptions.cc (sigpacket::process): Rework previous change. tls could still
become NULL.
2008-11-28 16:41:54 +00:00
Corinna Vinschen fa421c7a75 * dir.cc (readdir_worker): Initialize dirent.d_type and __d_unused1.
* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper):
	Set dirent.d_type based on FILE_ATTRIBUTE_*.
	* include/sys/dirent.h: Define _DIRENT_HAVE_D_TYPE (enables DT_*
	declarations).
	(struct dirent): Add d_type. Adjust __d_unused1 size to preserve layout.
2008-11-28 09:04:35 +00:00
Christopher Faylor 65ebf94e53 * exceptions.cc (sigpacket::process): Make sure that 'tls' is never NULL when
used.
2008-11-28 02:56:09 +00:00
Christopher Faylor 15c509b515 clarify entry 2008-11-26 17:21:20 +00:00
Christopher Faylor 025c1fac6e Remove unneeded whitespace.
* 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.
2008-11-26 17:21:04 +00:00
Corinna Vinschen 51303cbd0c * Makefile.in (DLL_OFILES): Add setlsapwd.o.
* 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.
2008-11-26 10:18:10 +00:00
Corinna Vinschen 99abc9526e * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Drop
initialization of bytes_to_read.  Set bytes_to_read to len in
	non-buffered case.  Call read_bytes correctly with bytes_to_read
	instead of len.
2008-11-21 13:46:17 +00:00
Corinna Vinschen b007725e34 * mmap.cc (MapView): Add NT status to debug output. 2008-11-21 10:52:10 +00:00
Corinna Vinschen babd4a9c62 * autoload.cc (GetSystemDEPPolicy): Define.
(GetProcessDEPPolicy): Ditto.
	(SetProcessDEPPolicy): Ditto.
	* dcrt0.cc (disable_dep): New static function.
	(dll_crt0_0): Call disable_dep on platforms requiring it.  Add longish
	comment to explain the circumstances.
	* wincap.h (wincaps::ts_has_dep_problem): New element.
	* wincap.cc: Implement above element throughout.
	(wincapc::init): Set ts_has_dep_problem to true on 2008 Terminal
	Servers.
	* winsup.h (WINVER): Set to 0x0601.
2008-11-12 11:04:27 +00:00
Corinna Vinschen 2348e4f3c6 * mount.cc (mount_info::cygdrive_win32_path): Always upper case
DOS drive letter to accommodate case sensitivity.
	(cygdrive_getmntent): Ditto.
	* path.cc (path_conv::check): Invalidate wide_path after making path
	relative.
2008-11-11 11:45:05 +00:00
Corinna Vinschen 188fb31537 * environ.cc (create_upcaseenv): New static variable.
(renv_arr): New static array to keep track of environment variables
	which have to be always uppercased.
	(idx_arr): Ditto.
	(start_at): Ditto.
	(ucreqenv): New function to uppercase only the environment variables
	from renv_arr.
	(parse_thing): Add "upcaseenv" setting.
	(environ_init): Parse $CYGWIN before doing anything else.  Call
	ucreqenv instead of ucenv if CYGWIN=noupcaseenv is set.
2008-11-11 10:51:03 +00:00
Christopher Faylor 6865f89087 * path.cc (normalize_win32_path): Don't add a trailing '\' if the cwd returns a
path with a trailing '\'.
2008-11-11 03:51:55 +00:00
Christopher Faylor dc74da050c * pthread.cc (pthread_mutex::_unlock): Avoid unlocking a mutex if the
recursion_counter is already 0.
(pthread_mutex::_destroy): Don't consider a mutex busy if its recursion_counter
== 0.
(pthread_mutex::_fixup_after_fork): Set recursion_counter to 0 to flag that
we've just forked.  Don't reset the owner of this mutex since the forkee may
think it still owns the mutex.  Reinstate initialization of win32_obj_id.
* fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Initialize a variable to
bypass a C++ warning.
2008-11-07 18:32:41 +00:00
Corinna Vinschen c6b7418c89 * environ.cc (environ_init): Avoid evaluating $CYGWIN twice. 2008-11-05 11:57:44 +00:00
Corinna Vinschen 8937c103ed * wincap.cc (all wincaps): Store in .cygwin_dll_common section same as
wincap.  Add comment to explain why.
2008-10-23 21:00:45 +00:00
Corinna Vinschen 3e97726f98 * autoload.cc (GetSystemWindowsDirectoryW): Define.
* kernel32.cc (GetWindowsDirectoryW): Implement to abstract from
	running under Terminal Services or not.
	(GetWindowsDirectoryA): Ditto.
2008-10-22 13:30:42 +00:00
Corinna Vinschen df54adb746 * passwd.cc (pwdgrp::read_passwd): Check if we're called within
user_shared initialization and ignore myself, if so.  Reformat
	conditional expression.
2008-10-21 16:47:28 +00:00
Corinna Vinschen 669bdeb822 * ntdll.h (NtSetAttributesFile): New inline function.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Use
	NtSetAttributesFile.
	* path.cc (symlink_worker): Ditto.
	* syscalls.cc (unlink_nt): Ditto.
	(rename): Omit FILE_SHARE_DELETE when opening files on Samba.  Add
	comment to explain why.
2008-10-20 19:30:06 +00:00
Corinna Vinschen edf5a5bd15 * dtable.cc (dtable::get_debugger_info): Call SetStdHandle
for the newly opened handle.  Explain why.
	(dtable::stdio_init): Don't duplicate standard error handle
	when stderr has already been created under debugger control.
2008-10-17 16:24:20 +00:00
Corinna Vinschen 5f9ca0d25a * sec_acl.cc (setacl): Align standard owner and group permissions
with alloc_sd.  Strip FILE_READ_ATTRIBUTES fromn setting
	FILE_GENERIC_EXECUTE permissions same as in alloc_sd.
	* security.cc (alloc_sd): Reformat expression.  Strip EA permission
	bits from owner_deny and group_deny computation.
2008-10-13 16:01:50 +00:00
Corinna Vinschen 079db16bf7 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Check
for executable suffixes here in case we're on a file system
	not supporting permission.
	* path.cc (path_conv::check): Drop check for executable suffixes.
2008-10-09 14:23:09 +00:00
Corinna Vinschen 3059d18288 * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Keep track of
current position in non-buffered case, too.
2008-10-09 12:41:52 +00:00
Corinna Vinschen 2768ae50dd * grp.cc (pwdgrp::read_group): Generate more speaking group name
if passwd gid exists under different gid in /etc/group.
2008-10-09 11:52:54 +00:00
Corinna Vinschen c7a8139540 Fix ChangeLog entry 2008-10-09 10:01:49 +00:00
Corinna Vinschen c32849c5bc * path.cc (path_conv::is_binary): Always check for GetBinaryType.
* syscalls.cc (rename): Fix test for just changing case of name on
	case insensitive filesystems.
2008-10-09 09:43:02 +00:00
Corinna Vinschen 4e88323ba0 * path.cc (symlink_info::check_shortcut): Don't check for executability
here.
	(symlink_info::check_sysfile): Ditto.
2008-10-09 08:56:09 +00:00
Corinna Vinschen 3ae5cb32c5 * path.cc (path_conv::path_conv): Only assume executability by suffix
on file systems not supporting permissions.
2008-10-08 14:58:26 +00:00
Christopher Faylor c4cb50b3a8 * pthread.cc (pthread_create): Very minor formatting change.
* timer.cc (timer_thread): Ensure that any created thread defaults to detached
state.
2008-10-07 23:28:30 +00:00
Christopher Faylor f241db6f60 * cygtls.h (_cygtls::initialized): Remove bogus stack check which would when
checking the current thread from the current thread.
2008-10-07 02:38:15 +00:00
Christopher Faylor 585697536f * dcrt0.cc (dll_crt0_0): Don't initialize signals early when dynamically
loaded.
(dll_crt0_1): Wait until this phase to initialize signals when dynamically
loaded.
2008-10-05 16:48:30 +00:00
Christopher Faylor 36670cc234 * thread.cc (pthread_mutex::_fixup_after_fork): Reinstate DEBUGGING
conditional.
2008-09-30 02:39:07 +00:00
Christopher Faylor 18f43099f7 * thread.cc (pthread_mutex::_fixup_after_fork): Just reset lock to pristine
state after fork.  Don't recreate a mutex since it may not actually be needed.
2008-09-30 02:22:39 +00:00
Corinna Vinschen e7afe579f5 * flock.cc (inode_t::get_all_locks_list): Fix typo.
* posix.sgml: Add cfmakeraw to list of implemented BSD functions.
2008-09-29 17:03:49 +00:00
Eric Blake ddf8700121 * errno.cc (_sys_errlist): Add ECANCELED, ENOTRECOVERABLE, EOWNERDEAD. 2008-09-19 23:29:24 +00:00
Christopher Faylor f2c11dadcf * cygtls.h (unionent): Move from net.cc.
(unionent::struct_type): Move enum here.
(_local_storage::hostent_buf): Define as unionent.
(_local_storage::protoent_buf): Ditto.
(_local_storage::servent_buf): Ditto.
* net.cc (unionent): Move to cygtls.h.
(struct_type): Ditto.
(dup_ent): Define one function per {host,proto,serv}ent type.
(cygwin_getprotobyname): Simplify dup_ent call.  Removed now-unneeded return
type coercion.
(cygwin_getprotobynumber): Ditto.
(cygwin_getservbyname): Ditto.
(cygwin_getservbyport): Ditto.
(cygwin_gethostbyname): Ditto.
(cygwin_gethostbyaddr): Ditto.  tlsoffsets.h: Regenerate.
2008-09-16 02:04:27 +00:00
Christopher Faylor 175742d8c8 * Makefile.in: Add -c option which is now removed from COMPILE_C*.
* cygwin.din (cfmakeraw): Export.
* termios.cc (cfmakeraw): Implement.
* include/sys/termios.h (cfmakeraw): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2008-09-12 22:32:07 +00:00
Christopher Faylor c4ca0e800a * cygwin.din (sys_sigabbrev): Add this here.
* dcrt0.cc (__argc,__argv,_check_for_executable): Remove dllexport decoration
since it is already handled in cygwin.din.
* errno.cc (_sys_errlist): Ditto.
* strsig.cc (sys_sigabbrev): Ditto.
* include/cygwin/signal.h: Protect use of dllimport when __INSIDE_CYGWIN__.
* libc/getopt.c: Revert previous changes.  Define __INSIDE_CYGWIN__.
2008-09-11 06:22:31 +00:00
Christopher Faylor cb7e1879ee * localtime.cc (increment_overflow): Mark as non-inline to prevent compiler
from complaining about the very thing we're trying to test.
* ntea.cc (read_ea): Reorganize to avoid a new compiler warning/error.
* sched.cc (sched_rr_get_interval): Ditto.
* select.cc (peek_serial): Ditto.
* libc/rexec.cc (ruserpass): Ditto.
* posix_ipc.cc (ipc_names): Make static to avoid a compiler warning
(and it's the right thing to do anyway).
2008-09-11 05:43:11 +00:00
Christopher Faylor 81ba2b77de * net.cc (in6addr_any, in6addr_loopback): Add appropriate number of braces
around initializer.
(dup_ent): Try harder to coerce the first argument to deal with more stringent
compiler.
(get_2k_ifs): Remove extraneous typedef.
(get_2k_ifs): Reorganize expression to avoid a compiler warning.
(get_xp_ifs): Ditto.
(get_nt_ifs): Ditto.
2008-09-11 04:58:45 +00:00
Christopher Faylor e3cbf1cc48 * fhandler.h (fhandler_pipe::raw_read): Remove __stdcall decoration.
* pipe.cc (fhandler_pipe::raw_read): Ditto.
2008-09-11 04:41:24 +00:00
Christopher Faylor 7b9e380f03 * cygheap.cc (creturn): Reorganize to avoid a new compiler warning/error.
* dtable.cc (handle_to_fn): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::scroll_screen): Ditto.
(dev_console::set_color): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
* fhandler_tape.cc (mtinfo_drive::get_status): Ditto.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* mmap.cc (msync): Ditto.
* pipe.cc (pipesync::pipesync): Ditto.
* sec_acl.cc (getace): Ditto.
* sec_auth.cc (create_token): Ditto.
(lsaauth): Ditto.
* select.cc (peek_pipe): Ditto.
* spawn.cc (av::fixup): Ditto.
* syscalls.cc (popen): Ditto.
* tty.cc (tty::init_session): Ditto.
* uinfo.cc (pwdgrp::load): Ditto.
* fhandler.cc (fhandler_base::setup_overlapped): Ditto.
(fhandler_base::wait_overlapped): Rename second use of res variable to wres or
errors are not returned correctly.
* dcrt0.cc: Remove obsolete variable.
* dll_init.cc (release_upto): Fix typo involving incorrect use of '|'.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a compiler
warning regarding coercing type-punned variables.
(fhandler_base::fstat_by_name): Ditto.  fhandler_fifo.cc
(fhandler_fifo::open_nonserver): Fix = vs.  == typo.
(fhandler_fifo::wait): Add all conditions to switch statement to avoid a
compiler warning.
* fhandler_process.cc: Avoid unneeded initialization of variables to zero.
(fhandler_socket::listen): Add braces around initializer.
* flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a compiler
warning.  Fix problem with EWOULDBLOCK error return.
* path.cc (GUID_shortcut): Use braces around struct initializer.
(cygwin_conv_path): Reorganize to avoid a compiler warning.
* random.cc (dummy): Mark variable as volatile to avoid a "used uninitialized"
warning.
* libc/getopt.c: Mark some variables as dllexport although gcc doesn't seem to
do the right thing with them.
* libc/minires-os-if.c (get_registry_dns_items): Coerce some function arguments
to avoid a compiler warning.
2008-09-11 04:34:24 +00:00
Christopher Faylor 5f05c64ce4 * fhandler_tty.cc (close_maybe): Check for both types of invalid handle before
attempting CloseHandle.
(fhandler_pty_master::setup): Only set inheritance on pty handles, not tty
handles.
2008-08-27 21:55:19 +00:00
Christopher Faylor 7e73b9cfd7 * shared_info.h (shared_info::create_root_entry): Remove extraneous
mount_info:: from declaration.
2008-08-26 16:56:30 +00:00
Corinna Vinschen a5d4ae5c5b * fhandler.h (class fhandler_pipe): Rename read and write
declarations to raw_read and raw_write.
	* pipe.cc (fhandler_pipe::raw_read): Rename from read.
	(fhandler_pipe::raw_write): Rename from write.
2008-08-26 15:39:17 +00:00
Christopher Faylor 8b2ed8e20a * fhandler.cc (fhandler_base::wait_overlapped): Reorganize again to accommodate
what appears to be an MSDN hint about not resetting the overlapped event prior
to calling GetOverlappedResult.
2008-08-22 04:06:01 +00:00
Corinna Vinschen 7d0a7940e6 * path.cc (symlink_info::check_shortcut): If file can't be opened,
treat it as non-symlink rather than generating an EIO error.
	(symlink_info::check_sysfile): Ditto.
2008-08-20 10:53:54 +00:00
Christopher Faylor fbf39a58cb * fhandler.cc (fhandler_base::wait_overlapped): Always assume that bytes will
be non-NULL.  Distinguish input result from result derived from WFMO and
GetOverlappedResult or res can never be -1.  Only raise SIGPIPE when writing.
* fhandler.h (fhandler_base::wait_overlapped): Pass first argument by value.
* fhandler_fifo.cc (fhandler_fifo::wait): Pass in dummy byte count to
wait_overlapped.
* pipe.cc (DEFAULT_PIPEBUFSIZE): Define to 65536 explicitly.
2008-08-20 02:25:06 +00:00
Corinna Vinschen ec8a7e416f * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Drop fattr variable
and use FILE_ATTRIBUTE_DIRECTORY directly in call to NtCreateFile.
	* posix_ipc.cc (ipc_mutex_init): Fix format string when creating IPC
	object name.
	(ipc_cond_init): Ditto.
	* security.cc (alloc_sd): Add parentheses to fix setting initial
	owner_allow value.
2008-08-19 09:46:31 +00:00
Christopher Faylor 46c6def37f * fhandler.cc (fhandler_base::wait_overlapped): Don't treat ERROR_BROKEN_PIPE
as a non-error.  Do raise SIGPIPE when it is detected.
2008-08-19 02:56:28 +00:00
Corinna Vinschen 2bd94f906d * mount.cc (mount_info::get_mounts_here): Don't subtract 2 from
Length if it's 0 anyway.
2008-08-15 12:33:26 +00:00
Corinna Vinschen 975f052c60 * mount.cc (mount_info::create_root_entry): Create default cygdrive
prefix with MOUNT_NOPOSIX flag.
2008-08-15 12:06:38 +00:00
Corinna Vinschen 2b41d940ca * path.cc (symlink_info::check): Don't use eabuf when trying to open
file a second time.  Call NtOpenFile instead of NtCreateFile in this
	case.
2008-08-15 10:19:12 +00:00
Corinna Vinschen 39f50e387b * fhandler_disk_file.cc (fhandler_disk_file::link): Fix linking
against symlinks.
2008-08-14 15:00:52 +00:00
Corinna Vinschen 88797e5979 * external.cc (cygwin_internal): Call set_security_attribute with
additional path_conv argument.
	* fhandler.cc (fhandler_base::open): Ditto.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Never set DOS
	R/O attribute when using ACLs.
	(fhandler_disk_file::mkdir): Ditto.  Set
	security descriptor on remote dirs after creating the dir, same as in
	fhandler_base::open.
	* fhandler_socket.cc (fhandler_socket::bind): Ditto for remote AF_LOCAL
	socket files.
	* path.cc (symlink_worker): Ditto. for remote symlinks.
	* security.cc (alloc_sd): Take additional path_conv argument.
	Accommodate throughout.  Drop setting FILE_WRITE_EA/FILE_READ_EA
	flags unconditionally (was only necessary for "ntea"). Don't set
	FILE_READ_ATTRIBUTES and FILE_WRITE_ATTRIBUTES unconditionally on
	Samba.  Add comment to explain.  Drop useless setting of
	STANDARD_RIGHTS_WRITE, it's in FILE_GENERIC_WRITE anyway.
	Remove FILE_READ_ATTRIBUTES bit from FILE_GENERIC_EXECUTE so as not
	to enforce read permissions on Samba.
	(set_security_attribute): Take additional path_conv argument.
	* security.h (set_security_attribute): Change prototype accordingly.
2008-08-14 14:05:04 +00:00
Corinna Vinschen 452f665fb1 * mount.cc (fillout_mntent): Always print noumount option last. 2008-08-13 15:30:52 +00:00
Corinna Vinschen aed2404c0d * mount.cc (fillout_mntent): Print options as taken in fstab and mount. 2008-08-13 15:11:25 +00:00
Corinna Vinschen 69d704beff * dll_init.cc: Throughout convert to use long pathnames.
* dll_init.h (struct dll): Change name to WCHAR, change operator [] to
	take PWCHAR argument.
2008-08-13 08:25:44 +00:00
Corinna Vinschen 0ea2c19934 * syscalls.cc (rename): If newpath doesn't exist, check if .exe suffix
in oldpath has been omitted before appending .exe to newpath.
2008-08-11 15:05:25 +00:00
Corinna Vinschen 36f17b4b40 * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Don't set
eom_detected when EOF is detected, thus returning 0 instead of
	setting errno to ENOSPC.
2008-08-09 11:09:02 +00:00
Corinna Vinschen b2d3f28fda * fhandler.cc (fhandler_base::open): Use Samba workaround generally
for all remote filesystems supporting ACLs.  Change comment and
	explain why.  Refer to the discussion which led to this.
2008-08-07 16:20:03 +00:00
Brian Dessent af15c95e70 * config/i386/profile.h (mcount): Mark asms volatile. 2008-08-05 19:20:58 +00:00
Christopher Faylor 53364a1fae * dll_init.cc (dll_global_dtors): Add an additional test to avoid walking the
linked list if it is empty.
(dll_list::detach): Don't set dll_global_dtors_recorded if we aren't actually
going to record any dlls.
2008-08-05 14:26:47 +00:00
Christopher Faylor bee18f45fd Changes suggested by Dave Korn.
* dcrt0.cc (cygwin_exit): Remove (hopefully) extraneous call to
dll_global_dtors.
* dll_init.cc (dll_global_dtors): Run destructors in reverse dependency/load
order.
* dll_init.h (dll_list): Add dll_global_dtors as a friend.
2008-08-04 15:55:32 +00:00