Commit Graph

3362 Commits

Author SHA1 Message Date
Christopher Faylor a743e3b940 * cygheap.cc (cygheap_init): Eliminate debugging #if.
* fork.cc (fork_parent): Don't issue errors if "somebody" has set the
PID_EXITED flag on a child.  Don't close process handle if it has potentially
already been closed.
* pinfo.cc (winpids::add): Eliminate PID_ALLPIDS handling which was obsoleted
by previous changes.
* spawn.cc (av::fixup): Do win16 detection for .com files.  Make sure that
buffer has been unmapped in all cases.
2005-09-05 17:30:04 +00:00
Corinna Vinschen bf58ec35b4 * thread.h (pthread_mutex::get_pthread_self): Remove.
(pthread_mutex::lock): Use ::pthread_self as self parameter.
	(pthread_mutex::trylock): Ditto.
	(pthread_mutex::unlock): Ditto.
	(pthread_mutex::destroy): Ditto.
2005-09-05 15:17:03 +00:00
Christopher Faylor 414808f9e0 * Makefile.in (CXXFLAGS): Use 'override' to correctly set flags to generate
dependencies when invoked from top-level make.
2005-09-02 17:12:37 +00:00
Christopher Faylor 6a53b21360 * exceptions.cc (set_process_mask_delta): Conditionalize debugging output.
* sigproc.cc (proc_subproc): Make strace output a little more verbose.
2005-08-29 03:12:39 +00:00
Christopher Faylor 74f5d7104b typo 2005-08-28 23:52:01 +00:00
Christopher Faylor c461fbf160 * cygtls.h (__ljfault): Declare.
(_cygtls::return_from_fault): Use __ljfault.
* exceptions.cc (set_signal_mask): Revert previous checkin.
* gendef (__sjfault): Split out into a separate function which doesn't bother
with any special signal locking.  routines.
(_ljfault): Return from a __sjfault without bothering with signals.
2005-08-28 23:26:23 +00:00
Christopher Faylor 2241d3fb53 Add missing ChangeLog for previous checkin.
Revert erroneous include/cygwin/version.h checkin.
2005-08-28 17:34:25 +00:00
Christopher Faylor 453185b136 * cygwin.din: Correct readdir_r typo. 2005-08-28 17:30:34 +00:00
Christopher Faylor a232350855 Fix typo. 2005-08-28 16:51:55 +00:00
Christopher Faylor b2068b401b Fix improper formatting. 2005-08-28 16:51:13 +00:00
Christopher Faylor 988e9165e9 *dir.cc (readdir_r): Invert sense on error-test. 2005-08-28 16:30:48 +00:00
Corinna Vinschen 63958f00d3 * path.cc (normalize_posix_path): Keep two leading slashes
intact throughout.
	(normalize_win32_path): Revert to only checking for slash.
	(realpath): Convert drive letters to cygdrive paths before
	doing anything else.
	* shared_info.h (mount_info::cygdrive_posix_path): Make public.
2005-08-26 15:11:06 +00:00
Corinna Vinschen 3716969169 * path.cc (realpath): Drop call to mount_info::conv_to_posix_path
in favor of calling path_conv with PC_POSIX flag.  Align error
	handling closer to POSIX.  As on Linux, return user space allocated
	memory if second parameter is NULL.
2005-08-25 21:18:26 +00:00
Corinna Vinschen 9d13e04523 * path.cc (normalize_win32_path): Honor network paths. Fold more
than two leading dir separators into one.  Check for dir separator
	instead of just slashes to handle incoming Win32 paths correctly.
2005-08-25 20:35:25 +00:00
Christopher Faylor b4b0980b9d * errno.cc (errmap): Translate ERROR_NO_MORE_ITEMS to ENMFILE. 2005-08-25 15:27:10 +00:00
Christopher Faylor b9ebff640a * exceptions.cc (handle_sigsuspend): Just sleep forever if called from non-main
thread.
(sigpacket:process): Simplify logic which determines when and how a signal is
masked.  Don't trigger sigwait if there is a signal handler.
* sigproc.cc (wait_sig): Update comment.  Try to process a signal which is in
the queue if it isn't queued for the target thread (this is still not right).
2005-08-25 03:12:48 +00:00
Christopher Faylor 04dfd98dc6 * spawn.cc (perhaps_suffix): Record errno-type error value in third argument.
(find_exec): On error, set errno returned from perhaps_suffix.
(spawn_guts): Ditto.
2005-08-24 18:26:14 +00:00
Christopher Faylor b56c466b2c * fhandler_virtual.cc (fhandler_virtual::close): Don't free filebuf if it's
NULL.
* pinfo.cc (_pinfo::commune_send): Fix test for incorrect number of bytes read
from pipe.
2005-08-24 17:45:11 +00:00
Corinna Vinschen 986c841b21 * syscalls.cc (endusershell): Reset shell_fp to NULL to allow
subsequent getusershell calls.
2005-08-24 15:50:11 +00:00
Christopher Faylor 7871cd8c5d * path.cc (path_conv::check): Fill in fileattr for /dev, defaulting to
directory if /dev doesn't actually exist.
(win32_device_name): Don't consider FH_DEV to be a device since it's really a
directory which should go through mount processing.
2005-08-24 14:17:56 +00:00
Christopher Faylor 14c4d65ef1 * cygheap.h (cygheap_types): Add HEAP_COMMUNE.
* fhandler_proc.cc: Use cygheap rather than user heap for allocation of filebuf
throughout.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* fhandler_process.cc: Ditto.
(get_mem_values): Use malloc/realloc/free rather than new.
* pinfo.cc (_pinfo::commune_send): Allocate on cygwin heap rather than user
heap.  Avoid calling ReadFile when correct number of characters have been read
or suffer buffer corruption.
(_pinfo::fd): Allocate on cygwin heap rather than user heap.
(_pinfo::fds): Ditto.
(_pinfo::root): Ditto.
(_pinfo::cwd): Ditto.
(_pinfo::cmdline): Ditto.
* devices.h (FH_DEV): New define.
* devices.in: Detect lone /dev.
* devices.cc: Regenerate.
* path.cc (path_conv::check): Treat FH_DEV as a special case.
2005-08-24 04:38:39 +00:00
Christopher Faylor db7f135b03 * sigproc.h (set_signal_mask): Remove default on second parameter and make pass
by reference.
* signal.cc (abort): Accommodate change to set_signal_mask.
* select.cc (pselect): Ditto.
* exceptions.cc (handle_sigsuspend): Ditto.
(ctrl_c_handler): Ditto.
(sighold): Ditto.
(sigrelse): Ditto.
(set_process_mask_delta): Ditto.
(_cygtls::call_signal_handler): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE if
__handle is not set.  Set __handle to NULL when out of files.
(fhandler_disk_file::rewinddir): Don't close handle if it's NULL.
(fhandler_disk_file::closedir): Ditto.
2005-08-23 22:22:52 +00:00
Christopher Faylor 5f5c6f7fa9 * dir.cc (readdir_worker): Make static. Only add '.' and '..' when readdir
fails due to ENMFILE.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Only close handle on
error != ENMFILE.
2005-08-23 03:58:09 +00:00
Corinna Vinschen b575e059ac * mtinfo.h (mtinfo_drive::error): Fix argument bug in debug_printf call. 2005-08-22 16:12:01 +00:00
Christopher Faylor acc12b15a1 add missing entry 2005-08-20 06:21:20 +00:00
Christopher Faylor d9a2276435 * cygerrno.h (geterrno_from_win_error): Change declaration to default to using
GetLastError and EACCESS.
* cygwin.din: Export readdir_r.
* include/cygwin/version.h: Bump API version number to 138.
* syscalls.cc (readdir_worker): New function, renamed from old readdir()
function.
(readdir): Use readdir_worker.
(readdir_r): New function.
* fhandler.h (fhandler_base::readdir): Accommodate second argument indicating
dirent buffer.
(fhandler_disk_file::readdir): Ditto.
(fhandler_cygdrive::readdir): Ditto.
(fhandler_proc::readdir): Ditto.
(fhandler_netdrive::readdir): Ditto.
(fhandler_registry::readdir): Ditto.
(fhandler_process::readdir): Ditto.
* fhandler.cc (fhandler_base::readdir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Ditto.
* fhandler_cygdrive.cc (fhandler_cygdrive::readdir): Ditto.
* fhandler_proc.cc (fhandler_proc::readdir): Ditto.
* fhandler_netdrive.cc (fhandler_netdrive::readdir): Ditto.
* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
2005-08-20 06:19:55 +00:00
Christopher Faylor 683ef95392 * fhandler.h (dirent_states): Add dirent_saw_proc.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Fill in "proc" if it is
the root dir and it is missing.
2005-08-19 16:29:43 +00:00
Christopher Faylor 358063ace3 * fhandler.h (dirent_states): Add dirent_isroot, dirent_saw_cygdrive,
dirent_saw_dev.
* dir.cc (opendir): Don't zero __flags here.  Push that responsibility to
opendir methods.
(seekdir): Preserve dirent_isrrot in __flags.
(rewinddir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set dirent_isroot
appropriately.
(fhandler_disk_file::readdir): Fill in "cygdrive" and "dev" if it is the root
dir and they are missing.
* fhandler_process.cc (fhandler_process::opendir): Set __flags here.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set __flags here.
2005-08-19 16:18:42 +00:00
Christopher Faylor babc4e5424 * winsup.h (create_pipe): Declare new function.
(CreatePipe): New define.
* miscfuncs.cc (create_pipe): Define new function.
2005-08-19 14:56:48 +00:00
Christopher Faylor 4f3e6ff17b * fhandler.h (fhandler_tty_common::lseek): Declare new method.
(fhandler_tty_slave::lseek): Delete old method.
(fhandler_tty_master::lseek): Delete old method.
* fhandler_tty.cc (fhandler_tty_common::lseek): Define new method.
2005-08-18 20:17:10 +00:00
Corinna Vinschen abebe87c40 * fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize
ret to 0.
	(fhandler_socket::recvmsg): Ditto.
2005-08-18 13:14:15 +00:00
Corinna Vinschen d71805725f * errno.cc (strerror): Check errnum for underflow. 2005-08-18 08:35:19 +00:00
Christopher Faylor 0d339267ec * dcrt0.cc (dll_crt0_1): Tweak debugging stuff.
* fhandler_tty.cc (fhandler_tty_common::close): Rearrange the code so that the
master end of the input and output pipes is closed before signalling an EOF
event to the slave.
(fhandler_pty_master::close): Likewise.
2005-08-17 16:10:48 +00:00
Corinna Vinschen 447419497d * init.cc (respawn_wow64_process): Make inline function. Remove
"noreturn" attribute.  Add additional check if parent process is
	actually a 64 bit process.
	(dll_entry): Only test WOW64 processes with a stack in the usual
	"dangerous" process space area.
2005-08-14 19:48:07 +00:00
Christopher Faylor b4ec184199 fix typo 2005-08-11 17:18:18 +00:00
Christopher Faylor 205a575188 * fhandler_serial.cc (fhandler_serial::tcgetattr): Return current baud rate
regardless of current DTR state.
2005-08-11 17:03:18 +00:00
Christopher Faylor b21413b304 * dcrt0.cc: Remove ld_preload declaration.
* winsup.h: Move ld_preload declaration here.
* fork.cc (fork_child): Call ld_preload() before returning.
2005-08-11 16:30:48 +00:00
Christopher Faylor ff7bdd11f5 * child_info. (CURR_CHILD_INFO_MAGIC): Refresh.
(child_info::child_info()): New constructor.
(child_info_spawn::child_info_spawn()): Ditto.
(child_info_spawn::operator new): New operator.
(child_info_spawn::set): New function.
* spawn.cc (av()): New constructor.
(av::operator new): New operator.
(av::set): New function.
(spawn_guts): Reorganize so that classes which allocates are defined early in
the function so that it can be properly cleaned up after an efault.  Set errno
to E2BIG in the event of a SEGV situation.
2005-08-11 16:13:30 +00:00
Christopher Faylor d4c8f095ba * include/sys/cdefs.h: Remove extra line. 2005-08-08 18:54:28 +00:00
Corinna Vinschen 2ab8ea6738 * security.cc (get_reg_security): New static function.
(get_nt_object_security): Call get_reg_security for registry keys
	to circumvent problems with predefined registry keys.
2005-08-08 16:30:15 +00:00
Corinna Vinschen af925fe4fa * fhandler_process.cc (fhandler_process::open): Allow opening of
/proc/<pid>/fd for reading.
	* fhandler_registry.cc (fhandler_registry::open): Ditto for registry
	keys.
2005-08-08 15:33:32 +00:00
Christopher Faylor 6e8cac2638 * include/sys/cdefs.h (__CONCAT): Define.
* include/elf.h: New file.
* include/sys/elf32.h: Ditto.
* include/sys/elf64.h: Ditto.
* include/sys/elf_common.h: Ditto.
* include/sys/elf_generic.h: Ditto.
2005-08-08 15:00:39 +00:00
Christopher Faylor 2e82c9355f * cygwin.sc: Use simpler method to align .cygheap.
* dllfixdbg: Just copy .stab and .stabstr sections when making cygwin1.dbg,
rather than relying on objcopy to keep only the debug sections since objcopy
seems to get it wrong.
* dtable.cc (build_fh_pc): Check setting fh to fhandler_nodevice for NULL, too.
2005-08-08 13:53:05 +00:00
Corinna Vinschen a8b939adc7 * ftw.c: Include winsup.h.
* nftw.c: Ditto.
	* include/ftw.h: Guard declarations appropriately.
2005-08-08 13:39:56 +00:00
Corinna Vinschen e6ae6cd338 * Makefile.in (DLL_OFILES): Add fts.o, ftw.o, nftw.o.
* cygwin.din: Export fts_children, fts_close, fts_get_clientptr,
	fts_get_stream, fts_open, fts_read, fts_set, fts_set_clientptr,
	ftw, nftw.
	* fts.c: New file, imported from FreeBSD.
	* ftw.c: Ditto.
	* nftw.c: Ditto.
	* include/fts.h: Ditto.
	* include/ftw.h: Ditto.
	* include/cygwin/version.h: Bump API minor number.
2005-08-08 09:45:42 +00:00
Christopher Faylor 6a7bea70f0 * Makefile.in (dtable_CFLAGS): Use -fomit-frame-pointer and -fcheck-new.
* cygheap.cc (cmalloc): Only emit system_printf warnings on failure if
DEBUGGING.
(crealloc): Ditto.
(ccalloc): Ditto.
* dtable.cc (build_fh_name): Treat NULL return from cnew as indicative of
EMFILE condition.
(build_fh_dev): Ditto.
(dtable::dup_worker): Handle NULL return from build_fh_pc.
(dtable::vfork_child_dup): Trust dup_worker to set errno.
* fhandler.h (fhandler_base::new): Mark as nothrow.
2005-08-08 04:06:07 +00:00
Christopher Faylor cbda22eb63 * dllfixdbg: New perl script.
* configure.in: Detect objcopy, objdump, strip.
* configure: Regenerate.
* Makefile.in: Pass target objcopy/objdump to new dllfixdbg script.  Remove
previous perl check.
* cygwin.sc: Add .gnu_debuglink_overlay section for eventual replacement with
.gnu_debuglink section.  Revert move of cygheap to end of image.
2005-08-08 02:27:43 +00:00
Corinna Vinschen 1e0cb9ee0a * Makefile.in: Allow previous patch to work in a 64 bit environment. 2005-08-07 09:21:09 +00:00
Christopher Faylor 82eaabf521 * Makefile.in: Warn when end of cygheap is not on 64k boundary.
* cygwin.sc: Try harder to ensure that cygheap is on a 64k boundary.  Move
cygheap to end of image to stop interference from unstripped debug regions.
2005-08-07 02:38:13 +00:00
Christopher Faylor 244f5a27a6 * include/endian.h: Move everything into this file and define things more like
linux.
* include/cygwin/types.h: Include endian.h.
* include/sys/dirent.h: Define DT_* types and conversion macros.
* pinfo.cc (pinfo::init): Remove special handling for PID_ALLPIDS and execed
code, even though it probably still isn't quite right.
2005-08-06 23:00:06 +00:00
Corinna Vinschen 7d7e7a21b1 * thread.cc (pthread::create(3 args)): Make bool.
(pthread_null::create): Ditto.
	(pthread::create(4 args)): Check return of inner create rather than
	calling is_good_object().
	* thread.h: Ditto.
2005-08-05 16:14:41 +00:00
Corinna Vinschen c8f07ce787 * fhandler_tty.cc (fhandler_tty_slave::tcflush): Return either 0 or -1. 2005-08-05 16:11:21 +00:00
Corinna Vinschen 8cba692063 * thread.cc (pthread_cond_timedwait): Check abstime for validity
according to SUSv3.  Rewrite timeout check and waitlength calculation
	to avoid overflow problems.
2005-08-05 11:31:33 +00:00
Corinna Vinschen 723d64e667 * include/sys/termios.h: Define TIOCMBIS and TIOCMBIC.
* fhandler.h (class fhandler_serial): Declare switch_modem_lines.
	* fhandler_serial.cc (fhandler_serial::switch_modem_lines): New
	static function to set or clear DTR and/or RTS.
	(fhandler_serial::ioctl): Use switch_modem_lines for TIOCMSET
	and new TIOCMBIS and TIOCMBIC.
	* include/cygwin/version.h: Bump API minor number.
2005-08-02 09:17:15 +00:00
Christopher Faylor 88c5a50f9f * fhandler_disk_file.cc (fhandler_base::pread): Don't move file offset pointer
after I/O.
(fhandler_base::pwrite): Ditto.
2005-07-29 17:26:10 +00:00
Christopher Faylor 7d7d09aee8 * fhandler.h (fhandler_base::pread): Declare new function.
(fhandler_base::pwrite): Ditto.
(fhandler_disk_file::pread): Ditto.
(fhandler_disk_file::pwrite): Ditto.
* fhandler.cc (fhandler_base::pread): Define new function.
(fhandler_base::pwrite): Ditto.
* fhandler_disk_file.cc (fhandler_base::pread): Ditto.
(fhandler_base::pwrite): Ditto.
* syscalls.cc (pread): Define new function.
(pwrite): Ditto.
* cygwin.din: Export pread, pwrite.
* include/sys/ioctl.h: Guard some _IO* declarations to avoid conflict with
socket.h.
2005-07-29 17:04:46 +00:00
Christopher Faylor 728b9af5c9 * include/sys/ioctl.h: Add some linux defines. 2005-07-29 15:26:18 +00:00
Christopher Faylor b78b8f53ae * pinfo.cc (pinfo::init): Put back accidentally removed debug_printf. 2005-07-29 14:33:50 +00:00
Christopher Faylor 2b3fc7325c * cygthread.cc (cygthread::simplestub): Wait for h to be filled out by main
thread before assigning it.
2005-07-29 14:29:33 +00:00
Christopher Faylor 40c125cf38 * pinfo.cc (pinfo::init): Sleep before retrying open_shared(). 2005-07-29 14:25:28 +00:00
Christopher Faylor f834829dee * fork.cc (fork_parent): Fix null deref if pinfo creation fails. 2005-07-29 14:22:56 +00:00
Christopher Faylor 4fe79f1c97 * cygmalloc.h (MSPACES): Define. This dropped through the cracks after the
last malloc update.
* dcrt0.cc: Fix a comment.
* malloc.cc (internal_malloc): Fix definition so that it can be safely coerced.
2005-07-28 17:03:34 +00:00
Christopher Faylor 09b490911c * include/cygwin/in.h (INET_ADDRSTRLEN): Add new definition. 2005-07-27 17:35:18 +00:00
Christopher Faylor efc7accc9d * gendef: Use nocr to remove \r's from input. gendef (nocr): New function. 2005-07-27 16:16:51 +00:00
Christopher Faylor a3c024d6ea * fhandler_clipboard.cc (fhandler_dev_clipboard::close): Set membuffer to NULL.
(fhandler_dev_clipboard::fixup_after_exec): Don't call close here.  Just set
variables directly.
2005-07-27 14:33:09 +00:00
Christopher Faylor 0a911c4e6d * include/byteswap.h: New file. 2005-07-26 00:55:42 +00:00
Christopher Faylor 33e7a6bb89 * include/cygwin/types.h: Define loff_t. 2005-07-25 21:46:36 +00:00
Christopher Faylor e8454a3400 * child_info.h (child_info::sync): Pass pid and HANDLE rather than using pinfo.
(child_info::child_info): Accept an argument controlling whether to create
proc_subproc.
(child_info_spawn::child_info_spawn): Ditto.
* sigproc.cc (child_info::child_info): Ditto.
(child_info_spawn::child_info_spawn): Ditto.
(child_info::sync): Use passed in pid and HANDLE.
* fork.cc (fork_parent): Reflect additional arguments required for
child_info::sync.
* hookapi.cc (hook_or_detect_cygwin): Rename.  Change so that NULL 'fn'
argument just returns "true", indicating that program uses cygwin1.dll.
* spawn.cc (av::win16_exe): New element.
* spawn.cc (av::iscygwin): New element.
(av::fixup): New function.
(spawn_guts): Protect against SEGV.  Use fixup function to detect when it is
safe to wait for a spawned (as opposed to an execed) program.  Reflect changes
in child_info::sync arguments.
* external.cc (cygwin_internal): Reflect function renaming to
hook_or_detect_cygwin.
* cygheap.cc (cygheap_fixup_in_child): Close handle after debug fixup has been
done to prevent false positives in handle collision.
* exceptions.cc (try_to_debug): Notify debugger if already being debugged.
2005-07-17 00:51:03 +00:00
Christopher Faylor f79359a5bc * path.cc (mount): Only check win32_path when we know we need it. 2005-07-09 17:15:38 +00:00
Corinna Vinschen 4cc9a82e3e * cygwin.din (getline): Export.
(getdelim): Export.
	* include/sys/stdio.h (getline): Replace macro with function prototype.
	(getdelim):  Likewise.
	* include/cygwin/version.h: Bump API minor number.
2005-07-09 08:22:39 +00:00
Corinna Vinschen 2f5de4af55 * cygwin.din (__getline): Export.
(__getdelim): Export.
	* include/sys/stdio.h (getline): Define as __getline.
	(getdelim): Define as __getdelim.
	* include/cygwin/version.h: Bump API minor number.
2005-07-08 08:24:13 +00:00
Christopher Faylor 0c55f6ed60 Eliminate (void) cast on standalone function calls throughout. 2005-07-06 20:05:03 +00:00
Christopher Faylor d3b593aa44 * dcrt0.cc (cygwin_exit): Mark as "noreturn".
* sigproc.cc (child_info::ready): Don't signal parent that we are a cygwin
process if we are dynamically loaded.
2005-07-05 20:20:48 +00:00
Christopher Faylor 57000a5d5c * malloc.cc: Update to version 2.8.2. 2005-07-05 15:11:49 +00:00
Corinna Vinschen 4ae72e8c0e * fhandler_tape.cc (fhandler_dev_tape::close): Don't do "extra stuff"
when we know we're execing.
2005-07-05 07:28:52 +00:00
Christopher Faylor 2f9ae2ed94 Change foo (void) to foo () for all c++ functions throughout. Remove all
fhandler_*::dump functions throughout.
* fhandler.h (fhandler_dev_mem::close): Remove pass-through function in favor
of virtual method.
(handler_dev_raw::close): Ditto.
(fhandler_dev_clipboard::fixup_after_exec): New method.
* fhandler_dev_mem.cc (fhandler_dev_mem::close): Eliminate pass through
* fhandler_dev_raw.cc (fhandler_dev_raw::close): Ditto.
* fhandler_clipboard.cc (fhandler_dev_clipboard::close): Don't go to extra
effort when execing.
(fhandler_dev_clipboard::fixup_after_exec): New function.
* fhandler_console.cc (fhandler_console::close): Don't do "extra stuff" when we
know we're execing.
* fhandler_disk_file.cc (fhandler_disk_file::close): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::close): Ditto.
* fhandler_fifo.cc (fhandler_fifo.cc::close): Ditto.  function in favor of base
function.
* fhandler_random.cc (fhandler_dev_random::close): Ditto.
* fhandler_registry.cc (fhandler_registry::close): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::close): Ditto.
* fhandler_virtual.cc (fhandler_virtual::close): Ditto.
* pinfo.cc (proc_waiter): Remove unneeded hExeced declaration.
* sigproc.cc: Ditto.
* winsup.h (hExeced): Define here.
* fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Just call close()
to reinitialize things to known state.
2005-07-05 03:16:46 +00:00
Christopher Faylor 26edeb6a7f * cygtls.h (_cygtls): Perform minor reformatting.
* winsup.h (close_all_files): Reflect argument change.
* dtable.cc (close_all_files): Ditto.
* dtable.h: Ditto.
* fhandler.h: Ditto.
* spawn.cc (spawn_guts): Move close_all_files back to its original location in
first P_OVERLAY test but use argument denoting that handles are only supposed
to be closed, not released (more work to be done here).
* syscalls.cc (close_all_files): Take an argument denoting whether to release
closed files or not.
* path.cc (symlink): Change argument names to reflect linux man page.
(symlink_worker): Ditto.  Also appropriately set ENOENT for empty strings.
2005-07-05 02:05:07 +00:00
Corinna Vinschen 0740b418fc * cygheap.h (struct init_cygheap): Delete cygwin_regname member.
* external.cc (cygwin_internal): Use cygpsid::get_id for
	CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID.
	Turn CW_SET_CYGWIN_REGISTRY_NAME and CW_GET_CYGWIN_REGISTRY_NAME
	into noops.
