From d25c187f126df8e4d1cff98368c24815d2088bd3 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 20 Oct 2002 04:15:50 +0000 Subject: [PATCH] Rename _kill() to kill() throughout. Rename _raise() to raise() throughout. Rename _pid() to pid() throughout. * Makefile.in: Compile some objects with -fomit-frame-pointer. * cygwin.din: Reverse aliasing for _kill. * syscalls.cc (_getpid_r): New function, implemented for newlib compatibility. * shared.cc (open_shared): Remove reserving of memory since previous change eliminate the need for this hack. --- winsup/cygwin/ChangeLog | 13 +++++++++++++ winsup/cygwin/Makefile.in | 17 ++++++++++------- winsup/cygwin/cygwin.din | 4 ++-- winsup/cygwin/fhandler_tty.cc | 12 ++++++------ winsup/cygwin/shared.cc | 3 ++- winsup/cygwin/signal.cc | 11 +++++------ winsup/cygwin/syscalls.cc | 12 +++++++++--- winsup/cygwin/thread.cc | 2 +- 8 files changed, 48 insertions(+), 26 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bf82bac48..d8b75b104 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2002-10-20 Christopher Faylor + + Rename _kill() to kill() throughout. Rename _raise() to raise() + throughout. Rename _pid() to pid() throughout. + * Makefile.in: Compile some objects with -fomit-frame-pointer. + * cygwin.din: Reverse aliasing for _kill. + * syscalls.cc (_getpid_r): New function, implemented for newlib + compatibility. + + * shared.cc (open_shared): Remove reserving of memory since previous + change eliminate the need for this hack. + + 2002-10-19 Christopher Faylor * fork.cc (fork_child): Move pinfo fixup later to attempt some minor diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 218d9de23..fe244e357 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -1,5 +1,5 @@ # Makefile.in for Cygwin. -# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc. +# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. # # This file is part of Cygwin. # @@ -47,13 +47,19 @@ INSTALL_PROGRAM:=@INSTALL_PROGRAM@ MT_SAFE:=@MT_SAFE@ DEFS:=@DEFS@ +# cygheap_CFLAGS:=-fomit-frame-pointer +malloc_CFLAGS:=-fomit-frame-pointer +shared_CFLAGS:=-fomit-frame-pointer +cygthread_CFLAGS:=-fomit-frame-pointer +miscfuncs_CFLAGS:=-fomit-frame-pointer + CC:=@CC@ # FIXME: Which is it, CC or CC_FOR_TARGET? CC_FOR_TARGET:=$(CC) -CFLAGS:=@CFLAGS@ -override CFLAGS+=-MMD -fbuiltin +CFLAGS=@CFLAGS@ +override CFLAGS+=-MMD -fbuiltin ${$(*F)_CFLAGS} CXX:=@CXX@ -CXXFLAGS:=@CXXFLAGS@ +CXXFLAGS=@CXXFLAGS@ # For linking mount, etc. crt0.o isn't accessable in a fresh build. EXE_LDFLAGS:=@EXE_LDFLAGS@ @@ -315,9 +321,6 @@ winver_stamp: mkvers.sh include/cygwin/version.h winver.rc $(DLL_OFILES) $(COMPILE_CXX) -o version.o version.cc && \ touch $@ -malloc.o: malloc.cc - $(COMPILE_CXX) -fomit-frame-pointer -o $@ $< - cygrun.o: cygrun.c $(CC) $(MINGW_CFLAGS) -o $@ -c $< diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 2c5e9f38c..b9b687f06 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -485,8 +485,8 @@ jn _jn = jn jnf _jnf = jnf -_kill -kill = _kill +kill +_kill = kill labs _labs = labs lchown diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index c8b73d7ee..8455f75b3 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -612,7 +612,7 @@ fhandler_tty_slave::write (const void *ptr, size_t len) default: __seterrno_from_win_error (err); } - _raise (SIGHUP); /* FIXME: Should this be SIGTTOU? */ + raise (SIGHUP); /* FIXME: Should this be SIGTTOU? */ towrite = (DWORD) -1; break; } @@ -704,7 +704,7 @@ fhandler_tty_slave::read (void *ptr, size_t len) if (!PeekNamedPipe (get_handle (), peek_buf, sizeof (peek_buf), &bytes_in_pipe, NULL, NULL)) { termios_printf ("PeekNamedPipe failed, %E"); - _raise (SIGHUP); + raise (SIGHUP); bytes_in_pipe = 0; } @@ -726,7 +726,7 @@ fhandler_tty_slave::read (void *ptr, size_t len) if (ReadFile (get_handle (), buf, readlen, &n, NULL) == FALSE) { termios_printf ("read failed, %E"); - _raise (SIGHUP); + raise (SIGHUP); } /* MSDN states that 5th prameter can be used to determine total number of bytes in pipe, but for some reason this number doesn't @@ -735,7 +735,7 @@ fhandler_tty_slave::read (void *ptr, size_t len) if (!PeekNamedPipe (get_handle (), peek_buf, 1, &bytes_in_pipe, NULL, NULL)) { termios_printf ("PeekNamedPipe failed, %E"); - _raise (SIGHUP); + raise (SIGHUP); bytes_in_pipe = 0; } if (n) @@ -923,7 +923,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg) /* background process */ termios_printf ("bg ioctl pgid %d, tpgid %d, ctty %d", myself->pgid, get_ttyp ()->getpgid (), myself->ctty); - _raise (SIGTTOU); + raise (SIGTTOU); } switch (cmd) @@ -1104,7 +1104,7 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg) break; case TIOCSWINSZ: get_ttyp ()->winsize = * (struct winsize *) arg; - _kill (-get_ttyp ()->getpgid (), SIGWINCH); + kill (-get_ttyp ()->getpgid (), SIGWINCH); break; case FIONBIO: set_nonblocking (*(int *) arg); diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 9bcefe3e9..3ea8465bd 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -128,9 +128,11 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat offsets[0] = (char *) shared; } +#if 0 if (!child_proc_info && wincap.needs_memory_protection ()) for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000) VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS); +#endif } debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h); @@ -227,7 +229,6 @@ memory_init () unsigned shared_info::heap_chunk_size () { - unsigned val; if (!initial_heap_size) { /* Fetch misc. registry entries. */ diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 07417de98..382a8a2ec 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -181,14 +181,13 @@ kill_worker (pid_t pid, int sig) } int -_raise (int sig) +raise (int sig) { - return _kill (myself->pid, sig); + return kill (myself->pid, sig); } -/* This is called _kill because the real kill is in newlib. */ int -_kill (pid_t pid, int sig) +kill (pid_t pid, int sig) { sigframe thisframe (mainthread); syscall_printf ("kill (%d, %d)", pid, sig); @@ -256,7 +255,7 @@ kill_pgrp (pid_t pid, int sig) extern "C" int killpg (pid_t pgrp, int sig) { - return _kill (-pgrp, sig); + return kill (-pgrp, sig); } extern "C" void @@ -279,7 +278,7 @@ abort (void) sigdelset (&sig_mask, SIGABRT); set_process_mask (sig_mask); - _raise (SIGABRT); + raise (SIGABRT); (void) thisframe.call_signal_handler (); /* Call any signal handler */ do_exit (1); /* signal handler didn't exit. Goodbye. */ } diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index a2c813c9e..305443f4c 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -252,11 +252,17 @@ remove (const char *ourname) } extern "C" pid_t -_getpid () +getpid () { return myself->pid; } +extern "C" pid_t +_getpid_r (struct _reent *) +{ + return getpid (); +} + /* getppid: POSIX 4.1.1.1 */ extern "C" pid_t getppid () @@ -288,8 +294,8 @@ setsid (void) && !check_pty_fds ()) FreeConsole (); myself->ctty = -1; - myself->sid = _getpid (); - myself->pgid = _getpid (); + myself->sid = getpid (); + myself->pgid = getpid (); syscall_printf ("sid %d, pgid %d, ctty %d", myself->sid, myself->pgid, myself->ctty); return myself->sid; } diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 42be6ca2c..115df453e 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -2214,7 +2214,7 @@ __pthread_kill (pthread_t thread, int sig) if (thread->sigs) myself->setthread2signal (thread); - int rval = _kill (myself->pid, sig); + int rval = raise (sig); // unlock myself return rval; -- 2.43.5