Commit Graph

182 Commits

Author SHA1 Message Date
Corinna Vinschen 3591470260 * Throughout fix copyright dates. 2011-02-15 15:56:03 +00:00
Christopher Faylor 63398011f9 * autoload.cc (wsock_init): Properly define WSAStartup function pointer to
avoid stack damage.
2011-02-05 19:38:21 +00:00
Corinna Vinschen 0dcfb061cf * autoload.cc (RETRY_COUNT): New define.
(std_dll_init): Restructure loop to retry loading a DLL only if
	specific errors occur.  If these errors persist, try to load DLL
	with name only.
2010-12-09 16:50:36 +00:00
Corinna Vinschen 943c59e3e8 * autoload.cc (SendARP): Remove.
* net.cc (get_flags): Set IFF_NOARP flag for PPP and SLIP devices.
	(get_xp_ifs): Unify IFF_BROADCAST setting.  Drop calling SendARP to
	set IFF_NOARP flag.
2010-11-23 15:37:41 +00:00
Christopher Faylor b66f254618 * autoload.cc (std_dll_init): Add a retry loop. 2010-10-01 21:53:11 +00:00
Corinna Vinschen 2a9b4b7aa0 Revert accidental previous login. 2010-09-28 14:49:31 +00:00
Corinna Vinschen 2f1f8815c0 * Makefile.in (DLL_IMPORTS): Remove libadvapi32.a.
* autoload.cc: Add all advapi32 entry points.
	* mount.cc (mount_info::init): Read user fstab only if we have a
	username.
	* passwd.cc (pwdgrp::read_passwd): Only use username if we have one.
	* shared.cc (user_info::initialize): Set cb last so as not to override
	planned behaviour in pwdgrp::read_passwd.
	* uinfo.cc (cygheap_user::init): Fetch Windows username from environment
	variable $USERNAME.  Don't set name in cygheap if variable is empty.
	(internal_getlogin): If we still have no username, try GetUserNameW.
2010-09-28 14:40:18 +00:00
Corinna Vinschen 92626febdd * autoload.cc: Throughout. order entry points alphabetically by DLL
and function name.  Make functions which are available on all supported
	systems non-optional.  Fix return value on entry points imported from
	secur32.dll.  Add comment.
	(std_dll_init): Call fesetenv unconditionally.
2010-09-25 19:57:34 +00:00
Christopher Faylor 8d07b1aa2b * autoload.cc (std_dll_init): Move dll_path closer to its use. Use dll_path in
fatal error.  Set ret values under lock control.
* lib/minires.c (res_nsend): Fix compilation errors owing to pointer
signedness.
2010-09-24 19:53:18 +00:00
Christopher Faylor b375557956 * autoload.cc (std_dll_init): Use correct format type when displaying dll name
in error output.
2010-09-23 20:18:16 +00:00
Dave Korn 0f81b5d4bc winsup/cygwin/ChangeLog:
* Makefile.in (DLL_OFILES): Add new fenv.o module.
	(fenv_CFLAGS): New flags definition for fenv.o compile.
	* autoload.cc (std_dll_init): Use fenv.h functions instead of direct
	manipulation of x87 FPU registers.
	* crt0.c (mainCRTStartup): Likewise.
	* cygwin.din (feclearexcept, fegetexceptflag, feraiseexcept,
	fesetexceptflag, fetestexcept, fegetround, fesetround, fegetenv,
	feholdexcept, fesetenv, feupdateenv, fegetprec, fesetprec,
	feenableexcept, fedisableexcept, fegetexcept, _feinitialise,
	_fe_dfl_env, _fe_nomask_env): Export new functions and data items.
	* fenv.cc: New file.
	* posix.sgml: Update status of newly-implemented APIs.
	* include/fenv.h: Likewise related header.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-09-11 06:53:28 +00:00
Corinna Vinschen 92596190c4 * autoload.cc (MsgWaitForMultipleObjectsEx): Define.
(MsgWaitForMultipleObjects): Remove.
	* select.cc (select_stuff::wait): Use MsgWaitForMultipleObjectsEx with
	QS_ALLPOSTMESSAGE and, if possible, MWMO_INPUTAVAILABLE flags.  Explain
	why.  Fix a potential crash due to a NULL pointer in WAIT_FAILED case.
	(peek_windows): Use filter pattern on NT4.  Explain why.
	* wincap.h (wincaps::has_mwmo_inputavailable): New element.
	* wincap.cc: Implement above element throughout.