2005-07-04 08:44:06 +00:00
Christopher Faylor aaa4ee1b89 * thread.cc (pthread_mutex::init): Remove unneeded efault/mutex check. 2005-07-03 04:05:00 +00:00
Christopher Faylor 9d2a12f47a add missing ChangeLog entries 2005-07-03 03:44:56 +00:00
Christopher Faylor 4c157aa9e5 * thread.h (verifyable_object_state verifyable_object_isvalid): Delete function
declaration that should have been static.
* thread.cc (verifyable_object_state verifyable_object_isvalid): Make inline
static.
(pthread*::is_good_object): Move to directly after verifyable_object_state
verifyable_object_isvalid and make inline.
2005-07-03 03:25:19 +00:00
Christopher Faylor 893ac8e03c Replace valid memory checks with new myfault class "exception handling", almost
everywhere.  Leave some thread.cc stuff alone for now.
* cygtls.h: Kludge some definitions to avoid including a problematic windows
header.
(_cygtls::_myfault): New entry.
(_cygtls::_myfault_errno): Ditto.
(_cygtls::fault_guarded): New function.
(_cygtls::setup_fault): Ditto.
(_cygtls::return_from_fault): Ditto.
(_cygtls::clear_fault): Ditto.
(myfault): New class.
* exceptions.cc (handle_exceptions): Handle case of guarded fault in system
routine.
* gendef: Add another entry point for setjmp that the compiler doesn't know
about and won't complain about.
* gentls_offsets: Just include windows.h rather than kludging a HANDLE def.
* miscfuncs.cc (check_null_str): Delete.
(check_null_empty_str): Ditto.
(check_null_empty_str_errno): Ditto.
(check_null_str_errno): Ditto.
(__check_null_invalid_struct): Ditto.
(__check_null_invalid_struct_errno): Ditto.
(__check_invalid_read_ptr): Ditto.
(__check_invalid_read_ptr_errno): Ditto.
(dummytest): New function.
(check_iovec_for_read): Delete.
(chec_iovec): Rename from check_iovec_for_write.  Take a read/write parameter.
* tlsoffsets.h: Regenerate.
* winsup.h: Remove check_* declarations.
(check_iovec_for_read): Delete declaration.  Turn into a define instead.
(check_iovec_for_write): Ditto.
(check_iovec): New declaration.
* thread.h: Use ifdef guard name consistent with other header files.
2005-07-03 02:40:30 +00:00
Christopher Faylor 3513b0478a * include/cygwin/version.h: Bump DLL minor number to 19. 2005-07-03 02:03:58 +00:00
Corinna Vinschen f2abf3173b * fhandler.cc (fhandler_base::readv): Use malloc/free instead of alloca.
(fhandler_base::writev): Ditto.
2005-06-30 17:00:10 +00:00
Christopher Faylor 5b3e1f7358 * cygerrno.h: Make multi-inclusion safe.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Deal with EINTR.
* dcrt0.cc (dll_crt0_0): Accommodate init_console_handler argument change.
* winsup.h: Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* exceptions.cc (init_console_handler): Ditto.  Ignore console events if we're
not attached to a terminal.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* wincap.cc: Implement has_null_console_handler_routine throughout.
* wincap.h: Ditto.
2005-06-30 02:52:14 +00:00
Christopher Faylor 87e8bd37a0 * autoload.cc (LoadDLLprime): Use a more descriptive name for autoload text
sections.
* cygwin.sc: Ditto.
2005-06-29 23:05:41 +00:00
Corinna Vinschen f1fb564952 * fhandler_disk_file.cc (fhandler_disk_file::facl): Add missing break. 2005-06-27 14:18:13 +00:00
Corinna Vinschen 677ded600c * path.cc (path_conv::check): Don't strip trailing dots and spaces
at the start of the path.
2005-06-24 09:15:05 +00:00
Corinna Vinschen 3b12a57cb6 * fhandler.cc (rootdir): Don't set errno.
* syscalls.cc (statvfs): Set errno to ENOTDIR if rootdir() failed.
2005-06-24 09:12:15 +00:00
Corinna Vinschen d9c1b93d19 * fhandler.h (class fhandler_dev_tape): Add declaration for
fixup_after_fork and set_close_on_exec.
	* fhandler_tape.cc (fhandler_dev_tape::open): Create mt_mtx mutex
	inheritable.
	(fhandler_dev_tape::close): Close mt_mtx.
	(fhandler_dev_tape::dup): Duplicate mt_mtx and mt_evt as necessary.
	(fhandler_dev_tape::fixup_after_fork): New method.
	(fhandler_dev_tape::set_close_on_exec): New method.
2005-06-22 19:59:19 +00:00
Corinna Vinschen 2a770b2a6f * security.cc (get_initgroups_sidlist): Drop special_pgrp parameter.
(get_setgroups_sidlist): Avoid duplicate groups in group list.
	(create_token): Remove special_pgrp local variable.  Accomodate
	change to get_initgroups_sidlist call.
