Commit Graph

4435 Commits

Author SHA1 Message Date
Corinna Vinschen ceaf31f416 * fhandler_disk_file.cc (fhandler_base::fstat_by_name): Use
RtlSplitUnicodePath.
	(fhandler_disk_file::fstat): Rename oret to opened.  Open file using NT
	functions right here.  Try to open parent dir instead of root directory
	to avoid call to rootdir.  Use NtFsControlFile.
	* ntdll.h (RtlSplitUnicodePath): Define.
2007-07-27 10:10:57 +00:00
Corinna Vinschen 655639ba89 * fhandler_disk_file.cc (is_volume_mountpoint): New static inline
function.
	(path_conv::ndisk_links): Call is_volume_mountpoint.
	(fhandler_disk_file::readdir_helper): Ditto.
2007-07-27 09:00:12 +00:00
Corinna Vinschen fe7bbe1504 * fhandler.h (enum query_state): Drop redundant query_stat_control.
* fhandler.cc (fhandler_base::open): Ditto.  Add READ_CONTROL to
	access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening
	for writing.  Always set security attributes to avoid calling
	has_acls.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to
	open file twice.
2007-07-27 08:38:00 +00:00
Corinna Vinschen 214c3a1167 * dir.cc (readdir_worker): Drop dir parameter from call to
readdir_get_ino.
	* fhandler.h (fhandler_disk_file::readdir_helper): Switch file name
	parameter to PUNICODE_STRING.
	* fhandler_disk_file.cc: Drop including ntdef.h.
	(class __DIR_mounts): Store mount points in UNICODE.  Additionally
	store cygdrive prefix in unicode here.  Change methods accordingly.
	(__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64.
	(__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers.
	(path_conv::ndisk_links): Rewrite using native NT functions.
	(fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH.
	Always set pfvi->VolumeSerialNumber to non-0.  Remove last resort
	code.
	(fhandler_base::fstat_by_name): Rewrite using native NT functions.
	(fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle
	fails.
	(fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber.
	(fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails.
	(DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH.
	(__DIR_cache): Remove __name.
	(d_dirname): Remove.
	(fhandler_disk_file::opendir): Drop pathname length check.
	Remove outdated comment.  Use get_name method instead of accessing
	pc.normalized_path directly.
	(readdir_get_ino): Drop unused dir parameter.  Accomodate throughout.
	Allocate fname dynamically.  Call new stat_worker instead of lstat64.
	Call NtOpenFile instead of CreateFile.  Call NtClose instead of
	CloseHandle.
	(fhandler_disk_file::readdir_helper): Use native NT functions.
	Check for volume mount points and use correct inode number.
	(fhandler_disk_file::readdir): Simplify slightly.
	Use get_name instead of pc.normalized_path.
	(fhandler_disk_file::rewinddir): Use RtlInitUnicodeString.
	(fhandler_cygdrive::fstat): Ignore floppy drives.  Set st_nlink
	correctly.
	(fhandler_cygdrive::readdir): Ignore floppy drives.
	* fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate
	change to readdir_get_ino.
	* fhandler_proc.cc (PROC_DIR_COUNT): Define.
	(fhandler_proc::fstat): Evaluate correct link count for /proc.
	* ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define.
	(NtFsControlFile): Declare.
	(RtlAppendUnicodeToString): Declare.
	(RtlAppendUnicodeStringToString): Declare.
	(RtlCompareUnicodeString): Declare.
	(RtlCopyUnicodeString): Declare.
	(RtlCreateUnicodeStringFromAsciiz): Declare.
	(RtlEqualUnicodeString): Declare.
	(RtlFreeUnicodeString): Declare.
	(RtlInitEmptyUnicodeString): Declare.
	(RtlSecondsSince1970ToTime): Declare.
	(RtlInitEmptyUnicodeString): Define as inline function.
	(RtlInitCountedUnicodeString): Define as inline function.
	* path.cc (path_conv::check): New method with PUNICODE_STRING as path,
	preliminary implementation.
	(mount_info::get_mounts_here): Change to create UNICODE_STRINGs.
	Also copy cygpath prefix into UNICODE_STRING.
	(is_floppy): Drop 9x consideration.
	* path.h: Drop including ntdef.h.
	(path_conv::check): Add declaration.
	(path_conv::path_conv): Add constructor for UNICODE_STRING paths.
	* shared_info.h (mount_info::get_mounts_here): Change declaration.
	* syscalls.cc: Drop forward declaration of stat_worker.
	(stat_worke): Take path_conv as parameter.  Drop nofollow flag.
	(stat64): Create matching path_conv and call stat_worker with it.
	(lstat64): Ditto.
	* winsup.h: Include ntdef.h.
	(stat_worker): Declare.
	(readdir_get_ino): Change declaration.
2007-07-26 17:30:54 +00:00
Corinna Vinschen 4b62a570de * autoload.cc (CreateToolhelp32Snapshot): Remove. 2007-07-25 16:11:03 +00:00
Corinna Vinschen 38a67d337d * autoload.cc (Process32First): Remove.
(Process32Next): Remove.
2007-07-25 16:07:41 +00:00
Corinna Vinschen fdcfcea4fc * autoload.cc (NetWkstaUserGetInfo): Remove.
(CharToOemBuffA): Remove.
	(KillTimer): Remove.
	(OemToCharBuffA): Remove.
	(SetTimer): Remove.
2007-07-25 10:04:57 +00:00
Corinna Vinschen 0bfdd78fa9 Fix ChangeLog 2007-07-20 15:42:09 +00:00
Corinna Vinschen eea4e48208 * fhandler.cc (fhandler_base::fhaccess): Accommodate interface changes
of access control functions throughout.
	* fhandler_disk_file.cc: Ditto.
	* fhandler_registry.cc: Ditto.
	* sec_acl.cc: Drop unnecessary includes.
	(setacl): Take path_conv instead of file name as parameter.
	Accommodate interface changes of access control functions.
	(getacl): Ditto.
	* sec_auth.cc: New file, taking over all authentication related
	functions from security.cc.
	* sec_helper.cc: Drop unnecessary includes.
	* security.cc: Ditto.  Move all authentication related functions to
	sec_auth.cc.
	(ALL_SECURITY_INFORMATION): New define.  Use throughout.
	(set_file_sd): New function, replacing read_sd and the file related
	part of get_nt_object_security.
	(get_reg_sd): Rename from get_reg_security.  Drop type parameter.
	(get_reg_attribute): New function, replacing the registry related part
	of get_nt_object_security.
	(get_file_attribute): Take path_conv instead of file name as parameter.
	Use new get_file_sd call.
	(set_file_attribute): Ditto plus new set_file_sd.  Drop unnecessary
	implementation without uid/gid parameters.
	(check_file_access): Take path_conv instead of file name as parameter.
	Use new get_file_sd call.
	(check_registry_access): Use new get_reg_sd call.
	* security.h: Accommodate above interface changes.
2007-07-20 14:29:43 +00:00
Corinna Vinschen f36b37ed6e * security.cc (set_nt_attribute): Remove.
(set_file_attribute): Do it yourself instead of calling
	set_nt_attribute.
2007-07-19 17:42:11 +00:00
Corinna Vinschen e25b3402ac * fhandler_disk_file.cc (fhandler_base::fstat_by_name): Use
NtQueryFullAttributesFile instead of FindFirstFile.
	(fhandler_base::fstat_fs): Drop check for exec_state.  Drop check for
	invalid characters.
	* ntdll.h (struct _FILE_NETWORK_OPEN_INFORMATION): Define.
	(NtQueryFullAttributesFile): Declare.
2007-07-19 17:22:34 +00:00
Corinna Vinschen 91d2f6eebf * fhandler.cc (fhandler_base::open): Drop local wpath and upath
variables.  Call pc.get_object_attr to create object attributes.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto.
	* syscalls.cc (unlink_nt): Ditto.
	* path.cc (path_conv::set_normalized_path): Set wide_path to NULL.
	(path_conv::get_nt_native_path): Drop parameter.  Create path in
	wide_path/uni_path members.
	(path_conv::get_object_attr): New method to create object attributes.
	(path_conv::get_wide_win32_path): New method to create Win32 wide path.
	(path_conv::check): Initialize wide_path to NULL.
	(path_conv::~path_conv): cfree wide_path.
	* path.h (class path_conv): New members wide_path and uni_path.
	Add declarations of get_object_attr and get_wide_win32_path.
	(path_conv::path_conv): Initialize wide_path to NULL.
	(path_conv::get_nt_native_path): Drop parameter.
2007-07-19 11:41:17 +00:00
Corinna Vinschen 892635fd9f * sec_helper.cc: Remove unused code. 2007-07-19 09:12:09 +00:00
Corinna Vinschen 63a87c815a * autoload.cc (SetSecurityDescriptorControl): Drop.
* security.cc (alloc_sd): Set security descriptor control flag without
	calling SetSecurityDescriptorControl function.
	* wincap.h (wincapc::has_dacl_protect): Rename from
	has_security_descriptor_control.
	* wincap.cc: Ditto throughout.
2007-07-19 09:06:54 +00:00
Corinna Vinschen 5f9c8e2a87 * autoload.cc (SetUserObjectSecurity): Drop.
* pinfo.cc (pinfo::set_acl): Use NtSetSecurityObject instead of
	SetKernelObjectSecurity.
	* spawn.cc (spawn_guts): Use NtSetSecurityObject instead of
	SetUserObjectSecurity.
	* uinfo.cc (cygheap_user::init): Ditto.
2007-07-19 08:36:32 +00:00
Corinna Vinschen cce28460fe * cygheap.h (init_cygheap::luid): Remove.
* mmap.cc (mlock): Accommodate parameter change in call to
	push_thread_privilege.
	(munlock): Ditto.
	* ntdll.h (STATUS_NOT_ALL_ASSIGNED): Define.
	(NtAdjustPrivilegesToken): Declare.
	* sec_helper.cc (cygpriv): Reorder to match numerical privilege order.
	(privilege_luid): Take job of privilege_luid_by_name, using new
	cygpriv.
	(privilege_luid_by_name): Remove.
	(privilege_name): Accommodate new cygpriv array.
	(set_privilege): Call NtAdjustPrivilegesToken to avoid using advapi32.
	Accommodate changes to privilege_name.
	(set_cygwin_privileges): Simplify.  Don't try to set
	SE_CREATE_GLOBAL_PRIVILEGE on systems not supporting it.
	* security.cc (sys_privs): Reorder to match numerical privilege order.
	Use real privilege values as defined in security.h.
	(get_system_priv_list): Drop unused grp_list argument.  Create
	list of privileges according to new wincapc::max_sys_priv value.
	(get_priv_list): Call privilege_luid instead of privilege_luid_by_name.
	Make priv a local value instead of a pointer.
	(create_token): Accommodate parameter change in call to
	push_self_privilege.
	(lsaauth): Ditto.
	(check_access): Use privilege values directly instead of calling
	privilege_luid.
	* security.h: Define real privilege values.
	(cygpriv_idx): Remove.
	(privilege_luid): Change declaration.
	(privilege_luid_by_name): Drop declaration.
	(set_privilege): Change declaration.
	(set_process_privilege): Drop definition.
	(_push_thread_privilege): Accomodate new set_privilege parameters.
	* wincap.h (wincapc::max_sys_priv): New element.
	* wincap.cc: Implement above element throughout.
	(wincap_2000sp4): New wincaps structure.
	(wincap_xpsp1): Ditto.
	(wincap_xpsp2): Ditto.
	(wincapc::init): Use new wincaps.
	(wincapc::max_sys_priv): New element.
2007-07-19 08:33:22 +00:00
Corinna Vinschen 5fbf573cd3 * dcrt0.cc (dll_crt0_0): Call set_cygwin_privileges here, after
initializing hProcToken.
	* sec_helper.cc (init_global_security): Don't call set_cygwin_privileges        here.
2007-07-19 07:24:17 +00:00
Corinna Vinschen c5b1a133c0 * cygheap.h (shared_prefix): De-const.
(shared_prefix_buf): Add static buffer for shared prefix to avoid
	additional allocation.
	* cygheap.cc (cygheap_init): Set cygheap->shared_prefix to
	cygheap->shared_prefix_buf and strcpy.
2007-07-18 11:15:51 +00:00
Corinna Vinschen 52a6e6d8c7 * fhandler.cc (fhandler_base::fhaccess): Add check for R/O file system.
* security.cc (check_registry_access): Set errno to EROFS when checking
	for W_OK.
2007-07-17 14:39:02 +00:00
Corinna Vinschen 822036b6c9 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Move setting
cfd->nohandle where it won't crash.
2007-07-17 13:22:21 +00:00
Corinna Vinschen 77ee880504 * cygheap.h (cygheap_user::curr_imp_token): Rename from current_token.
Accommodate changge throughout Cygwin.
	(cygheap_user::imp_token): Rename from token.  Accommodate changge
	throughout Cygwin.
	(rcygheap_user::eimpersonate): Use primary token for impersonation.
	* grp.cc (internal_getgroups): Use primary impersonation token when
	impersonated.
	* security.h (_push_thread_privilege): Use primary impersonation token
	when impersonated.
2007-07-16 20:01:15 +00:00
Christopher Faylor 6f76c68713 * init.cc (in_dllentry): Delete.
(dll_entry): Remove assignment to deleted variable.
* winsup.h (in_dllentry): Delete declaration.
* exceptions.cc (inside_kernel): Use another method to see if we are in
dll_entry phase.
2007-07-14 15:58:32 +00:00
Christopher Faylor d409af3661 * init.cc (in_dllentry): Make NO_COPY to avoid spurious false positives. 2007-07-14 02:27:11 +00:00
Christopher Faylor be1cabba23 * debug.cc (close_handle): Change debug output format slightly.
* dlfcn.cc (dlclose): Don't close handle returned from GetModuleHandle(NULL).
* fhandler.h (fhandler_pipe::create): Remove obsolete argument.
(fhandler_pipe::create): Ditto.
* fhandler.cc (fhandler_pipe::create): Ditto.
(fhandler_pipe::create): Ditto.
2007-07-10 01:21:03 +00:00
Christopher Faylor 5c8891e962 * cygwin/strsig.cc (__signals): New macro.
(sys_sigabbrev): New array of signal strings, patterned after linux.
(siglist): Use __signals.
* cygwin/include/cygwin/signal.h (sys_sigabbrev): Define.
* cygwin/include/cygwin/version.h: Bump API minor version to 177.

* utils/Makefile.in (kill.exe): Remove reliance on libiberty.
* utils/kill.cc (strsigno): New function patterned after libiberty but using
newly exported cygwin array.
2007-07-10 00:12:54 +00:00
Corinna Vinschen 281bd334ac * dir.cc (closedir): Revert change from 2007-06-29.
* fhandler.h (dirent_valid_fd): Drop.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): If opening a
	real dir, use the underlying fhandler to keep track of the directory
	handle.  In fdopendir case use original io_handle from fhandler.  Use
	fhandler's io_handle in subsequent directory functions throughout.
	Create handle non-inheritable and set close-on-exec flag.
	(readdir_get_ino): Drop dirent_isroot case.
	(fhandler_disk_file::readdir): Handle dirent_isroot case here.
	(fhandler_disk_file::rewinddir): Revert change from 2007-07-05.  Use
	NtClose instead of CloseHandle.
	* fhandler_virtual.cc (fhandler_virtual::opendir): Drop adding
	dirent_valid_fd flag.  Set close-on-exec flag.
2007-07-09 17:02:37 +00:00
Christopher Faylor b85bae86cd * Makefile.in (DLL_OFILES): Add newly-imported random.o. Eliminate reliance on
libiberty.
* random.cc: Import from FreeBSD.  Modify for Cygwin environment.
* include/cygwin/stdlib.h (random): Reflect change in return value to be more
linux/freebsd-like.
(srandom): Ditto.
2007-07-08 15:04:34 +00:00
Christopher Faylor f3c7a5c457 Add initial FreeBSD version of random.c 2007-07-08 14:59:47 +00:00
Christopher Faylor e19e357043 update copyright 2007-07-07 17:29:20 +00:00
Christopher Faylor 92eab16eed * fhandler.h (fhandler_base::write): Remove __stdcall decoration.
(fhandler_pipe::write): Ditto.
(fhandler_fifo::write): Ditto.
2007-07-07 17:28:22 +00:00
Christopher Faylor d9c0e3ec35 Preliminary change to make fifos/pipes interruptible and fifos reliable.
* dtable.cc (dtable::find_fifo): Eliminate definition.
* dtable.h (dtable::find_fifo): Ditto for declaration.
* fhandler.cc (fhandler_base::raw_read): Remove pipe-specific stuff.
(fhandler_base::fhandler_base): Ditto.
(fhandler_base::close): Handle overlapped I/O structure if appropriate.
(fhandler_base::dup): Ditto.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::setup_overlapped): Define new function.
(fhandler_base::destroy_overlapped): Ditto.
(fhandler_base::wait_overlapped): Ditto.
(fhandler_base::read_overlapped): Ditto.
(fhandler_base::write_overlapped): Ditto.
* fhandler.h (fhandler_base::get_overlapped): Declare new function.
(fhandler_base::setup_overlapped): Ditto.
(fhandler_base::destroy_overlapped): Ditto.
(fhandler_base::wait_overlapped): Ditto.
(fhandler_base::read_overlapped): Ditto.
(fhandler_base::write_overlapped): Ditto.
(fhandler_base::get_guard): Eliminate.
(fhandler_pipe::*): Rework to eliminate most Win9x related cruft, removing many
variables and defining a new overlapped capability.
(fhandler_fifo::*): Ditto.
(fifo_state): Declare new enum.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove old Win9x stuff.
Initialize overlapped handle to NULL.
(fhandler_fifo::set_use): Eliminate.
(fhandler_fifo::open_nonserver): Define.
(fhandler_fifo::open): Rework to use named pipes and overlapped I/O.
(fhandler_fifo::wait): Define new function to wait for named pipe connection.
(fhandler_fifo::read): Rework to use wait() and new overlapped I/O
functionality.
(fhandler_fifo::write): Ditto.
(fhandler_fifo::dup): Eliminate.
* pinfo.cc (commune_process): Remove fifo handling.
(_pinfo::commune_request): Ditto.
* pinfo.h (picom): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Remove Win9x stuff.  Initialize
overlapped handle to NULL.
(fhandler_pipe::open): Eliminate Win9x stuff.
(fhandler_pipe::set_close_on_exec): Eliminate.
(read_pipe): Eliminate.
(fhandler_pipe::close): Ditto.
(fhandler_pipe::fixup_after_exec): Ditto.
(fhandler_pipe::fixup_in_child): Ditto.
(fhandler_pipe::read): Rework to use overlapped I/O.
(fhandler_pipe::write): New function using overlapped I/O.
(fhandler_pipe::dup): Rework to eliminate Win9x stuff.
(fhandler_pipe::create_selectable): Rework to eliminate Win9x and use
overlapped I/O.
* select.cc (peek_pipe): Rework to eliminate Win9x stuff and use overlapped
I/O.
(fhandler_base::ready_for_read): Ditto.
2007-07-07 17:00:33 +00:00
Christopher Faylor dee5588839 * path.cc (symlink_info::check_shortcut): Handle device "symlinks" specially -
don't posixify them.
2007-07-07 16:48:26 +00:00
Christopher Faylor 8581e92c51 * fhandler_disk_file.cc: White space.
* fhandler_proc.cc: Ditto.
* fhandler_virtual.cc: Ditto.
2007-07-07 16:46:35 +00:00
Christopher Faylor 7b44665a7b * fork.cc: White space.
* net.cc: Ditto.
* posix_ipc.cc: Ditto.
2007-07-07 16:43:03 +00:00
Corinna Vinschen a5a0080d9c * times.cc (gettimeofday): Align definition to POSIX. 2007-07-06 20:09:23 +00:00
Corinna Vinschen d2d9ce09b5 * cygwin.din: Export wcstol, wcstoll, wcstoul, wcstoull, wcsxfrm.
* include/cygwin/version.h: Bump API minor number.
2007-07-06 20:05:44 +00:00
Corinna Vinschen 64f50c2b3c * fhandler_disk_file.cc (fhandler_disk_file::opendir): Add missing
OBJ_INHERIT flag when creating OBJECT_ATTRIBUTES.
	(fhandler_disk_file::rewinddir): Ditto.
2007-07-05 09:35:36 +00:00
Corinna Vinschen 3854c5c0d5 Check in missing cygwin.din change from 2007-06-29. 2007-07-05 07:36:11 +00:00
Corinna Vinschen c467d17e7c * times.cc: Define __timezonefunc__ before including time.h to protect
definition of timezone function.
2007-07-04 10:43:29 +00:00
Corinna Vinschen 0d9cddc377 * include/cygwin/time.h: Switch to timezone variable by default. Add
comment.
2007-07-04 09:56:15 +00:00
Corinna Vinschen 40570a828e * cygwin.din: Export fdopendir.
* dir.cc (opendir): Call fhandler's opendir with fd set to -1.
	(fdopendir): New function.
	(seekdir64): Use dirent_info_mask.
	(rewinddir): Ditto.
	(closedir): Only release underlying file descriptor if it has been
	reserved by opendir itself.
	* fhandler.cc (fhandler_base::opendir): Accommodate new parameter.
	* fhandler.h (dirent_states): Add dirent_valid_fd and dirent_info_mask.
	(fhander_XXX::opendir): Add file descriptor parameter.  Use regparms.
	(fhandler_procnet::opendir): Drop declaration.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto.
	If called from fdopendir, use existing handle to re-open directory
	with valid flags.  Rename fd to cfd.  Use only if no valid incoming fd.
	(fhandler_cygdrive::opendir): Accommodate new parameter.
	* fhandler_process.cc (fhandler_process::opendir): Ditto.
	* fhandler_procnet.cc (fhandler_procnet::opendir): Drop definition.
	* fhandler_virtual.cc (fhandler_virtual::opendir): Accommodate new
	parameter.  Only create new file descriptor entry if called from
	opendir.  Remove duplicated setting of dir->__flags.
	* posix.sgml: Add fdopendir to list of implemented Solaris functions.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/dirent.h: Declare fdopendir.
2007-06-29 15:13:01 +00:00
Brian Dessent 64fdc12ed5 * include/cygwin/version.h: Fix comment typo. 2007-06-28 22:45:49 +00:00
Corinna Vinschen 3e96da0b53 * cygwin.din: Export stpcpy, stpncpy.
* posix.sgml: Add stpcpy and stpncpy to list of implemented
	GNU extensions.
	* include/cygwin/version.h: Bump API minor number.
2007-06-28 17:55:01 +00:00
Corinna Vinschen 41391cb2bb * shared_info.h (SHARED_INFO_CB): Accommodate change to shared_info.
(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Add heap_slop_inited member.
	* shared.cc (shared_info::heap_slop_size): Use heap_slop_inited to
	track initializing heap_slop since 0 is a valid value for heap_slop.
	Drop useless < 0 consideration.
2007-06-27 17:08:19 +00:00
Eric Blake 048e00e01d * assert.cc (__assert_func): New function, to match newlib header
change.
	* cygwin.din: Export __assert_func.
	* include/cygwin/version.h: Bump API minor number.
2007-06-27 12:46:35 +00:00
Corinna Vinschen a71ecb55de * autoload.cc (WSAIoctl): Remove.
* cygwin.din: Export freeifaddrs, getifaddrs.
	* fhandler_socket.cc (fhandler_socket::ioctl): Drop SOCKET parameter
	from get_ifconf.
	* net.cc: Include ifaddrs.h.
	(in_are_prefix_equal): Match addresses in network byte order.
	(ip_addr_prefix): Convert address into host byte order before
	testing with IN_LOOPBACK.
	(struct ifall): Define.
	(get_xp_ifs): Replace get_xp_ifconf.  Return struct ifall array.
	(get_2k_ifs): Ditto, replace get_2k_ifconf.
	(get_nt_ifs): Ditto, replace get_nt_ifconf.
	(getifaddrs): New function.
	(freeifaddrs): New function.
	(get_ifconf): Call matching get_XX_ifs function and create
	ifc content from here.  Drop lo fake since it's now in get_nt_ifs.
	* posix.sgml: Add freeifaddrs and getifaddrs to list of implemented
	BSD functions.
	* wincap.h (wincapc::has_broken_if_oper_status): New element.
	* wincap.cc: Implement above element throughout.
	* include/ifaddrs.h: New file.
	* include/cygwin/version.h: Bump API minor number.
2007-06-21 15:57:54 +00:00
Corinna Vinschen d3c73d4999 * cygwin.din: Export exp10, exp10f, pow10, pow10f, strcasestr,
funopen, fopencookie.
	* include/cygwin/version.h: Bump API minor number.
	* posix.sgml: Minor improvements.
2007-06-21 07:22:16 +00:00
Corinna Vinschen 9cc40d5d16 * include/cygwin/if.h (IFF_POINTOPOINT): Fix typo. 2007-06-20 09:28:47 +00:00
Christopher Faylor 4a2c88cdc7 * include/search.h: Reinstate node_t definition.
* include/sys/cdefs.h: Remove in favor of newlib version.
2007-06-17 00:31:27 +00:00
Corinna Vinschen 8e4a60b383 * autoload.cc (GetIpForwardTable): Define.
* fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFDSTADDR.
	* net.cc (get_routedst): New static function to get destination
	address of point-to-point interfaces.
	(get_xp_ifconf): Handle SIOCGIFDSTADDR.
	(get_2k_ifconf): Ditto.
	(get_nt_ifconf): Ditto.
	(get_ifconf): Ditto.
	* include/asm/socket.h (SIOCGIFDSTADDR): Define.
	* include/cygwin/if.h (struct ifreq): Add ifru_dstaddr member.
	(ifr_dstaddr): Define.
	* include/cygwin/in.h: Cast ipv4 addresses correctly to in_addr_t in
	definitions.
2007-06-14 16:02:32 +00:00
Christopher Faylor ecd5f070c8 * signal.cc (usleep): Use useconds_t for the type as per POSIX. 2007-06-12 20:49:48 +00:00
Corinna Vinschen ead5b131e0 * Makefile.in (DLL_OFILES): Add xsique.o.
* cygwin.din (confstr): Make NOSIGFE.
	(insque): Export.
	(remque): Export.
	* lsearch.cc: Remove superfluous _SEARCH_PRIVATE define.
	* posix.sgml: Move insque to defined SUSv3 interfaces.  Remove
	comment for remque.
	* include/search.h: Remove _SEARCH_PRIVATE guarded definitions.
	Add struct qelem definition.  Add insque and remque declarations.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/queue.h: Remove insque/remque definitions so as not
	to collide with SUSv3 compatible declaration in search.h.
	* libc/xsique.cc: New file implementing insque and remque.
2007-06-12 15:24:46 +00:00
Corinna Vinschen 5ef61dd044 * fhandler.cc (fhandler_base::fstat): Set pipe permission bits more
correctly.
2007-06-12 08:28:44 +00:00
Corinna Vinschen 1570432db3 * cygwin.din (confstr): Export.
* posix.sgml (confstr): Move to list of implemented SUSv3 functions.
	* sysconf.cc (confstr): Implement.
	* include/cygwin/version.h: Bump API minor number.
2007-06-11 17:38:27 +00:00
Corinna Vinschen 32a2c31a83 * ansi.sgml: Delete.
* misc-std.sgml: Delete.
	* posix.sgml: Rework entirely.
2007-06-05 10:10:16 +00:00
Corinna Vinschen ad4e943fca * dtable.cc (dtable::set_file_pointers_for_exec): Call SetFilePointer
correctly for 64 bit file access.  Comment out functionality.
	* fhandler.cc (fhandler_base::open): Don't set append_mode.
	(fhandler_base::write): Check for O_APPEND instead of append_mode.
	Call SetFilePointer correctly for 64 bit file access.  Handle
	errors from SetFilePointer.
	* fhandler.h (class fhandler_base): Drop append_mode status flag.
	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Handle
	seeking correctly for 64 bit file access.
2007-05-29 17:25:36 +00:00
Corinna Vinschen 04396e79d2 * path.cc (cwdstuff::set): Revert useless acquire check. 2007-05-22 13:03:43 +00:00
Corinna Vinschen 542a6016e5 * path.cc (cwdstuff::set): Avoid double aquiring of cwd_lock.
Open directory with inheriting enabled.
2007-05-22 12:43:31 +00:00
Corinna Vinschen ba75e8c878 * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Don't invalidate
devbuf if new position is within buffered range.
2007-05-22 07:16:19 +00:00
Corinna Vinschen 8e563c2741 * include/search.h (hsearch_r): Provide declaration. 2007-05-21 13:34:12 +00:00
Corinna Vinschen b7a37e8d7c * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Set buf size to
sector size.  Simplify non-sector aligned case.  Handle errors from
	raw_read.
2007-05-21 09:11:27 +00:00
Corinna Vinschen f9a963b8a0 * fhandler_socket.cc (adjust_socket_file_mode): New inline function.
(fhandler_socket::fchmod): Squeeze mode through adjust_socket_file_mode
	before using it.
	(fhandler_socket::bind): Ditto.
2007-05-15 16:33:20 +00:00
Christopher Faylor 90c2ba7806 * path.cc (fs_info::update): Set and use is_cdrom.
* path.cc (fillout_mntent): Set ret.mnt_type to something more Linux-like,
based on data from fs_info.  Move "system" and "user" strings from mnt_type to
mnt_opts.
* path.h (struct fs_info): Add is_cdrom field.
* path.h (fs_info::clear): Initialize is_cdrom.
* path.h (struct fs_info): Add IMPLEMENT_STATUS_FLAG(bool,is_cdrom).
* path.h (class path_conv): Add fs_is_cdrom method.  Add missing fs_is_netapp
method.
2007-05-15 01:27:30 +00:00
Christopher Faylor 22ed94e503 * cygwin.din (asnprintf, dprint, _Exit, vasnprintf, vdprintf): Export.
* include/cygwin/version.h: Bump API minor number.
2007-05-15 01:23:30 +00:00
Christopher Faylor 5682d0f1a7 * include/cygwin/time.h: Use __cdecl on declaration. Remove
declarations which are duplicated in include/time.h.
2007-04-27 13:34:25 +00:00
Brian Dessent 09e5bb8e60 * cygwin.sc: Remove duplicated .debug_macinfo section.
* dllfixdbg: Also copy DWARF-2 sections into .dbg file.
2007-04-18 13:11:35 +00:00
Corinna Vinschen bde9647c6a * include/stdint.h (WINT_MIN): Fix sign. 2007-04-06 08:25:28 +00:00
Corinna Vinschen 26631d2144 * include/stdint.h (WINT_MIN, WINT_MAX): Fix definition. 2007-04-04 07:37:53 +00:00
Christopher Faylor e7fd6e5738 * cygwin/external.cc (cygwin_internal): Implement CW_SET_DOS_FILE_WARNING.
* cygwin/include/sys/cygwin.h: Define CW_SET_DOS_FILE_WARNING.
* utils/mount.cc (main): Turn dos file warnings off since we know what we're
doing.
2007-03-30 13:36:06 +00:00
Corinna Vinschen e6fbf13e48 * cygheap.cc (cygheap_init): Fix formatting. Remove comment. Set
shared_prefix depending only on terminal service capability.
	* dcrt0.cc (dll_crt0_1): Don't call set_cygwin_privileges here.
	* fhandler_fifo.cc (fhandler_fifo::open): Create the mutex as global
	object.
	* posix_ipc.cc (ipc_mutex_init): Use cygheap->shared_prefix.
	(ipc_cond_init): Ditto.
	* sec_helper.cc (privilege_name): Make static.  Use LookupPrivilegeName
	directly to be independent of the state of cygheap.
	(set_privilege): Take a LUID as parameter instead of an index value.
	Only print debug output in case of failure.
	(set_cygwin_privileges): Add comment.  Use LookupPrivilegeValue to
	get privilege LUIDs.
	(init_global_security): Call set_cygwin_privileges here.
	* security.h (privilege_name): Drop declaration.
	(set_privilege): Declare according to above change.
	(set_process_privilege): Call privilege_luid to get LUID.
	(_push_thread_privilege): Ditto.
	* shared.cc (open_shared): Add comment.  On systems supporting the
	SeCreateGlobalPrivilege, try to create/open global shared memory first.
	Fall back to local shared memory if that fails.
	* thread.cc (semaphore::semaphore): Use cygheap->shared_prefix.
	* wincap.h (wincapc::has_create_global_privilege): New element.
	* wincap.cc: Implement above element throughout.
2007-03-29 16:37:36 +00:00
Christopher Faylor 2319775273 * spawn.cc (spawn_guts): Start pure-windows processes in a suspended state to
avoid potential DuplicateHandle problems.
2007-03-28 14:34:24 +00:00
Corinna Vinschen bfb968cefd Fix typo. 2007-03-13 13:39:27 +00:00
Corinna Vinschen 15823b9d62 * include/cygwin/stat.h (S_TYPEISSHM, S_TYPEISSEM, S_TYPEISSHM):
Avoid compiler warnings.
2007-03-13 13:22:00 +00:00
Christopher Faylor b8804b1ecd * signal.cc (handle_sigprocmask): Remove extraneous sig_dispatch_pending. 2007-03-07 21:51:27 +00:00
Corinna Vinschen fcdca88165 * fhandler_proc.cc: Fix formatting. Drop setting errno when creating
proc file content.
	(format_proc_uptime): Simplify.
	(format_proc_cpuinfo): Align more closely to output of Linux 2.6 kernel.
	Evaluate more data, especially for AMD CPUs.
2007-03-07 14:03:29 +00:00
Corinna Vinschen 2213ad419b Fix log entry. 2007-03-06 16:35:45 +00:00
Corinna Vinschen 7113f5da75 Add accidentally missing checkins.
* fhandler.h (fhandler_base::fstat_helper): Add creation time parameter.
	* glob.cc (stat32_to_stat64): Set st_birthtim to st_mtim.
2007-03-06 16:29:40 +00:00
Corinna Vinschen 74652ce13e * include/cygwin/stat.h (S_TYPEISMQ): Define.
(S_TYPEISSEM): Dttio.
	(S_TYPEISSHM): Ditto.
2007-03-06 14:56:44 +00:00
Corinna Vinschen 70de8290c8 * fhandler_mailslot.cc (fhandler_mailslot::fstat): Set new stat member
st_birthtim to useful value.
	* fhandler_process.cc (fhandler_process::fstat): Ditto.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Take
	additional parameter for creation time.  Fill st_birthtim with it.
	Accomodate additional creation time parameter throughout.
	* fhandler_raw.cc (fhandler_dev_raw::fstat): Set new stat member
	st_birthtim to useful value.
	* fhandler.cc (fhandler_base::fstat): Ditto.
	* fhandler_registry.cc (fhandler_registry::fstat): Ditto.
	* include/cygwin/version.h: Bump API minor number.
	* include/cygwin/stat.h (struct __stat64): Replace st_spare4 with
	timestruc_t st_birthtim.
	(struct stat): Ditto if __CYGWIN_USE_BIG_TYPES__ is defined.
	(st_birthtime): Define if __CYGWIN_USE_BIG_TYPES__ is defined.
2007-03-06 14:48:25 +00:00
Corinna Vinschen 788e7da136 * ntdll.h (struct _OBJECT_NAME_INFORMATION): Define.
* syscalls.cc (unlink_nt): Check shared directory for being empty
	before trying to move and mark for deletion.
2007-03-02 20:04:26 +00:00
Corinna Vinschen 3532877889 * security.cc (get_file_attribute): Avoid compiler warning. 2007-03-02 19:54:20 +00:00
Christopher Faylor e943a1a37e * fork.cc (fork): Reset child to true after fork since it may have been reset
by fork memory copies.
2007-03-01 18:43:38 +00:00
Christopher Faylor 6e070c257c * Makefile (DLL_OFILES): Remove ntea.o
* environ.cc (set_ntea): Delete.
(parse_thing): Delete "ntea" setting.
* fhandler.cc (fhandler_base::open): Remove allow_ntea considerations.
(check_posix_perm): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Ditto.
(fhandler_base::open_fs): Ditto.
(fhandler_disk_file::mkdir): Ditto.
* path.cc (symlink_worker): Ditto.
* security.cc (get_file_attribute): Ditto.
(set_file_attribute): Ditto.
* security.h: Remove allow_ntea declaration.
2007-03-01 15:13:47 +00:00
Corinna Vinschen 40303ac9de * path.cc (close_user_proc_parms_cwd_handle): Remove.
(cwdstuff::init): Don't call close_user_proc_parms_cwd_handle.
	Call set to set cwd with all-sharing handle.
	(cwdstuff::set): Fix comment.  Don't close cwd handle.  Set in
	user parameter block instead and close old cwd handle.
	* syscalls.cc (rename): Call unlink_nt instead of RemoveDirectory or
	DeleteFile to allow deleting shared files/directories.
2007-02-27 18:38:22 +00:00
Corinna Vinschen 3323df7e0e * fhandler.cc(fhandler_base::open): Open with READ_CONTROL only in
case of query_open flag set to query_read_control.  Add case for
	new query_read_attributes flag.
	(fhandler_base::fstatvfs): New method.
	* fhandler.h (enum query_state): Add query_read_attributes flag.
	(class fhandler_base): Declare new virtual fstatvfs method.
	(class fhandler_socket): Ditto.
	(class fhandler_pipe): Ditto.
	(class fhandler_fifo): Ditto.
	(class fhandler_disk_file): Ditto.
	(class fhandler_virtual): Ditto.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Open with
	query_read_attributes instead of query_read_control.
	(fhandler_disk_file::fstatvfs): New method.
	(fhandler_disk_file::facl): Open with query_read_attributes instead of
	query_read_control.
	* fhandler_fifo.cc (fhandler_fifo::fstatvfs): New method.
	* fhandler_socket.cc (fhandler_socket::fstatvfs): New method.
	(fhandler_socket::fchmod): Return with EBADF in the default case.
	(fhandler_socket::fchown): Ditto.
	(fhandler_socket::facl): Ditto.
	* fhandler_virtual.cc (fhandler_virtual::fstatvfs): Ditto.
	* ntdll.h (struct _FILE_FS_ATTRIBUTE_INFORMATION): Define.
	(struct _FILE_FS_FULL_SIZE_INFORMATION): Define.
	* pipe.cc (fhandler_pipe::fstatvfs): New method.
	* syscalls.cc (fstatvfs): Just call the fhandler's fstatvfs.
	(statvfs): Ditto.
	(fstatfs): Call fstatvfs.
	(statfs): Drop EFAULT handling.
2007-02-27 12:58:56 +00:00
Corinna Vinschen 139654836c * fhandler.cc (fhandler_base::fstat): Set all file times to arbitrary
fixed value.
2007-02-26 14:19:00 +00:00
Corinna Vinschen 14e06cca26 * fhandler_registry.cc (registry_listing): Drop name of HKEY_DYN_DATA.
(registry_keys): Drop HKEY_DYN_DATA.
	* net.cc: Fix comment.
	* syslog.cc: Ditto.
2007-02-26 12:39:25 +00:00
Corinna Vinschen 457c7938f0 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Drop comment.
* mmap.cc (gen_access): Remove.
	(mmap_record::gen_access): Remove.
	(mmap64): Don't mention 9x any longer.
	* syscalls.cc (statvfs): Drop status code consideration for 9x.
	* libc/minires-os-if.c (get_registry_dns_items): Don't mention 9x any
	longer.
	(get_registry_dns): Drop getting registry key on 9x.  Drop is9x
	variable.
2007-02-26 12:22:41 +00:00
Corinna Vinschen a76877e977 Throughout remove all usage of wincap.has_security.
* environ.cc (environ_init): Drop setting allow_ntsec here.
	* grp.cc (initgroups32): Drop usage of label "out".
	* security.cc (allow_ntsec): Set to true by default.
	* syscalls.cc (seteuid32): Remove label success_9x.
	* wincap.cc: Remove has_security throughout.
	* wincap.h: Ditto.
2007-02-23 15:15:50 +00:00
Corinna Vinschen 9fa43ff6c6 * fhandler.h (class fhandler_pipe): Remove members writepipe_exists,
orig_pid and id.  Make hit_eof inline.
	* fhandler_fifo.cc (fhandler_fifo::open): Drop handling of
	writepipe_exists, orig_pid and id.
	* pipe.cc: Ditto throughout.
	(pipecount): Remove.
	(pipeid_fmt): Remove.
	(fhandler_pipe::hit_eof): Simplify.  Move to fhandler.h.
	(fhandler_pipe::dup): Drop leave label.
	(fhandler_pipe::create): Drop has_unreliable_pipes case.
	* wincap.cc: Remove has_unreliable_pipes throughout.
	* wincap.h: Ditto.
2007-02-23 14:47:45 +00:00
Corinna Vinschen 296a8a6369 * devices.in: Change native device name to native NT device name for
/dev/null, /dev/comX and /dev/ttySx.
	* devices.cc: Regenerate.
	* fhandler.cc (fhandler_base::open_9x): Remove.
	(fhandler_base::open): Don't test for DOS device name, don't call
	open_9x.
	(fhandler_dev_null::open): Remove.
	* fhandler.h (class fhandler_base): Drop open_9x declaration.
	(class fhandler_dev_null): Drop open declaration.
2007-02-23 14:20:28 +00:00
Corinna Vinschen b5cb5c9e64 * fhandler_console.cc (fhandler_console::need_invisible): Drop
pty_needs_alloc_console check.
	* spawn.cc (spawn_guts): Ditto.
	(av::fixup): Remove setting iscui.
	* syscalls.cc (rename): Drop has_move_file_ex checks.  Remove 9x
	specific code.
	* wincap.cc: Remove has_move_file_ex and pty_needs_alloc_console
	throughout.
	* wincap.h: Ditto.
2007-02-23 12:01:52 +00:00
Corinna Vinschen aaee2ffaed * exceptions.cc (dummy_ctrl_c_handler): Remove.
(init_console_handler): Drop has_null_console_handler_routine checks.
	* fhandler_raw.cc (fhandler_dev_raw::open): Drop has_raw_devices check.
	* fhandler_serial.cc (fhandler_serial::open): Drop
	.supports_reading_modem_output_lines check.
	* miscfuncs.cc (low_priority_sleep): Drop has_switch_to_thread check.
	* shared.cc (open_shared): Drop needs_memory_protection checks.
	* spawn.cc (spawn_guts): Drop start_proc_suspended check.
	* uname.cc (uname): Drop has_valid_processorlevel check.
	* wincap.cc: Remove has_raw_devices, has_valid_processorlevel,
	supports_reading_modem_output_lines, needs_memory_protection,
	has_switch_to_thread, start_proc_suspended and
	has_null_console_handler_routine throughout.
	* wincap.h: Ditto.
2007-02-23 10:51:59 +00:00
Corinna Vinschen 0ed760d75e * fhandler.cc (fhandler_base::lseek): Drop 9x considerations.
* fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto.
	* wincap.cc: Remove lock_file_highword and has_64bit_file_access
	throughout.
	* wincap.h: Ditto.
2007-02-23 09:49:49 +00:00
Corinna Vinschen 8e17bd8685 * cygheap.h (struct cwdstuff): Remove sync member and keep_in_sync
accessors.
	* external.cc (cygwin_internal): Drop call to cygheap->cwd.keep_in_sync.
	* fhandler_disk_file.cc (fhandler_disk_file::link): Always presume
	ability to create hard links.
	* path.cc (cwdstuff::init): Drop 9x considerations.
	(cwdstuff::keep_in_sync): Remove.
	(cwdstuff::set): Take NT for granted.
	* pinfo.h (cygwin_pid): Just return pid.
	* wincap.cc: Remove has_hard_links, can_open_directories,
	has_negative_pids, has_named_pipes, has_try_enter_critical_section,
	cant_debug_dll_entry and detect_win16_exe throughout.
	* wincap.h: Ditto.
2007-02-22 18:01:13 +00:00
Corinna Vinschen 3af640487f * fhandler_console.cc (fhandler_console::read): Drop 9x specific
handling of AltGr key.
	* mmap.cc: Take NT for granted throughout.
	* wincap.cc: Remove map_view_of_file_ex_sucks, altgr_is_ctrl_alt,
	has_working_copy_on_write, share_mmaps_only_by_name,
	virtual_protect_works_on_shared_pages, has_mmap_alignment_bug and
	has_working_virtual_lock throughout.
	* wincap.h: Ditto.
2007-02-22 17:35:14 +00:00
Corinna Vinschen eef57fe1e3 * fhandler.cc (fhandler_base::set_no_inheritance): Always use
SetHandleInformation.
	* fhandler_disk_file.cc (fhandler_disk_file::lock): Always use
	UnlockFileEx/LockFileEx functions.
	* net.cc (fdsock): Don't bother to duplicate socket for inheritance.
	* sysconf.cc (get_nproc_values): Take NT for granted.
	(get_avphys): Ditto.
	* syslog.cc (WIN95_EVENT_LOG_PATH): Remove define.
	(get_win95_event_log_path): Remove.
	(vsyslog): Fix formatting.  Take NT for granted.
	* wincap.cc: Remove has_lock_file_ex, has_signal_object_and_wait,
	has_eventlog, has_set_handle_information,
	has_set_handle_information_on_console_handles and supports_smp
	throughout.
	* wincap.h: Ditto.
2007-02-22 17:09:46 +00:00
Corinna Vinschen 64f211c87c Fix typo. 2007-02-22 16:33:44 +00:00
Corinna Vinschen 03d5ce6d08 * dir.cc (rmdir): Move existance check in front of
has_dot_last_component check.  Simply setting errno in latter case.
2007-02-22 16:32:39 +00:00
Corinna Vinschen e9095199cc * fhandler.cc (fhandler_base::write): Remove wincap.has_lseek_bug case.
Simplify seek beyond EOF case.
	* times.cc (times): Remove wincap.has_get_process_times case.
	* wincap.cc: Remove has_delete_on_close, has_page_guard,
	has_get_process_times and has_lseek_bug throughout.
	* wincap.h: Ditto.
2007-02-22 16:22:38 +00:00
Corinna Vinschen 501f1020f9 Throughout remove all usage of wincap.access_denied_on_delete.
* dir.cc (rmdir): Add existance check to be errno-compatible with Linux.
	* fhandler_disk_file.cc (fhandler_disk_file::rmdir): Drop test for
	non-existent dir on 9x share.
	* syscalls.cc (unlink): Add comment.
	* wincap.cc: Remove access_denied_on_delete flag throughout.
	* wincap.h: Ditto.
2007-02-22 16:04:19 +00:00
Corinna Vinschen e387a378b4 * fhandler_disk_file.cc (fhandler_disk_file::closedir): Fix bug
introduced by switching to NtClose.
2007-02-22 15:07:21 +00:00
Christopher Faylor 39fc0d36ae * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Change sense of guard test.
Increase size of stack reserved and increase size before the current stack
pointer.  Use pointers when doing arithmetic.
(dll_crt0_1): Initialize exception handler when we notice we're the child of a
fork from non-main thread.
* fork.cc (frok::parent): Make argument volatile.
(frok::child): Ditto.
(lock_signals): New class.
(lock_pthread): Ditto.
(hold_everhthing): Ditto.
(frok::parent): Move atforkprepare and atforkparent to lock_pthread class.
(fork): Make ischild boolean.  Use hold_everything variable within limited
scope to set various mutexes in such a way as to avoid deadlocks.
* thread.h (pthread_mutex::tid): New variable, active when debugging for
tracking thread id of owner.
(pthread_mutex::set_owner): Set tid when debugging.
* thread.cc (pthread_mutex::pthread_mutex): Clear tid.
(pthread_mutex::_unlock): Ditto when unlocking.
(pthread_mutex::fixup_after_fork): Set tid to special value after forking since
owner is unknown.
2007-02-22 12:34:55 +00:00
Corinna Vinschen bd8f891e8a Throughout replace all usage of wincap.shared with the constant
FILE_SHARE_VALID_FLAGS.
	* fhandler.cc (fhandler_base::open_9x): Drop local variable shared.
	* wincap.cc: Remove shared member throughout.
	* wincap.h: Ditto.
2007-02-22 11:17:01 +00:00
Corinna Vinschen 570858c30f * Makefile.in (DLL_IMPORTS): Add libntdll.a.
* autoload.cc: Remove all symbols from advapi32.dll, kernel32.dll and
	ntdll.dll available on all platforms since NT4.

	Throughout remove all usage of wincap.is_winnt.
	* dcrt0.cc (dll_crt0_0): Remove call to mmap_init.
	* fhandler.h (class fhandler_base): Remove has_changed flag.
	(fhandler_disk_file::touch_ctime): Remove declaration.
	(fhandler_disk_file::readdir_9x): Ditto.
	(fhandler_disk_file::touch_ctime): Remove.
	(fhandler_disk_file::readdir_9x): Remove.
	(fhandler_disk_file::closedir): Call NtClose instead of CloseHandle.
	* mmap.cc: Throughout call CreateMapping and MapView directly.
	(VirtualProt9x): Remove.
	(VirtualProtNT): Remove.
	(VirtualProtEx9x): Remove.
	(VirtualProtExNT): Remove.
	(VirtualProtect): Remove define.
	(VirtualProtectEx): Remove define.
	(CreateMapping9x): Remove.
	(CreateMappingNT): Rename to CreateMapping.
	(MapView9x): Remove.
	(MapViewNT): Rename to MapView.
	(struct mmap_func_t): Remove definition.
	(mmap_funcs_9x): Remove.
	(mmap_funcs_nt): Remove.
	(mmap_func): Remove.
	(mmap_init): Remove.
	* net.cc (getdomainname): Drop comment. Use NT4 registry key only.
	(get_95_ifconf): Remove.
	* pinfo.cc (winpids::enumNT): Rename to winpids::enum_processes.
	(winpids::enum9x): Remove.
	(winpids::set): Just call enum_processes directly.
	(winpids::enum_init): Ditto.
	* pinfo.h (class winpids): Drop enum_processes pointer.  Rename
	enumNT to enum_processes.  Drop enum9x declaration.  Drop initialization
	of enum_processes throughout.
	* registry.cc (get_registry_hive_path): Just create NT key.
	(load_registry_hive): Only load NT specific file.
	* syscalls.cc (unlink_9x): Remove.
	(unlink): Just call unlink_nt.
	* wincap.cc: Remove is_winnt flag throughout.
	* wincap.h: Ditto.
	* winsup.h: Remove mmap_init declaration.
2007-02-22 10:54:47 +00:00
Corinna Vinschen bc455088cf * wincap.cc (wincap_unknown): Change settings for unknown to reflect
the capabilities of NT4.
	(wincap_95): Remove.
	(wincap_95osr2): Remove.
	(wincap_98): Remove.
	(wincap_98se): Remove.
	(wincap_me): Remove.
	(wincap_nt3): Remove.
	(wincapc::init): Temporarily bail out on any 9x system.
2007-02-21 15:18:07 +00:00
Corinna Vinschen 8fbd574ef0 * cygwin.din (sem_unlink): Export.
* posix_ipc.cc: Include thread.h and semaphore.h.  Remove TODO
	comment.
	(ipc_names): Add max_len member.  Set to maximum length of the path
	before tacking on the prefix path.  Set prefix path for named semaphors
	to /dev/shm, as on Linux.
	(enum ipc_type_t): Change sem to semaphore to avoid name conflicts.
	(check_path): Detect empty paths.  Use ipc_names's max_len member.
	Use __small_sprintf to create full object path name.  Special case
	semaphores.
	(ipc_cond_init): Drop superfluous strcpy.
	(class ipc_flock): New class to simplify file locking in subsequent
	code.
	(struct mq_hdr): Raise size of mqh_uname to allow adding a unique
	LUID to the name.
	(mq_open): Fix formatting.  Create unique synchronization object names
	using AllocateLocallyUniqueId.
	(struct sem_finfo): New structure defining named semaphore file content.
	(sem_open): Move here.  Rework implementation to allow kernel
	persistent implementation of POSIX named semaphores.
	(_sem_close): Implement sem_close.
	(sem_close): Move here.  Just call _sem_close with do_close parameter
	set to true.
	(sem_unlink): New function.
	* pthread.cc (mangle_sem_name): Remove.
	(sem_open): Move to posix_ipc.cc.
	(sem_close): Ditto.
	* syscalls.cc (close_all_files): Call semaphore::terminate here.
	* thread.cc: Fix formatting.  Rearrange semaphore functions so that
	they are close together.
	(semaphore::semaphore): Rework to play nicely with new named semaphore
	implementation.
	(semaphore::_terminate): Call _sem_close if semaphore is a named
	semaphore.
	(semaphore::destroy): Don't destroy named semaphores.  Return EINVAL
	instead.
	(semaphore::close): Only destroy named semaphores.  Return EINVAL
	otherwise.
	(semaphore::open): Rework to play nicely with new named semaphore
	implementation.  Loop through existing semaphores to be able to
	return same sem_t pointer as a former call on the same named semaphore.
	(semaphore::getinternal): New function called from _sem_close.
	* thread.h (class List): Make mx and head public.
	(class semaphore): Fix formatting.  Align method declarations with
	implementation in thread.cc.  Add members used for named semaphores.
	(semaphore::terminate): New static method.
	* include/semaphore.h: Redefine SEM_FAILED.  Fix formatting.
	(sem_unlink): Add declaration.
	* include/cygwin/version.h: Bump API minor number.
2007-02-20 15:48:04 +00:00
Christopher Faylor d0cf179299 * exceptions.cc (_cygtls::signal_exit): Only call myself.exit when when
exit_state indicates that we've visited do_exit.
* sync.h (lock_process::lock_process): Use renamed exit_state -
ES_PROCESS_LOCKED.
* winsup.h: Rename ES_MUTO_SET to ES_PROCESS_LOCKED.
2007-02-20 14:31:26 +00:00
Corinna Vinschen 4997a508c8 * fhandler_socket.cc (fhandler_socket::bind): Remove printing wrong
errno in debug output.
2007-02-20 09:48:31 +00:00
Christopher Faylor 510a85cbf9 Remove extraneous whitespace.
* pinfo.cc (commune_process): Use default argument to lock_process.
* sigproc.cc: Update copyright.
* select.cc: Ditto.
2007-02-20 00:16:18 +00:00
Corinna Vinschen eb8a6636bf * posix_ipc.cc (mq_open): Avoid compiler warning. Initialize mqhdr
before using it in file exists case.
	* include/mqueue.h (mqd_t): Make non-pointer type.
2007-02-15 17:49:25 +00:00
Corinna Vinschen 93162be554 * posix_ipc.cc (ipc_mutex_init): Create global object name.
(ipc_cond_init): Ditto.
	(struct mq_hdr): Add mqh_uname member to store synchronization object
	name.
	(mq_open): Create unique synchronization object name and store in
	mq_hdr->mqh_uname.  Use this name in calls to ipc_mutex_init and
	ipc_cond_init.
2007-02-15 11:28:46 +00:00
Corinna Vinschen 7b487ba942 * Makefile.in (DLL_OFILES): Add posix_ipc.o.
* cygwin.din (mq_close): Export.
	(mq_getattr): Export.
	(mq_notify): Export.
	(mq_open): Export.
	(mq_receive): Export.
	(mq_send): Export.
	(mq_setattr): Export.
	(mq_timedreceive): Export.
	(mq_timedsend): Export.
	(mq_unlink): Export.
	* posix_ipc.cc: New file implementing the above functions.  Move
	shm_open and shm_unlink from syscalls.cc here.
	* sysconf.cc (sca): Set value of _SC_MQ_OPEN_MAX to MQ_OPEN_MAX,
	_SC_MQ_PRIO_MAX to MQ_PRIO_MAX, _SC_MESSAGE_PASSING to
	_POSIX_MESSAGE_PASSING.
	* include/limits.h (MQ_OPEN_MAX): Define.
	(MQ_PRIO_MAX): Define.
	* include/mqueue.h: New file.
	* include/cygwin/version.h: Bump API minor number.
2007-02-14 10:06:46 +00:00
Corinna Vinschen af52f2802f * include/cygwin/stdlib.h (valloc): Declare.
(memalign): Declare.
2007-02-13 18:55:49 +00:00
Corinna Vinschen 09928447ed * libc/minires-os-if.c (write_record): Handle DNS_TYPE_SRV and
some obsolete types.
2007-02-09 10:09:21 +00:00
Corinna Vinschen aafecff6a8 * syscalls.cc (check_shm): New static function to do path checking
common to shm_open and shm_unlink.  Check for /dev/shm existance.
	(shm_open): Call check_shm.
	(shm_unlink): Ditto.
2007-02-08 14:40:13 +00:00
Corinna Vinschen ce8bab5a92 * cygwin.din (shm_open): Export.
(shm_unlink): Export.
	* syscalls.cc (shm_open): New function.
	(shm_unlink): New function.
	* sysconf.cc (sca): Set value of _SC_SHARED_MEMORY_OBJECTS to
	_POSIX_SHARED_MEMORY_OBJECTS.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/mman.h (shm_open): Add prototype.
	(shm_unlink): Ditto.
2007-02-08 13:36:53 +00:00
Corinna Vinschen 0bce6570f0 * cygmalloc.h (__set_ENOMEM): Declare.
(MALLOC_FAILURE_ACTION): Call __set_ENOMEM.
	* malloc_wrapper.cc (malloc) Remove setting errno here.
	(realloc): Ditto.
	(calloc): Ditto.
	(memalign): Ditto.
	(valloc): Ditto.
	(posix_memalign): Save and restore errno.
2007-02-08 11:35:52 +00:00
Corinna Vinschen 5155321fbc * cygmalloc.h (MALLOC_FAILURE_ACTION): Move to correct #if branch. 2007-02-07 20:44:04 +00:00
Corinna Vinschen 59e3b6ca7d * cygmalloc.h (MALLOC_FAILURE_ACTION): Define empty.
* cygwin.din (posix_madvise): Export.
	(posix_memalign): Export.
	* fhandler.cc (fhandler_base::fpathconf): Return useful values in
	_PC_VDISABLE, _PC_SYNC_IO and _PC_SYMLINK_MAX cases.
	* malloc_wrapper.cc (malloc): Set errno here since it's not set in
	dlmalloc.c anymore.
	(realloc): Ditto.
	(calloc): Ditto.
	(memalign): Ditto.
	(valloc): Ditto.
	(posix_memalign): New function.
	* mmap.cc (posix_madvise): New function.
	* sysconf.cc (get_open_max): New function.
	(get_page_size): Ditto.
	(get_nproc_values): Ditto.
	(get_avphys): Ditto.
	(sc_type): New type.
	(sca): New array to map _SC_xxx options to sysconf return values.
	(sysconf): Reimplement using sca array.
	* include/limits.h: Add all missing values as defined by SUSv3.
	* include/pthread.h (PTHREAD_DESTRUCTOR_ITERATIONS): Move definition
	to sys/limits.h.
	(PTHREAD_KEYS_MAX): Ditto.
	* include/semaphore.h (SEM_VALUE_MAX): Ditto.
	* include/cygwin/stdlib.h (posix_memalign): Declare.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/mman.h: Add posix_madvise flags.
	(posix_madvise): Declare.
	* include/sys/termios.h (_POSIX_VDISABLE): Move definition to
	sys/limits.h.
2007-02-07 17:22:40 +00:00
Corinna Vinschen f82f801cd2 * fhandler_serial.cc (fhandler_serial::tcsetattr): Add support for
baud rates up to 3000000 baud.  Add missing 128K and 256K cases.
	(fhandler_serial::tcgetattr): Ditto.
	* include/sys/termios.h: Add baud rate definitions from B460800 up to
	B3000000.
2007-02-05 12:32:23 +00:00
Corinna Vinschen 9e9bc4e144 * syscalls.cc (unlink_nt): Add missing assignment in case NtClose fails. 2007-02-02 15:16:54 +00:00
Corinna Vinschen ee945cb382 Fix typo. 2007-02-01 17:13:31 +00:00
Corinna Vinschen 4815dd49bb * net.cc (ga_dup): New function, taken from ga_clone with v4-in-v6
mapping addition.
	(ga_clone): Just call ga_dup from here.
	(ga_duplist): New function to duplicate list of struct addrinfo.
	(ga_echeck): Don't check a_flags, it already happened in
	cygwin_getaddrinfo.
	(cygwin_freeaddrinfo): Always call ipv4_freeaddrinfo.
	(cygwin_getaddrinfo): Use new wincap.supports_all_posix_ai_flags
	flag rather than wincap.has_gaa_on_link_prefix.  Always duplicate
	WinSock's addrinfo list to a self-allocated list.  Handle AI_V4MAPPED
	for pre-Vista platforms supporting getaddrinfo.
	* wincap.h (wincapc::supports_all_posix_ai_flags): New element.
	* wincap.cc: Implement above element throughout.
	* include/netdb.h: Note how AI_ADDRCONFIG is not supported pre-Vista.
	Remove superfluous comment.
2007-02-01 15:54:40 +00:00
Corinna Vinschen 3281664245 * include/cygwin/socket.h: Add IPv6 socket options. 2007-02-01 10:04:45 +00:00
Corinna Vinschen 9cde55ad2d * net.cc (cygwin_getaddrinfo): Fix thinko in AI_ADDRCONFIG handling. 2007-01-31 15:30:42 +00:00
Corinna Vinschen c2decfdc8a * net.cc (cygwin_getaddrinfo): Check ai_flags for valid values.
Handle AI_NUMERICSERV.  Handle AI_ADDRCONFIG behaviour on Vista.
	* include/netdb.h (AI_NUMERICSERV): Add missing flag.
2007-01-31 15:10:22 +00:00
Corinna Vinschen c3772e717f * fhandler_disk_file.cc (fhandler_disk_file::closedir): Add dir name
to debug output.
	* syscalls.cc (try_to_bin): Enable code to move file to user specific
	recycler dir to eliminate Vista problem.
	(unlink_nt): Add comment that rename after opening for delete on close
	only fails on XP.
2007-01-31 10:55:59 +00:00
Corinna Vinschen 62d172bb49 * sigproc.cc (child_info::child_info): Set msv_count to non-zero
value only on systems requiring it.
2007-01-30 21:53:05 +00:00
Corinna Vinschen 291b2d8291 * include/ftw.h: Include sys/cdefs.h. 2007-01-28 11:27:05 +00:00
Corinna Vinschen b8d1550207 Fix typo. 2007-01-26 12:32:11 +00:00
Corinna Vinschen 3be6ababd8 * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Implement rmdir
on NT by calling unlink_nt.  Check for directory here.
	* syscalls.cc (try_to_bin): Fix buggy debug_printf statement.
	(unlink_nt): Make non-static.  Don't use delete-on-close semantics on
	directoires.  Explain why.
2007-01-26 12:25:23 +00:00
Corinna Vinschen e7fc99384e * net.cc (if_nametoindex): This time, really free IP_ADAPTER_ADDRESSES
memory.
	(if_indextoname): Ditto.
2007-01-24 15:55:51 +00:00
Corinna Vinschen fd1bf882f5 * security.h (pop_thread_privilege): Revert to previous state, not
to token used for impersonation.
2007-01-24 12:14:54 +00:00
Corinna Vinschen a0e1630add * cygheap.h (cygheap_user::deimpersonate): Always RevertToSelf. 2007-01-24 10:50:47 +00:00
Corinna Vinschen f28f68cc4f * net.cc (gai_errmap): Add EAI_OVERFLOW entry. Fix formatting.
(cygwin_gai_strerror): Drop using EAI_MAX.
	(w32_to_gai_err): Ditto.
	* include/netdb.h: Define EAI_OVERFLOW. Remove EAI_MAX.
2007-01-23 17:05:29 +00:00
Corinna Vinschen f7fee067b6 * include/netdb.h: Add AI_xxx flags available since Vista. 2007-01-23 15:56:13 +00:00
Corinna Vinschen 4b13fd15d4 * net.cc (if_nametoindex): Free IP_ADAPTER_ADDRESSES memory.
(if_indextoname): Ditto.
	(if_nameindex): Ditto.  Remove duplicate indexed entries in result.
2007-01-23 09:23:54 +00:00
Corinna Vinschen bff4389137 * autoload.cc (WSAIoctl): Define.
(SendARP): Define.
	* cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and
	if_nametoindex.
	* fhandler_procnet.cc: Drop including wchar.h.  Drop definitions of
	GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA.
	(fhandler_procnet::exists): Check for has_gaa_prefixes.  Call
	get_adapters_addresses here.
	(fhandler_procnet::readdir): Ditto.
	(prefix): Move to net.cc.
	(fhandler_procnet::fill_filebuf): Call get_adapters_addresses here.
	Simplify allocation.  Use AdapterName rather than FriendlyName as
	interface name.  Use IfIndex if available, Ipv6IfIndex otherwise.
	(in6_are_prefix_equal): Move to net.cc.
	* fhandler_socket.cc: Define old SIOCGxxx values.
	(CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one.
	(struct __old_ifreq): Define old struct ifreq.
	(fhandler_socket::ioctl): Handle old SIOCGxxx values.  Handle new
	SIOCGIFFRNDLYNAM command.  Simplify copying ifreq data to user space.
	Call get_ifconf with additional SOCKET parameter.
	* net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define.
	(IP_ADAPTER_ADDRESSES_LH): Define.
	(SIO_GET_INTERFACE_LIST): Define.
	(sockaddr_in6_old): Define.
	(sockaddr_gen): Define.
	(INTERFACE_INFO): Define.
	(IN_LOOPBACK): Define.
	(in_are_prefix_equal): New static function.
	(ip_addr_prefix): New function, replaces prefix function, add AF_INET
	handling.
	(GAA_FLAG_INCLUDE_ALL_INTERFACES): Define.
	(get_adapters_addresses): New function.
	(WS_IFF_xxx): Define Winsock interface flag values.
	(convert_ifr_flags): New function to convert Winsock interface flag
	values to Cygwin interface flag values.
	(get_xp_ifconf): New get_ifconf implementation for XP SP1 and above.
	(get_2k_ifconf): Fix interface index.  Fix formatting.
	(get_nt_ifconf): Fix formatting.
	(get_95_ifconf): Ditto.
	(get_ifconf): Take additional SOCKET parameter.  Call get_xp_ifconf
	on XP SP1 and above.
	(if_nametoindex): New function.
	(if_indextoname): New function.
	(if_nameindex): New function.
	(if_freenameindex): New function.
	(in6_are_prefix_equal): Moved here from fhandler_procnet.cc.
	* wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default.
	(wincapc::init): Assume has_osversioninfoex by default.  Call
	GetVersionEx with OSVERSIONINFOEX first.  Call with OSVERSIONINFO only
	if that fails.  Simplify NT4 case and try to avoid strcmp.  Check XP
	Service Pack using version.wServicePackMajor to avoid strcmp.
	* include/asm/socket.h (SIOCGIFFRNDLYNAM): Define.
	* include/cygwin/if.h: Fix formatting.
	(IFF_POINTTOPOINT): Define.
	(IFF_NOARP): Define.
	(IFF_LOWER_UP): Define.
	(IFF_DORMANT): Define.
	(struct if_nameindex): Define.
	(IFRF_FRIENDLYNAMESIZ): Define.
	(struct ifreq_frndlyname): Define.
	(IFNAMSIZ): Redefine as 44.
	(IF_NAMESIZE): Define.
	(struct ifreq): Redefine ifru_flags as int.  Define ifru_data.  Pad size
	to sizeof sockaddr_in6 for further extensions.
	(ifr_data): Define.
	(ifr_frndlyname): Define.
	(if_nametoindex): Declare.
	(if_indextoname): Declare.
	(if_nameindex): Declare.
	(if_freenameindex): Declare.
	* include/cygwin/version.h: Bump API minor number.
	(CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new
	ifreq structure.
2007-01-21 22:54:05 +00:00
Corinna Vinschen 45fa1f99c6 * spawn.cc (spawn_guts): Don't set cwd for non-Cygwin child processes
on NT to allow starting them in virtual directories.
2007-01-18 21:28:36 +00:00
Corinna Vinschen 2397d888b1 * mmap.cc (list::hash): Fix type to __ino64_t.
(list::get_hash): Ditto.
	(list::set): Add struct stat parameter.  Use that instead of calling
	fstat.
	(map::get_list_by_fd): Ditto.
	(map::add_list): Ditto.
	(mmap_is_attached_or_noreserve): Call get_list_by_fd appropriately.
	(mmap_worker): Add pameters for map list and file stat information.
	Propagate to called functions.
	(mmap64): Use fstat on files early.  Replace call to GetFileSize.
	Call get_list_by_fd and mmap_worker appropriately.
2007-01-18 17:15:59 +00:00
Corinna Vinschen 5ea0aee2ce * fhandler_procnet.cc: Drop declaration of htonl and ntohs. Include
asm/byteorder.h instead.
2007-01-18 10:30:43 +00:00
Corinna Vinschen 4eeaecbc18 * include/cygwin/in6.h: Drop inclusion of asm/byteorder.h.
* fhandler_procnet.cc: Declare htonl and ntohs here.
2007-01-18 10:25:40 +00:00
Corinna Vinschen 96d7dee2f0 * Makefile.in (DLL_OFILES): Add fhandler_procnet.o.
* autoload.cc (GetAdaptersAddresses): Define.
	* devices.h (FH_PROCNET): Define new device.
	* devices.in (dev_procnet_storage): Add "/proc/net" entry.
	* devices.cc: Regenerate.
	* dir.cc (readdir_worker): Use isproc_dev macro.
	* dtable.cc (build_fh_pc): Add FH_PROCNET.
	* fhandler.h (class fhandler_procnet): New class.
	* fhandler_proc.cc: Add "net" subdirectory handling.
	* fhandler_procnet.cc: New file handling "/proc/net" directory.
	* path.cc (isvirtual_dev): Move to path.h.
	* path.h (isproc_dev): New macro to identify /proc files by device.
	(isvirtual_dev): Moved here.  Define using isproc_dev.
	* syscalls.cc (unlink): Use isproc_dev macro.
	* wincap.h (wincapc::has_gaa_prefixes): New element.
	(wincapc::has_gaa_on_link_prefix): New element.
	* wincap.cc: Implement above elements throughout.
	(wincapc::init): Check XP for service pack and set has_gaa_prefixes
	appropriately.
	* include/cygwin/in6.h: Include asm/byteorder.h.
2007-01-17 19:26:58 +00:00
Corinna Vinschen 12ffdde350 * include/asm/socket.h (SIOGIFINDEX): Define. 2007-01-17 13:43:47 +00:00
Corinna Vinschen 9f3e3df961 * mmap.cc (MapView9x): Note possible uselessness of retrying.
(MapViewNT): Ditto.
	(mmap64): Fix pre-reservation to work for non NULL, non MAP_FIXED.
2007-01-17 10:49:24 +00:00
Corinna Vinschen cbe2437b28 * autoload.cc (RtlAnsiStringToUnicodeString): Define.
(RtlOemStringToUnicodeString): Define.
	* ntdll.h (struct _RTL_USER_PROCESS_PARAMETERS): Define.
	(struct _PEB): Redefine with a bit of content.
	(RtlAnsiStringToUnicodeString): Declare.
	(RtlOemStringToUnicodeString): Declare.
	* path.cc: Include ntdll.h.
	(_upp): New global variable pointing to user process parameter block.
	(get_user_proc_parms): New static function to retrieve user process
	parameter block.
	(close_user_proc_parms_cwd_handle): New function to close handle to
	current working directory in user process parameter block.
	(cwdstuff::init): Drop redundant declaration of dynamically_loaded.
	Set current dir only on 9x.  Call close_user_proc_parms_cwd_handle
	on NT instead.
	(cwdstuff::keep_in_sync): Only on 9x.
	(cwdstuff::set): Keep behaviour on 9x.  On NT write cwd path into user
	process parameter block and set cwd handle to NULL.  Fix comments to
	reflect new behaviour.
2007-01-16 18:01:06 +00:00
Corinna Vinschen 835fc32a3a * fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFINDEX.
* net.cc (get_2k_ifconf): Ditto.
	(get_nt_ifconf): Fake SIOCGIFINDEX.
	(get_95_ifconf): Ditto.
	(get_ifconf): Handle SIOCGIFINDEX.  Fake it for loopback on systems
	not supporting IP Helper Lib.
	* include/asm/socket.h (SIOCGIFINDEX): Define.
	* include/cygwin/if.h (struct ifreq): Add member for interface index.
	(ifr_ifindex): Define.
2007-01-16 12:01:36 +00:00
Corinna Vinschen 2fd167e6de * include/cygwin/in6.h (struct ipv6_mreq): Change type of interface
member to uint32_t.
	(struct in6_pktinfo): Ditto.
2007-01-16 11:41:55 +00:00
Corinna Vinschen 6281771f37 * include/cygwin/in.h (struct ip_mreq_source): Define.
(struct ip_msfilter): Define.
	(IP_MSFILTER_SIZE): Define.
	(struct in_pktinfo): Define.
	(struct group_req): Define.
	(struct group_source_req): Define.
	(struct group_filter): Define.
	(GROUP_FILTER_SIZE): Define.
	(INADDR_ALLRTRS_GROUP): Define.
	* include/cygwin/socket.h: Define protocol agnostic multicast options.
2007-01-16 11:37:05 +00:00
Corinna Vinschen 153995f846 * CYGWIN_LICENSE: Fix web pages and contact information. 2007-01-15 12:19:01 +00:00
Corinna Vinschen 362359bd10 * ntdll.h: Adjust status definitions. 2007-01-15 11:11:37 +00:00
Corinna Vinschen 5d93eb069e * cygheap.cc (cygheap_init): Add TODO comment. 2007-01-15 11:01:23 +00:00
Corinna Vinschen 5d1dd9308d * ntdll.h (STATUS_SHARING_VIOLATION): Define. 2007-01-15 10:52:15 +00:00
Corinna Vinschen a0638e5e67 * syscalls.cc (unlink_nt): Don't move files to recycle bin which are
not in use.
2007-01-13 20:56:01 +00:00
Christopher Faylor b3f40a5fd0 * glob.cc: Update copyright notice with latest from FreeBSD.
(glob0): Use correct type for c variable to propagate previously detected
protection.
2007-01-13 07:10:14 +00:00
Corinna Vinschen f51b396579 * cygheap.cc (_csbrk): Fix off-by-one error.
* cygwin.sc: Give .cygheap a minimum size of 512K.
2007-01-12 19:40:20 +00:00
Christopher Faylor 5f77729c30 * external.cc (sync_winenv): Use cur_environ () rather than __cygwin_environ. 2007-01-12 15:40:13 +00:00
Corinna Vinschen 0b7c56a5f5 * fork.cc (child_copy): Add missing Windows PID in debug output. 2007-01-12 15:26:02 +00:00
Corinna Vinschen ee4370fd29 * syscalls.cc: Update copyright. 2007-01-12 14:16:42 +00:00
Corinna Vinschen 3452cdd3c5 * mmap.cc (mmap64): Pre-Reserve space for the whole mapping to get a
useful, valid address before the actual mappings take place.
	Fix typo in comment.
2007-01-10 09:30:38 +00:00
Corinna Vinschen ac924d61de * syscalls.cc (sync): Use b_drive for B: drive (Thanks to Howard Chu). 2007-01-10 09:06:20 +00:00
Corinna Vinschen 1656b94637 * syscalls.cc (getpagesize): Change condition for clarity.
(getsystempagesize): Ditto.
2007-01-09 15:46:41 +00:00
Corinna Vinschen d5b45d2f38 * mmap.cc: Do bookkeeping in 4K pages, rather than in 64K chunks. 2007-01-09 11:18:57 +00:00
Corinna Vinschen 6bcc8fd7b1 * security.h (setacl): Add parameter for writability flag.
* sec_acl.cc (setacl): Ditto.  Set to true if any ACE with write
	permissions is created.
	* fhandler_disk_file.cc (fhandler_disk_file::facl): Reset
	FILE_ATTRIBUTE_READONLY if ACL contains an ACE with write permissions.
2007-01-07 12:44:10 +00:00
Corinna Vinschen 7ce031f211 * include/strings.h: Don't include string.h. Only declare functions
according to SUSv3.
2007-01-05 15:09:22 +00:00
Corinna Vinschen 0a9e977f62 (get_ifconf): Set MTU for loopback to more correct value. 2007-01-04 10:48:57 +00:00
Corinna Vinschen bcdf742178 * fhandler_socket.cc (fhandler_socket::ioctl): Don't fake results
for SIOCGIFFLAGS here.  Call get_ifconf instead.
	* net.cc (get_2k_ifconf): Clean up code to generate interface name.
	Handle SIOCGIFFLAGS here.
	(get_nt_ifconf): Fake SIOCGIFFLAGS here.
	(get_95_ifconf): Ditto.
	(get_ifconf): Don't fake loopback on systems with IP Helper Lib.
	Set MTU for loopback to a more "modern" value.
2007-01-04 10:11:27 +00:00
Corinna Vinschen 7bef7db5cc * fhandler.h (PREFERRED_IO_BLKSIZE): Define as 64K.
* fhandler.cc (fhandler_base::fstat): Set st_blksize to
	PREFERRED_IO_BLKSIZE.
	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Ditto.
	* fhandler_mailslot.cc (fhandler_mailslot::fstat): Ditto.
	* fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto.
2007-01-04 09:17:55 +00:00
Corinna Vinschen 960725d6ed * ChangeLog: Happy New Year.
* ChangeLog-2006: Move 2006 changelogs here.
	* spawn.cc: Bump copyright.
2007-01-03 11:14:53 +00:00
Christopher Faylor e734fdcae9 * spawn.cc (spawn_guts): Don't expect synchronization from a non-cygwin
_P_NOWAIT process.
2007-01-01 19:37:19 +00:00
Corinna Vinschen 65c3750e65 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Improve debug
output.
2006-12-21 10:59:47 +00:00
Corinna Vinschen 97b09fe1c5 Partially revert change from 2006-10-22. GetSecurityInfo messes up
user information on NT4.
	* sec_helper.cc (security_descriptor::malloc): Drop LocalAlloc
	considerations.
	(security_descriptor::realloc): Ditto.
	(security_descriptor::free): Ditto.
	* security.cc (get_reg_security): Reinstantiate.
	(get_nt_object_security): Revert to using NtQuerySecurityObject.
	* security.h (class security_descriptor): Drop type member.
	Accommodate throughout.
	(security_descriptor::size): Constify.
	(security_descriptor::copy): Ditto.
2006-12-20 17:14:23 +00:00
Christopher Faylor e09c8fde55 * pinfo.cc (set_myself): Use a more foolproof method for determining if the
current process was started from another cygiwn process.
2006-12-18 21:28:31 +00:00
Corinna Vinschen c21efb9a85 * libc/minires-os-if.c (cygwin_query): Remove ERROR_PROC_NOT_FOUND case.
(get_dns_info): Verify DnsQuery exists. Use autoloaded GetNetworkParams.
2006-12-15 09:50:32 +00:00
Corinna Vinschen 1fd82398bb * winsup.h (clear_procimptoken): Close hProcImpToken in a safer way. 2006-12-13 11:18:39 +00:00
Corinna Vinschen 56face1741 * security.cc (lsaauth): Initialize lsa to INVALID_HANDLE_VALUE to
avoid potential access violation.
2006-12-13 09:53:42 +00:00
Corinna Vinschen 26684e48d2 * environ.cc (subauth_id_init): Remove.
(parse_thing): Drop "subauth_id" option.
	* security.cc (get_token_group_sidlist): Drop comments concerning
	subauthentication.
	(create_token): Back out subauthentication related changes.
	(subauth): Remove.
	* security.h (create_token): Remove declaration.
	(subauth): Ditto.
	* syscalls.cc (seteuid32): Drop subauthentication handling entirely.
2006-12-12 19:18:56 +00:00
Corinna Vinschen a889232410 * environ.cc (set_traverse): Remove.
(parse_thing): Drop "traverse" option.
	* path.cc (fs_info::update): Don't request SE_CHANGE_NOTIFY_PRIV
	privilege.
	* sec_helper.cc (set_cygwin_privileges): Ditto.
	* security.cc (allow_traverse): Remove.
	(alloc_sd): Drop special allow_traverse code.
	* security.h (allow_traverse): Drop declaration.
	* syscalls.cc (statvfs): Don't request SE_CHANGE_NOTIFY_PRIV privilege.
2006-12-12 18:47:25 +00:00
Corinna Vinschen 5684cfebba Partially revert change from 2005-04-03, always running under an
impersonation token, which collides with Vista UAC.
	* cygheap.h (deimpersonate): revert to self instead of impersonating
	hProcImpToken.
	(reimpersonate): Only impersonate if setuid.
	* dcrt0.cc (dll_crt0_0): Don't initialize hProcImpToken here.
	(dll_crt0_1): Set privileges on hProcToken.
	* fork.cc (frok::child): Set privileges on hProcToken.  Close handle to
	hProcImpToken.
	* grp.cc (internal_getgroups): Use hProcToken instead of hProcImpToken.
	* security.cc (check_access): Create hProcImpToken on demand here.
	* security.h (set_process_privilege): Set privileges on hProcToken.
	(_push_thread_privilege): Use hProcToken instead of hProcImpToken.
	(pop_thread_privilege): If not setuid'ed, revert to self.
	* syscalls.cc (setegid32): Drop setting primary group on hProcImpToken.
	Close handle to hProcImpToken.
	* uinfo.cc (internal_getlogin): Ditto.
	* winsup.h (clear_procimptoken): New inline function.
2006-12-12 16:27:32 +00:00
Christopher Faylor 815122d842 Add missing ChangeLog. 2006-12-12 15:59:26 +00:00
Christopher Faylor a10c6f0312 * sigproc.cc (child_info::child_info): Initialize msv_count. 2006-12-12 15:58:08 +00:00
Corinna Vinschen 46b51548b1 Revert erroneous checkin. 2006-12-12 15:10:56 +00:00
Corinna Vinschen d6a6da338b * libc/minires.c (res_ninit): Drop handling for LOCALDOMAIN environment
variable.
2006-12-12 08:29:37 +00:00
Corinna Vinschen 0c365c631f * Makefile.in (DLL_OFILES): Add minires-os-if.o and minires.o.
(SUBLIBS): Add libresolv.a.
	Add rule for libresolv.a.
	* autoload.cc: Fix return code handling for IP Helper API in case
	of being unable to load iphlpapi.dll.
	(DnsQuery_A): Define.
	(DnsRecordListFree): Define.
	* cygwin.din: Export resolver functions.
	* include/resolv.h: New header.
	* include/arpa/nameser.h: New header.
	* include/arpa/nameser_compat.h: New header.
	* include/cygwin/version.h: Bump API minor number.
	* libc/minires-os-if.c: New file.
	* libc/minires.c: New file.
	* libc/minires.h: New file.
2006-12-11 19:59:06 +00:00
Christopher Faylor 7dfad3a0c6 * sigproc.cc (child_info::child_info): Move old comment about msv_count here.
Edit it slightly to reflect new sensibilities.
2006-12-11 19:17:20 +00:00
Christopher Faylor fc32d70841 correct email address 2006-12-11 18:58:40 +00:00
Christopher Faylor c16548b2a2 * child_info.h (child_info_spawn::__stdin): New element.
(child_info_spawn::__stdin): Ditto.
(CURR_CHILD_INFO_MAGIC): Regenerate.
* dcrt0.cc (check_sanity_and_sync): Minor cleanup.
(child_info_spawn::handle_spawn): Handle new __std* elements by calling
move_fd.
* dtable.cc (dtable::move_fd): Define new function.
* dtable.h (dtable::move_fd): Declare new function.
* fhandler.h (fhandler_pipe::popen_pid): Declare new element.
* fhandler.h (fhandler_pipe::get_popen_pid): Define new function.
* fhandler.h (fhandler_pipe::set_popen_pid): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Zero popen_pid.
(fhandler_pipe::dup): Ditto.
* spawn.cc (handle): Change second argument to bool.
(spawn_guts): Accept __stdin/__stdout arguments and set them appropriately in
child_info structure and in STARTUPINFO structure.
* syscalls.cc (popen): New cygwin-specific implementation using spawn.
(pclose): Ditto.
* winsup.h (spawn_guts): Accommodate new arguments for spawn_guts.
* fhandler.cc (fhandler_base::set_no_inheritance): Make second arg a bool.
* fhandler.h (fhandler_base::set_no_inheritance): Ditto for declaration.
* child_info.h (child_info::msv_count): Rename from the now-inappropriate
"zero".
(child_info_spawn::filler): Add filler to work around Vista bug.
(child_info_fork::filler): Ditto.
* dcrt0.cc (get_cygwin_startup_info): Remove "zero" check since it is now
always filled out.
* fork.cc (frok::parent): Move ch.zero manipulation to constructor.
* spawn.cc (spawn_guts): Ditto.  Remove _ch wrapper.
* sigproc.cc (child_info::child_info): Initialize starter[].
* shared.cc (shared_info::heap_slop_size): Remove noisy system_printfs.
* shared_info.h (CURR_SHARED_MAGIC): Regenerate.
2006-12-11 18:55:29 +00:00
Corinna Vinschen e79c01f84e * fhandler.cc (rootdir): Fix typo in comment.
* syscalls.cc (try_to_bin): Ditto.
2006-12-11 09:07:22 +00:00
Corinna Vinschen cbfb7b1b23 * autoload.cc (SHFileOperationA): Drop definition.
* ntdll.h (struct _FILE_RENAME_INFORMATION): Define.
	* path.cc (fs_info::update): Note length of rootdir prefix in
	root_len.
	(get_nt_native_path): New function, taking over functionality of
	path_conv::get_nt_native_path.
	(path_conv::get_nt_native_path): Just call get_nt_native_path.
	* path.h (get_nt_native_path): Declare.
	(struct fs_info): New member root_len.
	(fs_info::length): New inline method returning root_len.
	(path_conv::rootdir): New inline method returning rootdir prefix.
	* syscalls.cc (try_to_bin): Rewrite using only system calls.
	(unlink_nt): Call try_to_bin with additional handle to open file
	parameter.
	(statvfs): Use path_conv::rootdir method.
	* wincap.h: Define has_recycle_dot_bin throughout.
	* wincap.cc: Ditto.
2006-12-10 16:43:30 +00:00
Corinna Vinschen 6c64fb2fda * fhandler.cc (rootdir): Clarify comment. 2006-12-10 16:20:43 +00:00
Corinna Vinschen 37ae69e8b1 * fhandler.cc (rootdir): Don't look for volume mount points on remote
shares.
2006-12-10 16:18:51 +00:00
Corinna Vinschen 30cf835f7e * fhandler.cc (rootdir): Drop useless post-increment. Take volume
mount points into account.
	(check_posix_perm): Allocate space for root directory big enough.
2006-12-10 12:56:50 +00:00
Corinna Vinschen 8af19fdb25 * syscalls.cc (try_to_bin): Add comment that this is not possibly
the final version.
2006-12-09 09:29:47 +00:00
Corinna Vinschen e563a4d5b8 * syscalls.cc (unlink_nt): Open native symlinks with
FILE_OPEN_REPARSE_POINT flag.
2006-12-07 17:53:05 +00:00
Corinna Vinschen 1c9b2968fa * ntdll.h (STATUS_DELETE_PENDING): Define.
(struct _FILE_DISPOSITION_INFORMATION): Define.
	* syscalls.cc (unlink_9x): new function to delete file on 9x.
	* syscalls.cc (unlink_nt): new function to delete file on NT.
	(unlink): Simplify.  Move OS dependent stuff into aforementioned
	functions.  Also handle FILE_ATTRIBUTE_HIDDEN as R/O-like flag.
2006-12-07 17:40:24 +00:00
Corinna Vinschen 398e28fbbc * autoload.cc (SHFileOperationA): Define.
* syscalls.cc (try_to_bin): New function trying to move a file to
	the recycle bin.
	(unlink): Fix arguments used in CreateFile for delete on close.
	Before closing the handle, try to move the file to the recycle bin.
2006-12-07 11:53:46 +00:00
Corinna Vinschen 2ffc166d07 * cygheap.h (struct cwdstuff): Add "sync" member and accompanying
"keep_in_sync" methods.
	* external.cc (cygwin_internal): Call above keep_in_sync method when
	CW_SYNC_WINENV is requested.
	* path.cc (cwdstuff::init): Don't change to windows_system_directory
	if keep_in_sync is requested.
	(cwdstuff::keep_in_sync): New method.
	(cwdstuff::set): Take sync flag into account.
2006-12-07 10:04:52 +00:00
Corinna Vinschen 63f33caadc * termios.cc: Change include order to accomodate change to sys/ioctl.h. 2006-12-06 19:44:07 +00:00
Corinna Vinschen 8b8273781b * fhandler_mem.cc (fhandler_dev_mem::open): Fix comment.
* wincap.cc (has_physical_mem_access): Reflect the fact that physical
	memory access has been made a protected operation beginning with
	2003 Server.
2006-12-06 16:33:03 +00:00
Corinna Vinschen bf8ea306ec * include/sys/ioctl.h: Pick up termios.h, for TIOCGWINSZ. 2006-12-06 14:08:08 +00:00
Corinna Vinschen 6acc178a24 * winsup.h (WINVER): Set to 0x0600 to cover Vista. 2006-12-06 14:06:38 +00:00
Corinna Vinschen ad7915ffca * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Fix typo. 2006-12-06 14:05:59 +00:00
Corinna Vinschen 3c788ea42a * path.cc (cwdstuff::init): Don't change to windows_system_directory
if Cygwin DLL has been loaded dynamically.
2006-12-05 21:46:26 +00:00
Corinna Vinschen 2156546df2 * path.cc (cwdstuff::set): Don't try to open directory on systems not
supporting that.
2006-12-05 13:20:38 +00:00
Corinna Vinschen a83c59fbc3 * dcrt0.cc (get_cygwin_startup_info): Fix comment.
* wincap.cc (wincapc::init): Always reset needs_count_in_si_lpres2 to
	false on non 64-bit systems.
2006-12-05 13:16:24 +00:00
Corinna Vinschen 301cd37dda Fix date. 2006-12-05 11:07:12 +00:00
Corinna Vinschen c6674b53d3 * dcrt0.cc (get_cygwin_startup_info): Change zeros to DWORD array.
Expect first DWORD in child_info struct being set to non-zero if
	wincap.needs_count_in_si_lpres2 is set.  Add comment to explain why.
	* fork.cc (frok::parent): Set ch.zero[0] to a sensible count value
	if wincap.needs_count_in_si_lpres2 is set.
	* spawn.cc (spawn_guts): Ditto.  Add filler bytes after ch on stack
	to accomodate needs_count_in_si_lpres2.
	* wincap.h: Define needs_count_in_si_lpres2 throughout.
	* wincap.cc: Ditto.
2006-12-05 10:59:21 +00:00
Corinna Vinschen 8eca536272 * dir.cc (mkdir): Check last path component for "..".
(rmdir): Don't check last path component for "..".
	* fhandler_disk_file.cc (fhandler_disk_file::rmdir): Drop kludge
	which tries to allow deleting the current working directory.
	* path.cc (has_dot_last_component): Add parameter to indicate testing
	for "..".  Take trailing slash into account.
	(symlink_info::posixify): Rely on cygheap->cwd.win32 having a
	useful value.
	(cwdstuff::init): Initialize cygheap->cwd with current working
	directory.  Change to windows_system_directory afterwards.
	(cwdstuff::set): Never call SetCurrentDirectory here.  Just check
	if changing into target directory would be allowed.  Add comment to
	explain why.
	* path.h (has_dot_last_component): Declare with second parameter.
	* pinfo.cc (pinfo::zap_cwd): Remove.
	(pinfo::exit): Drop call to zap_cwd.
	* pinfo.h (class pinfo): Remove declaration of zap_cwd.
	* spawn.cc (spawn_guts): Set current working directory for non-Cygwin
	child applications.  Drop call to zap_cwd.
2006-11-30 10:17:24 +00:00
Corinna Vinschen 75bb63452d * security.cc (create_token): Revert erroneous change to test
subauth_token for INVAILD_HANDLE_VALUE.
	* syscalls.cc (seteuid32): Set create_token's subauth_token parameter
	back to NULL.
2006-11-28 23:15:01 +00:00
Corinna Vinschen 902716e599 * fhandler.cc (fhandler_base::open): Fix previous patch to handle the
SYSTEM attribute as well.
2006-11-28 09:57:01 +00:00
Corinna Vinschen ef26cc9307 * fhandler.cc (fhandler_base::open): Fix handling of files with
HIDDEN attribute set.
2006-11-27 19:14:24 +00:00
Christopher Faylor f64b151f59 * include/cygwin/signal.h: Add __extension__ to various anonymous unions and
structs.  (thanks to V.Haisman)
2006-11-27 16:43:34 +00:00
Corinna Vinschen b825c587ba * cyglsa.h: New header file.
* environ.cc: Disable subauth settings.
	* grp.cc: Accomodate cygsidlist's count now being a method.
	* sec_helper.cc (SECURITY_MANDATORY_INTEGRITY_AUTHORITY): Remove.
	(mandatory_medium_integrity_sid): Remove.
	(mandatory_high_integrity_sid): Remove.
	(mandatory_system_integrity_sid): Remove.
	(fake_logon_sid): Add.
	(cygsid::get_sid): Add well_known parameter.  Set well_known_sid
	accordingly.
	(cygsid::getfromstr): Ditto.
	(cygsidlist::alloc_sids): Move here from security.cc.
	(cygsidlist::free_sids): Ditto.
	(cygsidlist::add): Move here from security.h.  Add well_known parameter.
	Set well_known_sid accordingly.  Don't allow duplicate SIDs.
	* security.cc: Include cyglsa.h and cygwin/version.h.  Throughout
	accomodate cygsidlist's count now being a method.  Throughout drop
	redundant "contains" tests.
	(get_user_local_groups): Add local groups as well known SIDs.
	(get_token_group_sidlist): Add well known groups as well known SIDs.
	(get_server_groups): Ditto.  Only call get_unix_group_sidlist after
	get_user_local_groups to maintain "well_known_sid" attribute.
	(get_initgroups_sidlist): Add well known groups as well known SIDs.
	(get_setgroups_sidlist): Add usersid and struct passwd parameter to
	allow calling get_server_groups from here.
	(get_system_priv_list): Make static.  Return size of TOKEN_PRIVILEGES
	structure.
	(get_priv_list): Ditto.
	(create_token): Accomodate above changes.  Drop misguided attempt to
	add MIC SIDs to created user token.  Print returned token as hex value.
	(subauth): Disable.
	(lsaauth): New function implementing client side of LSA authentication.
	* security.h (class cygsid): Add well_known_sid attribute.  Accomodate
	throughout.  Add *= operator to create a well known SID.
	(class cygsidlist): Rename count to cnt.  Make count a method.
	(cygsidlist::add): Move to sec_helper.cc.
	(cygsidlist::operator *=): New method to add well known SID.
	(cygsidlist::non_well_known_count): New method returning number of
	non well known SIDs in list.
	(cygsidlist::next_non_well_known_sid): New method returning next non
	well known SID by index.
	(mandatory_medium_integrity_sid): Drop declaration.
	(mandatory_high_integrity_sid): Drop declaration.
	(mandatory_system_integrity_sid): Drop declaration.
	(fake_logon_sid): Add declaration.
	(subauth): Disable declaration.
	(lsaauth): Add declaration.
	* syscalls.cc (seteuid32): Disable subauthentication.  Add LSA
	authentication.
	* wincap.h: Define needs_logon_sid_in_sid_list throughout.
	* wincap.cc: Ditto.
2006-11-27 12:59:59 +00:00
Corinna Vinschen 124b187f16 * security.h (DBGSID): Define for debugging purposes.
(MKSID): Rename from SID so as to not hide SID definition from winnt.h.
	* sec_helper.cc: Change SID to MKSID throughout.
2006-11-23 16:44:55 +00:00
Corinna Vinschen 23f710014d * net.cc (get_ipv6_funcs): Fix formatting. 2006-11-23 16:30:12 +00:00
Corinna Vinschen 86404692c6 * path.cc (fs_info::update): Define GETVOLINFO_VALID_MASK and TEST_GVI.
Change FS_IS_SAMBA and FS_IS_SAMBA_WITH_QUOTA and their usage
	accordingly.  Define FS_IS_NETAPP_DATAONTAP.  Recognize NetApp device
	and store in is_netapp flag.  Mark NetApp device as having no good
	inodes.
	* path.h (struct fs_info): Add is_netapp flag.  Add matching accessors.
2006-11-23 11:28:52 +00:00
Corinna Vinschen bf4071fad0 * fhandler_console.cc (set_color): Avoid (again) inappropriate
intensity interchanging that used to render reverse output unreadable
	when (non-reversed) text is bright.
	See http://sourceware.org/bugzilla/show_bug.cgi?id=514
2006-11-23 10:08:04 +00:00
Corinna Vinschen 9e3f289f51 * devices.h: Add additional SCSI disk block device numbers per
http://www.kernel.org/pub/linux/docs/device-list/devices.txt
	up to 128 devices.
	* devices.in: Ditto.
	(device::parsedisk): Add additonal else-if cases for decoding base
	and drive indices.
	* devices.cc: Regenerate.
	* dtable.cc (build_fh_pc): Add additional DEV_SD{2..7}_MAJOR cases.
2006-11-23 09:55:55 +00:00
Corinna Vinschen c3a0492e16 * autoload.cc (EqualPrefixSid): Define.
* security.cc (create_token): Drop grps_buf.  Use alloca instead.
	Only add the MIC SID to the TOKEN_GROUPS list for the NtCreateToken
	call.  If the subauthentication token exists, use its MIC SID.
	Set SID Attributes for the MIC SID to 0.
2006-11-09 15:24:34 +00:00
Corinna Vinschen 2fd2ddf3f5 * sec_helper.cc (sid_auth): Remove.
(well_known_this_org_sid): New well known sid.
	(SECURITY_MANDATORY_INTEGRITY_AUTHORITY): Define.
	(mandatory_medium_integrity_sid): New well known sid.
	(mandatory_high_integrity_sid): Ditto.
	(mandatory_system_integrity_sid): Ditto.
	(cygsid::get_sid): Use local SID_IDENTIFIER_AUTHORITY.  Allow all
	authorities fitting in a UCHAR.
	* security.cc (get_token_group_sidlist): Always add the local
	group to the token.  Add comment.  Add "This Organization" group
	if available in incoming group list.
	(get_server_groups): Only add world and authenticated users groups
	if not already in list.
	(create_token): Add matching mandatory integrity SID to group list
	on systems supporting Mandatory Integrity Control.
	* security.h (well_known_this_org_sid): Define.
	(mandatory_medium_integrity_sid): Define.
	(mandatory_high_integrity_sid): Define.
	(mandatory_system_integrity_sid): Define.
	* wincap.h: Define has_mandatory_integrity_control throughout.
	* wincap.cc: Ditto.
2006-11-08 11:38:05 +00:00
Corinna Vinschen 86bc8fadff * fhandler.cc (check_posix_perm): Moved here from syscalls.cc.
(fhandler_base::fpathconf): New method implementing (f)pathconf.
	* fhandler.h (class fhandler_base): Declare fpathconf method.
	* path.cc (path_conv::check): Replace MAX_LINK_DEPTH with SYMLOOP_MAX.
	* path.h (MAX_LINK_DEPTH): Delete.
	* syscalls.cc (check_posix_perm): Move to fhandler.cc.
	(fpathconf): Call fhandler's fpathconf method.
	(pathconf): Build fhandler and call fhandler's fpathconf method.
	* sysconf.cc (sysconf): Reorder switch according to order of flags
	in sys/unistd.h.  Add handling for some missing flags.
	* include/limits.h: Reorder according to SUSv3 description.  Add some
	missing definitions.  Add comments.
	* include/sys/syslimits.h: New file overriding newlib's syslimits.h
	file.
2006-11-07 17:59:54 +00:00
Corinna Vinschen cc9dbc905c * dtable.cc (build_fh_pc): Add missing DEV_SD1_MAJOR case (Thanks to
Joe Loh for noticing).
2006-11-06 13:46:24 +00:00
Corinna Vinschen 2228ff0267 * path.cc (symlink_info::posixify): Fix comment. 2006-11-02 13:39:44 +00:00
Corinna Vinschen 4521c4bd0c * path.cc (symlink_info::check): Eliminate PATH_REP bit from pflags. 2006-11-02 12:19:16 +00:00
Corinna Vinschen 5fc8f227dc * path.cc (symlink_info::posixify): New mothod converting NT and DOS
paths in symlinks to POSIX.
	(symlink_info::check_shortcut): Allocate buf allowing for a trailing 0.
	Call posixify on the result.
	(symlink_info::check_sysfile): Read from file into local buffer.
	Eliminate old b16 considerations.  Call posixify on the result.
	(symlink_info::check_reparse_point): Don't use PrintName but
	SubstituteName which is relevant for Windows' path handling.
	Call posixify on the result.
2006-11-02 11:45:03 +00:00
Corinna Vinschen b904c35100 * security.h (cygpriv_idx): Add privileges new in Vista.
* security.cc (sys_privs): Ditto.
	* sec_helper.cc (cygpriv): Ditto.  Fix comment.
2006-11-01 09:00:14 +00:00
Corinna Vinschen c2b10dc4d8 * cygheap.h (struct user_heap_info): Add slop member.
* heap.cc (heap_init): Add slop factor to heap allocation.  Add
	comment.
	* mmap.cc (MapViewNT): Allocate memory maps top down.
	(fhandler_dev_zero::mmap): Ditto.
	* shared.cc (shared_info::heap_slop_size): New method.
	(shared_info::heap_chunk_size): Don't use debug_printf at early stage.
	* shared_info.h (SHARED_INFO_CB): Accomodate change to shared_info.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Add heap_slop member.  Declare heap_slop_size.
	* wincap.h: Define heapslop throughout.
	* wincap.cc: Ditto.
2006-10-31 18:41:16 +00:00
Corinna Vinschen 9740f34d11 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop
directory attribute for reparse points to avoid mistreating.
	(fhandler_base::fstat_by_name): Ditto.
	* path.cc (symlink_info::check_reparse_point): New method testing
	reparse points for symbolic links.
	(symlink_info::check_shortcut): Move file attribute tesat to calling
	function.
	(symlink_info::check): Add handling for reparse points.
	* path.h (enum path_types): Add PATH_REP to denote reparse point based
	symlinks.
	(path_conv::is_rep_symlink): New method.
	* syscalls.cc (unlink): Handle reparse points.
2006-10-31 11:40:47 +00:00
Corinna Vinschen fa9e684236 * shared.cc (open_shared): Drop useless attempt from 2006-08-11. 2006-10-27 10:51:25 +00:00
Corinna Vinschen 17f3068d4e * dcrt0.cc (__api_fatal): Drop spare argument to __small_sprintf.
* smallprint.c (__small_vsprintf): Preserve GetLastError value.
	* winsup.h (api_fatal): Simplify.  Drop duplicate filename arg.
2006-10-27 10:41:51 +00:00
Corinna Vinschen 74cab745fc * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Fix comment. 2006-10-23 16:41:10 +00:00
Corinna Vinschen 7a229db654 * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Accomodate
buggy RestartScan behaviour of Windows 2000.
	* wincap.h: Define has_buggy_restart_scan throughout.
	* wincap.cc: Ditto.
2006-10-23 15:13:55 +00:00
Corinna Vinschen fc545fe933 * fhandler_disk_file.cc (fhandler_disk_file::facl): Fix whitespace.
* external.cc: Update copyright.
	* fhandler.cc: Ditto.
	* sec_helper.cc: Ditto.
	* security.h: Ditto.
	* security.cc: Ditto.
	(check_registry_access): Return -1 if W_OK is requested.
2006-10-22 19:31:33 +00:00
Corinna Vinschen 2be593d961 * external.cc (cygwin_internal): Use security_descriptor::copy method.
* sec_helper.cc (security_descriptor::malloc): Use own free method.
	Set type.
	(security_descriptor::realloc): Handle the case that psd has been
	allocated using LocalAlloc.  Set type.
	(security_descriptor::free): Ditto.
	* security.cc (get_nt_attribute): Remove.
	(get_reg_security): Remove.
	(get_nt_object_security): Use GetSecurityInfo which handles all
	securable objects.
	(get_nt_object_attribute): Remove.
	(get_object_attribute): Call get_nt_object_security instead of
	get_nt_object_attribute.
	(get_file_attribute): Ditto.
	(check_registry_access): Call get_nt_object_security instead of
	get_reg_security.
	* security.h (cygpsid::operator PSID): Make method const, not the
	result.
	(class security_descriptor): Add type member.  Accomodate throughout.
	(security_descriptor::copy): New method.
	(security_descriptor::operator PSECURITY_DESCRIPTOR *): New operator.
2006-10-22 14:57:43 +00:00
Corinna Vinschen 2b26c2fc41 * fhandler.cc (fhandler_base::fhaccess): Check if opening registry
actually created a handle.  This handles the registry root dir.
	* fhandler_registry.cc (fhandler_registry::open): Set io_handle in
	case of opening one of the predefined registry keys.
2006-10-22 09:38:47 +00:00
Corinna Vinschen 1b4153db74 * fhandler.cc (fhandler_base::fhaccess): Call check_registry_access
for registry keys/values if ntsec is on.
	* security.cc (check_access): New static function derived from
	check_file_access, but object type agnostic.
	(check_file_access): Only do file specific stuff.  Call check_access.
	(check_registry_access): New access check function for registry keys/
	values.
	* security.h (check_registry_access): Declare.
2006-10-21 11:05:32 +00:00
Corinna Vinschen 9367c0dcff * fhandler_registry.cc (fhandler_registry::fstat): Set restrictive
permission and ownership if key can't be opened for reading security.
	(open_key): If opening key fails, retry opening with backup intent.
2006-10-21 10:58:35 +00:00
Corinna Vinschen d698e833cd * net.cc (cygwin_getnameinfo): Fix typo in comment. 2006-10-20 12:57:25 +00:00
Corinna Vinschen 20f9af5348 * fhandler.h (fhandler_base::set_name): Make virtual.
(class fhandler_registry): Add wow64 and prefix_len members.
	Declare set_name method.
	* fhandler_proc.cc (PROC_REGISTRY32): Define.
	(PROC_REGISTRY64): Define.
	(proc_listing): Add "registry32" and "registry64" elements.
	(proc_fhandlers): Add corresponding FH_REGISTRY values.
	* fhandler_registry.cc (registry_len): Drop static value in favor of
	class member prefix_len.  Use preifx_len instead of registry_len
	throughout.
	(fhandler_registry::set_name): Define.  Set wow64 and prefix_len
	according to directory prefix.
	(fhandler_registry::fhandler_registry): Set wow64 and prefix_len to
	default values.
	(open_key): Add wow64 argument.  Handle wow64 in call to RegOpenKeyEx.
	Use fhandler_registry member wow64 in this place throughout.
2006-10-19 10:01:03 +00:00
Corinna Vinschen d145878a07 * fhandler_proc.cc: Drop superfluous definition of _WIN32_WINNT.
* miscfuncs.cc: Ditto.
	* sched.cc: Ditto.
2006-10-19 09:15:26 +00:00
Corinna Vinschen 733c9ed374 * glob.c: Remove.
* glob.cc: New file.  Latest glob version from FreeBSD plus Cygwin
	specific changes (__stat64/__stat32, ignore_case_with_glob,
	drop collate functions).
	(glob3): Return GLOB_ABORTED in case directory is unreadable and
	GLOB_ERR is set, as demanded by SUSv3.
	* glob.h: Import latest version from FreeBSD.
2006-10-17 17:34:56 +00:00
Corinna Vinschen bf4875e4b0 * winsup.h (WINVER): Define instead of _WIN32_WINNT. Set to 0x0502.
(_NO_W32_PSEUDO_MODIFIERS): Define.
2006-10-17 13:55:05 +00:00
Corinna Vinschen 0b8affca5e * fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop redundant
access check.
2006-10-16 13:11:29 +00:00
Corinna Vinschen c28fea1bdc * include/asm/byteorder.h: Fix copyright dates.
Fix typos in ChangeLog.
2006-10-16 12:34:34 +00:00
Corinna Vinschen b031f5c3c5 Fix pathnames. 2006-10-16 12:31:19 +00:00
Corinna Vinschen 2c1ffdbf5e * autoload.cc (PrivilegeCheck): Define.
* fhandler.cc (fhandler_base::open): Always try opening with backup
	resp. restore intent.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): Always try
	opening with backup intent.
	(fhandler_disk_file::readdir): Ditto when trying to retrieve file id
	explicitely.
	* security.cc (check_file_access): Replace pbuf with correctly
	PPRIVILEGE_SET typed pset.  Check explicitely for backup and/or restore
	privileges when AccessCheck fails, to circumvent AccessCheck
	shortcoming.  Add comment to explain.
2006-10-16 12:26:59 +00:00
Christopher Faylor 7af26e0cc0 * winsup.h: Turn off DEBUGGING. 2006-10-13 12:49:18 +00:00
Corinna Vinschen fb7dc2480c * autoload.cc (Wow64DisableWow64FsRedirection): Define.
(Wow64RevertWow64FsRedirection): Define.
	* security.cc (cygsuba_installed): New shared variable to store result
	of cygsuba.dll installation test.
	(subauth): Check if cygsuba.dll has been installed and registered
	before issuing the (sub)authentication.
2006-10-13 11:10:28 +00:00
Corinna Vinschen 208e95c2f2 * security.cc (create_token): Fix condition for source identifier. 2006-10-12 15:38:26 +00:00
Corinna Vinschen 9565e2333c * select.cc (struct socketinf): Convert ser_num and w4 to dynamically
allocated arrays.  Add max_w4 member to keep track.
	(thread_socket): Make timeout depending on number of sockets to wait
	for.  Loop WFMO over all sockets.
	(start_thread_socket): Handle any number of sockets.  Fix typo.  Don't
	close socket event in out of memory condition.
	(socket_cleanup): Free ser_num and w4.
2006-10-11 16:21:12 +00:00
Corinna Vinschen b9c7deed9a * path.cc (path_conv::get_nt_native_path): Properly detect \\?\ paths.
(mount_info::conv_to_win32_path): Update comment.
	* fhandler_disk_file.cc (path_conv::ndisk_links): Use backslashes
	to make NT kernel functions work for \\?\GLOBALROOT paths.
2006-10-09 14:01:52 +00:00
Corinna Vinschen 5623fbd4ca * devices.in: Raise number of handled serial ports to 64.
* devices.cc: Regenerate.
2006-10-09 08:27:23 +00:00
Christopher Faylor 16b6142ad4 . 2006-10-06 22:32:09 +00:00
Christopher Faylor b44ba33a1f * byteorder.h: Correct typo. 2006-09-17 23:22:10 +00:00
Christopher Faylor 22aa38a0a8 * byteorder.h: Don't #define n* macros if -fnoinline is specified. 2006-09-17 22:34:45 +00:00
Christopher Faylor d6b1ac7faa * environ.cc (build_env): Don't put an empty environment variable into the
environment.  Optimize use of "len".
* errno.cc (ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN.
2006-09-07 20:42:53 +00:00
Corinna Vinschen 55283468e6 * grp.cc (initgroups32): Run get_server_groups under original token.
* syscalls.cc (seteuid32): Slightly reorganize code creating a token.
2006-08-31 15:57:56 +00:00
Christopher Faylor 1cc0c5d6f9 * child_info.h (child_info_spawn::~child_info_spawn): Don't close myself_pinfo
handle when spawning.
2006-08-27 16:46:27 +00:00
Corinna Vinschen f1f69c58bf * fhandler_disk_file.cc (fhandler_disk_file::opendir): Fix formatting. 2006-08-20 12:31:07 +00:00
Corinna Vinschen b0662a051b * fhandler_disk_file.cc (DIR_NUM_ENTRIES): Set to 100 to maximize
performance on remote shares.
	(fhandler_disk_file::opendir): Move comment about Samba weirdness into
	fhandler_disk_file::readdir.  Don't disallow
	FileIdBothDirectoryInformation on Samba.
	(fhandler_disk_file::readdir): Workaround Samba problem with
	FileIdBothDirectoryInformation by rereading already read entries
	using FileBothDirectoryInformation.  Change comment about Samba
	weirdness explaining this change.
2006-08-20 12:18:12 +00:00
Christopher Faylor ffa6849093 * fhandler_disk_file.cc (fhandler_disk_file::pread): Properly check for
non-error return from lseek.
2006-08-19 21:44:58 +00:00
Corinna Vinschen 30691bd756 * fhandler_serial.cc (raw_read): Evaluate minchars taking the
vmin_ > ulen case into account.  Simplify evaluating the bytes to read.
	Don't use bytes in Queue value from ClearCommError call in case vtime_
	is > 0.  Reformat GetOverlappedResult call.  Simplify call to ReadFile.
2006-08-17 14:51:48 +00:00
Corinna Vinschen 94dc73adc5 * security.cc (subauth): Initialize user_token to NULL. Add comment. 2006-08-14 11:32:11 +00:00
Corinna Vinschen e39a29e36b * shared.cc (open_shared): Desperately try to get shared memory, only
when DEBUGGING enabled for now.
2006-08-11 15:40:07 +00:00
Christopher Faylor 1767b8d028 * pinfo.cc (_onreturn::~onreturn): Don't attempt to close a NULL handle. 2006-08-10 20:25:54 +00:00
Christopher Faylor 2f98d8bdc7 revert erroneous checkin 2006-08-10 14:16:24 +00:00
Christopher Faylor 44d67b9b31 * winsup.h: Turn on DEBUGGING by default for now. 2006-08-10 14:15:00 +00:00
Corinna Vinschen 887e02e478 * fhandler_disk_file.cc (fhandler_disk_file::lock): Handle
ERROR_NOT_LOCKED returned from UnlockFileEx.
2006-08-10 08:44:43 +00:00
Corinna Vinschen 6f3105405d * path.h (SYMLINK_EA_NAME): Remove.
(SHORTCUT_HDR_SIZE): Ditto.
2006-08-09 15:33:46 +00:00
Christopher Faylor bbf38a55c6 * autoload.cc (GetHandleInformation): Declare new function.
(SetHandleInformation): Ditto.
* debug.cc (add_handle): Use SetHandleInformation to protect handle.
(close_handle): Use SetHandleInformation to unprotect handle.
* spawn.cc (spawn_guts): Move detached test outside of P_OVERLAY block.
2006-08-09 15:04:32 +00:00
Corinna Vinschen 7636b58590 * autoload.cc (NtSetInformationFile): Define.
* cygwin.din: Export posix_fadvise and posix_fallocate.
	* fhandler.cc (fhandler_base::fadvise): New method.
	(fhandler_base::ftruncate): Add allow_truncate parameter.
	* fhandler.h (class fhandler_base): Add fadvise method.  Accomodate
	new parameter to ftruncate.
	(class fhandler_pipe): Add fadvise and ftruncate methods.
	(class fhandler_disk_file): Add fadvise method.  Accomodate new
	parameter to ftruncate.
	* fhandler_disk_file.cc (fhandler_disk_file::fadvise): New method.
	(fhandler_disk_file::ftruncate): Accomodate new allow_truncate
	parameter.  Set EOF using NtSetInformationFile on NT.
	* ntdll.h (struct _FILE_END_OF_FILE_INFORMATION): Define.
	(NtSetInformationFile): Declare.
	* pipe.cc (fhandler_pipe::fadvise): New method.
	(fhandler_pipe::ftruncate): Ditto.
	* syscalls.cc (posix_fadvise): New function.
	(posix_fallocate): Ditto.
	(ftruncate64): Accomodate second parameter to fhandler's ftruncate
	method.
	* include/fcntl.h: Add POSIX_FADV_* flags.  Add declarations of
	posix_fadvise and posix_fallocate.
	* include/cygwin/version.h: Bump API minor number.
2006-08-07 19:29:14 +00:00
Christopher Faylor 6f1d48621e * environ.cc (env_win32_to_posix_path_list): Declare.
(conv_envvars): Use env_win32_to_posix_path_list rather than
cygwin_win32_to_posix_path_list.
(posify): Translate back to win32 path if errno is EIDRM.
* environ.h: Update copyright.  Define ENV_CVT.
* path.cc (conv_path_list): If converting for the environment and removed an
element set errno to ENV_CVT.
(env_win32_to_posix_path_list): New function.
2006-08-02 15:11:48 +00:00
Christopher Faylor 01bbb24d15 * environ.cc (dos_file_warning): Declare.
(parse_thing): Add "dosfilewarning".  Alphabetize.
* path.cc (normalize_posix_path): Return -1 when MS-DOS path detected.
(warn_msdos): New function.
(path_conv::check): Call if !PC_NOWARN and MS-DOS path detected.
(cygwin_conv_to_win32_path): Set PC_NOWARN when calling path_conv.
(cygwin_conv_to_full_win32_path): Ditto.
* path.h (pathconv_arg::PC_NOWARN): Define.
* shared_info.h (user_info::warned_msdos): New field.
(CURR_USER_MAGIC): Reset.
2006-08-01 18:00:44 +00:00
Corinna Vinschen b23bc8c33c * fhandler_socket.cc (fhandler_socket::recv_internal): Fix a problem
with poll(2) after shutdown(SHUT_RD) has been called on the local side.
	* poll.cc (poll): Use POSIX type nfds_t for second parameter.  Drop
	special socket handling for POLLIN.  Add comment to explain why.
	* include/sys/poll.h: Declare nfds_t.  Use as type for second parameter
	in poll(2) declaration.
2006-07-31 14:27:56 +00:00
Corinna Vinschen 1f7dbb011a * fhandler_socket.cc (fhandler_socket::evaluate_events): Circumvent
potential race condition.
	(fhandler_socket::recv_internal): Fix MSG_PEEK bug on blocking sockets
	and simplify recv loop.
	(fhandler_socket::send_internal): Only lock when changing wsock_events.
2006-07-31 12:55:20 +00:00
Corinna Vinschen a947b6879f * autoload.cc: Drop LoadDLLprime for wsock32 since no wsock32 function
is used anymore.  Drop all unused ws2_32.dll functions.
2006-07-31 08:59:56 +00:00
Corinna Vinschen 8f713b6b08 * fhandler.h (struct wsa_event): Define here.
(class fhandler_socket): Make wsock_evt private again.
	(fhandler_socket::wsock_event): New read accessor for wsock_evt.
	(fhandler_socket::serial_number): New read accessor to get the
	socket's serial number.
	(fhandler_socket::ready_for_read): Just return true.
	* fhandler_socket.cc (struct wsa_event): Move definition to fhandler.h.
	* select.cc (struct socketinf): Add serial number vector.
	(start_thread_socket): Identify duplicate sockets by their serial
	number, not (wrongly) by their wsock_evt.
2006-07-28 08:50:46 +00:00
Corinna Vinschen fd5879c110 * fhandler_socket.cc: Revert misguided attempt to handle FD_CLOSE error
conditions in evaluate_events.
	(search_wsa_event_slot): Move wrongly placed memset in
	fhandler_socket::init_events here.
	(fhandler_socket::init_events): Initially set FD_WRITE event for
	connectionless sockets.
	* poll.cc (poll): Don't add sockets always to except_fds since select
	is now supposed to do it right.
	* select.cc (set_bits): Set connection state correctly for failed
	af_local_connect on local sockets.  Remove socket special handling
	for except_selected descriptors.
	(peek_socket): Try to set the read/write/exception bits actually
	correctly.
2006-07-27 13:58:54 +00:00
Corinna Vinschen 883861544a * fhandler_socket.cc (fhandler_socket::recvmsg): Remove unused tot
argument.  All callers changed.
	(fhandler_socket::sendmsg): Likewise.
	* net.cc (cygwin_recvmsg): Likewise.
	(cygwin_sendmsg): Likewise, and prevent calling sendmsg whith an
	invalid iovec.
	* fhandler.h (fhandler_socket::recvmsg): Adjust prototype.
	(fhandler_socket::sendmsg): Likewise.
2006-07-27 09:18:28 +00:00
Corinna Vinschen 9869e006f3 * fhandler.h (class fhandler_socket): Remove prot_info_ptr.
(fhandler_socket::fixup_before_fork_exec): Remove.
	(fhandler_socket::fixup_after_exec): Remove.
	(fhandler_socket::need_fixup_before): Remove.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop
	initializing prot_info_ptr.  Remove unused code.
	(fhandler_socket::~fhandler_socket): Drop free'ing prot_info_ptr.
	(struct wsa_event): Rename connect_errorcode to errorcode.
	(fhandler_socket::evaluate_events): Handle FD_CLOSE error condition
	as FD_CONNECT error condition, except, never reset an FD_CLOSE error
	condition.  Always set FD_WRITE after successfully recorded FD_CONNECT.
	(fhandler_socket::fixup_before_fork_exec): Remove.
	(fhandler_socket::fixup_after_fork): Revert to using handle duplication.
	(fhandler_socket::fixup_after_exec): Remove.
	(fhandler_socket::dup): Revert to using handle duplication.
	(fhandler_socket::send_internal): Only call wait_for_events in case
	of WSAEWOULDBLOCK condition.
	(fhandler_socket::set_close_on_exec): Call
	fhandler_base::set_close_on_exec.
	* net.cc (fdsock): Just set socket to inheritable on non-NT.  Don't
	call inc_need_fixup_before.
	* select.cc (peek_socket): Don't set except_ready on every FD_CLOSE,
	just on error.
2006-07-27 09:11:38 +00:00
Christopher Faylor 5ecd1ea663 * fhandler.cc (fhandler_base::read): Call get_readahead_into_buffer instead of
duplicating it.
2006-07-27 03:32:51 +00:00
Corinna Vinschen a0bb355ffe * shared.cc (offsets): Define as offsets relative to cygwin_hmodule
instead of addresses.
	(off_addr): New macro.
	(open_shared): Use offsets array accordingly.  Remove unused code.
	* shared_info.h (cygwin_shared_address): Remove.
2006-07-26 21:02:01 +00:00
Corinna Vinschen 5faa48850f * cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
* fhandler_tape.cc (mt): Define as DLL shared area in
	.cygwin_dll_common instead of as dynamically allocated area.
	Change referencing throughout.
	* mtinfo.h (mt_h): Remove entirely.
	(mt): Remove extern declaration.
	* shared.cc (cygwin_shared_area): New global cygwin_shared
	variable located in .cygwin_dll_common.
	(offsets): Define shared region addresses descending from
	cygwin_shared_address.
	(open_shared): Replace usage of SH_CYGWIN_SHARED by SH_USER_SHARED.
	(memory_init): Set cygwin_shared just by pointing to cygwin_shared_area.
	* shared_info.h (shared_locations): Remove SH_CYGWIN_SHARED and
	SH_MTINFO.
	(cygwin_shared_address): Define as DLL start address.
	* tty.h (tty_min::tty_min): Remove constructor.
2006-07-26 15:59:39 +00:00
Corinna Vinschen 020a7b4711 * include/cygwin/in6.h: Guard in_port_t typedef more restrictive to
avoid compiler warning.
2006-07-25 20:01:38 +00:00
Christopher Faylor 724c4ed146 * security.cc (get_logon_server): Remove nret and use dret for everything to
avoid a g++ warning.
2006-07-25 19:44:17 +00:00
Corinna Vinschen 70e476d27b 2006-07-25 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Bump DLL version to 1.7.0.

2006-07-25  Corinna Vinschen  <corinna@vinschen.de>

	* select.h: Remove.
	* fhandler_socket.cc: Don't include select.h.
	* select.cc: Ditto.

2006-07-25  Corinna Vinschen  <corinna@vinschen.de>

	* cygtls.h: Drop socket related includes.
	(struct _local_storage): Remove exitsock and exitsock_sin. Add
	select_sockevt.
	* cygtls.cc: Accomodate above change throughout.
	* fhandler.h (class fhandler_socket): Make wsock_evt public.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate
	reordering members.
	(fhandler_socket::evaluate_events): Drop FD_CONNECT event as soon as
	it gets read once.  Never remove FD_WRITE event here.
	(fhandler_socket::wait_for_events): Wait 50 ms instead of INFINITE for
	socket events.
	(fhandler_socket::accept): Fix conditional.  Set wsock_events members
	of accepted socket to useful start values.
	(fhandler_socket::recv_internal): Always drop FD_READ/FD_OOB events from
	wsock_events after the call to WSARecvFrom.
	(fhandler_socket::send_internal): Drop FD_WRITE event from wsock_events
	if the call to WSASendTo fails with WSAEWOULDBLOCK.  Fix return value
	condition.
	* select.cc (struct socketinf): Change to accomodate using socket event
	handling.
	(peek_socket): Use event handling for peeking socket.
	(thread_socket): Ditto.
	(start_thread_socket): Ditto.
	(socket_cleanup): Same here.
	* tlsoffsets.h: Regenerate.

2006-07-20  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler.h (class fhandler_socket): Rearrange slightly to keep
	event handling methods and members together.  Drop owner status flag.
	Split wait method.  Rename event handling methods for readability.
	* fhandler_socket.cc (struct wsa_event): Add owner field.
	(LOCK_EVENTS): New macro.
	(UNLOCK_EVENTS): Ditto.
	(fhandler_socket::init_events): rename from prepare.
	(fhandler_socket::evaluate_events): First half of former wait method.
	Do everything but wait.  Allow specifiying whether or not events from
	event_mask should be erased from wsock_events->events.  Simplify
	OOB handling.  Allow sending SIGURG to any process (group).
	(fhandler_socket::wait_for_events): Second half of former wait method.
	Call evaluate_events and wait in a loop if socket is blocking.
	(fhandler_socket::release_events): Rename from release.
	(fhandler_socket::connect): Accomodate above name changes.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::recv_internal): Ditto.
	(fhandler_socket::send_internal): Ditto.
	(fhandler_socket::close): Ditto.
	(fhandler_socket::fcntl): Always set owner to given input value on
	F_SETOWN.  Handle F_GETOWN.
	* net.cc (fdsock): Accomodate above name changes.

2006-07-20  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler_socket.cc (fhandler_socket::wait): Set Winsock errno to
	WSAEWOULDBLOCK instead of WSAEINPROGRESS.

2006-07-18  Brian Ford  <Brian.Ford@FlightSafety.com>
	    Corinna Vinschen  <corinna@vinschen.de>

	* winsup.h (mmap_region_status): New enum.
	(mmap_is_attached_or_noreserve_page): Adjust prototype and rename
	as below.
	* mmap.cc (mmap_is_attached_or_noreserve_page):  Rename
	mmap_is_attached_or_noreserve.  Add region length parameter.
	Return enum above.
	* exceptions.cc (_cygtls::handle_exceptions): Accomodate above.
	* fhandler.cc (fhandler_base::raw_read): Call above for NOACCESS
	errors and retry on success to allow reads into untouched
	MAP_NORESERVE buffers.

2006-07-18  Corinna Vinschen  <corinna@vinschen.de>

	* cygwin.din (posix_openpt): Export.
	* tty.cc (posix_openpt): New function.
	* include/cygwin/stdlib.h (posix_openpt): Declare.
	* include/cygwin/version.h: Bump API minor number.

2006-07-14  Corinna Vinschen  <corinna@vinschen.de>

	* security.cc (get_token_group_sidlist): Always add the interactive
	group to the token.  Add comment.  Create logon_id group SID by
	copying it from incoming group list.
	(create_token): Add subauth_token parameter.  Use information in
	subauth_token if present.  Tweak SourceIdentifier if subauth_token
	is present for debugging purposes.
	* security.h (create_token): Add subauth_token parameter in declaration.
	* syscalls.cc (seteuid32): Call subauth first.  Call create_token
	regardless.  Use subauth token in call to create_token if subauth
	succeeded.

2006-07-13  Corinna Vinschen  <corinna@vinschen.de>

	* include/netinet/in.h: Update copyright.

2006-07-13  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler_socket.cc (fhandler_socket::wait): Rework function so that
	WaitForMultipleObjects is really only called when necessary.

2006-07-12  Corinna Vinschen  <corinna@vinschen.de>

	* include/netdb.h: Declare rcmd, rcmd_af, rexec, rresvport,
	rresvport_af, iruserok, iruserok_sa, ruserok.

2006-07-12  Corinna Vinschen  <corinna@vinschen.de>

	* Makefile.in (DLL_OFILES): Drop iruserok.o.  Add rcmd.o.
	* autoload.cc (rcmd): Drop definition.
	* cygwin.din: Export bindresvport, bindresvport_sa, iruserok_sa,
	rcmd_af, rresvport_af.
	* net.cc (cygwin_rcmd): Remove.
	(last_used_bindresvport): Rename from last_used_rrecvport.
	(cygwin_bindresvport_sa): New function implementing bindresvport_sa.
	(cygwin_bindresvport): New function implementing bindresvport.
	(cygwin_rresvport): Remove.
	* include/cygwin/version.h: Bump API minor number.
	* include/netinet/in.h: Declare bindresvport and bindresvport_sa.
	* libc/iruserok.c: Remove file.
	* libc/rcmd.cc: New file implementing rcmd, rcmd_af, rresvport,
	rresvport_af, iruserok_sa, iruserok and ruserok.

2006-07-12  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler_socket.cc (fhandler_socket::getsockname): Return valid
	result for unbound sockets.

2006-07-11  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Handle
	wsock_mtx and wsock_evt on fork, thus handling close_on_exec correctly.
	(fhandler_socket::fixup_after_exec): Drop misguided attempt to handle
	close_on_exec here.
	(fhandler_socket::dup): Call fixup_after_fork with NULL parent.
	Add comment.
	(fhandler_socket::set_close_on_exec): Handle wsock_mtx and wsock_evt.

2006-07-10  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler.h (class fhandler_socket): Add wsock_mtx, wsock_evt
	and wsock_events members.  Remove closed status flag, add listener
	status flag.  Accomodate new implementation of socket event handling
	methods.  Declare recv* and send* functions ssize_t as the POSIX
	equivalents.
	(fhandler_socket::recv_internal): Declare.
	(fhandler_socket::send_internal): Ditto.
	* fhandler_socket.cc (EVENT_MASK): Define mask of selected events.
	(fhandler_socket::fhandler_socket): Initialize new members.
	(fhandler_socket::af_local_setblocking): Don't actually set the
	socket to blocking mode.  Keep sane event selection.
	(fhandler_socket::af_local_unsetblocking): Don't actually set the
	socket to previous blocking setting, just remember it.
	(struct wsa_event): New structure to keep event data per shared
	socket.
	(NUM_SOCKS): Define number of shared sockets concurrently handled by
	all active Cygwin processes.
	(wsa_events): New shared datastructure keeping all wsa_event records.
	(socket_serial_number): New shared variable to identify shared sockets.
	(wsa_slot_mtx): Global mutex to serialize wsa_events access.
	(search_wsa_event_slot): New static function to select a new wsa_event
	slot for a new socket.
	(fhandler_socket::prepare): Rewrite.  Prepare event selection
	per new socket.
	(fhandler_socket::wait): Rewrite.  Wait for socket events in thread
	safe and multiple process safe.
	(fhandler_socket::release): Rewrite.  Close per-socket descriptor
	mutex handle and event handle.
	(fhandler_socket::dup): Duplicate wsock_mtx and wsock_evt.  Fix
	copy-paste error in debug output.
	(fhandler_socket::connect): Accomodate new event handling.
	(fhandler_socket::listen): Set listener flag on successful listen.
	(fhandler_socket::accept): Accomodate new event handling.
	(fhandler_socket::recv_internal): New inline method centralizing
	common recv code.
	(fhandler_socket::recvfrom): Call recv_internal now.
	(fhandler_socket::recvmsg): Ditto.  Streamline copying from iovec
	to WSABUF.
	(fhandler_socket::send_internal): New inline method centralizing
	common send code.
	(fhandler_socket::sendto): Call send_internal now.
	(fhandler_socket::sendmsg): Ditto.  Streamline copying from iovec
	to WSABUF.
	(fhandler_socket::close): Call release now.
	(fhandler_socket::ioctl): Never actually switch to blocking mode.
	Just keep track of the setting.
	* net.cc (fdsock): Call prepare now.
	(cygwin_connect): Revert again to event driven technique.
	(cygwin_accept): Ditto.
	* poll.cc (poll): Don't call recvfrom on a listening socket.
	Remove special case for failing recvfrom.
	* include/sys/socket.h: Declare recv* and send* functions ssize_t as
	requested by POSIX.

2006-07-07  Corinna Vinschen  <corinna@vinschen.de>

	* net.cc (cygwin_inet_ntop): Fix data type of forth parameter.

2006-07-06  Corinna Vinschen  <corinna@vinschen.de>

	* include/cygwin/in6.h (struct in6_addr): Fix typo.

2006-07-06  Corinna Vinschen  <corinna@vinschen.de>

	* cygwin.din: Export in6addr_any, in6addr_loopback, freeaddrinfo,
	gai_strerror, getaddrinfo, getnameinfo.
	* fhandler_socket.cc: Include cygwin/in6.h.
	(get_inet_addr): Accomodate AF_INET6 usage.
	(fhandler_socket::connect): Ditto.
	(fhandler_socket::listen): Ditto.
	(fhandler_socket::sendto): Ditto.
	* net.cc: Include cygwin/in6.h.
	(in6addr_any): Define.
	(in6addr_loopback): Define.
	(cygwin_socket): Accomodate AF_INET6 usage.
	(socketpair): Bind socketpairs only to loopback for security.
	(inet_pton4): New static function.
	(inet_pton6): Ditto.
	(cygwin_inet_pton): New AF_INET6 aware inet_pton implementation.
	(inet_ntop4): New static function.
	(inet_ntop6): Ditto.
	(cygwin_inet_ntop): New AF_INET6 aware inet_ntop implementation.
	(ga_aistruct): New static function.
	(ga_clone): Ditto.
	(ga_echeck): Ditto.
	(ga_nsearch): Ditto.
	(ga_port): Ditto.
	(ga_serv): Ditto.
	(ga_unix): Ditto.
	(gn_ipv46): Ditto.
	(ipv4_freeaddrinfo): Ditto.
	(ipv4_getaddrinfo): Ditto.
	(ipv4_getnameinfo): Ditto.
	(gai_errmap_t): New structure holding error code - error string mapping.
	(cygwin_gai_strerror): New function implementing gai_strerror.
	(w32_to_gai_err): New static function.
	(get_ipv6_funcs): Ditto.
	(load_ipv6_funcs): Ditto.
	(cygwin_freeaddrinfo): New function implementing freeaddrinfo.
	(cygwin_getaddrinfo): New function implementing getaddrinfo.
	(cygwin_getnameinfo): New function implementing getnameinfo.
	* include/netdb.h: Include stdint.h and cygwin/socket.h.  Define
	data types and macros used by getaddrinfo and friends.  Declare
	freeaddrinfo, gai_strerror, getaddrinfo and getnameinfo.
	* include/cygwin/in.h: Add IPv6 related IPPROTOs. Remove definition
	of struct sockaddr_in6.  Include cygwin/in6.h instead.
	* include/cygwin/in6.h: New header file defining IPv6 releated
	data types and macros.
	* include/cygwin/socket.h: Enable AF_INET6 and PF_INET6.  Add
	IPv6 related socket options.
	* include/cygwin/version.h: Bump API minor number.

2006-07-06  Corinna Vinschen  <corinna@vinschen.de>

	* autoload.cc (DsGetDcNameA): Define.
	(NetGetAnyDCName): Define.
	* security.cc: Include dsgetdc.h.
	(DsGetDcNameA): Declare.
	(DS_FORCE_REDISCOVERY): Define.
	(get_logon_server): Add bool parameter to control rediscovery of DC.
	Use DsGetDcNameA function if supported, NetGetDCName/NetGetAnyDCName
	otherwise.
	(get_server_groups): Rediscover DC if get_user_groups fails and
	try again.
	(get_reg_security): Use correct error code macro when testing
	RegGetKeySecurity return value.
	* security.h (get_logon_server): Remove default vaue from wserver
	parameter.  Add rediscovery parameter.
	* uinfo.cc (cygheap_user::env_logsrv): Accomodate rediscovery parameter
	in call to get_logon_server.
2006-07-25 19:23:23 +00:00
Christopher Faylor 5e765b24a2 update copyright 2006-07-25 17:18:05 +00:00
Christopher Faylor e7a8c11c0f * include/cygwin/version.h: Bump DLL minor version number to 22. 2006-07-24 01:28:29 +00:00
Corinna Vinschen 9d272b3c31 * pinfo.cc (commune_process): Don't add extra \0 to cmdline.
(_pinfo::cmdline): Ditto process internal.
2006-07-19 16:00:28 +00:00
Corinna Vinschen add2f65f37 * mmap.cc (msync): Disable rounding up len. Fix bug in access check
loop.
2006-07-19 08:58:09 +00:00
Corinna Vinschen ef4954b62d * path.cc (symlink_worker): Return EEXIST if newpath exists. 2006-07-19 08:20:26 +00:00
Christopher Faylor 8432b8b206 * tty.cc (tty_list::terminate): Don't enter the busy loop if we don't own the
master.
2006-07-18 15:09:11 +00:00
Corinna Vinschen 62e9d4b96f * sec_acl.cc (acltotext32): Add missing handling of default ACL entry
types.
2006-07-18 14:11:38 +00:00
Corinna Vinschen 295912e873 * fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Fix typo in lint
directive.
2006-07-18 12:56:37 +00:00
Christopher Faylor f62412f235 GCC 4.1 fixes.
* cygheap.h (cygheap_user): Remove unneeded class names from function
declaration.
* fhandler.h (fhandler_base): Ditto.
(fhandler_dev_floppy): Ditto.
(fhandler_console): Ditto.
* wininfo.h (wininfo): Ditto.
* exceptions.cc (sigpacket::process): Avoid compiler errors about gotos and
initialization.
* fhandler_fifo.cc (fhandler_fifo::open): Ditto.
* fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto.
* mmap.cc (mmap64): Ditto.
* pipe.cc (fhandler_pipe::open): Ditto.
* spawn.cc (spawn_guts): Ditto.
* sec_helper.cc: Fix some comments.
(get_null_sd): Move file-scope static to only function where it is used.
2006-07-17 19:30:30 +00:00
Christopher Faylor fbadc634cb * fork.cc (fork): Lock the process before forking to prevent things like new
fds from being opened, etc.
* sync.h (lock_process::dont_bother): New function.
2006-07-14 22:15:12 +00:00
Christopher Faylor d9ceecd2d2 * include/cygwin/types.h: Update copyright. 2006-07-14 21:45:00 +00:00
Christopher Faylor ebc223f182 * cygwin.sc: Make sure there's something in the cygheap.
* dllfixdbg: Accommodate newer binutils which put the gnu_debuglink at the end
rather than at the beginning.
2006-07-14 19:33:55 +00:00
Christopher Faylor 6b838263ea * sigproc.cc (waitq_head): Don't initialize to zero.
* sigproc.h: Update copyright, fix whitespace.
2006-07-14 00:50:55 +00:00