2010-08-30 10:39:43 +00:00
Corinna Vinschen 893a8b78fc * autoload.cc (LoadDLLprime): Change dllname storage to string16.
(struct dll_info): Convert name to WCHAR.
	(std_dll_init): Load DLLs with full path to windows system directory.
	Add hint to Microsoft security advisory.
	* dcrt0.cc (init_windows_system_directory): New function.
	(dll_crt0_0): Call init_windows_system_directory first.
	* exceptions.cc (windows_system_directory): Move to globals.cc.
	(windows_system_directory_length): Ditto.
	(events_init): Drop code fetching windows_system_directory.
	* globals.cc (windows_system_directory): New global variable.
	(windows_system_directory_length): Ditto.
	* net.cc (load_ipv6_funcs): Use windows_system_directory rather than
	GetSystemDirectoryW.
	* netdb.cc (open_system_file): Ditto.  Simplify debug output.
2010-08-28 08:51:21 +00:00
Christopher Faylor bee6d43176 * autoload.cc (noload): Use "pushl" rather than "push". 2010-07-18 20:14:51 +00:00
Corinna Vinschen cc01c77f7e * autoload.cc (GetNamedPipeClientProcessId): Define.
* fhandler.h (fhandler_tty_slave::fch_open_handles): Declare private.
	(fhandler_tty_slave::fch_close_handles): Ditto.
	(fhandler_tty_slave::cygserver_attach_tty): Drop declaration.
	(fhandler_tty_slave::fstat): Declare public.
	(fhandler_tty_slave::fchmod): Declare public.
	(fhandler_tty_slave::fchown): Declare public.
	(class fhandler_pty_master): Add master_ctl handle.
	(fhandler_pty_master::pty_master_thread): Declare public.
	* fhandler_termios.cc (fhandler_termios::tcinit): If the process
	is started from a non-Cygwin process, make it tty process group
	leader.
	* fhandler_tty.cc: Throughout accommodate additional security related
	arguments in calls to functions creating or opening objects.
	(close_maybe): Move to start of file to reuse it
	in other methods.
	(struct pipe_request): Define.
	(struct pipe_reply): Define.
	(fhandler_tty_slave::open): Throughout, try to open synchronization
	objects with MAXIMUM_ALLOWED permissions.  Drop call to cygserver.
	Try to duplicate pipe handles via master_ctl pipe if duplicating
	directly doesn't work.
	(fhandler_tty_slave::cygserver_attach_tty): Remove.
	(fhandler_tty_slave::init): Close unused incoming pipe handle.
	(fhandler_pty_master::close): Send exit message to master control
	thread and close master_ctl handle.
	(fhandler_pty_master::pty_master_thread): New method, implementing the
	master control thread.
	(pty_master_thread): Static helper to start master control thread.
	(fhandler_pty_master::setup): Simplify creating pipe inheritance.
	Make sure we're the one creating the input_available_event.  Add
	comment to explain why.  Create master_ctl pipe and start master
	control thread.  Close master_ctl handle in case of error.
	* security.cc (alloc_sd): Add code to handle tty objects.  Add comments
	to explain what exactly is required.
	(get_object_sd): New function.
	(get_object_attribute): New function.
	(create_object_sd_from_attribute): New function.
	(set_object_sd): New function.
	(set_object_attribute): New function.
	(set_file_attribute): Change attribute type to mode_t.
	* security.h (set_file_attribute): Change attribute type to mode_t.
	(get_object_sd): Declare.
	(get_object_attribute): Declare.
	(create_object_sd_from_attribute): Declare.
	(set_object_sd): Declare.
	(set_object_attribute): Declare.
	* tty.cc (tty::slave_alive): Implement directly instead of via alive.
	(tty::exists): Open mutex handle with READ_CONTROL access.
	(tty::alive): Remove.
	(tty::open_output_mutex): Convert to inline method.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): Take additional ACCESS_MASK parameter for the
	mutex open access mask.
	(tty::open_inuse): New method.
	(tty::create_inuse): Take PSECURITY_ATTRIBUTES parameter.  Drop fmt
	name parameter.  Always create TTY_SLAVE_ALIVE event.
	(tty::get_event): Take additional PSECURITY_ATTRIBUTES parameter for
	CreateEvent.
	* tty.h (class tty): Change declarations according to aforementioned
	changes.
	(tty::open_output_mutex): Implement as inline method.
	(tty::open_input_mutex): Ditto.
