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.
This commit is contained in:
Christopher Faylor 2002-10-20 04:15:50 +00:00
parent bea966c0d9
commit d25c187f12
8 changed files with 48 additions and 26 deletions

View File

@ -1,3 +1,16 @@
2002-10-20 Christopher Faylor <cgf@redhat.com>
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 <cgf@redhat.com> 2002-10-19 Christopher Faylor <cgf@redhat.com>
* fork.cc (fork_child): Move pinfo fixup later to attempt some minor * fork.cc (fork_child): Move pinfo fixup later to attempt some minor

View File

@ -1,5 +1,5 @@
# Makefile.in for Cygwin. # 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. # This file is part of Cygwin.
# #
@ -47,13 +47,19 @@ INSTALL_PROGRAM:=@INSTALL_PROGRAM@
MT_SAFE:=@MT_SAFE@ MT_SAFE:=@MT_SAFE@
DEFS:=@DEFS@ 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@ CC:=@CC@
# FIXME: Which is it, CC or CC_FOR_TARGET? # FIXME: Which is it, CC or CC_FOR_TARGET?
CC_FOR_TARGET:=$(CC) CC_FOR_TARGET:=$(CC)
CFLAGS:=@CFLAGS@ CFLAGS=@CFLAGS@
override CFLAGS+=-MMD -fbuiltin override CFLAGS+=-MMD -fbuiltin ${$(*F)_CFLAGS}
CXX:=@CXX@ CXX:=@CXX@
CXXFLAGS:=@CXXFLAGS@ CXXFLAGS=@CXXFLAGS@
# For linking mount, etc. crt0.o isn't accessable in a fresh build. # For linking mount, etc. crt0.o isn't accessable in a fresh build.
EXE_LDFLAGS:=@EXE_LDFLAGS@ 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 && \ $(COMPILE_CXX) -o version.o version.cc && \
touch $@ touch $@
malloc.o: malloc.cc
$(COMPILE_CXX) -fomit-frame-pointer -o $@ $<
cygrun.o: cygrun.c cygrun.o: cygrun.c
$(CC) $(MINGW_CFLAGS) -o $@ -c $< $(CC) $(MINGW_CFLAGS) -o $@ -c $<

View File

@ -485,8 +485,8 @@ jn
_jn = jn _jn = jn
jnf jnf
_jnf = jnf _jnf = jnf
_kill kill
kill = _kill _kill = kill
labs labs
_labs = labs _labs = labs
lchown lchown

View File

@ -612,7 +612,7 @@ fhandler_tty_slave::write (const void *ptr, size_t len)
default: default:
__seterrno_from_win_error (err); __seterrno_from_win_error (err);
} }
_raise (SIGHUP); /* FIXME: Should this be SIGTTOU? */ raise (SIGHUP); /* FIXME: Should this be SIGTTOU? */
towrite = (DWORD) -1; towrite = (DWORD) -1;
break; 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)) if (!PeekNamedPipe (get_handle (), peek_buf, sizeof (peek_buf), &bytes_in_pipe, NULL, NULL))
{ {
termios_printf ("PeekNamedPipe failed, %E"); termios_printf ("PeekNamedPipe failed, %E");
_raise (SIGHUP); raise (SIGHUP);
bytes_in_pipe = 0; 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) if (ReadFile (get_handle (), buf, readlen, &n, NULL) == FALSE)
{ {
termios_printf ("read failed, %E"); termios_printf ("read failed, %E");
_raise (SIGHUP); raise (SIGHUP);
} }
/* MSDN states that 5th prameter can be used to determine total /* MSDN states that 5th prameter can be used to determine total
number of bytes in pipe, but for some reason this number doesn't 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)) if (!PeekNamedPipe (get_handle (), peek_buf, 1, &bytes_in_pipe, NULL, NULL))
{ {
termios_printf ("PeekNamedPipe failed, %E"); termios_printf ("PeekNamedPipe failed, %E");
_raise (SIGHUP); raise (SIGHUP);
bytes_in_pipe = 0; bytes_in_pipe = 0;
} }
if (n) if (n)
@ -923,7 +923,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
/* background process */ /* background process */
termios_printf ("bg ioctl pgid %d, tpgid %d, ctty %d", termios_printf ("bg ioctl pgid %d, tpgid %d, ctty %d",
myself->pgid, get_ttyp ()->getpgid (), myself->ctty); myself->pgid, get_ttyp ()->getpgid (), myself->ctty);
_raise (SIGTTOU); raise (SIGTTOU);
} }
switch (cmd) switch (cmd)
@ -1104,7 +1104,7 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
break; break;
case TIOCSWINSZ: case TIOCSWINSZ:
get_ttyp ()->winsize = * (struct winsize *) arg; get_ttyp ()->winsize = * (struct winsize *) arg;
_kill (-get_ttyp ()->getpgid (), SIGWINCH); kill (-get_ttyp ()->getpgid (), SIGWINCH);
break; break;
case FIONBIO: case FIONBIO:
set_nonblocking (*(int *) arg); set_nonblocking (*(int *) arg);

