Commit Graph

3837 Commits

Author SHA1 Message Date
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 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 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
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