2010-04-19 19:52:43 +00:00
Christopher Faylor 084ea5108e Throughout change all calls of low_priority_sleep (0) to yield ().
* miscfuncs.cc (yield): Rename from low_priority_sleep.  Remove all of the
logic which called Sleep() and just use SwitchToThread.
* miscfuncs.h (yield): Rename from low_priority_sleep.
(SLEEP_0_STAY_LOW): Delete unused define.
* shared.cc (memory_init): Move heap_init() call directly after shared memory
initialization to more closely mimic long-standing program flow.
* tty.cc (tty_list::terminate): Replace call to low_priority_sleep with Sleep.
2010-03-12 23:13:48 +00:00
Corinna Vinschen 326fb376dd * Makefile.in (DLL_OFILES): Add nlsfunc.o and strfmon.o.
* autoload.cc (LocaleNameToLCID): Define.
	* cygwin.din (strfmon): Export.
	* nlsfuncs.cc: New file.  Define a lot of internal functions called
	from setlocale.
	(wcscoll): Implement locale-aware here, using CompareStringW function.
	(strcoll): Ditto.
	(wcsxfrm): Implement locale-aware here, usingLCMapStringW function.
	(strxfrm): Ditto.
	(__set_charset_from_locale): Replace __set_charset_from_codepage.
	Return Linux-compatible charset.
	* strfuncs.cc (__set_charset_from_codepage): Remove.
	* wchar.h (__set_charset_from_codepage): Drop definition.
	* wincap.h (wincaps::has_localenames): New element.
	* wincap.cc: Implement above element throughout.
	* libc/strfmon.c: New file.
	* libc/strptime.cc: Remove locale constant strings in favor of
	access to locale-specifc data.
	(strptime): Point _CurrentTimeLocale to locale-specific data.
	Throughout use correct locale-specific format fields for all
	locale-specific formats.
	* include/monetary.h: New file.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-01-22 22:31:31 +00:00
Corinna Vinschen b14f53a8ec Reintegrate socket duplication via WSADuplicateSocket/WSASocket.
* autoload.cc (WSADuplicateSocketW): Define.
	(WSASocketW): Define.
	* dtable.cc (dtable::release): Call dec_need_fixup_before if necessary.
	(dtable::fixup_before_fork): New function.
	(dtable::fixup_before_exec): New function.
	* dtable.h (class dtable): Add member cnt_need_fixup_before.  Add
	declarations for above new functions.
	(dtable::dec_need_fixup_before): New inline method.
	(dtable::inc_need_fixup_before): New inline method.
	(dtable::need_fixup_before): New inline method.
	* fhandler.h (fhandler_base::fixup_before_fork_exec): New virtual
	method.
	(fhandler_base::need_fixup_before): New virtual method.
	(class fhandler_socket): Add member prot_info_ptr.
	(fhandler_socket::init_fixup_before): Declare.
	(fhandler_socket::need_fixup_before): New inline method.
	(fhandler_socket::fixup_before_fork_exec): Declare.
	(fhandler_socket::fixup_after_exec): Declare.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	prot_info_ptr to NULL.
	(fhandler_socket::~fhandler_socket): Free prot_info_ptr conditionally.
	(fhandler_socket::init_fixup_before): New method.
	(fhandler_socket::fixup_before_fork_exec): Ditto.
	(fhandler_socket::fixup_after_fork): Use WSASocketW to duplicate
	socket if necessary.
	(fhandler_socket::fixup_after_exec): New method.
	(fhandler_socket::dup): Use fixup_before_fork_exec/fixup_after_fork
	to duplicate socket if necessary.
	* fork.cc (frok::parent): Start child suspended if some fhandler
	needs fixup before fork.  If so, call dtable::fixup_before_fork after
	CreateProcess and resume child.
	* net.cc (fdsock): Try to find out if socket needs fixup before and
	initialize socket accordingly.  Add HUGE comment to explain what happens
	and why.
	* spawn.cc (spawn_guts): Start child suspended if some fhandler needs
	fixup before exec.  If so, call dtable::fixup_before_exec after
	CreateProcess.
2009-11-17 10:43:01 +00:00
Corinna Vinschen 5e8d7527af * autoload.cc (WSARecv): Define.
* fhandler_socket.cc (fhandler_socket::recv_internal): Call WSARecv
	instead of WSARecvFrom if no name parameter is given.  Explain why.