2005-06-21 20:38:05 +00:00
Corinna Vinschen 4adc3db74e * uinfo.cc (uinfo_init): Call reimpersonate to set the main thread's
impersonation token.
2005-06-21 20:09:31 +00:00
Corinna Vinschen 74041a3a74 * fhandler_proc.cc (format_proc_partitions): Only list recognized
partitions.  Use partition number given by PartitionNumber member.
2005-06-20 19:58:26 +00:00
Corinna Vinschen fa2d9fc528 * glob.c: (glob0): New local variable `limit`. Use in calls to glob1
and globextend.
	(glob1): Add `limit' parameter.
	(glob2): Ditto.
	(glob3): Ditto.
	(globextend): Ditto. Implement GLOB_LIMIT handling.
	* include/glob.h (GLOB_LIMIT): New define.
	* include/cygwin/version.h: Bump API minor number.
2005-06-18 19:04:25 +00:00
Christopher Faylor 91717fb806 * wincap.h (wincaps::detect_win16_exe): Declare.
(wincapc::detect_win16_exe): Implement.
* wincap.cc: Populate detect_win16_exe where appropriate.
* spawn.cc (spawn_guts): Only go out of the way to detect 16-bit apps on
systems which are flummoxed by them.
2005-06-18 01:36:18 +00:00
Christopher Faylor 2bc6be1eda * spawn.cc (spawn_guts): Detect when executing a 16-bit application and avoid
setting the process pipe since this causes conniptions in Windows 9x.
2005-06-18 01:27:06 +00:00
Corinna Vinschen b3ba5059da * cygwin.din (inet_pton): Export.
(inet_ntop): Export.
	* net.cc (cygwin_inet_pton): Implement inet_pton for AF_INET for now.
	(cygwin_inet_ntop): Implement inet_ntop for AF_INET for now.
	* include/arpa/inet.h (inet_pton): Declare.
	(inet_ntop): Declare.
	* include/cygwin/version.h: Bump API minor number.
2005-06-17 20:01:59 +00:00
Corinna Vinschen 29b111ce59 * fhandler.h (fhandler_union): Add missing members corresponding to
fhandler_fifo and fhandler_netdrive.
2005-06-17 11:44:45 +00:00
Corinna Vinschen ec3b136a64 * syscalls.cc (statvfs): Handle the case when GetDiskFreeSpaceEx
succeeds but GetDiskFreeSpace fails by faking bytes-per-sector and
	sectors-per-cluster values.
2005-06-16 15:46:40 +00:00
Christopher Faylor 7a9b2d82ec add missing entry 2005-06-15 22:51:05 +00:00
Christopher Faylor a9c461626e * cygthread.cc (cygthread::detach): Fix debugging output.
* dcrt0.cc (dll_crt0_1): Create signal_arrived early -- before any filename
manipulation.
* sigproc.cc (sigproc_init): Don't create signal_arrived here.
* fork.cc (fork_child): Ditto.
2005-06-15 22:50:31 +00:00
Christopher Faylor 0fc9cf11f8 * path.cc (path_conv::check): Always reset to FH_FS when component != 0 and
FH_NETDRIVE to fix problems with strict case checking.
2005-06-14 23:52:53 +00:00
Corinna Vinschen 3925b4afc4 * fhandler_socket.cc (fhandler_socket::recvmsg): Avoid SEGV in OpenSSH
when trying to pass file descriptor by setting msg->msg_accrightslen
	to 0.
2005-06-12 12:01:09 +00:00
Christopher Faylor 88cbbd450e * Makefile.in: Avoid initial heap allocation since cygwin has its own heap. 2005-06-11 21:00:23 +00:00
Christopher Faylor b945228cb6 * fhandler_console.cc (fhandler_console::read): Fix a compiler warning. 2005-06-11 05:09:25 +00:00
Christopher Faylor 8556456790 * include/pthread.h: Change PTHREAD_MUTEX_DEFAULT to PTHREAD_MUTEX_NORMAL.
Revert PTHREAD_MUTEX_INITIALIZER to PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
since that is actually closer to what linux does.
* thread.h (cw_cancel_action): New enum.
(cancelable_wait): Use cw_cancel_action as third argument.
* thread.cc (cancelable_wait): Ditto.  Don't wait for cancel if cancel_action
== cw_no_cancel.
(pthread::create): Don't wait for cancel event since that is racy.
(pthread_mutex::pthread_mutex): Set default to PTHREAD_MUTEX_ERRORCHECK.
(pthread_mutexattr::pthread_mutexattr): Ditto.
(pthread_mutex::_lock): Tell cancelable_wait not to wait for cancellation
event.
(semaphore::_timedwait): Accommodate change in cancelable_wait args.
(pthread::join): Ditto.
2005-06-11 04:56:36 +00:00
Corinna Vinschen b4177338e1 * fhandler_socket.cc (fhandler_socket::sendto): Always initialize
ret to 0.
	(fhandler_socket::sendmsg): Ditto.
2005-06-10 21:47:24 +00:00
Corinna Vinschen 5680109cf6 * cygwin.din (imaxabs): Export.
(imaxdiv): Export.
	(llabs): Export.
	(lldiv): Export.
	(strtoimax): Export.
	(strtoumax): Export.
	* include/inttypes.h (imaxabs): Activate declaration.
	(imaxdiv): Ditto.
	(strtoimax): Ditto.
	(strtoumax): Ditto.
	* include/cygwin/version.h: Bump API minor.
2005-06-10 12:11:35 +00:00
Christopher Faylor 1b96f7da45 * cygthread.cc (cygthread::detach): Improve diagnostics for what should be an
impossible failure condition.
2005-06-09 23:48:08 +00:00
Christopher Faylor 9a91777205 * cygtls.h (_local_storage::setmode_file): New element.
(_local_storage::setmode_mode): New element.
* tlsoffsets.h: Regenerate.
* cygwin.din (setmode): Define as cygwin_getmode.
* syscalls.cc (setmode_helper): Use setmode_* variables from tls rather than
using unthreadsafe static.
(setmode): Break out fwalk stuff.
(cygwin_setmode): New function.  Put fwalk stdio stuff here.
2005-06-09 22:33:57 +00:00
Christopher Faylor fa0dcd0d65 * thread.cc (pthread_mutex::_lock): Use cancelable_wait rather than
WaitForSingleObject.
2005-06-09 20:59:59 +00:00
Christopher Faylor 85cd5c3d57 * cygwin.sc: Place .cygwin_dll_common in a more sensible spot. 2005-06-09 20:46:00 +00:00
Christopher Faylor 0acb042081 * cygwin.sc: Place .cygwin_dll_common.
* init.cc (threadfunc_ix): Use a more common name for the section name.
2005-06-09 19:29:27 +00:00
Christopher Faylor 8891625cbf * include/pthread.h (PTHREAD_MUEXT_INITIALIZER): Change to
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP to be closer to linux default.
2005-06-09 15:30:44 +00:00
Christopher Faylor abf60784be * thread.cc (cancelable_wait): No-op change to make sure that res is always a
valid WFMO return.
2005-06-09 05:14:02 +00:00
Christopher Faylor ed364fa9fb Change pthread::cancelable_wait to just cancelable_wait, throughout.
* thread.h (cw_sig_wait): New enum.
(fast_mutex::lock): Use cancelable_wait with resumable signal.
(cancelable_wait): Change fourth argument to cw_sig_wait enum.
* thread.cc (cancelable_wait): Ditto.  Loop on signal detection if fourth
argument == cw_sig_resume.
2005-06-09 05:11:51 +00:00
Christopher Faylor a63c42932e * cygwin.sc: Apparently nonloading sections need to go last. 2005-06-08 20:56:34 +00:00
Christopher Faylor ad96f0997b * cygwin.sc: Restore resource and reloc sections and use more modern syntax for
stabs sections.
2005-06-08 20:18:23 +00:00
Christopher Faylor 7273344558 * environ.cc (spenvs): Remove cut/paste error which associated CYGWIN_DEBUG
with HOME.
2005-06-08 15:42:58 +00:00
Corinna Vinschen ce132d0ffd * security.cc (cygwin_logon_user): Run LogonUser in the primary
process token context.  Fix potential handle leak.
2005-06-08 10:06:17 +00:00
Corinna Vinschen 7311cc1f0c * pinfo.cc (pinfo::init): Define sa_buf as PSECURITY_ATTRIBUTES and
allocate dynamically.
	(pinfo::set_acl): Replace sa_buf by dynamically allocated acl_buf.
	* sec_acl.cc (setacl): Allocate acl dynamically.
	* sec_helper.cc (sec_acl): Add test for alignment of acl when
	DEBUGGING is defined.
	(__sec_user): Same for sa_buf.
	* security.cc (verify_token): Define sd_buf as PSECURITY_DESCRIPTOR
	and allocate dynamically.
	(alloc_sd): Allocate acl dynamically.
	security.h (sec_user_nih): Change first parameter to
	SECURITY_ATTRIBUTES *.
	(sec_user): Ditto.
	* sigproc.cc (wait_sig): Define sa_buf as PSECURITY_ATTRIBUTES and
	allocate dynamically.
	* syscalls.cc (seteuid32): Define dacl_buf as PACL and allocate
	dynamically.
	* uinfo.cc (cygheap_user::init): Define sa_buf as PSECURITY_ATTRIBUTES
	and allocate dynamically.
	* winbase.h (ilockincr): Mark first argument of inline assembly as
	earlyclobber.
	(ilockdecr): Ditto.
2005-06-07 19:31:42 +00:00
Christopher Faylor b739751db9 * cygthread.cc (cygthread::detach): Make error message a little more detailed.
* fhandler.cc (fhandler_base::raw_read): Ditto for debug message.
* dcrt0.cc (do_exit): Add some more synchronization tests.
* fhandler_fifo.cc (fhandler_fifo::dup): Don't duplicate a nonexistent handle.
Use derived return value rather than always retuning 0.
* fhandler_netdrive.cc (fhandler_netdrive::exists): Wnet -> WNet.
* winsup.h (exit_states): Add a couple of new exit states.
2005-06-07 18:41:31 +00:00
Christopher Faylor 405e757cf9 reformat ChangeLog entry slightly. 2005-06-06 21:12:00 +00:00
Corinna Vinschen 7a70dda0b8 * path.cc (symlink_info::check): If GetFileAttributes returns
with ERROR_SHARING_VIOLATION, the file exists.
2005-06-06 16:58:39 +00:00
Corinna Vinschen 34667bbd39 * uname.cc (uname): Change "amd64" to "x86_64" as on Linux. 2005-06-06 16:17:10 +00:00
Corinna Vinschen 15a95a8ca6 * uname.cc (uname): Add missing break. 2005-06-06 15:58:08 +00:00
Christopher Faylor 6eb501439a * Makefile.in: Build sync.o with -fomit-frame-pointer and -O3. 2005-06-05 04:15:16 +00:00
Christopher Faylor 61496ed680 * sync.cc (muto::acquire): Remove unneeded brackets and fix whitespace. 2005-06-05 04:07:46 +00:00
Christopher Faylor c1e1d36141 * malloc.cc: Update to Doug Lea's malloc v2.8.0. 2005-06-05 03:47:36 +00:00
Christopher Faylor 6e780c8bf5 * dcrt0.cc (cygwin_dll_init): Now initializes main_environ and cygtls. Comment
to explain the caveats of this method.
* how-cygtls-works.txt: New file.
2005-06-04 02:11:50 +00:00
Christopher Faylor d8a68f645a * dlfcn.cc (get_full_path_of_dll): Use a relative path when converting so that
the standard Windows rules for finding a library will be used if no path is
given.  Stop explicitly searching /usr/bin since that is now in effect.
2005-06-03 01:07:40 +00:00
Christopher Faylor f9fb1149d5 Revert 2005-05-30 close_all_files changes.
* spawn.cc (spawn_guts): When execing, close all files after the child has
synced with us.
2005-06-02 02:36:50 +00:00
Christopher Faylor 5ac6edefaf * fhandler_disk_file.cc (fhandler_disk_file::fchown): Make sure that disk open
is called in case we're passed in a non-existent device.
2005-06-02 01:50:23 +00:00
Christopher Faylor 31d0f220ad * include/machine/stdlib.h: New file. 2005-06-01 18:24:31 +00:00
Christopher Faylor 19adafdc21 * thread.h (List_remove): Revert most of 2005-05-30 change. 2005-06-01 14:55:45 +00:00
Christopher Faylor 8d05cca34b * cygwin.sc: Don't output .reloc or .rsrc sections. Clean up stuff around
.cygheap and use a workaround to get things working with newer
(broken?) binutils.
2005-06-01 04:42:44 +00:00
Christopher Faylor 5d4a672193 * cygheap.cc (cygheap_end): Remove bogus section attribute.
* cygwin.sc: Make __cygheap_mid absolute.  Remove unused _cygheap_foo.
2005-06-01 04:00:40 +00:00
Christopher Faylor ce95c6407e * child_info.h (child_info::cygheap_h): Delete.
(child_info::dwProcessId): New field.
* cygheap.cc (init_cheap): Delete.
(dup_now): Ditto.
(cygheap_setup_for_child): Ditto.
(cygheap_setup_for_child_cleanup): Ditto.
(cygheap_fixup_in_child): Simplify.  Use new "child_copy" function to copy heap
from parent.
(_csbrk): Don't attempt allocation if within cygheap section.  Fix so that more
than one allocation will succeed.
(cygheap_init): Reset possibly-nonzero region to zero.
* cygheap.h (cygheap_setup_for_child): Delete declaration.
(cygheap_setup_for_child_cleanup): Ditto.
(cygheap_start): Define as an array.
* cygwin.sc: Modernize.  Remove unneeded sections.  Define cygheap here.
* dcrt0.cc (do_exit): Reflect argument change to close_all_files.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
* dtable.h: Ditto.
* fhandler.h: Ditto.
* fork.cc (fork_copy): Call ReadProcessMemory if there is no thread
(indicating that we're execing).
(fork_child): Don't mess with hParent.
(fork_parent): Remove hParent stuff.  It happens earlier now.  Remove call to
cygheap_setup_for_child* stuff.
(fork): Put child_info_stuff in grouped structure.  Issue error if parent
handle is not set.
(child_copy): New function.
* sigproc.cc (child_info::child_info): Put cygheap settings here.  Set parent
handle.
(child_info::~child_info): Close parent handle if it exists.
* spawn.cc (spawn_guts): Reorganize so that ciresrv is allocated at only the
last minute so that cygheap changes are reflected.  Delete cygheap_setup*
calls.
* syscalls.cc (close_all_files): Add an argument to flag when the fd entry
should be released.
* winsup.h (close_all_files): Add an argument to close_all_files declaration.
Declare child_copy.
2005-06-01 03:46:56 +00:00
Christopher Faylor 9885498829 * thread.h (List_remove): Make node parameter const. Use simple comparison and
assignment rather than InterlockedCompareExchangePointer since access is
already synchronized.
2005-05-30 18:37:41 +00:00
Christopher Faylor ac5e21b028 * dlfcn.cc (set_dl_error): Use UNIX error rather than Windows error. 2005-05-30 18:20:28 +00:00
Christopher Faylor 44055eca0b * cygmagic: Remove debugging cruft missed on 2005-05-21. 2005-05-30 00:54:01 +00:00
Corinna Vinschen 7897d3fd88 * path.cc (path_conv::check): Move component to function scope. Set
PATH_RO only on *real* FH_NETDRIVEs or on non-FH_NETDRIVE virtual
	paths. Allow non-retrievable shares to be handled as files.
2005-05-29 11:04:02 +00:00
Corinna Vinschen f330e7b8e8 * include/limits.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Always define. 2005-05-29 10:05:56 +00:00
Christopher Faylor 65a7ca7b7b * thread.h (pthread_key::set): Inline.
(pthread_key::get): Ditto.
* thread.cc (pthread::set): Delete.
(pthread::get): Ditto.
2005-05-29 02:42:36 +00:00
Christopher Faylor 37b01058e7 * cygwin.din: Remove signal front end from pthread_[gs]etspecific. 2005-05-29 02:26:29 +00:00
Christopher Faylor 5c0a13d486 * fhandler_tty.cc (fhandler_tty_slave:tcflush): Use signed comparison. 2005-05-29 00:05:49 +00:00
Christopher Faylor 03bb8acaa7 * times.cc (time_ms::usecs): Coerce comparison to signed or whole test is a
no-op.
2005-05-28 21:31:17 +00:00
Christopher Faylor 1bbf1ac6a5 * cygheap.h: Reference _cygheap_start via .cygheap section.
* environ.cc: Fix force_into_environment typo throughout.
(spenvs): Export CYGWIN_DEBUG if DEBUGGING.
2005-05-27 18:26:19 +00:00
Christopher Faylor 720c77ee72 * include/cygwin/version.h: Bump DLL minor number to 18. 2005-05-26 18:19:26 +00:00
Corinna Vinschen 181c20f1ac * ChangeLog: Remove accidentally checked in entry. 2005-05-25 08:41:28 +00:00
Christopher Faylor 125b724dd8 * fhandler.h (fhandler_base::mkdir): New virtual method.
(fhandler_base::rmdir): Ditto.
(fhandler_disk_file:mkdir): New method.
(fhandler_disk_file:rmdir): Ditto.
* dir.cc (mkdir): Implement with fhandlers.
(rmdir): Ditto.
* fhandler.cc (fhandler_base::mkdir): New virtual method.
(fhandler_base::rmdir): Ditto.
(fhandler_disk_file::mkdir): New method.
(fhandler_disk_file::rmdir): Ditto.

fhandler_random.cc: white space.
2005-05-25 04:32:59 +00:00
Christopher Faylor 2a41ee9e0c * include/cygwin/version.h: Bump API minor number to 129. 2005-05-25 03:46:10 +00:00
Christopher Faylor cb3f5f0862 * cygwin.din: Export mkdtemp.
* mktemp.cc: New file.
* Makefile.in (DLL_OFILES): Add mktemp.o
2005-05-25 03:40:07 +00:00
Corinna Vinschen e0242a025a * include/stdint.h (INTMAX_C, UINTMAX_C): Fix definition. 2005-05-23 13:13:00 +00:00
Christopher Faylor f82ca06eda * spawn.cc (find_exec): Accept a PATH-like string in place of an environment
variable.
* dlfcn.cc (get_full_path_of_dll): Search /usr/bin (for windows compatibility)
and /usr/lib (for UNIX compatibility) when looking for shared libraries.
* environ.cc (conv_envvars): Put back LD_LIBRARY_PATH since it is used by
get_full_path_of_dll().
* errno.cc (errmap): Map MOD_NOT_FOUND to ENOENT.
* cygmagic: Remove debugging cruft.
2005-05-22 03:54:29 +00:00
Corinna Vinschen 89e5f7f81e * include/cygwin/in.h: Add comment. 2005-05-19 21:22:37 +00:00
Corinna Vinschen 58065cb805 * include/cygwin/in.h: Define IPPROTO_xxx values as macros to
accomodate SUSv3.
2005-05-19 21:18:17 +00:00
Christopher Faylor 776b73dd33 * include/limits.h: Include features.h, as on linux. 2005-05-19 19:45:28 +00:00
Christopher Faylor 071f64d934 * include/endian.h: New file. 2005-05-19 19:44:31 +00:00
Corinna Vinschen 424946e8ab * cygwin.sc: Add Dwarf-2 debug sections. 2005-05-19 17:04:28 +00:00
Corinna Vinschen 989ea1c99e * mmap.cc (mmap64): Make granularity an automatic variable. 2005-05-19 08:43:17 +00:00
Christopher Faylor 969d6089ce * fhandler.h (fhandler_cygdrive::seekdir): Delete declaration.
(fhandler_cygdrive::seekdir): Delete.
* fhandler.h (fhandler_cygdrive::iscygdrive_root): Delete method.
(fhandler_cygdrive::telldir): Delete declaration.
* fhandler_disk_file.cc: Remove all uses of fhandler_cygdrive::iscygdrive_root.
(fhandler_disk_file::mkdir): New method.
(fhandler_disk_file::rmdir): Ditto.
(fhandler_cygdrive::telldir): Delete.
2005-05-19 05:43:55 +00:00
Christopher Faylor ac437c3e0c * external.cc: Move pids declaration to file scope and use less enthusiastic
constructor.
* pinfo.h (winpids::winpids): Remove default setting.
* fhandler_fifo.cc (fhandler_fifo::open_not_mine): Accommodate removal of
default setting.
* fhandler_proc.cc (fhandler_proc::readdir): Ditto.
2005-05-19 01:25:20 +00:00
Christopher Faylor 24515d6563 * cygtls.h (_local_storage::unknown_thread_name): New buffer.
* tlsoffsets.h: Regenerate.
* cygthread.cc (cygthread::name): Use new thread-local buffer.
* exceptions.cc (handle_exceptions): Avoid unnecessary initialization of static
variables to zero.
* fork.cc (slow_pid_reuse) Ditto.
2005-05-18 23:30:02 +00:00
Corinna Vinschen 692fccabfb * mmap.cc (mmap64): Avoid compiler warning.
* ntea.cc (NTReadEA): Ditto.
	* hires.h (hires_base): Remove useless usecs function.
2005-05-18 17:23:17 +00:00
Corinna Vinschen 49cc728adc * fhandler_netdrive.cc (fhandler_netdrive::telldir): Remove since it's
equivalent to fhandler_virtual::telldir now anyway.
	* fhandler.h (class fhandler_netdrive): Remove telldir.
2005-05-18 10:32:37 +00:00
Corinna Vinschen bffaf54d76 * fhandler_netdrive.cc (fhandler_netdrive::telldir): Implement.
(fhandler_netdrive::seekdir): Implement.
	(fhandler_netdrive::closedir): Call rewinddir to have only one point
	of calling WNetCloseEnum.
2005-05-18 10:23:40 +00:00
Corinna Vinschen 5b59a2cc0d * fhandler.h (class fhandler_netdrive): Add method rewinddir.
* fhandler_netdrive.cc (struct netdriveinf): New structure to
	store thread arguments.
	(thread_netdrive): Thread handling all potentially blocking
	WNet... calls.
	(create_thread_and_wait): Start and wait for above thread.
	(fhandler_netdrive::exists): Change to call create_thread_and_wait
	instead of calling WNet... function.
	(fhandler_netdrive::readdir): Ditto.  Fix error handling.
	(fhandler_netdrive::rewinddir): New method.
2005-05-17 20:34:15 +00:00
Corinna Vinschen 0d5ba26ccd * external.cc (cygwin_internal): Avoid compiler warning. 2005-05-17 08:46:41 +00:00
Christopher Faylor 4f7544bc97 * dcrt0.cc (dll_crt0_0): Don't do fixup_after_exec if dynamically loaded since
the state of fds is unknown at this point.
2005-05-17 01:27:31 +00:00
Christopher Faylor 5c8e6fbd8c * include/sys/cygwin.h (enum cygwin_getinfo_types): Add CW_DEBUG_SELF.
* external.cc (cygwin_internal): Implement CW_DEBUG_SELF.
* init.cc (dll_entry): Minor rearrangement of code.
2005-05-17 01:21:06 +00:00
Christopher Faylor b55ba2f3da * path.cc (path_conv::check): Remove embedded dots before slashes. 2005-05-17 01:08:58 +00:00
Corinna Vinschen 451c738bef * environ.cc (conv_envvars): Remove LD_LIBRARY_PATH entirely.
It doesn't belong here.
2005-05-16 15:48:36 +00:00
Corinna Vinschen 1f7b9e8bc6 * environ.cc (conv_envvars): Treat LD_LIBRARY_PATH as path list. 2005-05-15 12:04:13 +00:00
Corinna Vinschen dad546a5eb * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Check
return code from GetFileSize and set file size to 0 if necessary.
	* fhandler_netdrive.cc (fhandler_netdrive::fstat): Set permissions
	to read/execute for all.
2005-05-14 21:12:10 +00:00
Christopher Faylor 84778b9d8c really fix typo. 2005-05-13 22:40:19 +00:00
Christopher Faylor 9156326733 fix typo 2005-05-13 22:09:32 +00:00
Christopher Faylor 17e5c6a8f0 * path.cc (normalize_posix_path): Do normalization on . and .. after a '//'. 2005-05-13 21:05:46 +00:00
Corinna Vinschen 50361e07d1 * fhandler.h (fhandler_netdrive::readdir): Remove useless comment. 2005-05-13 20:29:31 +00:00
Corinna Vinschen e01eac68ed * autoload.cc (WNetGetResourceParentA): Import.
(WNetOpenEnumA): Import.
	(WNetEnumResourceA): Import.
	(WNetCloseEnum): Import.
	* fhandler.h (fhandler_netdrive::telldir): Add declaration.
	(fhandler_netdrive::seekdir): Ditto.
	(fhandler_netdrive::closedir): Ditto.
	* fhandler_netdrive.cc: Drop explicit including windows.h.  Include
	winnetwk.h instead of shlwapi.h.  Include dirent.h.
	(fhandler_netdrive::readdir): Implement.
	(fhandler_netdrive::telldir): New method.
	(fhandler_netdrive::seekdir): New method.
	(fhandler_netdrive::closedir): Ditto.
2005-05-13 20:20:02 +00:00
Christopher Faylor 063f1df2aa Remove PC_FULL from path_conv usage throughout.
* path.h (enum pathconv_arg): Change PC_FULL to PC_NOUILL.
* path.cc (path_conv::check): Test for PC_NOFULL rather than !PC_FULL.
(cygwin_conv_to_win32_path): Use PC_NOFULL to force non-absolute path.
2005-05-13 15:46:07 +00:00
Christopher Faylor eb6cd95fec * fhandler_netdrive.cc (fhandler_netdrive::exists): Assert that "//" exists. 2005-05-13 13:23:38 +00:00
Christopher Faylor 66582dd6e7 * cygtls.cc (_cygtls::remove): Eliminate compiler warning.
* dir.cc (mkdir): Check path for writability.
(rmdir): Ditto.  Remove check for special directories.
* path.cc (path_conv::check): Set PATH_RO for virtual devices.  Set error if
read-only and asked for writability.
* path.h (pathconv_arg): Add PC_WRITABLE.
(path_types): Add PATH_RO.
(path_conv::isro): Add (currently unused) check for read-only filesystem.
Return "ENOSHARE" when we know a share doesn't exist.
* include/sys/mount.h: Add MOUNT_RO flag.
* autoload.cc (WNetGetResourceInformationA): Import.
* fhandler_netdrive.cc (fhandler_netdrive::exists): Detect actual existence of
remote system rather than always assuming that it exists.
2005-05-13 03:21:39 +00:00
Christopher Faylor 3ac78fd612 * dcrt0.cc (do_global_dtors): Don't call dll_global_dtors here.
(__main): Reinstate atexit of do_global_dtors.
(cygwin_exit): Call dll_global_dtors here.
(do_exit): And here.
2005-05-11 21:53:54 +00:00
Christopher Faylor 8ad65ff049 * cygtls.cc (_cygtls::remove): Clear exitsock after close.
* fhandler_console.cc (fhandler_console::write_normal): Store character in a
local variable for potential future inspection.
2005-05-11 03:33:38 +00:00
Corinna Vinschen 13505ca8fc * Makefile.in (DLL_OFILES): Add fhandler_mailslot.o.
* devices.h (FH_KMSG): Define new device.
	* devices.in: Add "/dev/kmsg" entry.
	* devices.cc: Regenerate.
	* dtable.cc (build_fh_pc): Handle case FH_KMSG.
	* fhandler.h (class fhandler_mailslot): New class.
	(class select_stuff): Add device_specific_mailslot pointer.
	* fhandler_mailslot.cc: New file.
	* select.cc (peek_mailslot): New function.
	(verify_mailslot): Ditto.
	(struct mailslotinf): New stuct to handle select on mailslots.
	(thread_mailslot): New function.
	(start_thread_mailslot): Ditto.
	(mailslot_cleanup): Ditto.
	(fhandler_mailslot::select_read): New method.
	* syslog.cc (klog_guard): New muto.
	(dev_kmsg): Local mailslot for kernel message device.
	(vklog): New function.
	(klog): Ditto.
	* winsup.h (vklog): Declare.
	(klog): Ditto.
	* include/sys/syslog.h: Define _PATH_KLOG.
2005-05-10 20:56:07 +00:00
Christopher Faylor a586e5b6ae * dcrt0.cc (dll_crt0_1): Call cygwin_exit to ensure that destructors are
handled correctly.
2005-05-10 16:08:46 +00:00
Corinna Vinschen 94fed6a1f3 * path.cc (path_conv::check): Set correct file attributes for socket
files.
2005-05-10 09:08:20 +00:00
Pierre Humblet adef8db0ae 2005-05-09 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler.h (class fhandler_netdrive): New class.
        * fhandler_netdrive.cc (fhandler_netdrive::fhandler_netdrive): New constructor.
        (fhandler_netdrive::exists): New method.
        (fhandler_netdrive::fstat): Ditto.
        (fhandler_netdrive::readdir): Ditto.
        (fhandler_netdrive::open): Ditto.
        * dtable.cc (build_fh_pc): Handle case FH_NETDRIVE.
        * path.cc (isvirtual_dev): Add FH_NETDRIVE.
        (mount_info::conv_to_win32_path): Detect netdrive device and bypass mount
        search for network paths.
2005-05-09 02:39:34 +00:00
Christopher Faylor 1cd8ccec87 * dcrt0.cc (get_cygwin_startup_info): New function pulled from dll_crt0_0.
(dll_crt0_0): Use get_cygwin_startup_info to retrieve cygwin-specific startup
pointer.
* external.cc (cygwin_internal): Implement CW_ARGV and CW_ENVP.
* include/sys/cygwin.h: Implement CW_ARGV and CW_ENVP.
2005-05-09 01:19:38 +00:00
Christopher Faylor 3f6494e216 * path.cc (normalize_posix_path): Don't treat '//' specially since newer
versions of bash now get this right.
2005-05-07 21:06:08 +00:00
Christopher Faylor bbb3381289 * devices.cc: Regenerate with correct name for dev_netdrive_storage. 2005-05-07 20:20:51 +00:00
Christopher Faylor 8cdcc8803a * Makefile.in (DLL_O_FILES): Add fhandler_netdrive.o.
* fhandler_netdrive.cc: Placeholder file for future development.
* devices.h (FH_NETDRIVE): Define new virtual device type.
(netdrive_dev): Define.
* devices.in (dev_netdrive_storage): Define.
* devices.cc: Regenerate.
2005-05-06 04:06:17 +00:00
Corinna Vinschen 56f235345d * cygerrno.h (__set_errno): Remove useless parentheses. 2005-05-04 11:05:11 +00:00
Corinna Vinschen 5d4750a996 * cygerrno.h (__set_errno): Define as inline function here.
(set_errno): Always define as call to __set_errno.
	* debug.cc (__set_errno): Move to cygerrno.h.
2005-05-04 11:00:22 +00:00
Christopher Faylor 782e53ca69 * shared.cc (user_shared_initialize): Rework locking so that nothing is checked
until cb is non-zero.
2005-05-04 01:14:47 +00:00
Corinna Vinschen 21b9fe3e33 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't treat
inability to open file as failure if only SetFileAttributes is
	going to be called.  Only call set_file_attribute if really necessary.
2005-05-03 19:03:20 +00:00
Corinna Vinschen 2ba719de27 * fhandler_socket.cc (get_inet_addr): Add missing __seterrno call. 2005-05-03 14:07:19 +00:00
Christopher Faylor b9b1b38358 * fhandler_tty.cc (fhandler_tty_slave::read): Actually read input when vmin ==
vtime == 0.
2005-05-02 00:17:45 +00:00
Christopher Faylor f0b14f146e * environ.cc (spenv::force_into_environment): Rename from add_always.
(spenv::add_if_exists): Rename from force.
(build_env): Accommodate name changes.  Make sure that stuff that is always
supposed to be in the environment is actually added to the environment.
* shared.cc (open_shared): Restore VirtualFree eliminated by 2005-04-28 change.
2005-04-30 17:07:05 +00:00
Christopher Faylor 06e0dc9a46 * errno.cc (errmap): Sort table. 2005-04-30 04:10:39 +00:00
Christopher Faylor 7b076c36fc * errno.cc (errmap): Map ERROR_NETNAME_DELETED to ENOSHARE. 2005-04-30 03:40:26 +00:00
Christopher Faylor c4ffa3c427 * shared_info.h (cygwin_shared_address): Bump to a higher value to avoid
collision with large data areas.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Accommodate changes to
open_shared arguments.
* fhandler_tape.cc (mtinfo_init): Ditto.
* pinfo.cc (pinfo::init): Use open_shared rather than win32 mmap calls.
* shared.cc (user_shared_initialize): Ditto.
(memory_init): Ditto.
(open_shared): Change to allow use a smore general mmap handler.
* shared_info.h (shared_locations): Add SH_JUSTCREATE, SH_JUSTOPEN.
(open_shared): Change declaration to match new usage.
* autoload.cc (LoadDLLfuncEx2): Define in terms of LoadDLLfuncEx3.
(LoadDLLfuncEx3): New macro.
2005-04-28 23:59:44 +00:00
Christopher Faylor faae8c50a5 * fhandler.cc (fhandler_base::open_9x): Remove (broken) check for
O_CREAT|O_EXCL.
* syscalls.cc (open): Do O_CREAT|O_EXCL check here first.
2005-04-28 03:33:19 +00:00
Christopher Faylor dd991a7572 * environ.cc (build_env): Ensure that win32 array is properly filled in when a
missing value has to be generated.
2005-04-27 03:09:59 +00:00
Christopher Faylor 0aedc5e99a * include/cygwin/version.h: Bump DLL minor number to 17. 2005-04-26 17:27:40 +00:00
Joshua Daniel Franklin 46bf13ffc0 * how-to-debug-cygwin.txt: Fix typo. 2005-04-25 05:03:53 +00:00
Christopher Faylor bc79d16453 * shared.cc (user_shared_initialize): Implement locking similar to shared_info
when initializing shared region.
2005-04-23 03:24:21 +00:00
Christopher Faylor 098a429002 * fhandler.h (dev_console::set_color): Define new function.
(dev_console::set_default_attr): Ditto, moved from fhandler_console.
(dev_console::fillin_info): Ditto.  Accommodate this change throughout this
file.
(fhandler_console::get_win32_attr): Eliminate.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Properly set default
attributes on initialization.
(fhandler_console::open): Set current attributes rather than default color on
open.
(fhandler_console::get_win32_attr): Eliminate.
(dev_console::set_color): New function.  Move get_win32_attr stuff here.
(dev_console::set_default_attr): New function, moved from fhandler_console.
(dev_console::fillin_info): Ditto.
(fhandler_console::char_command): Call set_color to set screen characteristics.
2005-04-22 17:03:38 +00:00
Christopher Faylor fb201f9270 * fhandler.cc (fhandler_base::read): Remove unused signal state tweaks.
* fhandler.h (fhandler_pipe::create_selectable): Declare.
(fhandler_fifo::close_one_end): Declare.
* fhandler_fifo.cc (fhandler_fifo::close_one_end): Define.
(fhandler_fifo::open_not_mine): Use close_one_end to close appropriate end of
pipe.
* pinfo.cc (_pinfo::commune_recv): Ditto.
* pipe.cc (fhandler_pipe::create_selectable): Rename from
create_selectable_pipe.  Reorganize.
(fhandler_pipe::create): Use create_selectable.
2005-04-22 13:58:09 +00:00
Christopher Faylor b13aa00489 * shared.cc (shared_info::initialize): Test previous version of shared memory
magic rather than current version when determining if there has been a shared
memory mismatch.
2005-04-21 23:53:49 +00:00
Christopher Faylor c6cb7f8f01 * sigproc.cc (proc_subproc): Fix handling of waiting for pids with zero value.
* strace.cc (strace::hello): Report parent pid of executing process.
2005-04-20 20:43:36 +00:00
Christopher Faylor 2e98459145 * path.cc (path_conv::check): Fix problem reading symlinks introduced in below
change by reverting the change and adding an additional test for nonexistent
files in /proc.
2005-04-20 18:25:14 +00:00
Christopher Faylor 5746f4b602 * path.cc (path_conv::check): Punt when attempting to access a nonexistent
directory or file in /proc.
2005-04-20 04:06:25 +00:00
Corinna Vinschen 28f2a08860 * security.cc (alloc_sd): Remove DELETE bit from user's ACE if
allow_traverse is set.
2005-04-19 10:10:13 +00:00
Corinna Vinschen d02099f239 * cygwin.din (pselect): Export.
* select.cc (pselect): New function.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/select.h: Include signal.h.  Declare pselect.
2005-04-19 08:32:59 +00:00
Corinna Vinschen 04843bf4a0 * fhandler.h (enum conn_state): Add connect_failed state.
* fhandler_socket.cc (fhandler_socket::connect): Set connect_state to
	connect_failed when connect failed.
	* poll.cc (poll): Change errno to EINVAL if allocating memory fails,
	according to SUSv3. Add socket descriptors always to except_fds. Test
	for failed connect and set revents flags appropriately.
	* select.cc (set_bits): Set connect_state to connect_failed when
	select indicates failed nonblocking connect.
	(fhandler_dev_null::select_except): Set except_ready to false so that
	/dev/null is not always in except state.
	(peek_socket): Fix bogus conditional.
	(fhandler_socket::select_write): Treat all connect_states except
	unconnected equivalent to return consistent results.
	(fhandler_windows::select_except): Set except_ready to false so that
	/dev/windows is not always in except state.
2005-04-18 18:56:52 +00:00
Christopher Faylor 2180b9627d * include/cygwin/version.h: Bump DLL minor number to 16. 2005-04-18 17:25:04 +00:00
Corinna Vinschen 96ab3848d6 * grp.cc (initgroups32): Return the correct value. 2005-04-18 16:03:08 +00:00
Corinna Vinschen 68401acd24 * fhandler_disk_file.cc (fhandler_base::utimes_fs): Ignore
ERROR_NOT_SUPPORTED to workaround Win9x weirdness.
	* path.cc (symlink_info::check): Remap ERROR_INVALID_FUNTION to
	ERROR_FILE_NOT_FOUND for the same reason.
2005-04-16 17:17:33 +00:00
Corinna Vinschen 68a3f0d34a * security.h (cygsidlist::addfromgr): Allow duplicate entries.
(get_server_groups): Declare new function.
	* security.cc (is_group_member): Simplify.
	(get_server_groups): New function.
	(get_initgroups_sidlist): Call get_server_groups.
	(verify_token): Allow token when supplementary sids are not in
	/etc/group but are in the token.
	Streamline the code.
	* grp.cc (initgroups32): New implementation.
	(getgroups32): Handle case where the supplementary groups are set.
2005-04-16 15:21:47 +00:00
Corinna Vinschen 6381056b23 * environ.cc (environ_init): Don't set traverse checking as default. 2005-04-16 13:11:40 +00:00
Corinna Vinschen 8f47adf1c6 * fhandler_disk_file.cc (fhandler_base::utimes_fs): Drop touching
ChangeTime.
2005-04-16 12:53:48 +00:00
Christopher Faylor 06e18175e0 * fhandler.cc (fhandler::dup): Duplicate flags, too.
* fhandler.h (fhandler_fifo::owner): Eliminate.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk devices
better.
(fhandler_base::fstat_helper): Ditto.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize obsolete
"owner".
(fhandler_fifo::open_not_mine): Add some debugging.  Duplicate correct handle
when we own it.
(fhandler_fifo::open): Set flags from input, not from first pipe.  Flag that
fork fixup is needed.
(fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
* pinfo.cc (commune_send): Add debugging for fifo.
* cygwin/version.h: Bump API minor version to 127 to reflect exporting of
sigrelese.
2005-04-16 05:20:01 +00:00
Corinna Vinschen f40d6122ff * syscalls.cc (setuid32): Correct debugging output. 2005-04-15 08:19:07 +00:00
Christopher Faylor dda0657380 * dcrt0.cc (do_global_dtors): Run DLL dtors.
(__main): Don't rely on atexit to run dtors.
(do_exit): Specifically call do_global_dtors here.
(cygwin_exit): Ditto.
* dll_init.cc (dll_global_dtors): Make global.  Only run dtors once.
(dll_list::init): Just set flag that dtors should be run.  Don't rely on
atexit.
* dll_init.h (dll_global_dtors): Declare.
* exceptions.cc (sigrelse): Define.
* path.h (is_fs_device): New method.
(is_lnk_special): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::link): Use "is_lnk_special" rather
than "is_lnk_symlink".
* syscalls.cc (rename): Ditto.
* hookapi.cc (ld_preload): Use colon as a separator rather than space.
2005-04-14 17:34:03 +00:00
Corinna Vinschen bfe1ed40a8 * fhandler.h (class fhandler_socket): Remove utimes.
* fhandler_socket.cc (fhandler_socket::utimes): Remove.
2005-04-13 17:13:41 +00:00
Corinna Vinschen 7460bfd32b * cygerrno.h (__seterrno_from_nt_status): Define. Always set Win32
error code as well as errno. Use throughout where errno is set from
	NT status.
	(set_errno): Evaluate val only once.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fix typo in
	debug output.
	* fhandler_mem.cc (fhandler_dev_mem::open): Rely on
	__seterrno_from_nt_status setting Win32 error code in debug output.
	* fhandler_proc.cc (format_proc_uptime): Ditto.
	(format_proc_stat): Ditto.
	* fhandler_process.cc (format_process_stat): Ditto.
	* sysconf.cc (sysconf): Ditto.
2005-04-13 16:41:33 +00:00
Christopher Faylor f134945dcb * fhandler.h (fhandler_base::utimes_fs): New method.
* fhandler.cc (fhandler_base::utimes): Call utimes_fs if on-disk special file.
* fhandler_disk_file.cc (fhandler_disk_file::utimes): Use utimes_fs.
(fhandler_base::utimes_fs): Handle on-disk device files.
2005-04-13 16:17:37 +00:00
Corinna Vinschen 726fe41807 * fhandler_disk_file.cc (fhandler_disk_file::utimes): Don't set errno
if open fails, it has already been set by open.
2005-04-13 11:07:44 +00:00
Corinna Vinschen 2a24463d0b * autoload.cc (NtQueryVolumeInformationFile): Add.
* fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag.
	* fhandler.h (enum change_state): Remove.
	(fhandler_base::status): Revert has_changed to a simple bit.
	(fhandler_base::fstat_helper): Add nAllocSize parameter.  Rename
	ftCreationTime to ftChangeTime.
	* fhandler_disk_file.cc:
	Call fstat_helper with additional
	allocation size throughout.
	(fhandler_base::fstat_by_handle): Use NT native functions to get
	full file information on NT.  Call fstat_helper with LastWriteTime
	as ctime, if ChangeTime is not available.
	(fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime
	as ctime.
	(fhandler_base::fstat_helper): Add comment. Drop special FAT
	handling since it's useless. Use nAllocSize for st_blocks if available.
	(fhandler_disk_file::touch_ctime): Only touch LastWriteTime.
	(fhandler_disk_file::fchmod): Set has_changed on 9x only.
	(fhandler_disk_file::fchown): Don't set has_changed.
	(fhandler_disk_file::facl): Ditto.
	(fhandler_disk_file::ftruncate): Ditto.
	(fhandler_disk_file::link): Set has_changed on 9x only and on original
	file only.
	(fhandler_base::open_fs): Don't set has_changed in O_TRUNC case.
	* ntdll.h (FILE_BASIC_INFORMATION): Define.
	(FILE_STANDARD_INFORMATION): Define.
	(FILE_INTERNAL_INFORMATION): Define.
	(FILE_EA_INFORMATION): Define.
	(FILE_ACCESS_INFORMATION): Define.
	(FILE_POSITION_INFORMATION): Define.
	(FILE_MODE_INFORMATION): Define.
	(FILE_ALIGNMENT_INFORMATION): Define.
	(FILE_NAME_INFORMATION): Don't define with arbitrary FileName size.
	(FILE_ALL_INFORMATION): Define.
	(FILE_INFORMATION_CLASS): Add FileAllInformation.
	(FILE_FS_VOLUME_INFORMATION): Define.
	(FS_INFORMATION_CLASS): Define.
	(NtQueryVolumeInformationFile): Define.
2005-04-12 14:26:31 +00:00
Corinna Vinschen e8b0558a10 Fix ChangeLog entry. 2005-04-11 21:56:08 +00:00
Corinna Vinschen 98e103aac9 Revert previous patch.
* autoload.cc (GetVolumePathNamesForVolumeNameA): Remove.
	* autoload.cc (GetVolumeNameForVolumeMountPointA): Add.
	* syscalls.cc (sync): Rewrite guid case to skip floppies also on
	Windows 2000.
2005-04-11 21:54:54 +00:00
Corinna Vinschen 48d304ef5a * syscalls.cc (sync): Use renamed has_get_volume_pathnames wincap.
* wincap.h (wincaps::has_get_volume_pathnames): Rename from
	has_guid_volumes
	* wincap.cc: Accomodate above rename throughout.  Set to false on
	Windows 2000.
2005-04-11 20:44:45 +00:00
Christopher Faylor c07aaf0f04 * pipe.cc (fhandler_pipe::open): Remove O_CREAT limitation. 2005-04-08 19:57:36 +00:00
Corinna Vinschen 2ecb1a58cf * syslog.cc (try_connect_guard): Remove useless conditionalized code. 2005-04-07 20:42:20 +00:00
Corinna Vinschen 9d61c9a250 * syslog.cc: Include sys/socket.h.
(try_connect_guard): New static variable.
	(syslogd_inited): Ditto.
	(syslogd_sock): Ditto.
	(try_connect_syslogd): New function to connect and write syslog to
	local syslogd.
	(vsyslog): Log to stderr if LOG_PERROR flag has been given to openlog.
	Try logging to syslogd.  Use Event Log resp. log file as fallback.
	(closelog): Close socket to syslogd.
	* include/sys/syslog.h (_PATH_LOG): Define.
	(INTERNAL_NOPRI): Define if SYSLOG_NAMES is defined.
	(INTERNAL_MARK): Ditto.
	(struct _code): Ditto.
	(prioritynames): Ditto.
	(facilitynames): Ditto.
2005-04-07 20:16:46 +00:00
Corinna Vinschen a5bfc68712 * fhandler_socket.cc (get_inet_addr): Add type parameter to return
unix socket type.  Read socket type from unix socket file.
	(fhandler_socket::bind): Write socket type to unix socket file.
	(fhandler_socket::connect): Return with errno EPROTOTYPE if
	socket type of socket doesn't match socket type of unix socket
	trying to connect to.
2005-04-06 18:50:13 +00:00
Corinna Vinschen b62b8d7c80 * security.h (cygsidlist::addfromgr): Avoid duplicate entries.
* grp.cc (initgrousp): Add syscall_printf.
	(setgroups): Add syscall_printf and make sure sids are added only once.
2005-04-06 12:35:52 +00:00
Christopher Faylor 4ef6a27a5a * net.cc (cygwin_getservbyname): Return (possibly NULL) return value of dup_ent
rather than assuming that tls buffer is valid.
(cygwin_getservbyport): Ditto.
(cygwin_gethostbyname): Ditto.
(cygwin_gethostbyaddr): Ditto.
2005-04-06 05:48:55 +00:00
Christopher Faylor 42aa06a575 * cygtls.cc (_cygtls::remove): Don't free or close stuff if we're being called
in a "non-standard" way.
2005-04-05 17:13:35 +00:00
Christopher Faylor 2f1086cbca * sync.h (muto::initforce): Delete flawed implementation.
* pwdgrp.h (pwdgrp::pglock): Make static.
* grp.cc (pwdgrp::pwdgrp): Eliminate use of initforce.
2005-04-05 06:04:57 +00:00
Christopher Faylor f45c299dbe * sync.h (muto::initforce): Force initialization even when name != NULL.
* grp.cc (pwdgrp::pwdgrp): Use initforce since the enclosing structure is
!NO_COPY.
2005-04-05 04:48:02 +00:00
Christopher Faylor 322c131f9f * sync.h (muto::operator int): New operator.
(locker): Remove unused class.
(new_muto): Delete.
(new_muto1): Ditto.
(new_muto_name): Ditto.
* cygheap.cc (cygheap_setup_for_child): Reflect use of static storage for muto
rather than pointer.
(_csbrk): Ditto.
(_cmalloc): Ditto.
(_cmalloc): Ditto.
(_cfree): Ditto.
* cygheap.h (cwdstuff::cwd_lock): Ditto.
(cwdstuff::get_drive): Ditto.
* cygmalloc.h (__malloc_lock): Ditto.
(__malloc_unlock): Ditto.
* cygtls.cc (sentry::lock): Ditto.
(sentry::sentry): Ditto.
(~sentry): Ditto.
(_cygtls::init): Ditto.
* dcrt0.cc: Ditto.
(cygwin_atexit): Ditto.
(cygwin_exit): Ditto.
* debug.cc (lock_debug::locker): Ditto.
(lock_debug::lock_debug): Ditto.
(lock_debug::unlock): Ditto.
(debug_init): Ditto.
* dtable.cc (dtable::init_lock): Ditto.
* dtable.h (dtable::lock_cs): Ditto.
(dtable::lock): Ditto.
(dtable::unlock): Ditto.
* exceptions.cc (mask_sync): Ditto.
(sighold): Ditto.
(set_process_mask_delta): Ditto.
(set_signal_mask): Ditto.
(events_init): Ditto.
* grp.cc (pwdgrp::pwdgrp): Ditto.
* malloc_wrapper.cc (mallock): Ditto.
(malloc_init): Ditto.
* path.cc (cwdstuff::cwd_lock): Ditto.
(cwdstuff::get_hash): Ditto.
(cwdstuff::get_hash): Ditto.
(cwdstuff::init): Ditto.
(cwdstuff::set): Ditto.
(cwdstuff::get): Ditto.
* pwdgrp.h (pwdgrp::pglock): Ditto.
(pwdgrp::refresh): Ditto.
* sigproc.cc (sync_proc_subproc): Ditto.
(get_proc_lock): Ditto.
(proc_subproc): Ditto.
(_cygtls::remove_wq): Ditto.
(proc_terminate): Ditto.
(sigproc_init): Ditto.
* timer.cc (lock_timer_tracker::protect): Ditto.
(lock_timer_tracker::lock_timer_tracker): Ditto.
(lock_timer_tracker::~lock_timer_tracker): Ditto.
* wininfo.cc (wininfo::_lock;): Ditto.
(wininfo::winthread): Ditto.
(operator HWND): Ditto.
(wininfo::lock): Ditto.
(wininfo::release): Ditto.
* wininfo.h (wininfo::_lock;): Ditto.
2005-04-05 04:31:00 +00:00
Christopher Faylor 82ae6271ba * path.cc (path_conv::check): Only check for PC_NO_ACCESS_CHECK in end
component.
2005-04-04 16:07:36 +00:00
Corinna Vinschen e6d598eee0 * dcrt0.cc (dll_crt0_1): Don't call set_cygwin_privileges on 9x.
* fhandler.h (enum change_state): Add.
	(fhandler_base::status): Add a bit to has_changed flag.
	(fhandler_base::has_changed): Implement with type change_state.
	* fhandler.cc (fhandler_base::raw_write): Accomodate type change
	of has_changed.
	* fhandler_disk_file.cc )fhandler_disk_file::touch_ctime): Also
	touch modification time if has_changed == data_changed.
	(fhandler_disk_file::fchmod): Also open on 9x, otherwise we can't
	touch ctime.  Accomodate type change of has_changed.
	(fhandler_disk_file::fchown): Accomodate type change of has_changed.
	(fhandler_disk_file::facl): Ditto.
	(fhandler_disk_file::ftruncate): Ditto.
	(fhandler_disk_file::link): Ditto.
	(fhandler_base::open_fs): Ditto.
2005-04-04 10:26:35 +00:00
Corinna Vinschen f4a1f8a1db * cygheap.cc (cygheap_init): Accomodate set_process_privilege change.
* cygheap.h (cygheap_user::curr_primary_token): New member.
	(cygheap_user::primary_token): New method.
	(cygheap_user::deimpersonate): Always revert to processes'
	impersonation token.
	(cygheap_user::reimpersonate): Set processes' or setuid token as
	necessary.
	(cygheap_user::has_impersonation_tokens): Look for curr_primary_token
	value.
	(cygheap_user::close_impersonation_tokens): Close curr_primary_token
	here if necessary.  Don't reset token values to NO_IMPERSONATION since
	that's done in uinfo_init anyway.
	(init_cygheap::luid): New LUID array keeping privilege LUIDs.
	* cygtls.cc (_cygtls::init_thread): Call cygheap->user.reimpersonate.
	* dcrt0.cc (hProcToken): New global variable to keep process token.
	(hProcImpToken): Ditto for process impersonation token.
	(dll_crt0_0): Open process token here once.  Duplicate to create
	hProcImpToken.
	(dll_crt0_1): Call set_cygwin_privileges.
	* environ.cc (allow_ntea): Drop duplicate declaration.
	(allow_smbntsec): Ditto.
	(set_traverse): Only set allow_traverse here.
	(environ_init): Ditto.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Drop call to
	enable_restore_privilege.
	(fhandler_disk_file::fchown): Ditto.
	(fhandler_disk_file::facl): Ditto.
	* fork.cc (fork_child): Move call to cygheap->user.reimpersonate after
	syn with parent. Call set_cygwin_privileges.
	* grp.cc (internal_getgroups): Use hProcImpToken instead of opening
	process token.
	* path.cc (fs_info::update): Bypass traverse checking when retrieving
	volume information using push/pop_thread_privileges.
	* registry.cc (load_registry_hive): Drop setting restore privilege
	since it's already set if available.
	* sec_helper.cc: Include cygtls.h.
	(cygpriv): Privilege string array.
	(privilege_luid): New function, evaluate LUID from cygpriv_idx.
	(privilege_luid_by_name): New function, evaluate LUID from privilege
	string.
	(privilege_name): New function, evaluate privilege string from
	cygpriv_idx.
	(set_privilege): New static function called by set_process_privilege
	and set_thread_privilege.  Call privilege_luid to get privilege LUID.
	Fix bug in return value evaluation. Improve debug output.
	(set_cygwin_privileges): New function.
	(set_process_privilege): Remove.
	(enable_restore_privilege): Remove.
	* security.cc (allow_traverse): New global variable.
	(sys_privs): Change type to cygpriv_idx and store privilege indices
	instead of strings.
	(SYSTEM_PRIVILEGES_COUNT): Renamed from SYSTEM_PERMISSION_COUNT.
	(get_system_priv_list): Don't use numerical constant in malloc call.
	Use privilege_luid to get privilege LUIDs.
	(get_priv_list): Call privilege_luid_by_name to get LUIDs. Improve
	inner privilege LUID comparison loop.
	(create_token): Enable create token privilege using
	push/pop_self_privileges. Use hProcToken instead of opening process
	token. Use default DACL when duplicating token.
	(subauth): Enable tcb privilege using push/pop_self_privileges.
	Use sec_none instead of homw made security attributes when duplicating
	token.
	(check_file_access): Don't duplicate access token, use active
	impersonation token as is.
	* security.h (enum cygpriv_idx): New enumeration type enumerating
	possible privileges.
	(privilege_luid): Declare new function.
	(privilege_luid_by_name): Ditto.
	(privilege_name): Ditto.
	(allow_traverse): Declare.
	(set_privilege): Declare function.
	(set_process_privilege): Define as macro.
	(enable_restore_privilege): Remove declaration.
	(_push_thread_privilege): Define macro.
	(push_thread_privilege): Ditto.
	(pop_thread_privilege): Ditto.
	(pop_self_privilege): Ditto.
	* spawn.cc (spawn_guts): Use cygheap->user.primary_token instead of
	cygheap->user.token.
	* syscalls.cc (statvfs): Bypass traverse checking when retrieving
	volume information using push/pop_thread_privileges. Rearrange code
	to simplify push/pop bracketing.
	(seteuid32): Use hProcToken instead of opening process token. Call
	cygheap->user.deimpersonate instead of RevertToSelf.  Create
	impersonation token from primary internal or external token.  Set
	cygheap->user.curr_primary_token and cygheap->user.current_token
	privileges once here.  Drop "failed" and "failed_ptok" labels.
	Drop setting DefaultDacl of process token.
	(setegid32): Use hProcToken and hProcImpToken instead of opening
	process token. Always reimpersonate afterwards.
	* uinfo.cc (cygheap_user::init): Use hProcToken instead of opening
	process token.
	(internal_getlogin): Ditto. Set hProcImpToken, too.
	(uinfo_init): Initialize cygheap->user.curr_primary_token.
	* winsup.h (hProcToken): Declare.
	(hProcImpToken): Declare.
2005-04-03 13:06:43 +00:00
Corinna Vinschen fe3e333661 Unify usage of CYG_MAX_PATH throughout. Change buffers from
size CYG_MAX_PATH + 1 to CYG_MAX_PATH.  Change length tests
	accordingly.
2005-04-03 08:45:21 +00:00
Christopher Faylor 5e679b1981 * include/cygwin/version.h: Bump DLL minor number to 15. 2005-04-02 21:22:52 +00:00
Corinna Vinschen 31d419c977 * fork.cc (fork_child): Add missing __stdcall. 2005-04-01 16:52:48 +00:00
Christopher Faylor d0bed66e45 * sigproc.cc (create_signal_arrive): New (temporary?) function to create
signal_arrived event.
(sigproc_init): Use create_signal_arrived.
* fork.cc (fork_child): Create signal_arrived early.
2005-04-01 15:27:52 +00:00
Corinna Vinschen b6e69d53f6 * fork.cc (fork_child): Fixup SYSV IPC shared memory before fixing
up fdtab.
2005-04-01 11:47:00 +00:00
Corinna Vinschen e033f8aec0 * gentls_offsets: Add '-m32' flag to native compiler call to satisfy
cross platform builds.
2005-03-31 15:53:57 +00:00
Corinna Vinschen 12a410132d * errno.cc (NO_SYSTEM_RESOURCES): Map to EAGAIN.
(NONPAGED_SYSTEM_RESOURCES): Ditto.
	(PAGED_SYSTEM_RESOURCES): Ditto.
	(WORKING_SET_QUOTA): Ditto.
	(PAGEFILE_QUOTA): Ditto.
	(COMMITMENT_LIMIT): Ditto.
2005-03-30 22:07:20 +00:00
Christopher Faylor 4e6c0729d1 * environ.cc (spenvs): Re-force SYSTEMROOT to always be included in
environment.
(build_env): Ditto.
2005-03-30 22:06:32 +00:00
Christopher Faylor 6829b6e914 * environ.cc (spenv::retrieve): Revert most of previous change.
(build_env): Ditto.  Rework to track environment variables which need to always
be in the windows environment in a separate array.
2005-03-30 21:35:31 +00:00
Corinna Vinschen e8cf344cf6 * path.cc (symlink_info::case_check): Ignore trailing characters
in paths when comparing case.
2005-03-30 20:01:43 +00:00
Christopher Faylor 18ef968f40 fix typo 2005-03-30 19:43:36 +00:00
Christopher Faylor 47dc3dec0a * environ.h (win_env::immediate): Declare new field.
(win_env::operator = ): Declare new operator.
(win_env::reset): Declare new function.
(win_env::~win_env): Declare new destructor.
(getwinenv): Add optional third argument to declaration.
* environ.cc (conv_envvars): Accommodate immediate field.
(win_env::operator =): Define new operator.
(win_env::~win_env): Define new destructor.
(win_env::add_cache): Add value to environment immediately if "immediate" is
set.
(getwinenv): Accept optional third argument which will be used to store
"cached" values to avoid overwriting real cache.
(spenv::force): Declare new field.
(spenvs): Accommodate force field.  Add "PATH=" with force set to true.
(spenv::retrieve): Avoid duping anything if we're not building an envblock.
(build_env): Ditto.  Use size of potentially constructed new environment block
to determine if we need to create an environment block.  Pass getwinenv
temporary storage to avoid inappropriately overwriting the environment cache.
2005-03-30 15:54:28 +00:00
Corinna Vinschen 232fee428a * include/limits.h (NAME_MAX): New define.
(PATH_MAX): POSIX allows PATH_MAX to include trailing NUL.
2005-03-29 17:46:17 +00:00
Corinna Vinschen db27ea4125 * path.cc (is_floppy): Make externally available.
* path.h (is_floppy): Declare.
	* syscalls.cc (sync): Check for floppies on A: and B: in guid case.
	Don't call setmntent in non-guid case but evaluate drive bit mask
	locally.
2005-03-29 17:42:50 +00:00
Corinna Vinschen 75f212b2cc * fhandler_process.cc: Re-add exename. 2005-03-29 09:10:59 +00:00
Christopher Faylor 68d96be776 * include/ctype.h: Accommodate building in newlib. 2005-03-28 21:58:23 +00:00
Christopher Faylor f340d72e91 * timer.cc (getitimer): Check that ovalue is a valid pointer, not just NULL. 2005-03-28 21:51:55 +00:00
Christopher Faylor c6a7568670 * timer.cc (timer_tracker::settime): Set times to zero when just cancelling a
timer.
2005-03-28 19:55:59 +00:00
Christopher Faylor dc000a8386 * cygthread.cc (cygthread::detach): Revert to just waiting for thred event
since waiting for anything else is racy.
* timer.cc (timer_tracker::hcancel): Rename from cancel.
(timer_tracker::cancel): New method.
(timer_tracker::th): Remove.
(timer_tracker::~timer_tracker): Call cancel method.
(timer_tracker::timer_tracker): Ditto.
(timer_tracker::timer_tracker): Always, clear cancel, even though it is
probably not strictly necessary for ttstart.
(timer_thread): Accommodate cancel -> hcancel rename.
(timer_tracker::settime): Ditto.
(timer_tracker::gettime): Ditto.
(timer_delete): Ditto.
* cygwin.din: Export _ctype_.
* include/ctype.h: Mark that _ctype_ is imported.
2005-03-28 19:31:23 +00:00
Christopher Faylor 12f9fb4972 * timer.cc (timer_tracker::timer_tracker): Eliminate simple constructor.
(ttstart): Fully initialize.
* errno.cc: Fix typo introduced in previous change.
2005-03-28 18:06:49 +00:00
Christopher Faylor 64443bd47e * errno.cc (FILENAME_EXCED_RANGE): Map to ENAMETOOLONG. 2005-03-28 16:57:13 +00:00
Christopher Faylor cfa131587d * signal.cc (nanosleep): Revert tv_sec < 0 check as it is fixed properly in the
below change to hires.h.
2005-03-27 23:38:28 +00:00
Christopher Faylor 491110627f * times.cc (hires_ms::usecs): Compare the difference.
* hires.h: Add parentheses to HIRES_DELAY_MAX.
2005-03-27 23:33:30 +00:00
Christopher Faylor 255557f8c3 * timer.cc (nanosleep): Treat tv_sec < 0 as invalid.
* include/search.h: Make declarations consistent with newlib.
2005-03-27 02:31:33 +00:00
Christopher Faylor ec98d19a08 * wininfo.h (wininfo::timer_active): Delete.
(wininfo::itv): Ditto.
(wininfo::start_time): Ditto.
(wininfo::window_started): Ditto.
(wininfo::getitimer): Ditto.
(wininfo::setitimer): Ditto.
(wininfo::wininfo): Ditto.
(wininfo::lock): New method.
(wininfo::release): Ditto.
* window.cc: Use new lock/acquire wininfo methods throughout.
(wininfo::wininfo): Delete
(wininfo::getitimer): Ditto.
(wininfo::setitimer): Ditto.
(getitimer): Ditto.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
(wininfo::lock): Define new function.
(wininfo::release): Ditto.
(wininfo::process): Delete WM_TIMER handling.
* timer.cc (struct timetracker): Delete it, flags.  Add it_interval,
interval_us, sleepto_us, running, init_muto(), syncthread, and gettime().
(ttstart): Make NO_COPY.
(lock_timer_tracker): New class.
(timer_tracker::timer_tracker): Distinguish ttstart case.
(timer_tracker::~timer_tracker): New destructor.  Clean out events, and reset
magic.
(timer_tracker::init_muto): New method.
(to_us): Round up as per POSIX.
(timer_thread): Reorganize to match timer_tracker::settime and
timer_tracker::gettime.  Call sig_send without wait.  Call auto_release.
(timer_tracker::settime): Reorganize logic to avoid race.  Call gettime to
recover old value.
(timer_tracker::gettime): New method.
(timer_create): Properly set errno on invalid timerid.  Use new
lock_timer_tracker method.
(timer_delete): Ditto.  Simplify code slightly.
(timer_gettime): New function.
(fixup_timers_after_fork): Reinit ttstart.
(getitimer): New implementation.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
* cygwin.din: Export timer_gettime.
* winsup.h: Remove has has_visible_window_station declaration.
* Makefile.in (DLL_OFILES): Add lsearch.o.
* cygthread.h (cygthread::notify_detached): New element.
(cygthread::cygthread): Take optional fourth argument signifying event to
signal on thread completion.
* cygthread.cc (cygthread::stub): Signal notify_detached event, if it exists.
(cygthread::cygthread): Initialize notify_detached from fourth argument.
(cygthread::detach): Wait for notify_detached field is present.
* lsearch.cc: New file.
* search.h: Ditto.
* include/cygwin/version.h: Bump API minor number to 126.
* cygwin.din: Export lsearch, lfind.
2005-03-27 01:57:38 +00:00
Corinna Vinschen b832c4cf21 * fhandler.h (fhandler_socket::secret_event): Remove.
(fhandler_socket::af_local_set_secret): New function combining former
	set_connect_secret and get_connect_secret into one function.
	(fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
	(fhandler_socket::af_local_unsetblocking): Rename from
	eid_unsetblocking.
	(fhandler_socket::af_local_set_cred): New method.
	(fhandler_socket::af_local_copy): New method.
	(fhandler_socket::af_local_recv_secret): New method.
	(fhandler_socket::af_local_send_secret): New method.
	(fhandler_socket::af_local_recv_cred): Rename from eid_recv.
	(fhandler_socket::af_local_send_cred): Rename from eid_send.
	(fhandler_socket::af_local_accept): New method.
	(fhandler_socket::af_local_set_sockpair_cred): Rename from
	set_socketpair_eids.
	(fhandler_socket::eid_accept): Remove.
	(fhandler_socket::eid_connect): Remove.
	(fhandler_socket::set_connect_secret): Remove.
	(fhandler_socket::get_connect_secret): Remove.
	(fhandler_socket::create_secret_event): Remove.
	(fhandler_socket::check_peer_secret_event): Remove.
	(fhandler_socket::signal_secret_event): Remove.
	(fhandler_socket::close_secret_event): Remove.
	(fhandler_socket::sec_event_accept): Remove.
	(fhandler_socket::sec_event_connect): Remove.
	* fhandler_socket.cc (secret_event_name): Remove.
	(fhandler_socket::af_local_set_sockpair_cred): Rename from
	set_socketpair_eids.
	(fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
	(fhandler_socket::af_local_unsetblocking): Rename from
	eid_unsetblocking.
	(fhandler_socket::af_local_recv_secret): New function to receive
	AF_LOCAL connect secret over socket itself.
	(fhandler_socket::af_local_send_secret): New function to send AF_LOCAL
	connect secret over socket itself.
	(fhandler_socket::af_local_recv_cred): Rename from eid_recv.
	(fhandler_socket::af_local_send_cred): Rename from eid_send.
	(fhandler_socket::eid_connect): Remove.
	(fhandler_socket::af_local_connect): Take over connect side handling
	of AF_LOCAL secret and credential handshake.
	(fhandler_socket::eid_accept): Remove.
	(fhandler_socket::af_local_accept): New method, take over accept side
	handling of AF_LOCAL secret and credential handshake.
	(fhandler_socket::af_local_set_cred): New method, set eid credentials
	to start values.
	(fhandler_socket::af_local_copy): New method, copy secret and
	credentials to another socket.
	(fhandler_socket::af_local_set_secret): New function combining former
	set_connect_secret and get_connect_secret into one function.
	(fhandler_socket::create_secret_event): Remove.
	(fhandler_socket::signal_secret_event): Remove.
	(fhandler_socket::close_secret_event): Remove.
	(fhandler_socket::check_peer_secret_event): Remove.
	(fhandler_socket::sec_event_connect): Remove.
	(fhandler_socket::sec_event_accept): Remove.
	(fhandler_socket::fixup_after_fork): Drop secret_event handling.
	(fhandler_socket::bind): Call af_local_set_secret.
	(fhandler_socket::connect): Call af_local_set_cred and af_local_connect.
	(fhandler_socket::listen): Call af_local_set_cred.
	(fhandler_socket::accept): Call af_local_copy and af_local_accept on
	accepted socket.
	(fhandler_socket::close): Don't call close_secret_event.
	(fhandler_socket::set_close_on_exec): Don't set secret_event
	inheritance.
	* net.cc (cygwin_getsockopt): Add debug output.
	(socketpair): Call af_local_set_sockpair_cred instead of
	set_socketpair_eids.
	* select.cc (set_bits): Drop AF_LOCAL special handling in case
	of except bit set.
2005-03-24 14:04:06 +00:00
Christopher Faylor c6190209b3 * include/ctype.h: Always define macros when inside cygwin.
(isblank): New macro.
2005-03-23 21:04:00 +00:00
Christopher Faylor ffd9d72a80 fix comment 2005-03-23 17:43:51 +00:00
Corinna Vinschen a6099ff810 * fhandler.h (fhandler_socket::eid_connect): Make private.
(fhandler_socket::set_connect_secret): Ditto.
	(fhandler_socket::get_connect_secret): Ditto.
	(fhandler_socket::create_secret_event): Ditto. Remove secret argument.
	(fhandler_socket::check_peer_secret_event): Ditto.
	(fhandler_socket::signal_secret_event): Make private.
	(fhandler_socket::close_secret_event): Ditto.
	(fhandler_socket::sec_event_accept): New private method.
	(fhandler_socket::sec_event_connect): Ditto.
	(fhandler_socket::af_local_connect): New public method.
	* fhandler_socket.cc: Use 'struct sockaddr' and 'struct sockaddr_in'
	rather than just 'sockaddr' and 'sockaddr_in' throughout.
	(fhandler_socket::eid_connect): Drop AF_LOCAL/SOCK_STREAM test.
	(fhandler_socket::create_secret_event): Remove secret argument.
	Always use connect_secret instead.
	(fhandler_socket::check_peer_secret_event): Ditto.
	(fhandler_socket::sec_event_connect): New method, combining entire
	secret event handshake on connect side.
	(fhandler_socket::af_local_connect): New method, combining secret
	event handshake and eid credential transaction on connect side, to
	be called from select.
	(fhandler_socket::sec_event_accept): New method, combining entire
	secret event handshake on accept side.
	(fhandler_socket::connect): Drop secret, use connect_secret instead.
	Move entire secret event handshake to sec_event_connect.
	(fhandler_socket::accept): Move entire secret event handshake to
	sec_event_accept.
	* select.cc (set_bits): Just call af_local_connect here.
2005-03-23 17:27:18 +00:00
Christopher Faylor bc3f9e29d0 * include/cygwin/version.h: Change coment for most recent API version bump to
reflect new additions to the DLL and to remove change obsoleted by the previous
checkin.
2005-03-23 17:16:16 +00:00
Christopher Faylor 6d89e9dd43 * include/ctype.h: New file.
* ctype.cc: Ditto.
* Makefile.in: Add ctype.o to DLL_OFILES.
* cygwin.din: Remove _ctype_ptr (for now?).
2005-03-23 17:11:24 +00:00
Christopher Faylor b1d9a0bd41 * Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.
* cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK.
(hook_chain): New struct.
(init_cygheap::hooks): Define new element.
* cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec.
* dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function.
* external.cc (cygwin_internal): Implement CW_HOOK.
* fork.cc (fork_child): Call fixup_hooks_after_fork.
* init.cc (cygwin_hmodule): Reinstate after a long absence.
* include/sys/cygwin.h: Define CW_HOOK.
* hookapi.cc: New file.
* select.cc (start_thread_socket): Add debugging output.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x accommodation.
* fhandler_socket.cc (fhandler_socket::connect): Make sure that err is
initialized.
2005-03-22 19:00:31 +00:00
Corinna Vinschen 3b5f210520 * cygwin.din (__ctype_ptr): Export.
* include/cygwin/version.h: Bump API minor version.
2005-03-22 11:37:55 +00:00
Corinna Vinschen 257e3d8e89 * fhandler.h (class cygthread): Remove forward declaration. 2005-03-21 19:10:45 +00:00
Corinna Vinschen ef82f76c30 * fhandler.h (class cygthread): Forward declare.
(fhandler_socket::sec_pipe): Remove.
	(fhandler_socket::eid_pipe_name): Remove.
	(fhandler_socket::eid_setblocking): New private method.
	(fhandler_socket::eid_unsetblocking): Ditto
	(fhandler_socket::eid_recv): Ditto
	(fhandler_socket::eid_send): Ditto
	(fhandler_socket::eid_accept): Ditto
	(fhandler_socket::eid_connect): New public method.
	* fhandler_socket.cc (ASYNC_MASK): Move to beginning of file.
	(fhandler_socket::eid_pipe_name): Remove.
	(fhandler_socket::set_socketpair_eids): Move down to fhandler_socket
	methods.
	(fhandler_socket::fhandler_socket): Drop initializing sec_pipe.
	(fhandler_socket::~fhandler_socket): Drop closing sec_pipe.
	(fhandler_socket::eid_setblocking): New method.
	(fhandler_socket::eid_unsetblocking): New method.
	(fhandler_socket::eid_recv): New method.
	(fhandler_socket::eid_send): New method.
	(fhandler_socket::eid_connect): New method.
	(fhandler_socket::eid_accept): New method.
	(fhandler_socket::dup): Drop sec_pipe handling.
	(fhandler_socket::connect): Fix WinSock error handling. Prepare
	eid credential transaction. Call eid_connect on successful connect.
	(fhandler_socket::listen): Drop creating sec_pipe.
	(fhandler_socket::accept): Slightly simplify code. Call eid_accept
	on accepted socket.
	(fhandler_socket::getpeereid): Reshuffle code for readability. Fix
	test for invalid pid.
	* select.cc (set_bits): Call eid_connect on successfully connected
	socket.
2005-03-21 18:56:50 +00:00
Christopher Faylor f580813771 * child_info.h (fork_info): Use different method to alias variable.
(spawn_info): Ditto.
* cxx.cc (__cxa_guard_acquire): New function (needed for gcc 4.x).
(__cxa_guard_release): Ditto.
* devices.in: Make sure stuff is correctly bracketed (for gcc 4.x).
* devices.cc: Regenerate.
* fhandler.h (fhandler_disk_file::fchmod): Avoid left coercion (for gcc 4.x).
* smallprint.c (__rn): Declare as __fastcall since gcc 4.x complains about use
of regparm, for some reason.
* sync.h (sync::init_lock): Remove.
* sync.cc (sync::init_lock): Ditto.
2005-03-19 21:45:15 +00:00
Christopher Faylor cfaf367058 * net.cc (cygwin_getprotobyname): Don't try to be fancy with return values.
(cygwin_getprotobynumber): Ditto.
2005-03-18 22:42:51 +00:00
Corinna Vinschen 993317d0ed * fhandler_disk_file.cc (fhandler_disk_file::utimes): Handle opening
directories under 9x gracefully.
2005-03-17 12:53:47 +00:00
Corinna Vinschen 2e7c4a2ab1 * fhandler_socket.cc (fhandler_socket::connect): Always set sun_path
in case of a successful or pending connect.
	(fhandler_socket::accept): Don't run secret event and eid credential
	transactions if OS accept returned WSAEWOULDBLOCK.
2005-03-17 11:56:30 +00:00
Christopher Faylor 294a7d2a66 complete a sentenc 2005-03-16 22:08:33 +00:00
Christopher Faylor 29acee4020 * fhandler_tape.cc (get_ll): This is a generally useful function so move it
* winsup.h (get_ll): to here
* security.cc (get_token_group_sidlist): Use get_ll to figure out the long long
version of the luid since QuadPart is not part of the standard Windows API.
2005-03-16 21:52:06 +00:00
Christopher Faylor 2693c1ac56 * dir.cc: Rename opendir_* to dirent_* throughout.
(opendir_states): Move and rename.
* fhandler.h (dirent_states): to here.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Use raw readdir when
skipping through entries since it is keeping track of "." and "..".
(fhandler_cygdrive::seekdir): Use fhandler_disk_file::readdir to do everything.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set flag indicating that we
provide .  and ..
(fhandler_virtual::seekdir): Ditto.
(fhandler_virtual::rewinddir): Ditto.
* fhandler_registry.cc (fhandler_registry::rewinddir): Ditto.
2005-03-16 21:20:56 +00:00
Christopher Faylor fe83647073 * cygtls.cc (free_local): New macro.
(_cygtls::remove): Use free_local to free known-malloced local variables.
* cygtls.h: Mark some variables as "malloced".
* net.cc (enum struct_type): Rename from is_* to t_* for clarity.
(dump_protoent): Delete.
(dup_ent): New macro.
(__dup_ent): Renamed from dup_ent.  Change arguments for convenience.  Replace
first argument with newly alloced value.  Allocate a rounded number of bytes in
an attempt to try to reuse space.  Subsume "dump_protent".
(cygwin_getprotobyname): Simplify using new dup_ent functionality.
(cygwin_getprotobynumber): Ditto.
(cygwin_getservbyname): Ditto.
(cygwin_getservbyport): Ditto.
(cygwin_gethostname): Ditto.
(cygwin_gethostbyname): Ditto.
* tlsoffsets.h: Regenerate.
* syslog.cc (openlog): Use NULL rather than 0, for consistency with the rest of
cygwin.
(pass_handler::initialize): Use unbuffered I/O in pass one.
2005-03-16 17:07:32 +00:00
Christopher Faylor a53953b070 * errno.cc (errmap): Correct typo in previous change. 2005-03-16 01:00:05 +00:00
Christopher Faylor 9d387e73b8 * cygtls.cc (_cygtls::remove): Free process_ident, if it exists.
* errno.cc (errmap): ERROR_DISK_CORRUPT -> EIO.
2005-03-15 21:58:44 +00:00
Christopher Faylor ac7bc2d470 * path.h (pathconv_arg): Define PC_NO_ACCESS_CHECK.
(path_types): Define PATH_NO_ACCESS_CHECK == PC_NO_ACCESS_CHECK.
* path.cc (symlink_info::check_sysfile): Move to symlink_info class and
eliminate arguments that are part of class.  Use set_error.
(symlink_info::check_shortcut): Ditto.
(symlink_info::set_error): New function.
(path_conv::check): Pass PC_NO_ACCESS_CHECK to symlink_info::check.
(symlink_info::check): Preserve PC_NO_ACCESS_CHECK in pflags.  Use set_error.
2005-03-12 02:33:00 +00:00
Corinna Vinschen 640c3ce5df * path.cc (is_floppy): New function.
(setmntent): Drop floppy drives on A: and B: from logical drive DWORD.
	* syscalls.cc (sync): Don't sync floppies on A: and B:.
2005-03-10 17:02:52 +00:00
Christopher Faylor 542afc349c * autoload.cc (LoadDLLprime): Use nocopy segment or forked processes will not
initialize properly.
* autoload.cc (LoadDLLprime): Scrap use of .linkonce and just use an
2005-03-10 16:59:55 +00:00
Christopher Faylor 491e84c601 * autoload.cc (LoadDllprime): Scrap use of .linkonce and just use an ifdef
guard to load .foo_init into data segment.
* dcrt0.cc (initial_env): Allow colon or space as CYGWIN_DEBUG separator for
consistency.
2005-03-10 14:41:50 +00:00
Christopher Faylor 35b4534efe * pinfo.h (pinfo::pinfo): Clear more elements in the constructor. 2005-03-10 01:50:09 +00:00
Christopher Faylor 8b59143fcd * net.cc (dup_ent): Revert older stupid test for null. Don't copy name if it
is NULL.
2005-03-09 23:46:51 +00:00
Corinna Vinschen 7d243cd43b * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format
string.
	(fhandler_socket::connect): Set sun_path before running eid credential
	transaction.  Run transaction only if OS connect was successful.
	(fhandler_socket::accept): Run transaction only if OS accept was
	successful.
2005-03-09 23:00:20 +00:00
Christopher Faylor 8b7de010ab * net.cc (dup_ent): Revert previous stupid change. 2005-03-09 22:38:09 +00:00
Corinna Vinschen fa4b5b03c0 * signal.cc (sigprocmask): Rename first parameter to "how".
(handle_sigprocmask): Ditto.  Check "how" for being a valid "how" value.
	Fix call order in case of wrong "how" value.
2005-03-09 21:07:56 +00:00
Christopher Faylor b364b39867 * net.cc (dup_ent): Avoid dereferencing a null pointer in a debug_printf. 2005-03-09 20:56:44 +00:00
Christopher Faylor f5394c9560 * path.cc (path_conv::check): Treat ENOSHARE similarly to ENOENT when
determining if there was a problem with a symlink.
2005-03-09 20:33:21 +00:00
Corinna Vinschen 1e2ce19b96 * fhandler_socket.cc (fhandler_socket::listen): Don't limit the number
of pipe instances.
2005-03-08 16:33:17 +00:00
Christopher Faylor efdc312d12 * pinfo.cc (pinfo::exit): Right shift exit value by eight when not started in a
cygwin environment.
2005-03-08 14:31:21 +00:00
Corinna Vinschen d2428633a6 * mmap.cc (mmap64): Handle MAP_AUTOGROW flag.
(fhandler_disk_file::mmap): Ditto. Clean conditional for readability.
	* include/sys/mman.h: Add MAP_AUTOGROW flag.
	* include/cygwin/version.h: Bump API minor version.
2005-03-08 09:18:47 +00:00
Christopher Faylor 18edcecfbf * dcrt0.cc (dll_crt0_0): Eliminate muto::init call.
* sync.h (locker): New, currently unused class.
(muto::init): Eliminate.
* sync.cc (muto::init): Ditto.
(muto::init): Eliminate critical section lock and instead use name as a guard
to prevent against multiple attempts to initialize the same muto.
* pinfo.cc (pinfo::init): Set myself procinfo when not execing and pid matches
windows pid or cygwin pid.
2005-03-08 05:05:02 +00:00
Christopher Faylor fe7b4e0306 * path.cc (mount_info::read_cygdrive_info_from_registry): Use the user prefix
if it exists.
* sync.h (sync::init_lock): Declare new static member.
(sync::init()): Declare new static function.
* sync.cc (sync::init): Define.
(sync::init): Lock attempt to initialize a muto to stop multiple threads from
colliding.
* dcrt0.cc (dll_crt0_0): Initialize muto environment.
2005-03-06 21:28:28 +00:00
Christopher Faylor a50b6b2dcd * path.cc (special_name): Reorganize to always detect the use of special names
first, before detecting special characters.
2005-03-06 20:15:07 +00:00
Christopher Faylor 3016669b4b * fhandler_clipboard.cc: Use int for cygnativeformat rather than UINT as that
is what is returned by GetPriorityClipboardFormat.
(fhandler_dev_clipboard::read): Ditto for the format variable.
2005-03-04 18:04:11 +00:00
Corinna Vinschen 0f63e6247d * fhandler.cc (fhandler_base::open_9x): Satisfy query_open values. 2005-03-04 13:54:59 +00:00
Corinna Vinschen f317a917bc * fhandler_socket.cc (fhandler_socket::ioctl): Only cancel
WSAAsyncSelect when async mode is on.
2005-03-04 08:36:43 +00:00
Corinna Vinschen 6b76b0c5d4 * cygwin.din (utmpxname): Export.
* syscalls.cc (utmpxname): Create export alias to utmpname.
	* include/utmpx.h: Define ut_name and ut_xtime if not already defined.
	(utmpxname): Add prototype.
	* include/sys/utmp.h: Only define ut_name if not already defined.
	* include/cygwin/version.h: Bump API minor version.
2005-03-03 22:08:12 +00:00
Christopher Faylor 33aca56322 * cygthread.cc (cygthread::detach): Use a slightly higher priority when waiting
for thread signalling.
2005-03-03 16:53:52 +00:00
Christopher Faylor 410b2bc211 fix changelog garbling 2005-03-03 01:06:30 +00:00
Christopher Faylor 608b0ce960 * autoload.cc (std_dll_init): Save and restore fpu control register around
LoadAddress to prevent loaded dlls (like msvcrt.dll) from setting unwanted
stuff.
2005-03-03 00:49:53 +00:00
Christopher Faylor 55b670024c * cygtls.cc (_cygtls::remove): Don't attempt any removal activities if exitsock
is zero.
2005-03-03 00:36:49 +00:00
Christopher Faylor d845acc8d2 * cygtls.cc (_cygtls::init_thread): Move exitsock setting later. It should
always be set.
(_cygtls::remove): Detect zero exitsock.  Not quite sure why this is needed.
2005-03-03 00:32:57 +00:00
Christopher Faylor d0f0ea3034 * autoload.cc (LoadDLLprime): Mask error code to low-order 16 bits.
(noload): Preserve sign when returning error code.
2005-03-02 16:13:24 +00:00
Christopher Faylor d83eb0c7d0 * spawn.cc (do_cleanup): Properly restore SIGINT/SIGQUIT even if they had
previously been SIG_DFL.
2005-03-02 15:32:34 +00:00
Corinna Vinschen e04c777cc6 * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Replace
GetSystemTime/SystemTimeToFileTime with GetSystemTimeAsFileTime.
	* times.cc (time_as_timestruc_t): Ditto.
	(time): Ditto.
2005-03-02 08:28:54 +00:00
Christopher Faylor b9b8c930c3 * include/cygwin/version.h: Bump DLL minor number to 14. 2005-03-01 20:20:45 +00:00
Corinna Vinschen 4717214c20 * fhandler_clipboard.cc (fhandler_dev_clipboard::write): Never set
errno to 0.
	(fhandler_dev_clipboard::read): Ditto.
	* fhandler_windows.cc (fhandler_windows::read): Ditto.
	* scandir.cc (scandir): Ditto.
	* syscalls.cc (_fstat64_r): Ditto.
	(_fstat_r): Ditto.
	(_stat64_r): Ditto.
	(_stat_r): Ditto.

	* mmap.cc (mmap64): Fix /dev/zero mapping.
2005-03-01 11:51:29 +00:00
Corinna Vinschen 496337c9a5 * fhandler.h (class fhandler_socket): Declare new method
set_socketpair_eids.
	* fhandler_socket.cc (fhandler_socket::set_socketpair_eids): New method.
	(fhandler_socket::dup): Duplicate sec_pipe if necessary.
	(fhandler_socket::listen): Only create sec_pipe if named pipes are
	available. Initialized sec_peer_pid to 0 as on Linux.
	(fhandler_socket::connect): Only run eid credential transaction if
	named pipes are available.  Fake otherwise. Initialized sec_peer_pid
	to 0 as on Linux.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::close): Move closing sec_pipe handle from here...
	(fhandler_socket::~fhandler_socket): ... to here.
	* net.cc (socketpair): Set eid credentials by calling
	fhandler_socket::set_socketpair_eids() on both socket ends.
	* wincap.h (wincaps::has_named_pipes): New element.
	* wincap.cc: Implement above element throughout.
2005-02-28 13:11:50 +00:00
Christopher Faylor 882a0c8507 remove unneeded blank line 2005-02-28 01:55:45 +00:00
Christopher Faylor d61925786a * sigproc.cc (_pinfo::set_ctty): Move function
* pinfo.cc (_pinfo::set_ctty): to here.
* fhandler_mem.cc (fhandler_dev_mem::fstat): Don't fill out structure if this
is an on-disk device rather than an "auto" device.
* fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto.
* path.cc (normalize_posix_path): Don't treat a standalone '//' as introducing
a UNC path.
(normalize_win32_path): Ditto.
2005-02-27 04:30:08 +00:00
Christopher Faylor 1a9a235a5a * debug.cc (delete_handle): Report on handle value in debugging output.
* pinfo.h (_pinfo::exists): Declare "new" function.
(_pinfo::kill): Ditto.
* fhandler_termios.cc (tty_min::kill_pgrp): Use _pinfo::exists rather than
proc_exists.
* pinfo.cc (pinfo::init): Ditto.  Don't do a low_priority_sleep(0) when looping
to find exec'ed procinfo.
(pinfo::release): Be more careful about unmapping and closing.
* signal.cc (_pinfo::kill): Rename from kill_worker.  Accommodate entry into
_pinfo class.
(kill0): Use _pinfo::kill rather than kill_worker.
(kill_pgrp): Ditto.  Use _pinfo::exists rather than proc_exists.
* sigproc.cc (_pinfo::exists): Rename from proc_exists.
(pid_exists): Use _pinfo::exists rather than proc_exists.
(remove_proc): Ditto.
* sigproc.h (proc_exists): Delete declaration.
2005-02-26 20:50:25 +00:00
Corinna Vinschen 6d11044c63 * fhandler.h (class fhandler_base): Declare fixup_mmap_after_fork
with additional flags parameter.  Change offset parameter to _off64_t.
	(class fhandler_disk_file): Ditto.
	(class fhandler_dev_mem): Ditto.
	* fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork):
	Accomodate new parameters.
	* mmap.cc: Include ntdll.h.
	(class mmap_record): Add flags member.
	(mmap_record::mmap_record): Add flags parameter.
	(mmap_record::get_flags): New method.
	(class map): Add next_anon_addr member to store next anonymous mapping
	address suggestion.
	(map::get_next_anon_addr): New method.
	(map::set_next_anon_addr): New method.
	(mmap64): Don't align offset and length to granularity in case of
	MAP_ANONYMOUS on NT.  Check for already existing mapping only on 9x.
	Call mmap_record::mmap_record with additional flags argument.
	(fhandler_base::fixup_mmap_after_fork): Accomodate new parameters.
	(fhandler_disk_file::mmap): Use NtMapViewOfSection with
	AT_ROUND_TO_PAGE flag for anonymous mappings on NT.  If addr is NULL,
	try to map adjacent to previous mapping.
	(fhandler_disk_file::fixup_mmap_after_fork): Add flags argument.
	Change offset parameter to _off64_t.  Use NtMapViewOfSection to
	re-create anonymous mappings on NT.
	(fixup_mmaps_after_fork): Accomodate new parameters when calling
	fhandler's fixup_mmaps_after_fork function.
	* ntdll.h (AT_ROUND_TO_PAGE): New define.
2005-02-25 21:23:15 +00:00
Corinna Vinschen 99e281eb19 * Fix ChangeLog entries. 2005-02-25 11:48:02 +00:00
Corinna Vinschen a3079b47fe * mmap.cc (mmap64): Handle MAP_FIXED request on non-granulation
boundary.
2005-02-25 11:47:17 +00:00
Corinna Vinschen c68de3a262 * mmap.cc (class mmap_record): Declare new map_pages method with
address parameter.
	(mmap_record::map_pages): New method with address parameter.
	(mmap64): Evaluate access mode before checking if already existing
	mapping can be used.
	Only use existing mapping if requested access mode matches the one
	in the existing mapping.
	Add check for existing mapping for MAP_FIXED case.
2005-02-25 11:15:22 +00:00
Corinna Vinschen d0578adf88 * localtime.cc: Implement setting __tzrule's offset member using
newlib's __gettzinfo () interface.
	(__tzrule): Remove.
	(timezone): Define as long according to POSIX.
2005-02-23 22:17:28 +00:00
Corinna Vinschen ee8d935cdd * devices.cc: Regenerate. 2005-02-23 22:14:40 +00:00
Corinna Vinschen 3a021c19f4 * devices.in (parsedisk): Fix typo. 2005-02-23 17:59:04 +00:00
Corinna Vinschen c8b404bf5c * cygwin.din (getpeereid): Export.
* fhandler.h (class fhandler_socket): Add pipe and id members to
	exchange eid credentials for AF_LOCAL sockets.
	(eid_pipe_name): Declare new method.
	(getpeereid): Ditto.
	* fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method.
	(fhandler_socket::fhandler_socket): Initialize sec_pipe.
	(fhandler_socket::connect): Exchange eid credentials with accepting
	socket process.
	(fhandler_socket::listen): Prepare eid credential transaction.
	(fhandler_socket::accept): Exchange eid credentials with connecting
	socket process.
	(fhandler_socket::close): Close eid credentials pipe if open.
	(fhandler_socket::getpeereid): New method.
	* net.cc (cygwin_getsockopt): Add SO_PEERCRED handling.
	(getpeereid): New function.
	* include/asm/socket.h (SO_PEERCRED): Define.
	* include/cygwin/socket.h (struct ucred): Define new type.
	* include/cygwin/version.h: Bump API minor version.
2005-02-23 17:39:46 +00:00
Corinna Vinschen 81d0376064 * include/sys/statvfs.h (ST_RDONLY): Define.
(ST_NOSUID): Define.
2005-02-23 16:27:54 +00:00
Corinna Vinschen a652e6d52a * cygwin.din (fstatvfs): Export.
(statvfs): Export.
	* syscalls.cc: Include sys/statvfs.h.
	(statvfs): New function.  Move statfs functionality here.
	(fstatvfs): New function.
	(statfs): Just call statvfs and copy structure.  Check validity of
	incoming struct statfs pointer.
	* include/cygwin/types.h (fsblkcnt_t): Define.
	(fsfilcnt_t): Define.
	* include/cygwin/version.h: Bump API minor version.
	* include/sys/statvfs.h: New file.
2005-02-23 13:12:43 +00:00
Corinna Vinschen e5ef74dfb2 * devices.h: Switch FH_ZERO and FH_PORT as on Linux. Add FH_FULL.
* devices.in: Add /dev/full.
	* devices.cc: Regenerate.
	* dtable.cc (build_fh_pc): Add FH_FULL.
	* fhandler.cc (fhandler_base::fstat): Set FH_FULL permission bits
	correctly.
	* fhandler_zero.cc (fhandler_dev_zero::write): Set errno to ENOSPC
	and return -1 if device is FH_FULL.
2005-02-23 12:30:31 +00:00
Christopher Faylor d1b941af91 * fhandler_disk_file.cc (fhandler_cygdrive::closedir): Return 0 when closing
cygdrive_root.
2005-02-23 02:00:48 +00:00
Corinna Vinschen 24e8fc6872 * cygwin.din (basename): Export.
(dirname): Export.
	* path.cc (basename): New function.
	(dirname): New function.
	* include/libgen.h: New file.
	* include/cygwin/version.h: Bump API minor version.
2005-02-22 19:45:41 +00:00
Corinna Vinschen 156d93af29 * select.cc (peek_pipe): Disable new pipe code until there's
a working substitute.
2005-02-22 15:39:45 +00:00
Corinna Vinschen a62f6b806e * cygwin.din (fdatasync): Export.
* fhandler.cc (fhandler_base::fsync): Return with EINVAL if no
	handle is available.
	* syscalls.cc (fdatasync): Create export alias to fsync.
	* include/cygwin/version.h: Bump API minor version.
2005-02-22 15:30:09 +00:00
Corinna Vinschen 4e5a3fa5e2 * fhandler.h (fhandler_base::fstat_helper): Declare with additional
dwVolumeSerialNumber argument.  Drop default values for last three
	arguments.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass
	dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper.
	(fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper.
	Accomodate dropping default values for last three arguments of
	fstat_helper.
	(fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument.
	Use for st_dev member unless 0 in which case pc.volser () is used.
2005-02-20 16:14:53 +00:00
Corinna Vinschen 4944ca2f09 * autoload.cc (FindFirstVolumeA): Add.
(FindNextVolumeA): Add.
	(FindVolumeClose): Add.
	(GetVolumePathNamesForVolumeNameA): Add.
	* fhandler.h (class fhandler_base): Declare new method fsync.
	* fhandler.cc (fhandler_base::fsync): New method.
	* syscalls.cc (fsync): Move functionality into fhandler method fsync.
	Just call this method from here.
	(sync_worker): New static function.
	(sync): Fill with life for NT systems.
	* wincap.h (wincaps::has_guid_volumes): New element.
	* wincap.cc: Implement above element throughout.
2005-02-20 13:28:23 +00:00
Corinna Vinschen 2b09be25a3 * fhandler.h (enum query_state): Add query_write_attributes state.
(fhandler_base::status.query_open): Add a bit to make room for more
	states.
	(class fhandler_base): Declare new method utimes.
	(class fhandler_socket): Ditto.
	(class fhandler_disk_file): Ditto.
	(fhandler_disk_file::fhandler_disk_file): Add constructor with
	path_conv parameter.
	* fhandler.cc (fhandler_base::open): Add query_write_attributes
	handling.
	(fhandler_base::utimes): New method.
	* fhandler_disk_file.cc (fhandler_disk_file::link): Simplify.
	Open file with query_write_attributes instead of query_write_control.
	(fhandler_disk_file::utimes): New method.
	(fhandler_disk_file::fhandler_disk_file): Add constructor with
	path_conv parameter setting pc member immediately.
	* fhandler_socket.cc (fhandler_socket::fchmod): Use new
	fhandler_disk_file constructor.
	(fhandler_socket::fchown): Ditto.
	(fhandler_socket::facl): Ditto.
	(fhandler_socket::link): Ditto.
	(fhandler_socket::utimes): New method.
	* times.cc: Include dtable.h.
	(timeval_to_filetime): Make non-static.
	(utimes): Move functionality into fhandler method utimes. Just call
	this method from here.
	* winsup.h: Simplify declarations of time helper functions.
	(timeval_to_filetime): Add extern declaration.
2005-02-20 11:44:32 +00:00
Corinna Vinschen 0d75ce965c * fhandler.h (class fhandler_base): Declare new method link.
(class fhandler_socket): Ditto.
	(class fhandler_disk_file): Ditto.
	* fhandler.cc (fhandler_base::open): Add FILE_WRITE_ATTRIBUTES
	to query_write_control access flags.
	(fhandler_base::link): New method.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't try to
	open with O_WRONLY since query_write_control includes
	FILE_WRITE_ATTRIBUTES.
	(fhandler_disk_file::fchown): Ditto.
	(fhandler_disk_file::facl): Ditto.
	(fhandler_disk_file::link): New method.  Touch st_ctime on successful
	link.
	* fhandler_socket.cc (fhandler_socket::link): New method.
	* syscalls.cc (link): Move functionality into fhandler method link.
	Just call this method from here.
2005-02-19 21:53:36 +00:00
Corinna Vinschen c2d0b9d89a * fhandler.h (class fhandler_socket): Declare new methods fchown,
fchmod and facl.
	* fhandler_socket.cc (fhandler_socket::fstat): Handle AF_LOCAL
	sockets.
	(fhandler_socket::fchmod): New method.
	(fhandler_socket::fchown): New method.
	(fhandler_socket::facl): New method.
2005-02-19 20:03:18 +00:00
Corinna Vinschen 2d7606a594 * localtime.cc: Temporary implementation of setting __tzrule's offset
member to be used by strftime.
	(__tzrule): New global variable.
	(tzparse): Set __tzrule's offset member appropriately.
2005-02-19 19:58:38 +00:00
Christopher Faylor 2cd6f872f3 * path.cc (path_conv::check): Set fs flag when a unix-domain socket is
detected.
2005-02-17 17:21:11 +00:00
Corinna Vinschen 3419b5bc2b * fhandler_disk_file.cc (fhandler_disk_file::fstat): Set st_ctime if
has_changed flag is set.
	(fhandler_disk_file::touch_ctime): Reset has_changed flag on success.
2005-02-17 12:41:49 +00:00