* Makefile.in: Add cygheap.o.
* child_info.h: Add specific exec class.
* cygheap.h: New file. Contains declarations for cygwin heap.
* cygheap.cc: New file. Implements cygwin heap functions.
* dcrt0.cc (quoted): Simplify due to new method for passing arguments between
cygwin programs.
(alloc_stack_hard_way): Attempt to handle overlapped stack.
(dll_crt0_1): Move child_info processing here. Accomodate new method for
passing arguments between cygwin programs. Initialize cygwin heap. Establish
__argc and __argv variables.
(_dll_crt0): Move most of child_info processing to dll_crt0_1.
(cygwin_dll_init): Remove duplication.
* dtable.cc (dtable::extend): Allocate dtable using cygwin heap.
(dtable::build_fhandler): Ditto for fhandler type being constructed.
(dtable::dup_worker): Free new fhandler from cygwin heap on error.
(dtable::select_*): Don't assume that this == fdtab.
(dtable::linearize_fd_array): Delete.
(dtable::delinearize_fd_array): Delete.
(dtable::fixup_after_exec): New file.
(dtable::vfork_child_dup): Use cygwin heap.
(dtable::vfork_parent_restore): Ditto.
* dtable.h: Remove obsolete methods. Add new method.
* environ.cc (posify): Eliminate already_posix parameter and logic.
(envsize): New function.
(_addenv): Use envsize.
(environ_init): Accept an argument pointing to an existing environment list.
If supplied, allocate space for this in the the program's heap.
* fhandler.cc (fhandler_base::operator =): Move here from fhandler.h. Use
cygwin heap to allocate filenames.
(fhandler_base::set_name): Allocate/free names from cygwin heap.
(fhandler_base::linearize): Delete.
(fhandler_base::de_linearize): Delete.
(fhandler_base::operator delete): Free from cygwin heap.
(fhandler_base::~fhandler_base): Ditto.
* fhandler.h: Accomodate elimination of *linearize and other changes above.
* fhandler_console.cc (fhandler_console::fixup_after_exec): Rename from
de_linearize.
* heap.h: New file.
* fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Use cygwin heap for
name. fhandler_tty::fixup_after_exec): Rename from de_linearize.
* fork.cc (fork): Call cygheap_fixup_in_child.
* heap.cc: Use declarations in heap.h.
* malloc.cc: Sprinkle assertions throughout to catch attempts to free/realloc
something from the cygwin heap.
* path.cc: Throughout, eliminate use of per-thread cache for cwd. Use cwd_*
functions rather than cwd_* variables to access cwd_win32 and cwd_posix.
(cwd_win32): New function.
(cwd_posix): New function.
(cwd_hash): New function.
(cwd_fixup_after_exec): New function.
* path.h: Accomodate path.cc changes.
* pinfo.cc (pinfo_init): Accept a pointer to an environment table. Pass this
to environ_init. Eliminate old 'title' tests.
* pinfo.h: Accomodate above change in argument.
* spawn.cc (struct av): New method for building argv list.
(av::unshift): New method.
(spawn_guts): Allocate everything that the child process needs in the cygwin
heap and pass a pointer to this to the child. Build argv list using new
method. Eliminate delinearize stuff.
* thread.h: Eliminate _cwd_win32 and _cwd_posix buffers.
* winsup.h: Eliminate obsolete functions. Add envsize() declaration.
* sigproc.cc (proc_info): Rename proc_exists which takes a pid to "pid_exists".
* shared.h: Split out "child_info" stuff into a new header file and use where
necessary. Declare pid_exists.
* child_info.h: New file.
Geoffrey Keating [Wed, 30 Aug 2000 18:30:16 +0000 (18:30 +0000)]
* libc/string/swab.c: Specify that it's defined in <unistd.h>.
* libc/include/string.h: Don't include <sys/types.h>,
as it causes really bad namespace pollution. Don't declare
swab(), it is properly declared in unistd.h.
* signal.cc (_raise): New function.
* exceptions.cc (unused_sig_wrapper): Remove _raise.
* sigproc.h (class sigframe): Default frames to skip to zero or suffer from
exuberant optimization.
* fhandler_tty.cc (fhandler_tty::write): Set appropriate errno when WriteFile
to pipe fails.
Jeff Johnston [Mon, 28 Aug 2000 20:06:54 +0000 (20:06 +0000)]
2000-08-27 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/posix/scandir.c (DIRSIZ, scandir): use struct dirent.d_namlen
only if _DIRENT_HAVE_D_NAMLEN is defined.
(alphasort): aligned prototype with
libc/sys/cygwin/sys/dirent.h and simplified function body.
* libc/posix/telldir.c (telldir): changed "telldir" prototype to
long telldir (DIR *) as mentioned in annex B of POSIX.1
Jeff Johnston [Mon, 28 Aug 2000 17:50:06 +0000 (17:50 +0000)]
2000-08-27 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/machine/i386/i386mach.h: added SOTYPE_FUNCTION to set type
of global entry points if _I386MACH_NEED_SOTYPE_FUNCTION is defined;
Added __CLI and __STI macros (controlled via
_I386MACH_ALLOW_HW_INTERRUPTS macro).
* libc/machine/i386/f_atan2.S libc/machine/i386/f_atan2f.S
libc/machine/i386/f_frexp.S libc/machine/i386/f_frexpf.S
libc/machine/i386/f_ldexp.S libc/machine/i386/f_ldexpf.S
libc/machine/i386/f_log.S libc/machine/i386/f_log10.S
libc/machine/i386/f_log10f.S libc/machine/i386/f_logf.S
libc/machine/i386/f_tan.S libc/machine/i386/f_tanf.S
libc/machine/i386/memchr.S libc/machine/i386/memcmp.S
libc/machine/i386/memcpy.S libc/machine/i386/memmove.S
libc/machine/i386/memset.S libc/machine/i386/setjmp.S
libc/machine/i386/strchr.S libc/machine/i386/strlen.S:
(that's libc/machine/i386/*.S) added SOTYPE_FUNCTION(symbol)
for all global entry points.
* libc/machine/i386/setjmp.S: removed code replicated in
libc/machine/i386/i386mach.h and included i386mach.h instead;
Use __CLI and __STI instead of cli and sti.
Jeff Johnston [Mon, 28 Aug 2000 17:45:56 +0000 (17:45 +0000)]
2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/stdlib/mprec.c (ulp, b2d, d2b): changed a few expressions
like x << y-z to the equivalent x << (y-z).
(d2b): changed if statements with assignment to perform the
assignment prior to the if check.
* libc/reent/reent.c: included stdlib.h for "_free_r" prototype.
* libc/unix/getpass.c (getpass): moved "echo" assignment out of if.
* libc/unix/ttyname.c: included string.h for "strcpy" prototype.
* libc/unix/getcwd.c (ISDOT): added parentheses to clarify && and ||
precedence.
* libc/include/sys/unistd.h: added "vfork" prototype (for popen.c).
Added "_execve" prototype (for execl.c, execle.c, execv.c, and
execve.c).
* libc/posix/popen.c (popen): added parentheses to clarify && and ||
precedence.
* libm/math/e_cosh.c (__ieee754_cosh): changed parentheses to
clarify && and || precendence (and to remove pascalism).
* libm/math/e_sinh.c (__ieee754_sinh): Ditto.
* libm/math/s_infconst.c: added another pair of braces to all
initializers for __infinity (need three: for __infinity[1] array,
for union __dmath, and for i[2]).
* pinfo.h (pinfo): Un-inline release.
* pinfo.cc (pinfo::release): Move here from pinfo.h.
* sigproc.cc (proc_terminate): Remove bogus 'pinfo child' which caused strange
destruction of random regions of memory when destructor was invoked.
* dcrt0.cc (dll_crt0_1): Move set_os_type.
(_dll_crt0): To here.
(cygwin_dll_init): And here.
* external.cc (fillout_pinfo): Use more foolproof method for scanning for pids.
* pinfo.cc (set_myself): Eliminate myself_identity.init.
* sigproc.cc (wait_sig): Do it here instead to reduce the amount of time where
there could potentially be two processes with the same pid.
* spawn.cc (spawn_guts): Eliminate duplicate initialization.
* include/sys/cygwin.h: Mark unused PID_* elements.
* external.cc (cygwin_internal): Add CW_INIT_EXCEPTIONS to allow cygwin
exception handling on threads not created by cygwin.
* sigproc.cc (proc_terminate): Don't release pinfo structs since we are
exiting.
* include/sys/cygwin.h: Add CW_INIT_EXCEPTIONS.
Jeff Johnston [Thu, 24 Aug 2000 22:32:38 +0000 (22:32 +0000)]
2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/stdlib/mprec.c (ulp, b2d, d2b): changed a few expressions
like x << y-z to the equivalent x << (y-z).
(d2b): changed if statements with assignment to perform the
assignment prior to the if check.
* libc/reent/reent.c: included stdlib.h for "_free_r" prototype.
* libc/unix/getpass.c (getpass): moved "echo" assignment out of if.
* libc/unix/ttyname.c: included string.h for "strcpy" prototype.
* libc/unix/getcwd.c (ISDOT): added parentheses to clarify && and ||
precedence.
* libc/include/sys/unistd.h: added "vfork" prototype (for popen.c).
Added "_execve" prototype (for execl.c, execle.c, execv.c, and
execve.c).
* libc/posix/popen.c (popen): added parentheses to clarify && and ||
precedence.
* libm/math/e_cosh.c (__ieee754_cosh): changed parentheses to
clarify && and || precendence (and to remove pascalism).
* libm/math/e_sinh.c (__ieee754_sinh): Ditto.
* libm/math/s_infconst.c: added another pair of braces to all
initializers for __infinity (need three: for __infinity[1] array,
for union __dmath, and for i[2]).
* select.cc (cygwin_select): Correct logic for "always_ready" fds or when there
is no wait specified.
* syslog.cc (pass_handler::set_message): Zero the buffer prior to setting it.
* Makefile.in: Add dumper.exe target and associated mechanisms for building it.
* dumper.cc: New file.
* dumper.h: New file.
* module_info.cc: New file.
* parse_pe.cc: New file.
Jeff Johnston [Thu, 24 Aug 2000 18:51:09 +0000 (18:51 +0000)]
2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/stdlib/abort.c: changed description: uses "raise" instead of
"getpid" and "kill"; added: uses "write" and "_exit".
Also included unistd.h for "_exit" prototype.
* libc/stdlib/system.c: included unistd.h for "execve" prototype,
reent.h for "_fork_r" and "_wait_r" prototypes.
(do_system): changed extern char *environ[] to POSIX-friendly
extern char **environ.
* libc/stdlib/wctomb_r.c: included string.h for "strlen" and "strcmp"
prototypes.
* libc/stdlib/remove.c: included reent.h for "_unlink_r" prototype.
* libc/reent/execr.c: included sys/wait.h for "wait" prototype.
* libc/reent/fstatr.c: included sys/stat.h for "fstat" prototype.
* libc/reent/openr.c: included fcntl.h for "open" prototype.
* libc/reent/signalr.c: included signal.h for "kill" prototype,
unistd.h for "getpid" prototype.
* libc/reent/statr.c: included sys/stat.h for "stat" prototype.
* libc/reent/timer.c: included sys/time.h for "gettimeofday" prototype.
* libc/unix/getut.c (utmpname): removed local, incorrect "strdup"
prototype. Also included stdlib.h for "abort", string.h for
"strdup" and "strncmp" prototypes.
* libc/unix/getlogin.c: included string.h for "strncmp", "memset", and
"strncpy", unistd.h for "read" and "close" prototypes.
* libc/posix/execvp.c: included string.h for "strchr", "strlen", and
"strcat" prototypes.
* include/cygwin/core_dump.h: New file, contains structures used in cygwin core
core files.
* include/sys/procfs.h: New file, needed to autoconfigure cygwin core dumps
support in bfd.
* environ.cc (parse_thing): nobinmode should force O_TEXT.
(regopt): Use correct path to find LOCAL_MACHINE registry options.
* fhandler.cc (fhandler_base::open): Set binary mode only when binmode ==
O_BINARY.
* pipe.cc (pipe): Pipe handling should rely on binmode not _fmode now that the
two are different.
Jeff Johnston [Thu, 24 Aug 2000 16:25:36 +0000 (16:25 +0000)]
2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/stdio/stdio.c (__swrite): declare "oldmode" only if it's
used later (ifdef __SCLE)
* libc/stdio/vfscanf.c (__svfscanf): declare "state" only if it's
used later (ifdef MB_CAPABLE)
* libc/string/memset.c (memset): removed unused variables "count"
and "unaligned_addr"
* libc/locale/locale.c (_setlocale_r): declare "lc_ctype" and
"last_lc_ctype" only of they're used later (ifdef MB_CAPABLE)
* libc/unix/getpwent.c (getpwnam): removed unused variables "uid"
and "gid"
Jeff Johnston [Thu, 24 Aug 2000 16:11:59 +0000 (16:11 +0000)]
2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/stdlib/envlock.c: changed documented "__env_lock" and
"__env_unlock" prototype from "void *" or "char *" to
"struct _reent *" to match real function. Also added include
of envlock.h.
* libc/stdlib/mlock.c: changed documented "__malloc_lock" and
"__malloc_unlock" prototype from "void *" or "char *" to
"struct _reent *" to match real function.
* libc/stdlib/envlock.h: added "__env_lock" and "__env_unlock"
prototypes (for getenv_r.c and setenv_r.c).
* dcrt0.cc (dll_crt0_1): Move exception list and constructor stuff earlier in
the process. Use new second argument to set_myself.
(cygwin_dll_init): Initialize exception list and constructor stuff here.
(_dll_crt0): And here. Also, deal with inherited pinfo shared memory region
from parent.
* pinfo.cc (set_myself): Accept a second argument signifying the a shared
memory region, passed from an execing parent.
(pinfo_init): Ditto.
* pinfo.h: Ditto.
* shared.h (child_info): Add a handle field to pass to child.
* spawn.cc (spawn_guts): Create a shared handle to pass to an execed child.
* winsup.h: Remove extraneous declaration.
* winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h files
only in sources which require them.
* Makefile.in: Generate dependencies with -MD option.
* cygerrno.h: New file. Use this throughout whenever errno manipulation is
required.
* errno.cc: Use DWORD to hold Windows errors.
(geterrno_from_win_error): New function.
(seterrno_from_win_error): Use geterrno_from_win_error to convert supplied
windows error (suggested by Corinna Vinschen).
* path.cc (symlink_info): Add error element.
* path.cc (path_conv::check): Remove errno setting. Use new symlink_info errno
element to set path_conv error, where appropriate.
(symlink_info::check): Set error element rather than attempting to manipulate
errno. Add more checks for trailing / and /.. even though they are currently
useless. Avoid setting EINVAL.
* path.cc (normalize_posix_path): Correct check for trailing /.
Jim Wilson [Mon, 14 Aug 2000 20:13:39 +0000 (20:13 +0000)]
Add support for IA-64 specific elf header flags.
bfd/
2000-08-14 Jim Wilson <wilson@cygnus.com>
* elf64-ia64.c (elf64_ia64_merge_private_bfd_data): Handle
EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP, and EF_IA_64_NOFUNCDESC_CONS_GP.
(elf64_ia64_print_private_bfd_data): Likewise. Also handle
EF_IA_64_ABSOLUTE.
gas/
2000-08-14 Jim Wilson <wilson@cygnus.com>
* config/tc-ia64.c (md_longopts): Add -mconstant-gp and -mauto-pic.
(md_parse_option): Add OPTION_MCONSTANT_GP and OPTION_MAUTO_PIC.
(md_begin): Change assignment to md.flag to OR in the new bit.
include/elf/
2000-08-14 Jim Wilson <wilson@cygnus.com>
* elf/ia64.h (EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP,
EF_IA_64_NOFUNCDESC_CONS_GP, EF_IA_64_ABSOLUTE): Define.
* winsup.h: Split out dtable definitions into separate header file.
* dtable.h: New file.
* sigproc.h: Eliminate pinfo.h usage here. Use it in source files that need
it.
Jason Merrill [Sat, 12 Aug 2000 00:49:39 +0000 (00:49 +0000)]
* configure.in (CC_FOR_TARGET, CHILL_FOR_TARGET,
CXX_FOR_TARGET): Add -B$$r/gcc/ here.
(FLAGS_FOR_TARGET): Not here.
(CHILL_FOR_TARGET, CXX_FOR_TARGET): Don't check the list of languages.
Corinna Vinschen [Fri, 11 Aug 2000 12:51:47 +0000 (12:51 +0000)]
* poll.cc: Add bounds checking for file descriptors. Return POLLNVAL
if fd is invalid. Return POLLERR for each valid fd if cygwin_select
returned with error.
include/sys/poll.h: Change POLLERR comment according to above change.
* dir.cc (readdir): Ensure that errno is *only* set when we've run out of
filenames.
* fhandler.cc (fhandler_disk_file::fstat): Use modern method for saving errno,
making it effective for the whole function.