2009-09-22 14:27:57 +00:00
Corinna Vinschen e4001d4ccd * autoload.cc: Delete stray CR. 2009-07-06 10:44:14 +00:00
Christopher Faylor 01d8a2dfd6 * autoload.cc (SetParent): Add new import.
* fhandler.h (fhandler_console::create_invisible_console): Declare new
function.
(create_invisible_console_workaround): Ditto.
* fhandler_console.cc (fhandler_console::create_invisible_console): Define new
function.
(create_invisible_console_workaround): Ditto.  Add too much code to deal with
broken Windows 7.  Use a helper app to start an invisible console window.
(fhandler_console::need_invisible): Reorganize to use helper functions to
create invisible console.
* spawn.cc (spawn_guts): Avoid zeroing already zeroed fields in si.
2009-07-04 23:51:10 +00:00
Dave Korn 38a58dd13c * autoload.cc (AttachConsole): Correct size of args. 2009-07-04 14:51:09 +00:00
Corinna Vinschen a4175657bf * autoload.cc: Fix typo in comment.
(ShowWindowAsync): Define.
	(AttachConsole): Define.
	* fhandler_console.cc (fhandler_console::need_invisible): Add band-aid
	for Windows 7 AllocConsole bug.
2009-07-03 10:50:51 +00:00
Corinna Vinschen 962082b91a * autoload.cc (GetSystemTimes): Remove.
* fhandler_proc.cc (format_proc_uptime): Use global system_info rather
	than retrieving a local copy of the SYSTEM_INFO.  Drop call to
	GetSystemTimes and retrieve SystemPerformanceInformation on all systems
	again with buffer size big enough for 64 bit systems.
	(format_proc_stat): Use global system_info rather than retrieving a
	local copy of the SYSTEM_INFO.  Retrieve SystemPerformanceInformation
	with buffer size big enough for 64 bit systems.
2009-06-09 09:45:29 +00:00
Corinna Vinschen d8e551a1a7 * autoload.cc (GetSystemTimes): Define.
* fhandler_proc.cc (format_proc_uptime): Use GetSystemInfo to retrieve
	processor count.  Use GetSystemTimes when available to retrieve system
	idle time.  Improve debug output.
	(format_proc_stat): Use GetSystemInfo to retrieve processor
	count.  Improve debug output.  Ignore if SystemPerformanceInformation
	returns error.  Explain why.
2009-06-08 20:04:37 +00:00
Corinna Vinschen 348267bdf6 * autoload.cc (NetLocalGroupEnum): Remove.
(NetLocalGroupGetMembers): Remove.
	(NetUserGetLocalGroups): Add.
	* sec_auth.cc (is_group_member): Remove function.
	(get_user_local_groups): Get user as string instead of as SID.
	Call NetUserGetLocalGroups instead of NetLocalGroupEnum.  Drop call
	to is_group_member.
	(get_server_groups): Call get_user_local_groups with user name instead
	of user SID.
2009-02-20 16:10:45 +00:00
Corinna Vinschen 3787b37ef2 * autoload.cc (WSAIoctl): Reintroduce.
(WSASendMsg): Define.
	* fhandler.h (class fhandler_socket): Change definition of recv_internal
	and send_internal to take WSAMSG pointer as parameter.
	* fhandler_socket.cc (WSAID_WSARECVMSG): Define.
	(LPFN_WSARECVMSG): Define.
	(WSASendMsg): Declare.
	(get_ext_funcptr): New function to fetch address of WSARecvMsg.
	(fhandler_socket::recv_internal): Take just a LPWSAMSG parameter.
	Change code accordingly.  If control information is requested,
	fetch address of WSARecvMsg and use that instead of WSARecvFrom.
	(fhandler_socket::recvfrom): Change return type to ssize_t as
	declared in fhandler.h.  Accommodate changes to recv_internal.
	(fhandler_socket::recvmsg): Ditto.  Make sure that control information
	is only requested if system, address family, and socket type support it.
	(fhandler_socket::send_internal): Take just a LPWSAMSG parameter
	and the flags.  Change code accordingly.  If control information is
	provided, use WSASendMsg instead of WSASendTo.
	(fhandler_socket::sendto): Drop useless comment.  Accommodate changes
	to send_internal.
	(fhandler_socket::sendmsg): Ditto.  Make sure that control information
	is only provided if system, address family, and socket type support it.
	* wincap.h (wincaps::has_recvmsg): New element.
	(wincaps::has_sendmsg): New element
	* wincap.cc: Implement above elements throughout.
	* include/cygwin/socket.h (CMSG_ALIGN): Phrase in terms of alignment
	of type struct cmsghdr.
