Commit Graph

1575 Commits

Author SHA1 Message Date
Christopher Faylor 8e74c3207f * fhandler_console.cc (fhandler_console::open): Reinstate setting of flags. 2002-05-31 22:53:25 +00:00
Christopher Faylor de86e35bc4 * fhandler_console.cc (fhandler_console::open): Always default to binmode.
(fhandler_console::write_normal): Don't honor binmode setting.  There is
already a termios setting for this.
(fhandler_console::init): Correct argument order in init call.
2002-05-31 22:35:57 +00:00
Christopher Faylor 8461f41ec0 * fhandler.cc (fhandler_base::open): Make default open mode == binmode.
(fhandler_base::init): Set open flags based on derived binmode argument.
2002-05-31 20:48:14 +00:00
Christopher Faylor bcd0ed9f6a * dll_init.cc (dll_list::init): Eliminate unneeded debugging statement. 2002-05-31 20:34:40 +00:00
Christopher Faylor 18c04cc4b2 * fhandler_proc.cc (fhandler_proc::readdir): Set errno when no more files.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
2002-05-31 20:30:36 +00:00
Christopher Faylor 69be001cea * path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES for
nonexistent virtual device path.
(chdir): Set correct errno when attempt is made to cd to nonexistent virtual
device path.
2002-05-31 03:11:21 +00:00
Christopher Faylor 5d8c7a56c2 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Always call fstat_by_name
if fd is not opened to allow fstat_by_name to properly set errno.
* fhandler.cc (binmode): Default to binmode when mode is not known.
2002-05-31 00:15:22 +00:00
Corinna Vinschen d74eced5d5 * autoload.cc: Replace autoload statments for ZwXXX by NtXXX.
Drop ZwQuerySystemInformation since NtQuerySystemInformation was
	already available.
	* fhandler_proc.cc (format_proc_uptime): Replace call to
	ZwQuerySystemInformation by call to NtQuerySystemInformation.
	(format_proc_stat): Ditto.
	* fhandler_process.cc (format_process_stat): Replace call to
	ZwQueryInformationProcess by call to NtQueryInformationProcess.
	(get_process_state): Ditto.
	(get_mem_values): Ditto.  Replace call to ZwQueryVirtualMemory by
	call to NtQueryVirtualMemory.
	* ntdll.h: Cleanup.  Drop ZwQuerySystemInformation since
	NtQuerySystemInformation was already available.  Replace declarations
	of ZwXXX functions by declarations of NtXXX.
	* pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
	by call to NtQuerySystemInformation.
2002-05-30 07:45:30 +00:00
Christopher Faylor d4000bc4c6 speling fxi 2002-05-30 03:14:04 +00:00
Christopher Faylor 186637a508 * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate.
* external.cc (fillout_pinfo): Use it.
2002-05-29 21:00:55 +00:00
Corinna Vinschen 3a571063b3 * external.cc (fillout_pinfo): Use new version define.
* include/sys/cygwin.h (external_pinfo): Define
	EXTERNAL_PINFO_VERSION_16_BIT and EXTERNAL_PINFO_VERSION_32_BIT
	instead of just EXTERNAL_PINFO_VERSION.
2002-05-29 20:07:54 +00:00
Christopher Faylor 9fef0139c2 * external.cc (fillout_pinfo): Set new version field in external_pinfo
structure.
* include/sys/cygwin.h (external_pinfo): Replace strace_file with version
field.
2002-05-29 17:12:07 +00:00
Corinna Vinschen a8d7ae61e7 Change internal uid datatype from __uid16_t to __uid32_t
throughout.
	* cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32,
	geteuid32, setuid32, seteuid32.
	* passwd.cc (getpwuid32): New function.
	(getpwuid_r32): Ditto.
	* syscalls.cc (seteuid32): Ditto.
	(setuid32): Ditto.
	* uinfo.cc (getuid32): Ditto.
	(geteuid32): Ditto.
	* winsup.h (uid16touid32): New macro, correclt casting from __uid16_t
	to __uid32_t.
	(gid16togid32): Ditto fir gids.
	(getuid32): Declare.
	(geteuid32): Ditto.
	(getpwuid32): Ditto.
	* include/sys/cygwin.h (struct external_pinfo): Add members uid32 and
	gid32.
2002-05-29 15:04:29 +00:00
Corinna Vinschen 9854c44c43 * include/cygwin/socket.h: Protect some symbols against multiple
definition.
	* include/netinet/ip.h: Ditto.
	* include/netinet/tcp.h: Ditto.

	* include/netinet/ip.h: Replace by BSD derived version of the file.
	* include/netinet/tcp.h: Ditto.
	* include/netinet/udp.h: New file.
	* include/cygwin/ip.h: Remove.
2002-05-29 07:38:54 +00:00
Christopher Faylor cef6955910 * dtable.cc (dtable::init_std_file_from_handle): Attempt stronger detection of
invalid handle.
(handle_to_fn): Detect pathological condition where NT resets the buffer
pointer to NULL on an invalid handle.
2002-05-29 05:15:43 +00:00
Christopher Faylor 654783b62f clarify changelog 2002-05-29 03:42:12 +00:00
Christopher Faylor a761ad8200 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly check for
whether we should be opening the file to search for #! characters.  Set
path_conv structure execability, too, if found.
2002-05-29 03:06:37 +00:00
Corinna Vinschen 7ea70e9970 * security.cc (set_security_attribute): Call getegid32() instead of
getegid().
	* include/cygwin/grp.h: Declare getegid32().
2002-05-28 14:58:13 +00:00
Corinna Vinschen 5719640581 Change internal gid datatype from __gid16_t to __gid32_t
throughout.
	* cygwin.din: Export new symbols chown32, fchown32, getegid32,
	getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32,
	setgid32, setegid32, getgrent32.
	* grp.cc (grp32togrp16): New static function.
	(getgrgid32): New function.
	(getgrnam32): Ditto.
	(getgrent32): Ditto.
	(getgroups32): Change name of internal function from getgroups.
	(getgroups32): New function.
	(initgroups32): Ditto.
	* syscalls.cc (chown32): Ditto.
	(lchown32): Ditto.
	(fchown32): Ditto.
	(setegid32): Ditto.
	(setgid32): Ditto.
	* uinfo.cc (getgid32): Ditto.
	(getegid32): Ditto.
	* include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam().
	Declare getgrgid32() and getgrnam32() instead.  Declare getgid32().
