Commit Graph

4997 Commits

Author SHA1 Message Date
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 24e2f8b482 * include/winnt.h (SE_UNDOCK_NAME TEXT): Define.
(SE_MANAGE_VOLUME_NAME TEXT): Ditto.
	(SE_IMPERSONATE_NAME TEXT): Ditto.
	(SE_ENABLE_DELEGATION_NAME TEXT): Ditto.
	(SE_SYNC_AGENT_NAME TEXT): Ditto.
2005-04-03 17:47:37 +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
Corinna Vinschen c9f545e20f * bsd_mutex.cc (_msleep): Whitespace fix.
* process.cc (process::process): Handle invalid signal_arrived values
	more gracefully.
2005-04-01 15:35:47 +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
Danny Smith a1d1d8ab80 * include/_mingw.h (__MINGW_ATTRIB_NONNULL): Define. 2005-03-31 10:00:26 +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 5b70a45665 * how-using.texinfo: Add more words to the "multiple DLL" section. 2005-03-30 17:02:00 +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 a4ec6363ca update copyright 2005-03-28 00:09:08 +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
Joshua Daniel Franklin 9eba97c0d5 Mention generic-build-script in packaging FAQ 2005-03-26 04:01:52 +00:00
Corinna Vinschen 0f0595abd9 * cygcheck.cc (init_paths): Use full path instead of "." for the
current directory.  Do not add "." if present in $PATH.
	(dump_sysinfo): Skip placeholder first value of paths[].
2005-03-24 14:48:15 +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
Danny Smith bc47d398b2 * include/stdio.h (__mingw_fwrite): Change return value to
size_t.
	* mingwex/mingw-fseek.c (__mingw_fwrite): Likewise.
2005-03-24 05:58:52 +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 b5478403a9 checkin previously missed file. 2005-03-23 17:47:29 +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 bade737e45 * Makefile.common: Add -dD to options when creating preprocess files. 2005-03-23 03:22:27 +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
Joshua Daniel Franklin b5e27d4009 * how-programming.texinfo: Remove incorrect libm.a note. 2005-03-19 23:33:04 +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 38a1953cfc * winclude/winnt.h (SYSTEM_LUID): Fix definitition invalidated by below change. 2005-03-16 21:50:14 +00:00
Christopher Faylor 77e5f8975d missing file from previous checkin. 2005-03-16 21:21:18 +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
Danny Smith 3ce11ca8d0 * include/winnt.h (_LUID): Add structure. Correct LUID typedef.
Thanks to:
	Paul-Christiaan Spruijtenburg <wakarimasu at users dot sf dot net>
2005-03-16 00:46:17 +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
Danny Smith e967098660 2005-03-15 Hans Leidekker <hans@it.vu.nl>
* include/malloc.h (_FREEENTRY, _USEDENTRY): Correct defines.
2005-03-15 03:10:01 +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
Christopher Faylor 82518b7c54 Remove \n from debug_printf 2005-03-09 20:08:29 +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 8c2fb68a11 revert errnoneous checkin 2005-03-08 14:32:07 +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 4534561877 * kill.cc (getsig): Rectify bug introduced by 2005-02-26 change. Don't pad
signal name with spaces.
2005-03-08 04:06:26 +00:00
Corinna Vinschen a593a4c5e3 * strace.cc (handle_output_debug_string): Fix compiler warning. 2005-03-07 10:24:23 +00:00
Danny Smith d34d3da637 * include/ws2tcpip.h (getaddrinfo, freeaddrinfo, getnameinfo):
Guard with _WIN32_WINNT >= 0x0501. Add FIXME comment.
	* gai_strerror[AW]: Put into #if 0 block.
2005-03-07 08:32:24 +00:00
Danny Smith 4f7e895a3a * include/basetyps.h (__int16): Correct define. 2005-03-07 04:58:30 +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 3f02a8d0f4 * 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 20:21:30 +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 5f8e4efa67 * cygpath.cc (usage): Pass in one more copy of program_name to printf to avoid
a SEGV.
2005-03-06 18:00:03 +00:00
Christopher Faylor 57a64c15da * pathnames.sgml: Clarify binmode/textmode behavior slightly.
* textbinary.sgml: Ditto.
2005-03-06 02:46:54 +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
Joshua Daniel Franklin 7486d0c019 Add Pierre's security text. 2005-03-03 16:36:08 +00:00
Christopher Faylor 7c8d92d7a6 restore comment 2005-03-03 15:12:50 +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 9dc6005ae2 * regtool.cc (opts): The argument to 'K' is not optional.
(main): Revert previous change.  Just let getopt deal with missing argument.
2005-02-27 17:55:54 +00:00
Christopher Faylor 2391eea57e * regtool.cc (main): Avoid a SEGV when nothing follows -K. 2005-02-27 06:10:58 +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 78d9eaa5ea * kill (getsig): Avoid buffer overflow when generating a signal name.
* strace.cc (handle_output_debug_string): Make error a little more specific.
2005-02-27 03:03:19 +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
Danny Smith 078f08b81a * include/wctype.h (wctrans) Remove _CRTIMP.
(towctrans): Likewise.
	(wctype): Likewise,
2005-02-25 08:15:46 +00:00
Danny Smith b7c201d588 * include/wctype.h: Add comment on wctrans, towctrans, wctype. 2005-02-25 01:48:38 +00:00
Danny Smith 7e9439a0eb * mingwex/wctype.c: New file.
* mingwex/wctrans.c: New file.
	* mingwex/Makefile.in (DISTFILES): Add wctype.c, wctrans.c.
	* mingwex/Makefile.in (Q8_OBJS): Add wctype.o, wctrans.o.
2005-02-25 01:43:43 +00:00
Joshua Daniel Franklin f6dbe3872a *README: New file. 2005-02-24 05:26:33 +00:00
Joshua Daniel Franklin 4c6344923e * cygpath.cc (usage): Clarify help output to indicate acceptance
of multiple file names as arguments.
2005-02-24 04:32:45 +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 9ba51f6d17 * include/cygwin/version.h: Fix comment. 2005-02-22 15:35:10 +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
Christopher Faylor 731028b326 copyright 2005-02-20 04:25:33 +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
Corinna Vinschen b066a19513 * times.cc (utimes): Open files with FILE_WRITE_ATTRIBUTES first,
if that fails, try opeing with GENERIC_WRITE.  Fix comments.
2005-02-17 12:08:16 +00:00
Christopher Faylor 031619634c * path.h (path_conv::issocket): Return true if device == FH_UNIX rather than
expecting path_conv to set a flag.
2005-02-16 00:24:38 +00:00
Christopher Faylor 264f41f081 white space 2005-02-13 18:17:29 +00:00