2009-01-20 11:16:59 +00:00
Corinna Vinschen babd4a9c62 * autoload.cc (GetSystemDEPPolicy): Define.
(GetProcessDEPPolicy): Ditto.
	(SetProcessDEPPolicy): Ditto.
	* dcrt0.cc (disable_dep): New static function.
	(dll_crt0_0): Call disable_dep on platforms requiring it.  Add longish
	comment to explain the circumstances.
	* wincap.h (wincaps::ts_has_dep_problem): New element.
	* wincap.cc: Implement above element throughout.
	(wincapc::init): Set ts_has_dep_problem to true on 2008 Terminal
	Servers.
	* winsup.h (WINVER): Set to 0x0601.
2008-11-12 11:04:27 +00:00
Corinna Vinschen 3e97726f98 * autoload.cc (GetSystemWindowsDirectoryW): Define.
* kernel32.cc (GetWindowsDirectoryW): Implement to abstract from
	running under Terminal Services or not.
	(GetWindowsDirectoryA): Ditto.
2008-10-22 13:30:42 +00:00
Corinna Vinschen 5a3ed02610 * autoload.cc (WNetGetProviderNameA): Define.
(WNetGetResourceParentA): Remove.
	* fhandler_netdrive.cc (struct net_hdls): New structure to keep
	WNet handles.  Stored in dir->__handle throughout.
	(thread_netdrive): Rewrite to enumerate all servers in all accessible
	domains and workgroups.
	(fhandler_netdrive::readdir): Simplify toplevel code.  Lowercase all
	server names in toplevel.
	(fhandler_netdrive::rewinddir): Close all WNet handles and free
	net_hdls structure.
2008-07-19 12:26:09 +00:00
Corinna Vinschen 88d1b6df94 * autoload.cc (GetExtendedTcpTable): Define.
* fhandler_socket.cc (address_in_use): Take const struct sockaddr
	pointer as argument.  Implement additional AF_INET6 table check.
	(fhandler_socket::bind): Drop AF_INET test before calling
	address_in_use.
	* net.cc (ipv4_getnameinfo): Return EAI_FAMILY instead of 1 if
	called with unsupported af_family.
2008-07-14 15:56:11 +00:00
Corinna Vinschen 5558de95e5 * autoload.cc (DsGetDcNameW): Replace DsGetDcNameA.
* dcrt0.cc (child_info_spawn::handle_spawn): Drop artificial
	supplementary group list from calling setgroups in parent.
	* grp.cc (internal_getgroups): Drop 9x-only code.  Reformat.
	* sec_auth.cc (get_logon_server): Do everything in WCHAR only.
	(get_user_groups): Ditto.  Use wlogonserver in LookupAccountNameW
	calls, too.
	(is_group_member): Get logon server as first argument and use in call
	to NetLocalGroupGetMembers.
	(get_user_local_groups): Get logon server as first argument and use in
	calls to NetLocalGroupEnum and LookupAccountNameW.  Revamp to work
	more correctly in domain environments.
	(get_server_groups): Accommodate aforementioned changed function calls.
	* security.h (get_logon_server): Change prototype accordingly.
	* uinfo.cc (cygheap_user::env_logsrv): Accommodate changed
	get_logon_server call.
2008-07-09 11:58:38 +00:00
Corinna Vinschen 4c153b24d9 * autoload.cc (LoadDLLfuncNt): Re-invent.
(NtCreateTransaction): Define.
	(NtCommitTransaction): Define.
	(NtRollbackTransaction): Define.
	(RtlGetCurrentTransaction): Define.
	(RtlSetCurrentTransaction): Define.
	* ntdll.h (TRANSACTION_ALL_ACCESS): Define.
	(NtCreateTransaction): Declare.
	(NtCommitTransaction): Declare.
	(NtRollbackTransaction): Declare.
	(RtlGetCurrentTransaction): Declare.
	(RtlSetCurrentTransaction): Declare.
	* syscalls.cc (start_transaction): New static function to start TxF
	transaction.
	(stop_transaction): New static function to end TxF transaction.
	(rename): Call start_transaction and stop_transaction where appropriate
	on systems supporting transactions.
	* wincap.h (wincaps::has_transactions): New element.
	* wincap.cc: Implement above element throughout.
2008-05-15 16:34:01 +00:00
Corinna Vinschen aacf1864d8 * autoload.cc (IsWow64Process): Remove.
(Wow64DisableWow64FsRedirection): Remove.
	(Wow64RevertWow64FsRedirection): Remove.
	* ntdll.h (enum _PROCESSINFOCLASS): Define ProcessWow64Information.
	* init.cc (respawn_wow64_process): Use NtQueryInformationProcess to
	get WOW64 state.
	* wincap.cc (wincapc::init): Ditto.
	* wincap.h (wincapc::wow64): Change type to ULONG.