2002-05-28 14:10:55 +00:00
Christopher Faylor 0c12979b72 * autoload.cc (noload): Properly mask low order word for determining number of
bytes to pop.
2002-05-28 02:09:15 +00:00
Christopher Faylor 57e2ae682c * fhandler_disk_file.cc (fhandler_disk_file::fstat): Minor logic cleanup. 2002-05-28 02:00:55 +00:00
Christopher Faylor 2402700d07 * autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.
(LoadFuncEx2): Adapted from LoadFuncEx.  Provides control of return value for
nonexistent function.
(NtQueryObject): Declare.
(IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not
available.
* debug.h (being_debugged): Just rely on IsDebuggerPresent return value.
* dtable.cc (handle_to_fn): New function.
(dtable::init_std_file_from_handle): Attempt to derive std handle's name via
handle_to_fn.
(dtable::build_fhandler_from_name): Fill in what we can in path_conv structure
when given a handle and path doesn't exist.
* fhandler.cc (fhandler_base::open): Don't set the file pointer here.  Use
pc->exists () to determine if file exists rather than calling GetFileAttributes
again.
* fhandler.h (fhandler_base::exec_state_isknown): New method.
(fhandler_base::fstat_helper): Add extra arguments to declaration.
(fhandler_base::fstat_by_handle): Declare new method.
(fhandler_base::fstat_by_name): Declare new method.
* fhandler_disk_file (num_entries): Make __stdcall.
(fhandler_base::fstat_by_handle): Define new method.
(fhandler_base::fstat_by_name): Define new method.
(fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate.
(fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat
structure.  Move handle or name specific stuff to new methods above.
(fhandler_disk_file::open): Use real_path->exists rather than calling
GetFileAttributes again.
* ntdll.h (FILE_NAME_INFORMATION): Define new structure.
(OBJECT_INFORMATION_CLASS): Partially define new enum.
(OBJECT_NAME_INFORMATION): Define new structure.
(NtQueryInformationFile): New declaration.
(NtQueryObject): New declaration.
* path.cc (path_conv::fillin): Define new method.
* path.h (path_conv::fillin): Declare new method.
(path_conv::drive_thpe): Rename from 'get_drive_type'.
(path_conv::volser): Declare new method.
(path_conv::volname): Declare new method.
(path_conv::root_dir): Declare new method.
* syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 01:55:40 +00:00
Corinna Vinschen 74b2f73ea4 * security.cc (lsa2str): New function.
(get_priv_list): Call lsa2str instead of sys_wcstombs.
2002-05-27 11:58:49 +00:00
Corinna Vinschen 75bf293153 * syscalls.cc (seteuid): Do not take allow_ntsec into account.
Attempt to use an existing or new token even when the uid
	matches orig_uid, but the gid is not in the process token.
	Major reorganization after several incremental changes.
	(setegid): Do not take allow_ntsec into account. Minor
	reorganization after several incremental changes.
2002-05-27 11:48:15 +00:00
Christopher Faylor 918a268c80 * debug.h (being_debugged): New macro.
* dtable.cc (dtable::extend): Use new macro.
* exceptions.cc (try_to_debug): Ditto.
* strace.cc (strace::hello): Only output debugging info when we think we're
being debugged.
2002-05-27 02:25:28 +00:00
Christopher Faylor 0cfbfc249f * winsup.h: Remove duplicate declarations of malloc_lock and malloc_unlock. 2002-05-27 02:09:19 +00:00
Christopher Faylor 149965f73c update comment 2002-05-27 02:06:16 +00:00
Christopher Faylor d7b4a30001 Remove unneeded sync.h, where appropriate, throughout. Remove unneeded heap.h,
where appropriate, throughout.  Remove unneeded exceptions.h, where
appropriate, throughout.  Remove unneeded perprocess.h, where appropriate,
throughout.
2002-05-25 02:22:50 +00:00
Corinna Vinschen 908f9b653b * security.cc (create_token): Call __sec_user() instead of
sec_user() to remove dependence on allow_ntsec. Verify that
	the returned sd is non-null.
2002-05-24 14:44:05 +00:00
Robert Collins a6247be998 2002-05-25 Robert Collins <rbtcollins@hotmail.com>
* gmon.c (fake_sbrk): Correctly return -1 on failed malloc's.
2002-05-24 14:24:33 +00:00
Christopher Faylor ff93854697 * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path along to
set_name via return_and_clear_normalized_path.
(dtable::build_fhandler): New method with const char * argument.
(dtable::reset_unix_path_name): Eliminate.
(dtable::dup_worker): Use correct build_fhandler method.
* mmap.cc (mmap_record::alloc_fh): Ditto.
* dtable.h (dtable::build_fhandler): New method.
(dtable::reset_unix_path_name): Eliminate.
* fhandler.cc (fhandler_base::set_name): Assume that unix_name has already been
cmalloced.
(fhandler_base::reset_unix_path_name): Eliminate.
(fhandler_base::~fhandler_base): Coercion for cfree.
* fhandler.h (fhandler_base::unix_path_name): Make const char *.
(fhandler_base::win32_path_name): Ditto.
(fhandler_base::reset_unix_path_name): Eliminate.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate const char
*ness of win32_path_name.
* fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name
requirements.
* path.cc (path_conv::return_and_clear_normalized_path): New method.
(path_conv::clear_normalized_path): Eliminate.
(path_conv::~path_conv): Ditto.
(path_conv::check): Accommodate new build_fhandler method.
* path.h (path_conv::~path_conv): Eliminate.
(path_conv::clear_normalized_path): Ditto.
(path_conv::return_and_clear_normalized_path): Declare new method.
2002-05-24 05:44:10 +00:00
Christopher Faylor b4bb31ad55 * path.cc (path_conv::check): Make sure any trailing path component is part of
potential normalized posix path.
2002-05-23 20:01:46 +00:00
Christopher Faylor b2f338e9a9 * smallprint.c (__small_vsprintf): Implement '%o' after all these years. 2002-05-23 06:00:49 +00:00
Christopher Faylor fc240f584b * fhandler.h (fhandler_virtual::exists): Eliminate path argument.
(fhandler_proc::exists): Ditto.
(fhandler_registry::exists): Ditto.
(fhandler_process::exists): Ditto.
* fhandler_proc.cc (fhandler_proc::exists): Ditto.  Use built-in name.
* fhandler_process.cc (fhandler_process::exists): Ditto.
(fstat): Ditto.
* fhandler_registry.cc (fhandler_registry::exists): Ditto.
(fhandler_registry::fstat): Ditto.
* fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
* path.cc (path_conv::check): Ditto.  Add debugging.
* syscalls.cc (dup): Always call dup2 for error handling.
2002-05-22 22:09:58 +00:00
Corinna Vinschen 1d2b71d6a3 * include/cygwin/types.h: Revert previous patch. 2002-05-22 12:47:54 +00:00
Corinna Vinschen 36f86a5537 * include/cygwin/types.h: Define pthread stuff only if _POSIX_THREADS
is defined.
2002-05-22 10:33:39 +00:00
Corinna Vinschen 2d6ce5c228 * security.cc (open_local_policy): Initialize lsa to
INVALID_HANDLE_VALUE instead of NULL.
	(get_logon_server_and_user_domain): Test for INVALID_HANDLE_VALUE
	instead of NULL.
	(create_token): Both of the above.
2002-05-21 14:50:26 +00:00
Christopher Faylor 9ded8bd8b2 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Make handling of nlink
consistent for remote files.
2002-05-18 21:07:18 +00:00
Christopher Faylor 2701126aaf * path.cc (path_conv::check): Always set executable bit for executable
extension.
2002-05-18 20:27:49 +00:00
Christopher Faylor 197f807736 remove white space 2002-05-18 06:10:16 +00:00
Christopher Faylor b05b7d84d6 * fhandler.cc (fhandler_base::lseek): Avoid calling SetFilePointer with high
order part of 64 bit address on OS's which do not support that kind of
operation.  Otherwise Windows 95 will become confused.
2002-05-17 19:30:52 +00:00
Corinna Vinschen d6dc98256c * fhandler_raw.cc (fhandler_dev_raw::open): Replace set_errno()
by __seterrno_from_win_error().
	* security.cc (open_local_policy): Ditto.
	(get_lsa_srv_inf): Ditto.
	(get_user_groups): Ditto.
	(get_user_primary_group): Ditto.
	(create_token): Ditto.
	(subauth): Ditto.
2002-05-17 09:32:45 +00:00
Corinna Vinschen 35a89cbe95 * times.cc (utimes): Use FILE_WRITE_ATTRIBUTES even on 9x/Me when
opening file for writing timestamp.
	* wincap.cc: Remove flag has_specific_access_rights.
	* wincap.h: Ditto.
2002-05-17 08:32:29 +00:00
Corinna Vinschen ebbdc7034b * syscalls.cc (seteuid): Set default dacl in process token.
Replace in-line code by call to verify_token().
	(setegid): Reverse change from 2002-01-21. Add call to
	RevertToSelf and set primary group in impersonation token.
	* security.cc (create_token): Store pgrpsid in token security
	descriptor, except if it already appears in my_grps.
	Use sec_acl() in place of get_dacl().
	(verify_token): Create from code in seteuid(), with tighter checks.
	(get_dacl) Deleted.
	(get_group_sidlist): Add argument to indicate if pgrpsid is already
	in the groups.
	* security.h: Define verify_token().
	* autoload.cc: Load GetKernelObjectSecurity().
2002-05-16 09:30:48 +00:00
Christopher Faylor feb7f1a97d * cygwin.din: Add strlcat and strlcpy.
* include/cygwin/version.h: Increment API minor version number.
2002-05-13 19:53:46 +00:00
Corinna Vinschen 043bc3e1ee * shared.cc (__sec_user): Split into sec_acl() and call orig_sid().
(sec_acl): Create from part of __sec_user(), except creator/owner.
	* security.h: Define sec_acl() and MAX_DACL_LEN.
2002-05-13 12:10:49 +00:00
Christopher Faylor c8b20196dd * fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using O_DIROPEN when
OS doesn't support it.  Return proper errno in that case.
2002-05-12 19:20:01 +00:00
Christopher Faylor 56caca1d16 fix entry 2002-05-12 04:55:10 +00:00
Christopher Faylor b4f8d31f3b * syscalls.cc (_read): Change error to EBADF if attempt to write to a
non-writable fd.
2002-05-12 04:43:29 +00:00
Christopher Faylor 29ee580d07 * fhandler.h (executable_states): For now, make dont_care_if_executable
equivalent to not_executable.
* sys/mount.h: Define MOUNT_NOTEXEC.
* path.h (fs_info): New class.
(path_conv): Move fs-specific fields to new 'fs' structure.
(path_conv::update_fs_info): Move to fs_info and rename to just 'update'.
* path.cc (fs_info::update): Ditto.  Return 'true' if successful.
(fillout_mntent): Add ',noexec' to list of reported options.
2002-05-12 03:08:59 +00:00
Christopher Faylor b84621d2e3 * fhandler_virtual.cc (fhandler_virtual::close): Quiet a compiler warning. 2002-05-12 01:59:53 +00:00
Christopher Faylor 6566d27da4 fix formatting 2002-05-12 01:50:38 +00:00
Christopher Faylor 0371d66a64 fix comment 2002-05-12 01:41:17 +00:00
Christopher Faylor 9ba913a56d * autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and
'ZwQueryVirtualMemory'.
* fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual
from int to size_t.  Change type of position member from __off32_t to
__off64_t.  Add new fileid member to fhandler_virtual class.  Make seekdir take
an __off64_t argument.  Make lseek take an __off64_t argument.  Add
fill_filebuf method to fhandler_virtual.  Add fill_filebuf method to
fhandler_proc.  Add fill_filebuf method to fhandler_registry.  Add fill_filebuf
method to fhandler_process.  Add saved_pid and saved_p members to
fhandler_process.
* fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'.
(proc_fhandlers array): Ditto.
(fhandler_proc::open): Use fill_filebuf to flesh out the file contents.
(fhandler_proc::fill_filebuf): New method.
(fhandler_proc::format_proc_meminfo): Ditto.
(fhandler_proc::format_proc_stat): Ditto.
(fhandler_proc::format_proc_uptime): Ditto.
* fhandler_process.cc (process_listing): Add 'stat' and 'statm'.
(fhandler_process::fstat): Find the _pinfo structure for the process named in
the filename.  Return ENOENT if the process is no longer around.  Set the gid
and uid fields of the stat structure.
(fhandler_process::open): Store pid and pointer to _pinfo structure in
saved_pid and saved_p respectively.  Use fill_filebuf to flesh out file
contents.
(fhandler_proc::fill_filebuf): New method.
(format_process_stat): New function.
(format_process_status): Ditto.
(format_process_statm): Ditto.
(get_process_state): Ditto.
(get_mem_values): Ditto.
* fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from
__off32_t to __off64_t.
(fhandler_registry::fill_filebuf): New method.
* fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from
__off32_t to __off64_t.
(fhandler_virtual::lseek): Ditto.
(fhandler_virtual::fill_filebuf): New method.
(fhandler_virtual::fhandler_virtual): Initialise fileid to -1.
* wincap.cc: Set flag has_process_io_counters appropriately.
* wincap.h: Add flag has_process_io_counters.
2002-05-12 01:37:48 +00:00
Christopher Faylor f561f644e9 * syscalls.cc (_write): Change error to EBADF if attempt to write to a
non-writable fd.
2002-05-09 22:55:08 +00:00
Corinna Vinschen 6327de5fef * cygheap.h (class cygheap_user): Add member `orig_psid'.
Add method `orig_sid()'.
	* cygheap.cc (cygheap_user::set_sid): Maintain orig_psid.
2002-05-08 14:21:08 +00:00
Corinna Vinschen 795b46cf8f * localtime.cc (tzsetwall): Use wildabbr if generated timezone name
length < 3.
2002-05-07 13:18:44 +00:00
Corinna Vinschen a991777994 * spawn.cc (spawn_guts): Move call to set_process_privilege()
to load_registry_hive().
	* registry.cc (load_registry_hive): ditto.
	* fork.cc (fork_parent): Call sec_user_nih() only once.
2002-05-06 10:05:46 +00:00
Christopher Faylor 13ee3618d0 * path.h (path_conv::path_conv): Initialise normalized_path to NULL. 2002-05-04 18:27:27 +00:00
Christopher Faylor 58e74c7e7f . 2002-05-04 04:30:57 +00:00
Christopher Faylor 8761c1dcf7 * net.cc (getdomainname): Change second argument of getdomainname to size_t.
* fhandler_proc.cc (proc_listing): Add '.' and '..' to directory listing.
(fhandler_proc::open): Change use of mode to flags.  If the file does not exist
already, fail with EROFS if O_CREAT flag is set.  Change EROFS error to EACCES
error when writing to a file.  Use cmalloc to allocate memory for filebuf.
(fhandler_proc::close): Use cfree to free filebuf.
(fhandler_proc::get_proc_fhandler): Properly detect attempts to access unknown
subdir.
* fhandler_process.cc (process_listing): Add '.' and '..' to directory listing.
(fhandler_process::open): Use cmalloc to allocate memory for filebuf.
(fhandler_process::close): Use cfree to free filebuf.
* fhandler_registry.cc (registry_listing): Add .  and '..' to directory
listing.
(fhandler_registry::open): Move check for open for writing before open_key.
Use cmalloc to allocate memory for filebuf.
(fhandler_registry::close): Use cfree to free filebuf.
(fhandler_registry::telldir): Use lower 16 bits of __d_position as position in
directory.
(fhandler_registry::seekdir): Ditto.
* fhandler_virtual.cc (fhandler_virtual::write): Change EROFS error to EACCES
error.
(fhandler_virtual::open): Set the NOHANDLE flag.
(fhandler_virtual::dup): Add call to fhandler_base::dup.  Allocate child's
filebuf using cmalloc.  Copy filebuf from parent to child.
(fhandler_virtual::close): Use cfree to free filebuf.
(fhandler_virtual::~fhandler_virtual): Ditto.
(from Chris Faylor <cgf@redhat.com>).
(fhandler_registry::readdir): Add support for '.' and '..' files in
subdirectories of /proc/registry.
* path.cc (path_conv::check): Do not return ENOENT if a file is not found in
/proc.
2002-05-04 03:24:35 +00:00
Christopher Faylor 335c87f94d * fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather than
path_conv name.
(fhandler_proc::open): Ditto.
* fhandler_process.cc (fhandler_process::fstat): Use fhandler name rather than
path_conv name.
(fhandler_process::open): Ditto.
* fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name rather
than path_conv name.
(fhandler_registry::open): Ditto.
* path.cc (path_conv::check): Don't copy posix path when virtual.
(mount_info::conv_to_win32_path): Don't zero string when isproc.  Just derive
normal windows path.
* path.h (path_conv::clear_normalized_path): Declare new method.
* path.cc (path_conv::clear_normalized_path): Define new method.
* dtable.cc (build_fhandler_from_name): Clear normalized path when finished to
conserve space.
2002-05-03 02:43:45 +00:00
Christopher Faylor 3bb7eb449c * fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
fhandler_base::fstat.  Use defines rather than constants for permission
settings.
2002-05-02 23:58:20 +00:00
Corinna Vinschen d055ecb08f * path.cc (hash_path_name): Improve hash function strength. 2002-05-02 16:46:12 +00:00
Robert Collins 6396bad848 missed a conflict indicator 2002-05-02 11:27:15 +00:00
Robert Collins 37143995da 2002-05-02 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
        thread woken by the same condition variable it's signalling on. Thanks
        to Michael Beach for the report and test case.
2002-05-02 11:26:22 +00:00
Christopher Faylor c477dccfa8 add new files 2002-05-02 04:26:05 +00:00
Christopher Faylor 7a90892d0c add comment 2002-05-02 04:14:40 +00:00
Christopher Faylor 291be3076b * path.h (pathconv_arg): Add PC_POSIX.
(path_conv): Add normalized_path field.
* path.cc (path_conv::~path_conv): New destructor.
(path_conv::check): Set normalized_path, where appropriate.
* dtable.cc (build_fhandler_from_name): Use normalized path from path_conv.
* syscalls.cc (chroot): Ditto.
* cygheap.h: Remove path_prefix_p declaration.  Christopher Faylor
<cgf@redhat.com> (minor fixups)
* Makefile.in: Add fhandler_proc.o, fhandler_registry.o, fhandler_process.o and
fhandler_virtual.o.
* dtable.cc (dtable::build_fhandler): Add entries for FH_PROC, FH_REGISTRY and
FH_PROCESS.  Set unix_name to the normalized posix path.
* fhandler.h: Add constants for FH_PROC, FH_REGISTRY and FH_PROCESS.  Add class
declarations for fhandler_virtual, fhandler_proc, fhandler_registry and
fhandler_virtual.  Update fhandler_union accordingly.
* fhandler_proc.cc: New file.  Add implementation for fhandler_proc.
* fhandler_virtual.cc: New file.  Add implementation for fhandler_virtual.
* fhandler_process.cc: New file.  Add implementation for fhandler_process.
* fhandler_registry.cc: New file.  Add implementation for fhandler_registry.
* path.cc: Add isproc and isvirtual_dev macros.
* path.cc (path_conv::check): Add check for virtual devices.
* path.cc (mount_info::conv_to_win32_path): Convert paths in /proc to empty
Win32 paths.
* path.cc (chdir): Replace check for FH_CYGDRIVE with more generic
isvirtual_dev macro.  Force setting of posix path for virtual fhandlers.
* path.h: Add externally visible path_prefix_p and normalized_posix_path
prototypes.
2002-05-02 04:13:48 +00:00
Christopher Faylor fee93846d6 * include/cygwin/types.h: Include <sys/sysmacros.h>. 2002-05-01 20:26:33 +00:00
Christopher Faylor 27dcb52a29 revert patch 2002-04-19 14:42:20 +00:00
Robert Collins 4ce4e69db6 2002-04-16 Thomas Pfaff <tpfaff@gmx.net>
* dll_init.h (per_process::dtors_run): New member.
        * dll_init.cc (per_module::run_dtors): Run dtors only once.
        (dll::init): Initialize dtors_run flag.
2002-04-19 12:46:19 +00:00
Corinna Vinschen 9b15f5fa95 * security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
the NT Domain case.
2002-04-18 09:11:54 +00:00
Christopher Faylor 32eec3ec1c remove obsolete comment. 2002-04-15 19:23:27 +00:00
Corinna Vinschen 4deace13e4 * net.cc (cygwin_accept): Set socket type for accepted socket.
(socketpair): Set socket type for both sockets.

	From Egor Duda <deo@logos-m.ru>:

	* fhandler.h (class fhandler_socket): New member to store socket type.
	(fhandler_socket::get_socket_type): Access it.
	(fhandler_socket::set_socket_type): Ditto.
	* net.cc (cygwin_socket): Store socket type.
	(cygwin_connect): Disable security checks for connectionless sockets.
	(cygwin_accept): Ditto.
2002-04-12 14:52:36 +00:00
Christopher Faylor dbe67a8103 * cygwin.din: Add strptime.
* include/cygwin/version.h: Increment API version number.
2002-04-09 23:47:26 +00:00
Corinna Vinschen 464b3e8039 * fork.cc (fork_child): Call fixup_mmaps_after_fork() somewhat earlier. 2002-04-09 16:33:13 +00:00
Corinna Vinschen d78bda7b75 * fhandler.cc (fhandler_base::open): Set read-only bit in
file_attributes when adequate.
2002-04-09 13:01:00 +00:00
Christopher Faylor 932e88a3bc new description for old api. 2002-04-04 05:28:49 +00:00
Christopher Faylor 8996623b78 * times.cc (gettimeofday): Fix typo in previous patch. 2002-03-28 05:20:53 +00:00
Christopher Faylor 7d7524e57d * times.cc (gettimeofday): Revert to setting timezone info if tz != NULL. 2002-03-28 04:56:06 +00:00
Christopher Faylor 2f3126f6ec * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set
st_[ug]id to value derived from get_file_attributes.
2002-03-22 04:27:52 +00:00
Christopher Faylor 45d2ea8a52 * spawn.cc (find_exec): Return input if file not found. 2002-03-22 03:24:30 +00:00
Christopher Faylor e7ac2b2299 add eol to end 2002-03-21 05:52:21 +00:00
Corinna Vinschen 99dbafacb6 * poll.cc (poll): Add support for invalid descriptors. 2002-03-19 17:12:49 +00:00
Robert Collins b035997120 2002-03-15 Robert Collins <rbtcollins@hotmail.com>
* fhandler.h (fhandler_termios::lseek): Override lseek.
        * fhandler_termios.cc (fhandler_termios::lseek): Implement this.
2002-03-19 04:39:01 +00:00
Christopher Faylor 59a2339f27 * cygserver.cc: Include stdlib.h for exit declaration.
* threaded_queue.cc: Ditto.
2002-03-15 21:52:05 +00:00
Christopher Faylor ca17537785 * pinfo.cc (pinfo::init): Use PID_ALLPIDS flag to control when a redirected
block should be marked as nonexistent.
(winpids::add): Use PID_ALLPIDS when looking for all pids.
* cygwin.h (PID_ALLPIDS): New enum element.
2002-03-15 21:49:12 +00:00
Corinna Vinschen 2f26318784 * glob.c (stat32_to_STAT): New function.
(g_lstat): Call user space functions always with 32 bit struct stat
	as a workaround.
	(g_stat): Ditto.
	* include/glob.h (struct glob): Don't prototype function pointers
	when compiling Cygwin.
2002-03-15 10:12:31 +00:00
Christopher Faylor 4af6d4a9ab * pinfo.cc (pinfo::init): Properly handle execed process stub when PID_NOREDIR
is specified.
2002-03-14 23:14:19 +00:00
Christopher Faylor e10c087bd6 Fix ChangeLog 2002-03-14 15:34:32 +00:00
Corinna Vinschen 6ea9c71656 * poll.cc: Remove variable open_fds, rearrange and add code
to fix settings of revents.
2002-03-14 12:15:31 +00:00
Corinna Vinschen bbe0913914 * mmap.cc (mmap_record::map_map): Return -1 if VirtualProtect fails.
(list::erase): New method with no argument.  Erase latest record
	added.
	(mmap64): Fail if map_map() fails.
2002-03-13 20:54:57 +00:00
Christopher Faylor 73ea29f42c whitespace cleanup, update copyright 2002-03-13 02:34:05 +00:00
Corinna Vinschen cb4589f49d * sysconf.cc (sysconf): Fix condition. 2002-03-12 08:57:22 +00:00
Christopher Faylor 1f77d71b4c remove erroneous part of comment 2002-03-12 03:36:01 +00:00
Corinna Vinschen 2817e0dc89 * mmap.cc (msync): Check area given by addr and len for being a
contigeous mmap'd region.
2002-03-11 20:23:09 +00:00
Corinna Vinschen 713fb38b7c * fork.cc (fork_child): Call fixup_mmaps_after_fork() before
closing parent process handle.  Call fixup_mmaps_after_fork()
	with parent process handle as parameter.
	* mmap.cc (mmap_record::access): New method.
	(fixup_mmaps_after_fork): Take process handle as parameter.
	In case of FILE_MAP_COPY access, copy valid memory regions to child.
	* pinfo.h (fixup_mmaps_after_fork): Change prototype accordingly.
2002-03-11 17:57:22 +00:00
Corinna Vinschen c8c3824dc8 * autoload.cc (NetGetDCName): Add symbol.
(NetServerEnum): Remove symbol.
	* security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of
	NetServerEnum() since it's faster.  Don't call it at all if machine
	is not a domain member.
2002-03-07 14:32:53 +00:00
Christopher Faylor 9420d2b833 * path.cc (normalize_posix_path): Avoid runs of '.'s > 2. 2002-03-07 01:31:08 +00:00
Christopher Faylor 07a21bce5b * errno.cc: Change EPERM associated text to "Operation not permitted"
throughout.
2002-03-05 18:11:20 +00:00
Christopher Faylor 1d25d6f87e Update copyright. 2002-03-05 18:03:32 +00:00
Christopher Faylor eeac69d835 * fhandler_socket.cc (fhandler_socket::close): Respond to signals while
looping, waiting for socket to close.  Superstitiously clear last error when
WSAEWOULDBLOCK.
2002-03-05 18:02:53 +00:00
Robert Collins 241a7c5a8c 2002-03-05 Robert Collins <rbtcollins@hotmail.com>
* cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
        Always init - until static members work correctly.
        * shm.cc (shmget): Initialize the security descriptor - thanks Corinna!
        * include/sys/ipc.h: Make the ipc control constants partitioned off from the sem
        control constants.
2002-03-05 12:58:24 +00:00
Corinna Vinschen ad2864f4c8 * include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro.
* fhandler_termios.cc: Include <sys/termios.h>.
	(line_edit): Recognize disabled c_cc[] chars.  Ignore VDISCARD when
	not in ICANON mode.
2002-03-05 08:15:28 +00:00
Christopher Faylor 96ef4a6d4d bump copyright 2002-03-05 02:23:39 +00:00
Corinna Vinschen 59149930a3 * syscalls.cc (truncate64): Use ftruncate64 directly to not lose
upper 32 bits.
2002-03-04 16:47:41 +00:00
Robert Collins 7c3617cc0a 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc (delete_shmnode): New function.
        (client_request_shm::serve): Use it.
2002-03-04 08:45:40 +00:00
Robert Collins 038c71f10c 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc (client_request_shm::serve): Implement SHM_DETACH.
        * shm.cc (shmdt): Implement.
2002-03-04 08:12:53 +00:00
Robert Collins 67be0adb71 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc: Run indent.
        (deleted_head): New global for storing shm id's pending deletion.
        (client_request_shm::serve): Return ENOSYS for invalid request types.
        Implement SHM_DEL - delete a shm id.
        * cygserver_shm.h (SHM_DEL): New type value.
        * shm.cc (delete_inprocess_shmds): New function, does what it's name implies.
        (shmctl): Implement shm_rmid control type.
2002-03-04 07:22:08 +00:00
Robert Collins 74c3173ade 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in (install): Remove install-bin to allow make install to work.
2002-03-03 21:46:38 +00:00
Robert Collins 009314a45d 2002-03-03 Robert Collins <rbtcollins@hotmail.com>
* shm.cc (shmat): Prevent a compile error.
        (shmdt): Set errno as this function is incomplete.
2002-03-03 12:52:59 +00:00
Christopher Faylor e77292877c * times.cc: Remove if 0'd code. Clean up slightly. 2002-02-28 19:36:11 +00:00
Christopher Faylor 7a43dbe39b * times.cc: Remove if 0'd code. Clean up slightly. 2002-02-28 19:06:42 +00:00
Robert Collins f449bfef40 2002-02-28 Robert Collins <rbtcollins@hotmail.com>
* Merged cygwin_daemon into head minus the new shm and ipc exports.

2002-02-28  Robert Collins  <rbtcollins@hotmail.com>

	* fhandler_tty.cc (fhandler_tty_slave::open): More debugging.
	(fhandler_tty_slave::read): Fix printf type for the handle.
	* tty.cc (tty::common_init): Add a FIXME for security.

2002-01-29  Robert Collins  <rbtcollins@hotmail.com>

	* Makefile.in (OBJS): Remove duplicate localtime.o.

2002-01-17  Robert Collins  <rbtcollins@hotmail.com>

	* cygserver.cc (check_and_dup_handle): Consolidate the two variants for
	simplicity.
	Add Some basic debug output.
	(client_request_attach_tty::serve): Use the new debug_printf for clarity.
	Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen
	tty's.

2002-01-16  Robert Collins  <rbtcollins@hotmail.com>

	* cygserver.cc (transport): Correct scope.
	(client_request_attach_tty::serve): Add more debug information.
	Fix erroneous use of transport instead of conn.
	* cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug.
	(transport_layer_pipes::read): Ditto.
	(transport_layer_pipes::write): Ditto.
	(transport_layer_pipes::impersonate_client): Ditto.

Mon Oct  8  7:41:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* cygserver.cc (server_request::process): Rename client_request_shm_get to
	client_request_shm.
	* cygserver_process.cc (process_cache::add): Rename to add_task.
	Use process_cleanup instead of process_request.
	(process_cache::remove_process): New method.
	(process::process): Initialize new members.
	(process::~process): New member.
	(process::cleanup): New method.
	(process::add_cleanup_routine): New method.
	(process_request::process): Rename to process_cleanup.
	Call the process object's cleanup method and then delete it.
	(process_process_param::request_loop): Remove the signalling process.
	* cygserver_shm.cc: Globally rename client_request_shm_get to client_request_shm.
	(client_request_shm_get::serve): Handle attach request counting.
	* cygserver_shm.h: Globally rename client_request_shm_get to client_request_shm.
	(class shm_cleanup): New class.
	* shm.cc: Globally rename client_request_shm_get to client_request_shm.
	(client_request_shm::client_request_shm): New constructor for attach requests.
	(shmat): Use it.
	* include/cygwin/cygserver_process.h (class process_request): Rename to
	process_cleanup.
	(class cleanup_routine): New class.
	(class process): New members and methods to allow calling back when the process
	terminates.

Thu Oct  4 14:12:00 2001  Robert Collins <rbtcollins@hotmail.com>
	* cygserver.cc (request_loop): Make static.
	(main): Use new cache constructor syntax.
	Start cache worker threads.
	Cleanup the cache at shutdown.
	* cygserver_process.cc: Run indent.
	(process_cache::process_cache): Add a trigger to use when adding a process.
	(process_cache::process): Move process_entry to process.
	Insert at the end of the list.
	Trigger the request loop when new process's inserted.
	(process_cache::process_requests): Do it.
	(process_cache::add): New method.
	(process_cache::handle_snapshot): New method.
	(process::process): Merge in the process_entry fields.
	(process::handle): Make a stub function.
	(process::exit_code): New method.
	(process_request::process): New method.
	(process_process_param::request_loop): New method.
	* cygserver_shm.cc: New header dependency - threaded_queue.h.
	* threaded_queue.cc (threaded_queue::cleanup): Clearer messages.
	(queue_process_param::stop): Short spinlock on interruptible threads.
	* threaded_queue.h (class threaded_queue): New constructor.
	* include/cygwin/cygserver_process.h (process_request): New class.
	(process_entry): Remove.
	(process): Merge in process_entry.
	(process_cache): Inherit from threaded_queue.

Tue Oct  2 23:24:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* cygserver.cc (class server_process_param): Use new constructor syntax.
	* cygserver_process.cc (process_cache::~process_cache): New function.
	* threaded_queue.cc: Define condition debug_printf.
	Run indent.
	(threaded_queue::cleanup): Move queue_process_param guts to a method.
	(threaded_queue::process_requests): Ditto.
	(queue_process_param::queue_process_param): New method.
	(queue_process_param::~queue_process_param): Ditto.
	(queue_process_param::start): Ditto.
	(queue_process_param::stop): Ditto.
	* threaded_queue.h (class queue_process_param): Add support for
	interruptible request loops.
	* cygwin/include/cygwin/cygserver_process.h (class process_cache): Add
	destructor.

Tue Oct  2 23:24:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* cygserver_client.cc: New flag allow_daemon to disable the daemon completely.
	(cygserver_request): Check it.
	(cygserver_init): Ditto.
	* environ.cc (parse_thing): Add (no)daemon option.

Tue Oct  2 23:00:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* shm.cc: Update to handle include changes from HEAD.

Tue Oct  2 16:06:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* Makefile.in: Remove cygserver_shm.o from cygwin1.dll.
	Rename cygserver_shm_outside.o to cygserver_shm.o.
	* cygserver.cc (server_request::process): Use the new client_request
	constructor.
	* cygserver_client.cc: Remove the #ifdef's stubs for the server method
	within cygwin.
	(client_request_attach_tty::client_request_attach_tty): Use the new
	client_request constructor.
	(client_request_shutdown::client_request_shutdown): Ditto.
	(client_request::client_request): Ditto.
	* cygserver_shm.cc (client_request_shm_get::serve): Remove the
	#ifdef'd stub for in-cygwin builds.
	(client_request_shm_get::client_request_shm_get): Use the new
	client_request constructor, and remove the in-cygwin variants.
	* cygserver_shm.h (class client_request_shm_get): #ifndef test the
	serve method - it's only used in cygserver.
	* shm.cc (client_request_shm_get::client_request_shm_get): New function.
	* include/cygwin/cygserver.h (request_header): New constructor.
	(class client_request): Use it.
	New constructor accepting the header size.
	#ifndef test the server method - it's only used within cygserver.
	(client_request_get_version): #ifdef test the server method.
	(client_request_shutdown): Ditto.
	(client_request_attach_tty): Ditto.

Tue Oct  2  9:57:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* Makefile.in: add threaded_queue.o to cygserver.exe.
	* cygserver.cc: Include threaded_queue.h
	(class server_request): Inherit from queue_request.
	(class server_process_param): Inherit from queue_process_param.
	(class server_request_queue): Inherit from threaded_queue.
	(request_loop): Adjust for new types.
	(server_request_queue::process_requests): Remove guts to
	threaded_queue::process_requests.
	(server_request::server_request): Adjust for new types.
	(worker_function): Delete.
	(server_request_queue::create_workers): Delete.
	(server_request_queue::cleanup): Delete.
	(server_request_queue::add): Move guts to threaded_queue::add.
	* threaded_queue.cc: New file.
	* threaded_queue.h: New file.

Mon Oct  1 12:38:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* cygserver.cc (client_request::serve): New function.
	* cygserver_process.cc: Inlude <pthread.h> for pthread_once.
	(process_cache::process_cache): Initialise a crtiical section for write access.
	(process_cache::process): Use the critical section. Also add missing entries to
	the cache.
	(do_process_init): New function to initalise class process static variables.
	(process::process): Ensure that the process access critical section is
	initialised.
	(process::handle): Close the handle of old process's when they have terminated
	and we are returning the handle for a process with the same pid.
	* cygserver_shm.cc: Run indent.
	Include cygserver_process.h to allow process cache functionality.
	(client_request_shm_get::serve): New parameter for process cache support.
	Use the process cache, not OpenProcess to get a handle to the originating process.
	Fix a handle leak with token_handle.
	* cygserver_shm.h (class client_request_shm_get): Update ::serve for process
	cache support.
	* cygserver_transport_pipes.cc: Redefine debug_printf to be conditional on DEBUG.
	* include/cygwin/cygserver.h: Do not implement client_request::serve in the
	header.
	* include/cygwin/cygserver_process.h (class process_cache): Add a write access
	critical section to prevent races when requests from a  multithreaded
	application arrive.

Sun Sep 30 23:41:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* Makefile.in: Add cygserver_process.o to cygserver.exe.
	* cygserver.cc: Include signal.h and cygwin_version.h.
	Define debug_printf as a macro.
	Define DEBUG to a value.
	(client_request_attach_tty::serve): Add beginning of process cache support.
	Change from #ifdef DEBUG to work with new DEBUG style.
	(client_request_get_version::serve): Add beginning of process cache support.
	(class server_request): New prototype for support of process cache.
	(class queue_process_param): New class to allow request loop threading.
	(class server_request_queue): Add beginning of process cache support.
	Allow request loop threading.
	(request_loop): Thread function for request loops.
	(server_request_queue::process_requests): Initiator for threaded request loops.
	(client_request_shutdown::serve): Add beginning of process cache support.
	(server_request::server_request): Ditto.
	(server_request::process): Use debug_printf. Add beginning of process cache
	support.
	(server_request_queue::cleanup): Kill off any request loop threads.
	(server_request_queue::add): Add beginning of process cache support.
	(handle_signal): Trigger a shutdown.
	(main): Print out some useful info at startup - version, date time.
	Add process cache support.
	Spawn a separate thread for the transport request loop, thus allowing concurrent
	support for multiple transports.
	* cygserver_client.cc (client_request_get_version::serve): Add process cache
	support.
	(client_request_attach_tty::serve): Add process cache support.
	(client_request_shutdown::serve): Add process cache support.
	* cygsserver_process.cc: New file with the process cache support.
	* cygserver_shm.cc: Redefine debug_printf to allow conditional output.
	* cygwin.din: Export shmdt().
	* shm.cc: Run indent.
	Update FIXME's.
	(shmdt): New function.
	* include/cygwin/cygserver.h (class client_request): Add process cache support.
	(class client_request_get_version): Ditto.
	(class client_request_shutdown): Ditto.
	(class client_request_attach_tty): Ditto.
	* include/cygwin/cygserver_process.h: New header for process cache support.

Sun Sep 30  8:52:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* include/cygwin/cygserver_transport.h: Add copyright header.
	* include/cygwin/cygserver_transport_pipes.h: Ditto.
	* include/cygwin/cygserver_transport_sockets.h: Ditto.

Sat Sep 29 20:40:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* Makefile.in: Add cygserver_transport_sockets.o to DLL_OFILES.
	Add cygserver_transport_sockets_outside.o to cygserver.exe.
	* cygserver.cc: Include new include files.
	* cygserver_client.cc: Ditto.
	* cygserver_shm.h: No need to include <sys/socket.h> now.
	* cygerver_transport.cc: Include new include files.
	(transport_layer_base::transport_layer_base): Strip back to a stub.
	(transport_layer_base::listen): Ditto.
	(transport_layer_base::accept): Ditto.
	(transport_layer_base::close): Ditto.
	(transport_layer_base::read): Ditto.
	(transport_layer_base::write): Ditto.
	(transport_layer_base::connect): Ditto.
	* cygserver_transport_pipes.cc: Include new header
	"cygwin/cygserver_transport_pipes.h".
	* cygserver_transport_sockets.cc: New file.
	* dcrt0.cc: No need to include <sys/socket.h> now.
	* fhandler_tty.cc: Ditto.
	* tty.cc: Ditto.
	* include/cygwin/cygserver_transport.h: Strip the base class to a stub.
	Remove the cygserver_transport_pipes class.
	* include/cygwin/cygserver_transport_pipes.h: New file.
	* include/cygwin/cygserver_transport_sockets.h: New file.

Tue Sep 25 16:22:00 2001  Robert Collins <rbtcollins@hotmail.com>

	* autoload.cc: Add dynamic load statement for 'ImpersonateNamedPipeClient'.
	* Makefile.in: Add new object files, and build instructions for cygserver.exe.
	* cygwin.din: Export ftok, shmat, shmctl and shmget.
	* dcrt0.cc: Additional includes for cygserver support.
	(dll_crt0_1): Initialise the cygserver client.
	* fhandler.h (fhandler_tty): New method cygserver_attach_tty.
	* fhandler_tty.cc: Additional includes for cygserver support.
	(fhandler_tty_slave::open): Attempt to use the cygserver when obtaining
	handles from the parent process. On failure or 9x use the current method.
	(fhandler_tty_slave::cygserver_attach_tty): New function.
	* fork.cc (fork_child): Fixup shm memory mapped areas.
	* pinfo.h: Declare fixup_shms_after_fork().
	* security.h: Declare alloc_sd().
	* tty.cc: Additonal includes to support cygserver.
	(tty::common_init): Don't allow others to open us if the cygserver is running.
	* winsup.h: Declare cygserver_running.
	* cygserver.cc: New file.
	* cygserver_client.cc: New file.
	* cygserver_shm.cc: New file.
	* cygserver_shm.h: New file.
	* cygserver_transport.cc: New file.
	* cygserver_transport_pipes.cc: New file.
	* ipc.cc: New file.
	* shm.cc: New file.
	* include/cygwin/cygserver.h: New file.
	* include/cygwin/cygserver_transport.h: New file.
	* include/sys/ipc.h: New file.
	* include/sys/shm.h: New file.

2002-02-28  Robert Collins  <rbtcollins@hotmail.com>

	* thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
	(__sem_wait): Ditto.
	(__sem_trywait): Ditto.
2002-02-28 14:30:38 +00:00
Robert Collins 062401c9b4 2002-02-28 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
        (__sem_wait): Ditto.
        (__sem_trywait): Ditto.
2002-02-28 13:50:41 +00:00
Christopher Faylor d1f50ae546 * include/cygwin/version.h: Bump DLL minor number. 2002-02-27 23:06:55 +00:00
Corinna Vinschen acb5617538 * cygwin.din (fstat64): New symbol.
(ftruncate64): Ditto.
	(lseek64): Ditto.
	(lstat64): Ditto.
	(mmap64): Ditto.
	(seekdir64): Ditto.
	(stat64): Ditto.
	(telldir64): Ditto.
	(truncate64): Ditto.
	* dir.cc (telldir64): New function.
	(telldir): Call telldir64().
	(seekdir64): New function.
	(seekdir): Call seekdir64().
	* fhandler.h: Redefine all methods using __off32_t to use __off64_t.
	* fhandler.cc: Use __off64_t and struct __stat64 throughout.
	* fhandler_clipboard.cc: Ditto.
	* fhandler_disk_file.cc: Ditto.
	* fhandler_dsp.cc: Ditto.
	* fhandler_floppy.cc: Ditto.
	* fhandler_mem.cc: Ditto.
	* fhandler_random.cc: Ditto.
	* fhandler_socket.cc: Ditto.
	* fhandler_tape.cc: Ditto.
	* fhandler_zero.cc: Ditto.
	* pipe.cc: Ditto.
	* glob.c: Ditto, call lstat64 and stat64 in Cygwin.
	* mmap.cc: Use __off64_t throughout.
	(mmap64): New function.
	* sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
	* syscalls.cc (lseek64): New function.
	(stat64_to_stat32): Ditto.
	(fstat64): Ditto.
	(stat64): Ditto.
	(lstat64): Ditto.
	(ftruncate64): Ditto.
	(truncate64): Ditto.
	(_fstat): Call fstat64.
	(_stat): Call stat64.
	(cygwin_lstat): Rename to avoid declaration problem.  Call lstat64.
	(stat_worker): Use struct __stat64.
	(access): Ditto.
	(ftruncate): Call ftruncate64.
	(truncate): Call truncate64.
	* wincap.cc: Set flag has_64bit_file_access appropriately.
	* wincap.h: Add flag has_64bit_file_access.
	* winsup.h (ILLEGAL_SEEK): Define as __off64_t.
	(stat_dev): Declare using struct __stat64.
	(stat_worker): Ditto.
	* include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
	(struct __stat64): Ditto.
	(struct stat): Revert definition with explicitly sized datatypes.
	Eliminate sized field names.
	* include/cygwin/types.h (blksize_t): New type.
	(__blkcnt32_t): Ditto.
	(__blkcnt64_t): Ditto.
	(blkcnt_t): Ditto.
2002-02-25 17:47:51 +00:00
Christopher Faylor 083abe5428 * sync.h (new_muto): Just accept an argument which denotes the name of the
muto.  Use this argument to construct static storage.
* cygheap.cc (cygheap_init): Reflect above change.
* exceptions.cc (events_init): Ditto.
* malloc.cc (malloc_init): Ditto.
* path.cc (cwdstuff::init): Ditto.
* cygheap.h (cwdstuff): Change name of lock element to make it less generic.
* path.cc (cwdstuff::get_hash): Ditto.
(cwdstuff::get_initial): Ditto.
(cwdstuff::set): Ditto.
(cwdstuff::get): Ditto.
* sigproc.cc (proc_subproc): Ditto.
* debug.cc (lock_debug): Change to method.  Use method rather than macro
throughout.
* tty.h (tty_min::kill_pgrp): Declare new method.
* fhandler_termios.cc (tty_min::kill_pgrp): New method.
(fhandler_termios::line_edit): Use new method for killing process.
* dcrt0.cc (do_exit): Ditto.
* dtable.cc (dtable::get_debugger_info): New method for inheriting dtable info
from a debugger.
* tty.cc (tty_init): Attempt to grab file handle info from parent debugger, if
appropriate.  # dtable.cc (dtable::stdio_init): Make this a method.
(dtable::init_std_file_from_handle): Don't set fd unless it's not open.
(dtable::build_fhandler_from_name): Move name setting to
dtable::build_fhandler.
(dtable::build_fhandler): Add win32 name parameter.
* dcrt0.cc (dll_crt0_1): Change to use dtable stdio_init.
* dtable.h (dtable): Reflect build_fhandler parameter change.
* mmap.cc (mmap_record::alloc_fh): Don't set name parameter in build_fhandler.
* net.cc (fdsock): Remove set_name call since it is now handled by
build_fhandler.
* sigproc.cc (proc_subproc): Release muto as early as possible.
2002-02-22 19:33:41 +00:00
Corinna Vinschen a6790c5f11 * smallprint.c (rn): Allow long long values.
(__small_vsprintf): Add 'D', 'U' and 'X' formats for long long
	parameters.
2002-02-22 18:22:24 +00:00
Christopher Faylor aa6df8d7d4 * fhandler.cc (fhandler_base::puts_readahead): Remove default parameter
setting.  Newer gcc's complain about this.
(fhandler_base::set_readahead_valid): Ditto.
* fhandler_dsp.cc (Audio::open): Ditto.
(fhandler_dev_dsp::open): Ditto.
2002-02-19 22:06:50 +00:00
Christopher Faylor cecb74ae47 * fork.cc (fork_parent): Use sec_user_nih to control process/thread
inheritance/permission.
* spawn.cc (spawn_guts): Ditto.
* security.cc (create_token): Initialize token so that it is not tested for
bogus value later.  Use sec_user to control process/thread creation.
* security.h (__sec_user): Rename declaration from sec_user.
(sec_user_nih): Declare here as inline function wrapper for __sec_user.
(sec_user): Ditto.
* sigproc.cc (czombies): Allocate a character array for zombies to avoid
constructor overhead
(extremely hackish, I know).
(cpchildren): Ditto.
(pchildren): New define.
(zombies): Ditto.
(getsem): Use sec_user_nih to control semaphore inheritance/permission.
2002-02-19 05:58:44 +00:00
Christopher Faylor 4c761646cc reformat 2002-02-17 22:00:28 +00:00
Christopher Faylor 2bd22312df * times.cc (hires::prime): Restore thread priority on failure condition.
* uinfo.cc (uinfo_init): Use more robust method for determining if process was
invoked from a non-cygwin process.
* sync.h (muto::init): Eliminate "inheritance" parameter.
(new_muto): Reflect removal of parameter.
* sync.cc (muto::init): Ditto.
* cygheap.cc (cygheap_init): Ditto.
* debug.cc (threadname_init): Ditto.
* exceptions.cc (events_init): Ditto.
* malloc.cc (malloc_init): Ditto.
* path.cc (cwdstuff::init): Ditto.
* sigproc.cc (sigproc_init): Ditto.
* grp.cc (group_lock): Use different method for locking with static member.
(read_etc_group): REALLY ensure that read lock mutex is released.
* passwd.cc (passwd_lock): Use different method for locking with static member.
(read_etc_passwd): REALLY ensure that read lock mutex is released.
* shared.cc (sec_user): Correct reversed inheritance test.
2002-02-17 04:59:55 +00:00
Christopher Faylor 9490dffa7b whitespace cleanup 2002-02-16 17:47:48 +00:00
Christopher Faylor 60b68f0d39 * hires.h (hires::usecs): Rename from utime. Accept an argument.
* strace.cc (strace::microseconds): Use hires class for calculating times.
* sync.h (new_muto): Use NO_COPY explicitly in declaration.
* times.cc (gettimeofday): Reflect change in usecs argument.
(hires::usecs): Ditto.  Changed name from utime.
* winsup.h (NO_COPY): Add nocommon attribute to force setting aside space for
variable.
* regcomp.c (REQUIRE): Add a void cast to bypass a warning.
2002-02-15 17:06:40 +00:00
Christopher Faylor dce87b21e1 * hires.h: New file.
* times.cc (gettimeofday): Use hires class for calculating current time.
(hires::prime): New method.
(hires::utime): Ditto.
2002-02-15 07:05:05 +00:00
Christopher Faylor 3d45652083 * include/sys/cygwin.h (cygwin_getinfo_types): New CW_STRACE_ACTIVE.
* external.cc (cygwin_internal): Handle CW_STRACE_ACTIVE.
2002-02-14 21:31:23 +00:00
Christopher Faylor 907dc7d0c9 * exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to asm.
* external.cc (cygwin_internal): Change CW_STRACE_ON to CW_STRACE_TOGGLE.
* strace.cc (strace::hello): Toggle strace on and off.
* sync.cc (muto::init): Renamed from constructor.
* sync.h (muto::new): Delete.
(muto::delete): Ditto.
(new_muto): Simplify.  Use muto.init for nearly everything.
* uinfo.cc (uinfo_init): Avoid closing a NULL handle.
* include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to
CW_STRACE_TOGGLE.  Delete CW_STRACE_OFF.
* include/sys/strace.h (strace): Add "inited" field.
2002-02-14 21:20:06 +00:00
Corinna Vinschen 4753a17b28 * include/cygwin/acl.h: Fix definition of aclent_t. 2002-02-12 21:21:32 +00:00
Christopher Faylor 26dd202b01 new how-to. 2002-02-11 02:25:42 +00:00
Christopher Faylor 909acaf679 * Makefile.in (DLL_OFILES): Consolidate object files. 2002-02-10 21:26:27 +00:00
Corinna Vinschen b31c68c447 * child_info.h, cygheap.h, fhandler_clipboard.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
	fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
	pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
	security.h, thread.h, uinfo.cc, include/cygwin/acl.h: Fix copyright.
2002-02-10 13:50:13 +00:00
Corinna Vinschen de4e0d3001 * (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
	fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
	fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
	pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
	security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
	Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
	off_t to __off32_t throughout.  Use INVALID_UID, INVALID_GID and
	INVALID_SEEK instead casting -1 to the appropriate type.
	* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
	* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
	types.  Don't declare acl functions when compiling Cygwin.
	* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
	correct types for internal usage.
2002-02-10 13:38:51 +00:00
Corinna Vinschen 39b553b8f0 * uinfo.cc (internal_getlogin): Try evaluating user by SID even if
ntsec is off.
	(uinfo_init): Set primary group even if ntsec is off.
2002-02-10 11:15:56 +00:00
Corinna Vinschen 52296b850c * include/cygwin/grp.h: New file.
* include/cygwin/stat.h: Ditto.
	* include/cygwin/types.h: Add definitions for __off32_t,
	__off64_t, off_t, __uid16_t, __uid32_t, uid_t, __gid16_t,
	__gid32_t and gid_t.
	* include/sys/cygwin.h: Use correct uid and gid types.
2002-02-09 20:39:55 +00:00
Corinna Vinschen ff86860ba6 * dtable.cc (dtable::dup2): Revert previous patch.
* fhandler.h: Ditto.
	(fhandler_socket::recv): Define new method.
	(fhandler_socket::send): Ditto.
	* fhandler_socket.cc (fhandler_socket::recv): New method.
	(fhandler_socket::send): Ditto.
	(fhandler_socket::read): Call fhandler_socket::recv() now.
	(fhandler_socket::write): Call fhandler_socket::send() now.
	* net.cc (class wsock_event): Move definition to wsock_event.h.
	(fdsock): Revert previous patch.
	(cygwin_recv): Move implementation to fhandler_socket::recv().
	(cygwin_send): Move implementation to fhandler_socket::send().
	* wsock_event.h: New file.
2002-02-09 10:40:48 +00:00
Corinna Vinschen d0672acc75 * net.cc (get_2k_ifconf): Create interface entries for tokenring cards. 2002-02-09 09:01:18 +00:00
Corinna Vinschen fae28904e9 * dtable.cc (dtable::dup2): Store fd for fhandler_socket.
* fhandler.h (fhandler_base::set_fd): New virtual method.
	(fhandler_base::get_fd): Ditto.
	(fhandler_socket::set_fd): Ditto.
	(fhandler_socket::get_fd): Ditto.
	* fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
	of native Winsock recv.
	(fhandler_socket::write): Call cygwin_send instead of native Winsock
	send.
	* net.cc (fdsock): Store fd in fhandler_socket.
2002-02-08 11:54:10 +00:00
Corinna Vinschen 1f64102fa6 * net.cc (cygwin_getsockname): Fix handling of NULL sun_path. 2002-02-07 15:04:32 +00:00
Christopher Faylor 8e2deb48d6 add more words 2002-01-30 02:44:21 +00:00
Corinna Vinschen 562d97451a * net.cc (getdomainname): Fix registry key for 9x systems, too. 2002-01-29 13:39:41 +00:00
Corinna Vinschen 94ee02fa05 * net.cc (getdomainname): Fix registry key for NT systems. 2002-01-29 13:23:09 +00:00
Christopher Faylor 494a66d9c5 * external.cc (cygwin_internal): Initialize various internal settings if
required to allow use of some things from user loaded DLL.
(CW_STRACE_ON): Add new feature.
(CW_CYGWIN_PID_TO_WINPID): Ditto.
* pinfo.cc (set_myself): Call "strace.hello" to initiate possible strace
session.
(pinfo::init): Guard against dereferencing uninitialized myself.
* sigproc.cc (wait_sig): Call strace.hello() when __SIGTRACE "signal" received.
* strace.cc (strace::hello): New method.
* wincap.cc (wincapc::init): Avoid initializing if already initialized.
* wincap.h (wincapc::wincapc): New method.
* include/sys/cygwin.h: Add new CW_ enums.  Kludge typedefs of {g,u}id_t if
required.
* strace.h (strace::hello): Declare new method.
2002-01-29 02:02:03 +00:00
Christopher Faylor 6616e6cf76 * include/sys/strace.h (_STRACE_ON): Define.
(_STRACE_OFF): Ditto.
2002-01-28 18:03:40 +00:00
Christopher Faylor dfb4c34707 * speclib: Ensure that temporary def file is removed. 2002-01-24 21:39:09 +00:00
Christopher Faylor 3c07fbebf8 * speclib: Use rm -f to remove temp file just to quiet any potential warnings. 2002-01-23 18:46:19 +00:00
Corinna Vinschen be6d8567eb Supplement ChangeLog entry. 2002-01-23 18:37:58 +00:00
Corinna Vinschen f6fc31e1a9 * security.cc (create_token): Use sec_user() to create
SECURITY_ATTRIBUTES structure for primary token.
2002-01-23 18:35:03 +00:00
Corinna Vinschen adbd01afe4 * path.cc (symlink): Fix check for already existing file. 2002-01-23 16:50:17 +00:00
Christopher Faylor aed69a5b0d * cygmagic: Suppress error output when figuring out if sum takes an option. 2002-01-22 03:48:16 +00:00
Christopher Faylor f3647dd7e6 * cygmagic: Attempt to figure out if sum takes an option. 2002-01-22 03:02:00 +00:00
Christopher Faylor 51076b7360 * Makefile.in (libpthread.a): Pass the assembler also.
(libm.a): Ditto.
(libc.a): Ditto.
* speclib: Specify the assembler to dlltool.
2002-01-22 01:40:11 +00:00
Christopher Faylor 0ac2abea6c * include/cygwin/version.h: Bump DLL minor number. 2002-01-21 20:55:59 +00:00
Corinna Vinschen 28982aa871 Fix ChangeLog entry. 2002-01-21 20:52:33 +00:00
Corinna Vinschen ac11ec8845 * grp.cc (getgrent): Don't return default gid entry when ntsec is on.
* syscalls.cc (setegid): Don't set primary group in process token.
2002-01-21 20:51:30 +00:00
Christopher Faylor 1c6577408e Add newline at EOF. 2002-01-21 17:47:53 +00:00
Christopher Faylor 8ef47135dd * speclib: Don't use /dev/null as DLL name. Just default to what's already in
.def file.
* exceptions.cc (sig_handle): Remove last vestiges of SA_NOCLDSTOP code which
caused SIGCHLD to be ignored.
2002-01-21 17:42:08 +00:00
Christopher Faylor 07cc1f1fd8 * include/cygwin/version.h: Bump DLL minor number. 2002-01-21 03:36:16 +00:00
Christopher Faylor 385437d4c5 * syscalls.cc (regfree): Make dll_export. 2002-01-21 03:15:24 +00:00
Christopher Faylor d7c16d8da3 * exceptions.cc (ctrl_c_handler): Convert windows pid to cygwin pid when
detecting if we should actually handle CTRL-C.
2002-01-20 23:13:03 +00:00
Christopher Faylor 216109a824 * Makefile.in (new-cygwin1.dll): Revert previous change. libsupc++.a is only
available in libstdc++-v3.
2002-01-20 03:39:36 +00:00
Christopher Faylor 9e73b3397b * exceptions.cc (sig_handle_tty_stop): Don't send SIGCHLD if parent doesn't
want it.
(sig_handle): Don't check for SA_NOCLDSTOP here.  We don't have enough
information.
2002-01-19 23:57:45 +00:00
Christopher Faylor 5946622e72 * include/cygwin/version.h: Bump DLL minor number. 2002-01-19 23:06:28 +00:00
Christopher Faylor 994fe87b6e * Makefile.in (new-cygwin1.dll): Just use -lsupc++ for link.
* sigproc.cc (proc_exists): Change existence criteria.
* sync.h (new_muto): Add volatile to definition to avoid gcc optimization
problems.
2002-01-19 18:15:23 +00:00
Corinna Vinschen df3af7731e * include/cygwin/version.h: Bump API minor version to 51. 2002-01-19 16:17:59 +00:00
Corinna Vinschen 7d6be0d616 * cygwin.din: Add recvmsg and sendmsg.
* net.cc: Add cygwin_recvmsg and cygwin_sendmsg.
        * /usr/include/sys/socket.h: Add recvmsg and sendmsg.
2002-01-19 16:11:00 +00:00
Corinna Vinschen 2d3dab2ea5 * security.cc (create_token): Close processes token handle as soon
as it's not used anymore.
2002-01-19 16:06:11 +00:00
Corinna Vinschen 104c3be681 * Makefile.in: Add fnmatch.o to DLL_OFILES.
* cygwin.din: Add fnmatch export symbol.
	* fnmatch.c: New file.
	* include/fnmatch.h: Ditto.
	* include/cygwin/version.h: Bump API minor version to 50.
2002-01-17 10:39:37 +00:00
Corinna Vinschen 9a7e156253 * path.cc (fchdir): Call chdir with full windows path. 2002-01-15 20:29:09 +00:00
Corinna Vinschen 7eddac1bc5 * dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1"
for file attributes throughout.
	* fhandler.cc: Ditto.
	* fhandler_disk_file.cc: Ditto.
	* path.cc: Ditto.
	* path.h: Ditto.
	* syscalls.cc: Ditto.
	* times.cc (utimes): Use path_conv::isdir() instead of explicit
	GetFileAttributes() call.
2002-01-14 20:39:59 +00:00
Christopher Faylor 33ad2bf9d1 Add copyright stuff 2002-01-13 20:03:03 +00:00
Christopher Faylor 5daa0835e3 * dcrt0.cc (multiple_cygwin_problem): Clarify logic and make CYGWIN_MISMATCH_OK
more powerful.
2002-01-13 16:55:32 +00:00
Christopher Faylor 06486d9e55 * exceptions.cc (sig_handle): Accept a second argument indicating whether the
signal came from this process or not.
* sigproc.h: Reflect sig_handle arg change.
* signal.cc (kill_pgrp): Add sigframe info.
(abort): New function.  Eliminates newlib function of same name.
* sigproc.cc (wait_sig): Pass "signal from this process" value as arg 2.
2002-01-11 02:24:06 +00:00
Corinna Vinschen bb5225c236 * syscalls.cc (pathconf): Guard _PC_PATH_MAX branch against invalid
file parameter.
2002-01-10 13:24:28 +00:00
Christopher Faylor c0a8e8d0f9 * exceptions.cc (early_stuff_init): Rename from misnamed set_console_handler.
(ctrl_c_handler): Attempt to work around potential signal duplication during
process startup.
(sig_handle): Ignore SIGINT when we're just an "exec stub".
* spawn.cc (spawn_guts): Store pid of spawned process in global for use by
ctrl_c_handler.
* dcrt0.cc (dll_crt0_1): Call renamed initialization function.
* winsup.h: Reflect function name change.
2002-01-10 03:21:27 +00:00
Corinna Vinschen fe37dd79ec * net.cc (cygwin_accept): Set sun_path for newly connected socket. 2002-01-09 20:57:55 +00:00
Christopher Faylor cbf7a9eb4a * Makefile.in: Add uninstall target. 2002-01-08 04:51:01 +00:00
Christopher Faylor a2e12d0c37 * sigproc.cc (getsem): Clean up debugging output. 2002-01-07 22:18:36 +00:00
Christopher Faylor 4a08cbfefb * sigproc.cc (getsem): Set errno when unable to create own semaphore.
Reorganize to make clearer that error should only come from initial creation of
process semaphore.
2002-01-07 16:47:12 +00:00
Christopher Faylor 10dedaaa4c * dtable.cc (dtable::init_std_file_from_handle): Add some defensive code to
invalid handle case.
2002-01-06 17:29:41 +00:00
Corinna Vinschen d6154fb758 * ioctl.cc (ioctl): Make third argument optional.
* include/sys/ioctl.h: Ditto in declaration.
	* dtable.cc (dtable::init_std_file_from_handle): Revert previous
	bogus patch.
	* window.cc (WndProc): Raise SIGURG instead of SIGIO in case of FD_OOB
	message.
2002-01-06 09:28:13 +00:00
Christopher Faylor 9125cbd7cf * dir.cc (opendir): Guarantee release of alloced fhandler structure on error. 2002-01-06 03:32:32 +00:00
Corinna Vinschen fcb76c5dcb exceptions.cc (sig_handle): Set default action for SIGURG to SIG_IGN. 2002-01-05 22:25:34 +00:00
Corinna Vinschen 2edba2368a * dtable.cc (dtable::init_std_file_from_handle): Don't treat NULL
handle as errorneous.
2002-01-05 18:42:52 +00:00
Christopher Faylor acf05df744 * cygmagic: Change logic for equality test. 2002-01-04 23:29:58 +00:00
Christopher Faylor 7acba9716b * dir.cc (opendir): Don't attempt to call sub-opendir if ENOENT. 2002-01-04 19:06:01 +00:00
Corinna Vinschen dc63cea5ed * net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCAL
throughout.
	(socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types
	in families AF_UNIX and AF_LOCAL.  Explicitly allow PF_UNSPEC, PF_LOCAL
	and PF_INET protocols.  Return error otherwise.  Implement datagram
	socketpairs.
2002-01-04 16:56:53 +00:00
Christopher Faylor 3b789217ae * speclib: Remove temp files automatically. 2002-01-02 00:06:35 +00:00
Christopher Faylor fdd75ff3d2 restore missing entry 2002-01-01 16:49:52 +00:00
Corinna Vinschen 2fe2790925 * fhandler.h (fhandler_socket::sun_path): New private member.
(fhandler_socket::set_sun_path): New method.
	(fhandler_socket::get_sun_path): Ditto.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	sun_path to NULL.
	(fhandler_socket::~fhandler_socket): Free sun_path if needed.
	(fhandler_socket::set_sun_path): New method.
	* net.cc (cygwin_bind): Set sun_path to path of local socket file.
	(cygwin_getsockname): Add code to return correct sockaddr for unix
	domain sockets.
2002-01-01 16:25:31 +00:00
Christopher Faylor f417fcf315 Strip path when installing library. 2001-12-31 06:24:15 +00:00
Christopher Faylor 6d218bb5c6 * include/getopt.h: Fix define. 2001-12-31 04:00:07 +00:00
Christopher Faylor e56f4d7fc4 * speclib: New file.
* Makefile.in: Create library versions of automode.o, textmode.o, and binmode.o
for easier use on command line.  Create libpthread.a, libm.a, and libc.a with
subsets of exports found in libcygwin.a.
2001-12-31 03:19:29 +00:00
Christopher Faylor cdd3a8bd67 * cygmagic: Eliminate unneeded use of 'tr' and 'bc'. 2001-12-30 18:52:19 +00:00
Corinna Vinschen 5d3949b064 * security.cc (open_local_policy): Use POLICY_EXECUTE instead of
enumerating user rights.
2001-12-30 17:38:24 +00:00
Corinna Vinschen e37f6c57cd * security.cc (open_local_policy): Initialize lsa handle to NULL.
Request only needed access rights in call to LsaOpenPolicy().
	(create_token): Check for NULL lsa pointer.
2001-12-29 22:03:32 +00:00
Corinna Vinschen 971ec8d310 * cygwin.din: Add symbols for endutent(), getutent(), getutid(),
getutline(), setutent() and utmpname().
	* syscalls.cc (setutent): New function.
	(endutent): Ditto.
	(utmpname): Ditto.
	(getutent): Ditto.
	(getutid): Ditto.
	(getutline): Ditto.
	* include/cygwin/version.h: Bump API minor version.
2001-12-28 15:53:27 +00:00
Christopher Faylor aaf219f01e * cygmagic: Add define name to warning.
* dcrt0.cc (_dll_crt0): Check for changes in child_info size.
(multiple_cygwin_problem): Avoid "proc" errors when testing.  Just assume new
cygwin proc.
* shared_info.h (mount_info): Add 'cb' element for sanity checks.
(shared_info): Ditto.
* child_info.h (child_info): Add fhandler_union_size element for sanity
checking.
* shared.cc (open_shared): Detect shared region size mismatch between parent
and child.
(shared_info::initialize): Detect shared region size mismatch with expectation.
(memory_Init): Ditto.
* sigproc.cc (init_child_info): Correctly set cb in passed structure.
* shared.cc (open_shared):
2001-12-26 21:35:16 +00:00
Christopher Faylor dcd8b9be82 * include/getopt.h: Protect a declaratin. 2001-12-26 17:48:44 +00:00
Robert Collins 028ee5466b Remove accenidentally left >>> marker 2001-12-26 12:48:12 +00:00
Robert Collins cbce49804f 2001-12-26 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_cond::Signal): Use a separate flag for signal detection
        and broadcast semantics.
        (__pthread_cond_dowait): Ditto.
        * thread.h (pthread_cond): New flag for testing when a waiter has woken.
2001-12-26 12:46:26 +00:00
Christopher Faylor 7a0252e203 comment 2001-12-26 06:18:41 +00:00
Christopher Faylor a2b75539a2 * Makefile.in: Quote arguments to shell scripts.
(clean): Remove new *_magic.h autogenerated files.
2001-12-26 05:02:07 +00:00
Christopher Faylor 77f4a25028 * Makefile.in: Autogenerate some header files which provide magic numbers.
Force dependencies for files which depend on autogenerated headers to ensure
that they are always built.
* child_info.h (child_info): Add new fields to accommodate new magic number
header stuff.
* dcrt0.cc: Rely on "child_info_magic.h" to ensure that correct child_info
magic numbers are used.
(dll_crt0_1): Temporarily remove _cygwin_testing_magic test.
(_dll_crt0): Do more testing on magic numbers from fork_info structure.  Call
"multiple_cygwin_problem" where appropriate.
(multiple_cygwin_problem): Rename from multiple_cygwin_die.  Issue a warning or
die, as appropriate based on cygwin version/magic number mismatch.
* pinfo.cc (pinfo::exit): Don't attempt to dereference `this' if it doesn't
exist.  This can happen when a fatal error occurs early in process
initialization.
* shared.cc: Rely on "shared_info_magic.h" to accommodate that new magic number
header stuff.
(shared_info::initialize): Use new magic number stuff, for shared region.
(memory_init): Ditto, for mount table.
* shared_info.h: Accomodate new magic number stuff for shared region and mount
table.
* sigproc.cc: Rely on "child_info_magic.h" to accommodate new magic number
header stuff.
(init_child_info): Initialize new fields in child_info) to accomodate magic
numbers.
* winsup.h: Rename multiple_cygwin_die to multiple_cygwin_problem.
* include/cygwin/version.h: Define macros for manipulating version magic.
* cygmagic: New shell script for generating magic numbers.
2001-12-26 04:53:34 +00:00
Christopher Faylor 4f235c9559 * include/cygwin/version.h: Bump API minor version for below changes. 2001-12-20 18:54:30 +00:00
Christopher Faylor 93034cfc7c Remove obsolete include. 2001-12-20 03:03:59 +00:00
Christopher Faylor 48beacf6e4 * Makefile.in (VPATH): Add regex directory.
(NM): new variable.
(OBSOLETE_FUNCTIONS): Ditto.
(NEW_FUNCTIONS): Ditto.
(install-headers): Install regex.h.
(install-man): New target.
(install): Use new target.
(DLL_OFILES): Add v8_reg* stuff.
(new-cygwin1.dll): Eliminate stamp-cygwin-lib creation.
(libcygwin.a): Remove obsolete functions from import lib.  Add new functions.
* configure.in: Detect 'nm' tool.
* configure: Regenerate.
* cygwin.din: Export posix_reg* functions.  Eliminate export of v8 reg*
functions.  This is now handled in object files themselves.
* regex/*: New files.
* regexp/v8_*.c: New files, renamed from non v8_ equivalents.
2001-12-20 02:55:11 +00:00
Christopher Faylor 4b31ae795b Fix up comments. 2001-12-19 20:10:03 +00:00
Corinna Vinschen 6d114a5dea * include/getopt.h: Don't define getopt_long() and friends when
included through unistd.h.
2001-12-17 21:34:59 +00:00
Christopher Faylor 513a848fe6 * dtable.cc (dtable::init_std_file_from_handle): Avoid initializing using an
invalid handle.
2001-12-17 19:55:58 +00:00
Christopher Faylor a318eb217d * include/limits.h: Define LLONG_MIN, LLONG_MAX, ULLONG_MAX. 2001-12-17 01:41:07 +00:00
Christopher Faylor 9b02812029 * include/getopt.h: Add HAVE_DECL_GETOPT to save pain elsewhere. 2001-12-11 22:22:43 +00:00
Christopher Faylor 40139114ea * fhandler.h (fhandler_serial::ev): New class member.
* fhandler_serial.cc (fhandler_serial::raw_read): Use class member for event
status.
* select.cc (peek_serial): Ditto.
2001-12-11 00:24:46 +00:00
Christopher Faylor cf77faefc8 whitespace cleanup 2001-12-10 03:35:54 +00:00
Christopher Faylor 397f94082d * path.cc (path_conv::check): Use full path name for determining attributes
when /cygdrive/x/foo.
2001-12-08 01:27:10 +00:00
Christopher Faylor a12a3466b1 * path.cc (path_conv::check): Reset FH_CYGDRIVE if iterating through path. 2001-12-07 05:03:32 +00:00
Christopher Faylor a0c1938145 * path.cc (path_conv::check): Don't complain if /dev/x/foo when x doesn't
exist.
(mount_info::conv_to_win32_path): Keep translating when a /cygdrive is found.
Don't attempt to translate to a device name when devn == FH_CYGDRIVE.
(cygwin_conv_to_win32_path): Set buffer to empty on error.
(cygwin_conv_to_full_win32_path): Ditto.
* window.cc: Include unistd.h to verify definitions.
2001-12-06 22:36:08 +00:00
Christopher Faylor 5a88f2554a * dir.cc (opendir): Detect error return from build_fhandler_from_name. 2001-12-05 23:05:15 +00:00
Christopher Faylor d653df0d95 Add missing ChangeLog entries. 2001-12-05 04:48:15 +00:00
Christopher Faylor 958348a4cf * net.cc (cygwin_getsockopt): Dereference optlen pointer when passing to
__check_null_invalid_struct_errno.
2001-12-04 22:01:03 +00:00
Christopher Faylor 7543995b74 * net.cc (cygwin_getsockopt): Allow NULL optval.
* path.cc (mount_info::read_cygdrive_info_from_registry): Don't write cygdrive
to registry if it doesn't exist.
2001-12-03 20:09:33 +00:00
Christopher Faylor 2a50e3df6f * path.cc (mount_info::conv_to_win32_path): Avoid returning error if cygdrive
== '/'.
(mount_info::cygdrive_win32_path): Return 0 if invalid cygdrive path.
2001-12-03 16:47:18 +00:00
Christopher Faylor 7b80d68f4c minor reformatting. 2001-12-02 05:23:26 +00:00
Christopher Faylor 1cf0d8510a * debug.cc (makethread): Eliminate unneeded function call.
* miscfuncs.cc (tls_ix): Predefine.
* perthread.h (set_reent): Eliminate.
(get_reent): Ditto.
* winbase.h (my_tlsalloc): Use global stack base pointer.  Set newly allocated
location to NULL.
(my_tlssetvalue): Use global stack base pointer.
(my_tlsgetvalue): Ditto.
2001-11-30 06:19:58 +00:00
Christopher Faylor 558f1fb418 * winsup.h: Reorganize to avoid use of experimental stuff.
* shortcut.cc: Move winsup.h first in include order.
2001-11-28 02:36:32 +00:00
Christopher Faylor 0caa03b00a Add attribution. 2001-11-28 01:54:05 +00:00
Christopher Faylor 4d029f3940 * cygwin.din (ualarm): New export.
* dcrt0.cc (_dll_crt0): Add experimental tls storage declaration.
(dll_crt0): Ditto.
* debug.cc (thread_stub): Ditto.
* thread.cc: Minor cleanup.
(__pthread_create): Add experimental tls storage declaration.
* miscfuncs.cc: Define tls index.
* winsup.h: Declare experimental tls storage.
* window.cc (alarm): Use old timer return from setitimer.
(ualarm): New function.
2001-11-28 00:06:35 +00:00
Christopher Faylor 505f9ba17a Revert erroneous checkin. 2001-11-26 20:21:27 +00:00
Christopher Faylor 94c0e197f0 * Makefile.in (libcygwin.a): Use ar commands to build libcygwin.a since adding
an archive doesn't work the way we want it to.
2001-11-26 20:20:42 +00:00
Corinna Vinschen c74b8922ae Add missing ChangeLog entries. 2001-11-25 09:55:15 +00:00
Christopher Faylor ded250563f * fhandler_disk_file.cc (fhandler_cygdrive::readdir): Avoid reporting
inaccessible drives.
2001-11-25 03:28:16 +00:00
Corinna Vinschen 21e379455a * net.cc (cygwin_hstrerror): Allow s == NULL.
(cygwin_rcmd): Add parameter checking.
	(cygwin_rexec): Ditto.
2001-11-24 21:52:28 +00:00
Corinna Vinschen b0fa0e6e0f * net.cc (cygwin_inet_ntoa): Add parameter checking.
(cygwin_inet_network): Return INADDR_NONE instead of 0 in case of
	EFAULT.
	(cygwin_hstrerror): Add parameter checking.
	(cygwin_rresvport): Ditto.
	(socketpair): Ditto.
	* winsup.h (check_null_str): Add extern declaration.
2001-11-24 21:10:00 +00:00
Christopher Faylor 28d3cc021d * path.cc (path_conv::check): Tighten FH_CYGDRIVE check to avoid matching
trailing component, like other devices.
2001-11-24 21:05:00 +00:00
Christopher Faylor 3409763ff3 * autoload.cc (IsDebuggerPresent): Make conditional load since it is not
available everywhere.
* path.cc (mount_info::conv_to_win32_path): Only consider /cygdrive to be
FH_CYGDRIVE, not /cygdrive/x.
2001-11-24 20:57:19 +00:00
Christopher Faylor 53a12585ac * net.cc (inet_makeaddr): Revert previous change. 2001-11-24 17:31:15 +00:00
Christopher Faylor 4e5289d848 * path.cc (chdir): Allow 'cd /cygdrive'. 2001-11-24 03:35:58 +00:00
Christopher Faylor c123b1f3a1 fix typo. 2001-11-24 03:12:41 +00:00
Christopher Faylor 5a64d86941 * dtable.cc (dtable::vfork_parent_restore): Add debugging statement.
* exceptions.cc (try_to_debug): Spin only as long as we don't have a debugger
attached.
* fhandler.h (fhandler_base::set_nohandle): New method.
(fhandler_base::get_nohandle): New method.
* fhandler.cc (fhandler_base::dup): Avoid duplicating handle if there is no
handle.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set nohandle flag on
dummy fd.
* Makefile.in: Make intermediate library for eventual inclusion in libcygwin.a
* fhandler.h (fhandler_pipe::fhandler_pipe): Remove default argument setting
since it is no longer used.
* miscfuncs.cc (check_null_str): New function.
(+check_null_str_errno): Ditto.
* net.cc: Add defensive buffer checking throughout.
(cygwin_sendto): Protect against invalid fd.
(cygwin_recvfrom): Ditto.
(cygwin_getpeername): Ditto.
(cygwin_recv): Ditto.
(cygwin_send): Ditto.
* winsup.h: Declare a new function.
* select.cc (set_bits): Fix conditional for setting fd in exceptfds.
* dtable.cc (dtable::build_fhandler): Create fhandler_pipe using correct device
type.
* path.cc (get_devn): Set correct pipe device type from device name.
2001-11-24 03:11:39 +00:00
Christopher Faylor 97a2e0756d * path.cc (conv_path_list): Fix wild indexing into path due to conflicting
methods for setting src pointer.
* dir.cc (opendir): Only pass path_conv argument to opendir, since name is
already part of the fhandler.
* dtable.cc (dtable::build_fhandler): Accomodate new FH_CYGDRIVE type.
* fhandler.cc (fhandler_base::opendir): Nuke name argument.
* fhandler.h: Add FH_CYGDRIVE to "device" enum.
(fhandler_base::opendir): Nuke name argument.
(fhandler_disk_file::opendir): Ditto.
(fhandler_disk_file::fhandler_disk_file): Declare new method which passes
devtype through.
(fhandler_cygdrive): Add elements for tracking drives.
(fhandler_cygdrive::set_drives): Declare new method.
(fhandler_cygdrive::iscygdrive_root): Declare new method.
(fhandler_cygdrive::opendir): Declare new method.
(fhandler_cygdrive::readdir): Declare new method.
(fhandler_cygdrive::telldir): Declare new method.
(fhandler_cygdrive::seekdir): Declare new method.
(fhandler_cygdrive::rewinddir): Declare new method.
(fhandler_cygdrive::closedir): Declare new method.
(fhandler_cygdrive::fstat): Declare new method.
* fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file): Define new
method which passes devtype through.
(fhandler_disk_file::open): Tweak debug output.
(fhandler_disk_file::opendir): Nuke first argument.  Use info from path_conv
and class rather than calling fstat.
(fhandler_cygdrive::set_drives): New method.
(fhandler_cygdrive::iscygdrive_root): New method.
(fhandler_cygdrive::opendir): New method.
(fhandler_cygdrive::readdir): New method.
(fhandler_cygdrive::telldir): New method.
(fhandler_cygdrive::seekdir): New method.
(fhandler_cygdrive::rewinddir): New method.
(fhandler_cygdrive::closedir): New method.
(fhandler_cygdrive::fstat): New method.
* path.cc (iscygdrive_device): Assume cygdriveness is already verified.
(path_conv::check): Treat FH_CYGDRIVE "method" as a special case, setting file
attributes as needed.
(mount_info::conv_to_win32_path): Allow stand-alone /cygdrive, meaning "the
directory which contains all of the drives on the system".
(fillout_mntent): Use cyg_tolower for conversions.
(mount_info::cygdrive_win32_path): Replace unused argument with unit number.
* shared_info.h (mount_info::cygdrive_win32_path): Reflect argument change.
2001-11-22 05:59:07 +00:00
Christopher Faylor 7903ee6955 * Makefile.in (DLL_OFILES): Add fhandler_disk_file.o.
* cygheap.h (cygheap_fdnew::operator =): New operator.
* dir.cc: Add invalid struct checking throughout.  Use methods for all
directory manipulation throughout.
* fhandler.cc: Move fhandler_disk_file stuff to own file.
(fhandler_base::opendir): New method.
(fhandler_base::readdir): New method.
(fhandler_base::telldir): New method.
(fhandler_base::seekdir): New method.
(fhandler_base::rewinddir): New method.
(fhandler_base::closedir): New method.
* fhandler_disk_file.cc: New file.
* fhandler.h (fhandler_base): Declare new virtual methods.
(fhandler_disk_file): Ditto.
(fhandler_cygdrive): New class.
* path.cc (conv_path_list): Use strccpy to break apart path.
2001-11-21 06:47:57 +00:00
Christopher Faylor 9c6a5c6ea8 * path.cc (conv_path_list): Copy source paths before modifying them. 2001-11-17 20:19:19 +00:00
Corinna Vinschen 42d292493b * fhandler_raw.cc (fhandler_dev_raw::clear): Don't reset unit.
* fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Add debug
	output.
2001-11-16 23:28:56 +00:00
Egor Duda f38ac9b70c * include/pthread.h (PTHREAD_COND_INITIALIZER): Define.
* thread.cc (__pthread_cond_destroy): Add support for
PTHREAD_COND_INITIALIZER.
(__pthread_cond_init): Ditto.
(__pthread_cond_broadcast): Ditto.
(__pthread_cond_signal): Ditto.
(__pthread_cond_dowait): Ditto.
(__pthread_mutex_init): Handle PTHREAD_MUTEX_INITIALIZER correctly,
don't return error when it's passed as parameter.
* winsup.h (check_null_invalid_struct): Call correct function.
2001-11-15 11:10:38 +00:00
Christopher Faylor e2b3dc2580 * exceptions.cc: Add stdlib.h include for alloca declaration.
* poll.cc: Ditto.
* termios.cc: Ditto.
* syscalls.cc (_write): Only allow zero length when fd is valid.
2001-11-15 03:25:52 +00:00
Corinna Vinschen 7158264315 * fhandler.cc (fhandler_disk_file::fstat): Add setting access time
and creation time to last modification time for files on filesystems
	not supporting multiple timestamps.
	(fhandler_disk_file::fstat_helper): Set access time and creation
	time in incoming Windows structure instead of in stat buf to avoid
	incorrectly overwriting Epoch timestamp.
2001-11-14 21:47:41 +00:00
Corinna Vinschen ac0ac6534d * winsup.h: Remove alloca definition since it's now defined through
inclusion of stdlib.h.
	* lib/cygwin_crt0.c: Ditto.
2001-11-14 10:47:54 +00:00
Christopher Faylor 65814395b6 * syscalls.cc (_write): Allow zero length as per SUSv2. 2001-11-14 04:12:11 +00:00
Corinna Vinschen 03adcc0fda * dir.cc (mkdir): Add HIDDEN file attribute if file has leading dot
and HIDDEN_DOT_FILES is defined.
	* fhandler.cc (fhandler_base::open): Ditto.
	* path.cc (symlink): Ditto.
	* syscalls.cc (_rename): Ditto and remove HIDDEN file attribute if
	new filename does not begin with a dot.
2001-11-13 21:49:06 +00:00