View File

@ -128,9 +128,11 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat
offsets[0] = (char *) shared; offsets[0] = (char *) shared;
} }
#if 0
if (!child_proc_info && wincap.needs_memory_protection ()) if (!child_proc_info && wincap.needs_memory_protection ())
for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000) for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000)
VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS); VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS);
#endif
} }
debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h); debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h);
@ -227,7 +229,6 @@ memory_init ()
unsigned unsigned
shared_info::heap_chunk_size () shared_info::heap_chunk_size ()
{ {
unsigned val;
if (!initial_heap_size) if (!initial_heap_size)
{ {
/* Fetch misc. registry entries. */ /* Fetch misc. registry entries. */

View File

@ -181,14 +181,13 @@ kill_worker (pid_t pid, int sig)
} }
int 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 int
_kill (pid_t pid, int sig) kill (pid_t pid, int sig)
{ {
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
syscall_printf ("kill (%d, %d)", pid, sig); syscall_printf ("kill (%d, %d)", pid, sig);
@ -256,7 +255,7 @@ kill_pgrp (pid_t pid, int sig)
extern "C" int extern "C" int
killpg (pid_t pgrp, int sig) killpg (pid_t pgrp, int sig)
{ {
return _kill (-pgrp, sig); return kill (-pgrp, sig);
} }
extern "C" void extern "C" void
@ -279,7 +278,7 @@ abort (void)
sigdelset (&sig_mask, SIGABRT); sigdelset (&sig_mask, SIGABRT);
set_process_mask (sig_mask); set_process_mask (sig_mask);
_raise (SIGABRT); raise (SIGABRT);
(void) thisframe.call_signal_handler (); /* Call any signal handler */ (void) thisframe.call_signal_handler (); /* Call any signal handler */
do_exit (1); /* signal handler didn't exit. Goodbye. */ do_exit (1); /* signal handler didn't exit. Goodbye. */
} }

View File

@ -252,11 +252,17 @@ remove (const char *ourname)
} }
extern "C" pid_t extern "C" pid_t
_getpid () getpid ()
{ {
return myself->pid; return myself->pid;
} }
extern "C" pid_t
_getpid_r (struct _reent *)
{
return getpid ();
}
/* getppid: POSIX 4.1.1.1 */ /* getppid: POSIX 4.1.1.1 */
extern "C" pid_t extern "C" pid_t
getppid () getppid ()
@ -288,8 +294,8 @@ setsid (void)
&& !check_pty_fds ()) && !check_pty_fds ())
FreeConsole (); FreeConsole ();
myself->ctty = -1; myself->ctty = -1;
myself->sid = _getpid (); myself->sid = getpid ();
myself->pgid = _getpid (); myself->pgid = getpid ();
syscall_printf ("sid %d, pgid %d, ctty %d", myself->sid, myself->pgid, myself->ctty); syscall_printf ("sid %d, pgid %d, ctty %d", myself->sid, myself->pgid, myself->ctty);
return myself->sid; return myself->sid;
} }

View File

@ -2214,7 +2214,7 @@ __pthread_kill (pthread_t thread, int sig)
if (thread->sigs) if (thread->sigs)
myself->setthread2signal (thread); myself->setthread2signal (thread);
int rval = _kill (myself->pid, sig); int rval = raise (sig);
// unlock myself // unlock myself
return rval; return rval;