2008-04-28 08:47:06 +00:00
Corinna Vinschen abbde48704 * Makefile.in (DLL_OFILES): Add kernel32.o.
* autoload.cc (WSACloseEvent): Remove.
	(WSACreateEvent): Remove.
	* cygheap.cc (cygheap_init): Drop initializing shared_prefix.
	* cygheap.h (struct init_cygheap): Drop shared_prefix and
	shared_prefix_buf members.
	* fhandler_socket.cc (sock_shared_name): New static function.
	(search_wsa_event_slot): Convert name buffers to WCHAR.  Call
	NtCreateMutant/NtOpenMutant to create mutexes in session local
	namespace.
	(fhandler_socket::init_events): Ditto.  Fix debug output.
	(fhandler_socket::release_events): Close mutexes using NtClose.
	(fhandler_socket::dup): Ditto.
	* kernel32.cc: New file, implementing Win32 calls in a Cygwin-specific
	way.
	* mmap.cc (MapView): Make static.
	* ntdll.h: Fix status code sorting.
	(STATUS_OBJECT_NAME_EXISTS): Define.
	(SEMAPHORE_QUERY_STATE): Define.
	(CYG_SHARED_DIR_ACCESS): Define.
	(CYG_MUTANT_ACCESS): Define.
	(CYG_EVENT_ACCESS): Define.
	(CYG_SEMAPHORE_ACCESS): Define.
	(enum _PROCESSINFOCLASS): Define ProcessSessionInformation.
	(struct _PROCESS_SESSION_INFORMATION): Define.
	(NtCreateSemaphore): Declare.
	(NtOpenSemaphore): Declare.
	* flock.cc: Use CYG_xxx_ACCESS access masks where appropriate.
	* posix_ipc.cc (ipc_mutex_init): Use native functions to create mutex.
	Create in cygwin-shared subdir.
	(ipc_cond_init): Ditto for event.
	(ipc_mutex_close): Use NtClose.
	(ipc_cond_close): Ditto.
	(mq_open): Drop "cyg" prefix from mqh_uname.
	* shared.cc (CYG_SHARED_DIR_ACCESS): Drop definition here.
	(_cygwin_testing): Declare extern on file level.
	(get_shared_parent_dir): Change name of shared directory.  Add name
	to api_fatal output.
	(get_session_parent_dir): New function.
	(shared_name): Simplify.
	(shared_info::initialize): Call get_session_parent_dir.
	* shared_info.h (get_session_parent_dir): Declare.
	* smallprint.cc (__small_vswprintf): Fix bug in multibyte string
	conversion.
	* thread.cc (semaphore::semaphore): Align semaphore name to object
	names in posix IPC functions.
	* include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
