* fhandler_console.cc: New member variable `dwBufferSize' for `info'.
(fillin_info): Set `dwBufferSize' to the size of the console buffer.
(clear_screen): Use width of console buffer to calculate how many spaces to
clear.
* sigproc.cc (wait_sig): Remove unneeded for loop iteration.
* exceptions.cc (interrupt_setup): Don't set signal mask here or races occur
with main thread. Set it in sigdelayed instead.
(sigreturn): Reflect change in stack order of ebp and flags.
(sigdelayed): Set stack frame correctly. Call set_process_mask here with flags
for last trapped signal.
(signal_dispatch): Add newmask.
* sigproc.cc (wait_sig): Eliminate ill-considered attempt to halt looping
signal processors.
Corinna Vinschen [Wed, 15 Nov 2000 21:14:27 +0000 (21:14 +0000)]
* uinfo.cc (internal_getlogin): Change parameter list to reflect
that `token' is member of cygheap_user now.
(uinfo_init): Use modified internal_getlogin.
* syscalls.cc (seteuid): Ditto.
Throughout use myself->ppid_handle rather than parent_alive.
* child_info.h (child_info): Eliminate parent_alive.
* dcrt0.cc (dll_crt0_1): Call fork_init for debugging pid creation.
* fork.cc (fork_child): Reflect change to fixup_mmaps_after_fork arguments.
(slow_pid_reuse): New function to grab last 'n' pids to prevent pid reuse.
(fork_parent): Move last_fork_proc into slow_pid_reuse. Handle fork_pids
debugging. Eliminate unnecessary call to set_child_mmap_ptr.
(fork_init): New debugging function.
* mmap.cc (fixup_mmaps_after_fork): Renamed from recreate_mmaps_after_fork.
Rely on copied data after a fork.
(set_child_mmap_ptr): Eliminate.
* pinfo.h (_pinfo): Eliminate parent_alive, mmap_ptr and reflect above changes.
* spawn.cc (spawn_guts): Eliminate vestiges of "old way" of sending new hProc
to parent process.
Corinna Vinschen [Wed, 15 Nov 2000 00:13:09 +0000 (00:13 +0000)]
* cygheap.cc (cygheap_root::cygheap_root): New function.
(cygheap_root::~cygheap_root): Ditto.
(cygheap_root::operator=): Ditto.
(cygheap_user::~cygheap_user): Ditto.
(cygheap_user::set_name): Ditto.
(cygheap_user::set_logsrv): Ditto.
(cygheap_user::set_domain): Ditto.
(cygheap_user::set_sid): Ditto.
* cygheap.h (cygheap_root): New class.
(cygheap_user): Ditto.
(init_cygheap): Change type of `root' member to cygheap_root.
Add `user' member.
* dir.cc (opendir): Use new `cygheap_root' class.
* dcrt0.cc (dll_crt0_1): Use new `cygheap_user' class.
* fork.cc (fork_parent): Ditto.
* grp.cc (getgroups): Ditto.
* passwd.cc (search_for): Ditto.
* path.cc: Use new `cygheap_root' class throughout.
* pinfo.h (_pinfo): Remove `use_psid'. Move `username', `psid',
`logsrv', `domain', `orig_{uid,gid}' and `real_{uid,gid}' to
cygheap_user class.
* security.cc: Use new `cygheap_user' class throughout.
* shared.cc (sec_user): Ditto.
* sigproc.cc (proc_subproc): Remove copy statements for user
related information moved to `cygheap_user' class.
* spawn.cc (spawn_guts): Invalidate current chroot settings
when creating Windows environment. Use new `cygheap_user' class.
* syscalls.cc: Use new `cygheap_user' class throughout.
* uinfo.cc: Ditto.
* uinfo.cc (internal_getlogin): Change parameters to reflect the
move of user information to cygheap.
* cygheap.h (init_cygheap): New struct holding values that live in the Cygwin
heap.
* child_info.h (child_info): Change pointer type of cygheap to init_cygheap.
* cygheap.cc (init_cheap): Point cygheap_max after contents of cygheap. Move
some stuff into cygheap.h.
* dir.cc (opendir): Change to use root and rootlen in cygheap rather than in
myself.
(mkdir): Change to use umask in cygheap rather than in myself.
* path.cc: Ditto, throughout.
* syscalls.cc (_open): Ditto. Change to use umask in cygheap rather than in
myself.
(chroot): Change to allocate root dir on the cygwin heap.
(umask): Change to use umask in cygheap rather than in myself.
(cygwin_bind): Ditto.
* sigproc.cc (proc_subproc): Don't copy umask or root stuff as this happens
automatically now.
* pinfo.h (_pinfo): Migrate stuff out of here and into init_cheap.
* dcrt0.cc (dll_crt0_1): Call cygheap_init later in startup for first cygwin
process.
* dcrt0.cc: New global variable `ignore_case_with_glob'.
(dll_crt0_1): Disable case-insensitive globbing before calling `main'.
* environ.cc (glob_init): New static function to set or clear
`ignore_case_with_glob'.
(known): Changed "glob" entry to call `glob_init'.
* glob.c (match): Use case-insensitive globbing if needed.
* mount.cc (main): Call show_cygdrive_info instead of show_cygdrive_prefixes.
* mount.cc (show_cygdrive_prefixes): Remove function.
* mount.cc (show_cygdrive_info): New function. Actually, show_cygdrive_info is
really an enhanced version of show_cygdrive_prefixes renamed to
show_cygdrive_info that also displays the user and system flags.
* environ.cc (_addenv): malloc space for setenv if cygwin1.dll is used in
conjunction with older binaries.
(environ_init): Ditto.
* external.cc (get_cygdrive_info): New function.
* external.cc (get_cygdrive_prefixes): Change to use get_cygdrive_info but toss
the user and system flags.
* external.cc (cygwin_internal): Add new CW_GET_CYGDRIVE_INFO case.
* path.cc (mount_info::get_cygdrive_prefixes): Remove method.
* path.cc (mount_info::get_cygdrive_info): New method. Actually,
get_cygdrive_info is really an enhanced version of get_cygdrive_prefixes
renamed to get_cygdrive_info that also gets the user and system flags.
* shared_info.h (get_cygdrive_prefixes): Remove method.
* shared_info.h (get_cygdrive_info): New method.
* include/cygwin/version.h: Bump minor API version due to adding
CW_GET_CYGDRIVE_INFO to cygwin_internal.
* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_CYGDRIVE_INFO.
* mkgroup.c (load_netapi): New function to load netapi32.dll functions
dynamically so that mkgroup works on 9x/ME as well.
Use corresponding function pointers throughout.
(usage): Change to `int'. Change text to be conformant to mkpasswd.
(main): Use `getlongopt' to process options.
Special handling to create a group entry on 9x/ME.
* mkpasswd.c (load_netapi): New function to load netapi32.dll functions
dynamically so that mkpasswd works on 9x/ME as well.
Use corresponding function pointers throughout.
(usage): Change to `int'. Change text to be conformant to mkgroup.
(main): Use `getlongopt' to process options.
Special handling to create a passwd entry on 9x/ME.
Change conditional to create an entry for the local administrators
group when appropriate.
* dcrt0.cc (sigthread::init): Reinstitute sigthread lock as a critical section.
(dll_crt0_1): Move sigthread lock initialization to earlier in startup.
* exceptions.cc (interrupt_on_return): Remove previous kludgy attempt to detect
an invalid frame.
(call_handler): Eliminate inner for loop. Grab signal critical section lock
where appropriate.
* sigproc.cc (proc_subproc): Restore uid setting.
* sigproc.h (sigthread): Reinstitute sigthread lock as a critical section.
(sigframe): Grab the sigthread lock before clearing frame to avoid having the
signal thread use an invalid frame.
Earnie Boyd [Mon, 6 Nov 2000 16:17:16 +0000 (16:17 +0000)]
* Makefile.in: increment VERSION.
(dist:) Rename to srcdist. Create new dist target to call
srcdist and bindist targets.
(srcdist:) New target.
(clean-top:) add call to mostlyclean-top and add rm of distribution
tarballs.
* lib/Makefile.in: (uninstall:) modify to remove files from the
new w32api subdirectory and to remove w32api subdirectory.
(xuninstall:) Ditto.
TODO: Add a task to redo the clean targets of Makefile.in
* child_info.h (child_info): Add pppid_handle for closing the parent's of the
parent handle.
* dcrt0.cc (_dll_crt0): Close parent's parent handle when spawned or forked.
* debug.cc (add_handle): Correct erroneous reference to handle structure when
printing warning.
* exceptions.cc (interrupt_now): Always return 1.
(interrupt_on_return): Accept a sigthread argument. Check to see if this
argument has been trashed prior to setting up the stack return.
(call_handler): Add a loop around attempts to dispatch signals to detect case
where interrupt_on_return fails.
(_sigdelayed): Set up a temporary frame pointer prior to calling stuff that
could trigger an interrupt or the stack walking code will be very confused.
* fork.cc (fork_parent): Move a lot of the setup of the child process into
proc_subproc.
* spawn.cc (spawn_guts): Ditto. Use ppid_handle to contact logical parent when
reparenting.
* pinfo.h (_pinfo): Remember the logical handle of the parent process.
* sigproc.cc (proc_subproc): Record most stuff necessary for the _pinfo
structure that is inferrable from myself when adding children.
(wait_sig): Always set 'pending_signals' flag when about to kick off the signal
scanning loop. Reset it only if there are no pending signals.
* pinfo.cc (winpids:add): New method.
(winpids::enumNT): New method renamed from EnumProcessesNT. Use add method to
add elements to the lists.
(winpids::enum9x): New method renamed from EnumProcesses9x. Use add method to
add elements to the lists.
(winpids::enum_init): Accept 'winpid' parameter to control whether to add all
windows pids to the list.
(winpids::release): New method.
* pinfo.h (winpids): Reflect above changes.
* signal.cc (kill_pgrp): Ditto.
* external.cc (fillout_pinfo): Ditto.
* hashtab.h (struct htab): Add member return_allocation_failure.
(htab_try_create): New prototype. Mention which functions may
return NULL when this is used.
* pinfo.cc (pinfo::init): Reverse order of setting status and pid info in an
execed process to avoid a race.
* sigproc.cc (wait_subproc): Print more info when a WFSO error occurs.
* automode.c: New file.
* syscalls.cc (close_all_files): Streamline slightly.
* cygheap.cc (ccalloc): Clear *entire* allocated array.
* pinfo.cc (EnumProcessesNT): New function. Eliminates dependence on psapi.h.
(EnumProcesses9x): Rename from EnumProcessesW95. Change arguments to be more
useful for cygwin.
(winpids::init): Accomodate argument changes.
(enum_init): Ditto.
* pinfo.h (winpids): Make pidlist dynamically extendable by storing it as a
pointer and remembering the size.
* ntdll.h: Add extra definitions needed for EnumProcessesNT. Reformat via
'indent'.
* exceptions.cc (interruptible): Remove obsolete tests.
(sigreturn): Construct pseudo-frame-pointer so that signal handler can figure
out where to put return address when signals are coming in quickly.
* path.cc (cwdstuff::get): Allow length 0 buffer length when buffer when NULL.
Earnie Boyd [Wed, 1 Nov 2000 00:37:23 +0000 (00:37 +0000)]
* include/basetyps.h: add comment for GUID_DEFINED
* include/lm.h: add includes for lmerr.h and lmserver.h
* include/lmcons.h: add W2K typedefs LMSTR, LMCSTR
* include/lmerr.h: add error codes
* include/lmserver.h: replace LPTSTR with LPWSTR,
LPTCSTR with LPWCSTR in structures and prototypes
* include/lmshare.h: ditto
* include/lmuse.h: ditto
* include/lmstats.h: ditto
* include/oleauto.h: add function prototype SystemTimeToVariantTime
* include/winbase.h: change first argument of CommConfigDialog to const
* include/windowsx.h: add macros defining FAR versions of
mem and string functions for porting from Win16 code
* include/winioctl.h: added IOCTL_STORAGE defines
* include/winnetwk.h: added WNNC_NET flags
* include/winnt.h: add include of <basetsd.h>;
add structs; add pointer typedefs for TOKEN structs
* include/winsock.h: add guard around BSD-ish typedefs
* include/wtypes.h: new VARENUM enums, new WIN32/WIN64 compat. macros
* include/basetsd.h: new file
* include/raserror.h: ditto
* include/rassapi.h: ditto
* include/ras.h: ditto
comment from Earnie: replaced original ras.h contribution with Danny's
contribution as it is more complete.
* include/rpcndr.h: add default definition for __RPCNDR_H_VERSION__
* path.h (has_exec_chars): Standard function for checking for executable magic
numbers.
* path.cc (symlink_info::check): Use the above function.
* fhandler.cc (fhandler_disk_file::open): Ditto.
Corinna Vinschen [Tue, 31 Oct 2000 22:20:59 +0000 (22:20 +0000)]
* fhandler.h (fhandler_dev_raw): Add definition for method
`fixup_after_fork'.
* fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Add
`set_need_fixup_after_fork' call.
(fhandler_dev_raw::~fhandler_dev_raw): Revert to user space
allocation.
(fhandler_dev_raw::open): Ditto.
(fhandler_dev_raw::dup): Ditto. Reset buffer pointer.
(fhandler_dev_raw::fixup_after_fork): New function.
* fhandler_tape.cc (fhandler_dev_tape::open): Revert to user space
memory allocation.
(fhandler_dev_tape::ioctl): Ditto. Change behaviour on MTSETBLK when
new size is 1.
Corinna Vinschen [Thu, 26 Oct 2000 10:13:41 +0000 (10:13 +0000)]
* dtable.cc (dtable::release): Check for socket. Change
cnt_need_fixup_before accordingly.
(dtable::dup2): Ditto.
(dtable::fixup_before_fork): New method.
(dtable::fixup_before_exec): Ditto.
* dtable.h (class dtable): Add member `cnt_need_fixup_before'. Add
definition for methods `dec_need_fixup_before', `inc_need_fixup_before',
`need_fixup_before', `fixup_before_exec' and `fixup_before_fork'.
* fhandler.h (class fhandler_base): Slight rearrangements. Add
definitions for methods `fixup_before_fork_exec'.
(class fhandler_socket): Eliminate superfluous constructor.
Add member `prot_info_ptr'. Add destructor. Add definitions for
methods `dup', `fixup_before_fork_exec', `fixup_after_fork' and
`fixup_after_exec'.
* fork.cc (fork_parent): Care for file types which need a fixup
before fork. Start child in suspended state then.
* net.cc: New global variable `ws2_32_handle' and `wsadata'.
(fdsock): Check for Winsock version. Call `set_socket_inheritance'
only if Winsock version < 2.0. Care for `need_fixup' count in fdtab.
(cygwin_socket): Eliminate call to `set_socket_inheritance'.
(cygwin_accept): Ditto.
(cygwin_rcmd): Ditto.
(cygwin_rresvport): Ditto.
(cygwin_rexec): Ditto.
(socketpair): Ditto.
(fhandler_socket::fhandler_socket): Set `need_fork_fixup'. Allocate
space for the WSAPROTOCOL_INFOA struct used in fixup.
(fhandler_socket::~fhandler_socket): New destructor.
(fhandler_socket::fixup_before_fork_exec): New method.
(fhandler_socket::fixup_after_fork): Ditto.
(fhandler_socket::dup): Ditto.
(wsock_init): New static function.
(LoadDLLinitfunc (wsock32)): Rearranged.
(LoadDLLinitfunc (ws2_32)): New function.
(dummy_autoload): Add autoload statemants for `WSADuplicateSocketA'
and `WSASocketA'.
* spawn.cc (spawn_guts): Care for file types which need a fixup
before exec. Start child in suspended state then.
* signal.cc (kill_pgrp): Don't limit sending of signals to stopped processes
when sig < 0.
(kill_worker): Only send SIGCONT to stopped processes when sendSIGCONT.
Corinna Vinschen [Wed, 25 Oct 2000 08:47:23 +0000 (08:47 +0000)]
* fhandler.cc (fhandler_base::fcntl): Treat O_NONBLOCK and OLD_O_NDELAY
as exactly the same. If one is set, both are set.
* net.cc (fhandler_socket::fcntl): Ditto.
* dcrt0.cc (do_exit): Don't bother looking for pgrp children to send SIGHUP if
process has never created any children.
* fork.cc (fork): Set flag indicating that there is another process with our
process group.
* spawn.cc (spawn_guts): Ditto.
* pinfo.h (set_has_pgid_children): New methods for setting when process has
children in its process group.
* syscalls.cc (setpgid): Clear has_gid_children if pgid changes.
Corinna Vinschen [Tue, 24 Oct 2000 18:44:56 +0000 (18:44 +0000)]
* ntdll.h: New file.
* fhandler_mem.cc: Move ntdll.dll specific definitions and
declarations to ntdll.h.
* sysconf.cc (sysconf): Add support for _SC_NPROCESSORS_CONF,
_SC_NPROCESSORS_ONLN, _SC_PHYS_PAGES and _SC_AVPHYS_PAGES.
* exceptions.cc (signal_exit): Kill any executing child process if we're dying.
* path.h: Remove unneeded extern.
* spawn.cc (std_suffixes): Make static. Don't set dwProcessId here since it
makes the process unsignalable. Set strace flag that this is an execed process
stub.
* strace.cc (strace::vsprntf): Use strace flag to indicate when to visually
flag that this is an exec stub.
* include/sys/strace.h (strace): Add 'execing' flag.