2008-04-21 12:46:58 +00:00
Christopher Faylor 1d8db11e8e * autoload.cc (noload): Make sure this and succeeding functions are located in
the text segment.
2008-04-18 18:20:30 +00:00
Christopher Faylor ade47a3430 Add miscfuncs.h to files as needed throughout.
* mount.cc: New file.
* path.cc: Move mount-specific stuff into mount.cc.  Move common stuff into
miscfuncs.cc.  Remove unneeded includes.
* miscfuncs.cc: Move some common path functions here.
* miscfuncs.h: New file.
* winsup.h: Move miscelleneous functions to miscfuncs.h.
* dcrt0.cc: Remove unneeded includes.
* Makefile.in (DLL_OFILES): Add mount.o.
* include/cygwin/config.h: Fix a minor typo.
2008-04-07 16:15:45 +00:00
Corinna Vinschen a7d2cc16e2 * Fix copyright dates. 2008-04-01 13:22:47 +00:00
Corinna Vinschen 752b16ce35 * Makefile.in (DLL_OFILES): Add tls_pbuf.o.
* autoload.cc (CreateDesktopW): Replace CreateDesktopA.
	(CreateWindowStationW): Replace CreateWindowStationA.
	(GetUserObjectInformationW): Replace GetUserObjectInformationA.
	* cygheap.h (cwdstuff::get): Assume default buffer size NT_MAX_PATH.
	* cygtls.cc (_cygtls::remove): Free temporary TLS path buffers.
	* cygtls.h (TP_NUM_C_BUFS): Define.
	(TP_NUM_W_BUFS): Define.
	(class tls_pathbuf): New class to store pointers to thread local
	temporary path buffers.
	(_local_storage::pathbufs): New member.
	* environ.cc (win_env::add_cache): Use temporary TLS path buffer instead
	of stack based buffer.
	(posify): Get temporary outenv buffer from calling function.
	(environ_init): Create temporary TLS path buffer for posify.
	(build_env): Create Windows environment block as WCHAR buffer.
	* environ.h (build_env): Change declaration accordingly.
	* external.cc (sync_winenv): Accommodate build_env change.
	* fhandler_console.cc (fhandler_console::need_invisible): Use
	GetUserObjectInformationW and CreateWindowStationW.
	* fhandler_process.cc (format_process_maps): Use temporary TLS path
	buffer instead of stack based buffer.
	* fork.cc (frok::parent): Convert to use CreateProcessW.
	* path.cc: Throughout use temporary TLS path buffers instead of stack
	based buffer.  Replace checks for CYG_MAX_PATH by checks for
	NT_MAX_PATH.
	(getfileattr): New function to replace GetFileAttributesA.
	(normalize_win32_path): Remove Win32 and NT long path prefixes.
	(getwd): Assume PATH_MAX + 1 buffer per SUSv3.
	* path.h (class path_conv): Set path buffer to size NT_MAX_PATH.
	(iswdrive): Define.
	* pinfo.cc (commune_process): Use temporary TLS path buffer instead of
	stack based buffer.
	* registry.cc (get_registry_hive_path): Ditto.
	(load_registry_hive): Ditto.
	* spawn.cc (spawn_guts): Convert to use CreateProcessW and
	CreateProcessAsUserW.
	(av::fixup): Open/close file using NtOpenFile/NtClose.
	* syscalls.cc (mknod_worker): Allow PATH_MAX file name.
	(mknod32): Ditto.
	(getusershell): Ditto.
	* tls_pbuf.cc: New file implementing tls_pathbuf and tmp_pathbuf
	methods.
	* tls_pbuf.h: New header for files using tmp_pathbuf.
	* tlsoffsets.h: Regenerate.
	* winsup.h (NT_MAX_PATH): Define as 32767 to avoid USHORT overflow.
2008-03-07 11:24:51 +00:00
Corinna Vinschen a7197550f3 * autoload.cc (CharToOemA): Remove.
(CharNextExA): Define.
	* environ.cc (codepage_init): Un-static.  Set active_codepage to
	active codepage.  Default to ansi regardless of buf pointer.
	* fhandler.h (dev_console::get_console_cp): New method.
	(dev_console::con_to_str): Change declaration according to new
	implementation.
	(dev_console::str_to_con): Ditto.
	* fhandler_console.cc (cp_convert): Remove.
	(dev_console::con_to_str): Redefine to take WCHAR as incoming console
	char.
	(dev_console::get_console_cp): Return correct codepage according to
	alternate_charset_active setting.
	(dev_console::str_to_con): Redefine to create WCHAR buffer for console
	output.
	(fhandler_console::read): Read console input as WCHARs.
	(base_chars): Fix typo in comment.
	(fhandler_console::char_command): Save and restore console output
	buffer using UNICODE functions.
	(fhandler_console::write_normal): Convert to write output in UNICODE.
	Use CharNextExA to recognize multibyte characters in input.  Workaround
	problem with UTF-8 and MultiByteToWideChar.  Simplify the loop for
	printing "normal" characters.
	* strfuncs.cc (active_codepage): New variable to store active codepage.
	(get_cp): Call codepage_init() if active_codepage is uninitialized.
	Just return active_codepage.
	(is_cp_multibyte): New function.
	* winsup.h (active_codepage): Declare.
	(codepage_init): Declare.
	(is_cp_multibyte): Declare.
2008-02-05 17:37:10 +00:00
Corinna Vinschen 814066b912 * autoload.cc (GetModuleFileNameExW): Replace definition of
GetModuleFileNameExA.
	* fhandler_process.cc (format_process_maps): Change modname type to
	WCHAR.  Set buffer sizes to PATH_MAX.  Call GetModuleFileNameExW
	instead of GetModuleFileNameExA.  Call mount_info::conv_to_posix_path
	instead of cygwin_conv_to_full_posix_path.  Set posix_modname to
	modname if that call fails.
	(format_process_stat): Set cmd buffer size to NAME_MAX + 1.  Simplify
	setting cmd to process name.
	(format_process_status): Ditto.
	* path.cc (mount_info::conv_to_posix_path): Call sys_wcstombs
	correctly.
2007-12-03 14:13:03 +00:00
Corinna Vinschen e0bdf94f32 * autoload.cc (CloseDesktop): Define.
(CreateDesktopA): Define.
	(SetThreadDesktop): Define.
	* spawn.cc (spawn_guts): When starting a process under another user
	account, don't open up permissions on current window station and
	desktop.  Instead, if not in interactive session, create a new per-user
	window station plus default desktop and use that for the child process.
2007-08-17 19:58:57 +00:00
Corinna Vinschen 745c29fe7b * autoload.cc (CreateHardLinkA): Remove.
* fhandler_disk_file.cc (fhandler_disk_file::link): Drop GetBinaryType
	test.  Just check exe suffix instead.  Tune creating new file name.
	Implement creating hard link using native NT functions which works
	on all platforms.
	* ntdll.h (STATUS_INVALID_DEVICE_REQUEST): Define.
	(struct _FILE_LINK_INFORMATION): Define.
2007-07-27 16:24:07 +00:00
Corinna Vinschen 4b62a570de * autoload.cc (CreateToolhelp32Snapshot): Remove. 2007-07-25 16:11:03 +00:00
Corinna Vinschen 38a67d337d * autoload.cc (Process32First): Remove.
(Process32Next): Remove.
2007-07-25 16:07:41 +00:00
Corinna Vinschen fdcfcea4fc * autoload.cc (NetWkstaUserGetInfo): Remove.
(CharToOemBuffA): Remove.
	(KillTimer): Remove.
	(OemToCharBuffA): Remove.
	(SetTimer): Remove.
2007-07-25 10:04:57 +00:00
Corinna Vinschen 63a87c815a * autoload.cc (SetSecurityDescriptorControl): Drop.
* security.cc (alloc_sd): Set security descriptor control flag without
	calling SetSecurityDescriptorControl function.
	* wincap.h (wincapc::has_dacl_protect): Rename from
	has_security_descriptor_control.
	* wincap.cc: Ditto throughout.
2007-07-19 09:06:54 +00:00
Corinna Vinschen 5f9c8e2a87 * autoload.cc (SetUserObjectSecurity): Drop.
* pinfo.cc (pinfo::set_acl): Use NtSetSecurityObject instead of
	SetKernelObjectSecurity.
	* spawn.cc (spawn_guts): Use NtSetSecurityObject instead of
	SetUserObjectSecurity.
	* uinfo.cc (cygheap_user::init): Ditto.
2007-07-19 08:36:32 +00:00
Corinna Vinschen a71ecb55de * autoload.cc (WSAIoctl): Remove.
* cygwin.din: Export freeifaddrs, getifaddrs.
	* fhandler_socket.cc (fhandler_socket::ioctl): Drop SOCKET parameter
	from get_ifconf.
	* net.cc: Include ifaddrs.h.
	(in_are_prefix_equal): Match addresses in network byte order.
	(ip_addr_prefix): Convert address into host byte order before
	testing with IN_LOOPBACK.
	(struct ifall): Define.
	(get_xp_ifs): Replace get_xp_ifconf.  Return struct ifall array.
	(get_2k_ifs): Ditto, replace get_2k_ifconf.
	(get_nt_ifs): Ditto, replace get_nt_ifconf.
	(getifaddrs): New function.
	(freeifaddrs): New function.
	(get_ifconf): Call matching get_XX_ifs function and create
	ifc content from here.  Drop lo fake since it's now in get_nt_ifs.
	* posix.sgml: Add freeifaddrs and getifaddrs to list of implemented
	BSD functions.
	* wincap.h (wincapc::has_broken_if_oper_status): New element.
	* wincap.cc: Implement above element throughout.
	* include/ifaddrs.h: New file.
	* include/cygwin/version.h: Bump API minor number.
2007-06-21 15:57:54 +00:00
Corinna Vinschen 8e4a60b383 * autoload.cc (GetIpForwardTable): Define.
* fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFDSTADDR.
	* net.cc (get_routedst): New static function to get destination
	address of point-to-point interfaces.
	(get_xp_ifconf): Handle SIOCGIFDSTADDR.
	(get_2k_ifconf): Ditto.
	(get_nt_ifconf): Ditto.
	(get_ifconf): Ditto.
	* include/asm/socket.h (SIOCGIFDSTADDR): Define.
	* include/cygwin/if.h (struct ifreq): Add ifru_dstaddr member.
	(ifr_dstaddr): Define.
	* include/cygwin/in.h: Cast ipv4 addresses correctly to in_addr_t in
	definitions.
2007-06-14 16:02:32 +00:00