On Sun, Apr 02, 2000 at 02:34:25AM +0200, Ralf Baechle wrote:
> > On Fri, Mar 31, 2000 at 03:15:55PM +0200, Ralf Baechle wrote:
> > > I just found another brainfart in the libc / kernel interface. In the
> > > believe libc wouldn't use the pause(2) syscall any longer I removed it.
> > > This makes a number of programs like screen burn all CPU they can get.
> > > I'll provide two fixes, one to libc and a second for the kernel and
> > > either one will be sufficient.
> > Could this also be the cause of "top" refreshing the screen as fast
> > as it can ? I noticed that when i rebuild the debian procps package
> > and tried top ... It then consumes the cpu it gets ...
> I haven't tried myself but sounds very probable. The sympthon is that
> an strace will show large numbers of pause(2) syscalls which all return
> with -ENOSYS as error.
Ok, fix implemented and tested. I made sure that glibc now actually compiles
even with 2.3.99-pre3 headers which stock 2.0 won't on any architecture. The
full glibc patch is a bit too large to be posted to this list, so I'll just
put it on oss.sgi.com after my arrival in Mountain View so that should be
The pause fix itself is a new pause(3) function which tries to use pause(2)
where available. If that ever fails with ENOSYS then it will switch over
to the emulation of the pause syscall. I'll also add the pause(2) syscall
back to all kernel flavours which will ensure that either a libc or a kernel
upgrade will fix the pause bug. This is the fix:
New file glibc/sysdeps/unix/sysv/linux/mips/pause.c:
/* Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Suspend the process until a signal arrives.
This always returns -1 and sets errno to EINTR. */
extern int __sys_pause(void);
static int must_emulate = 0;
int errno_saved = errno;
int retval = __sys_pause();
if (retval >= 0 || errno != ENOSYS)
must_emulate = 1;
return __sigpause (__sigblock (0), 0);
weak_alias (__libc_pause, pause)
Add an entry for pause in sysdeps/unix/sysv/linux/mips/syscalls.list:
s_pause pause pause 0 __sys_pause
This next libc release fixes all open bugs on my list except maybe a merge
with all one of the inofficial 2.0.7 releases that have been made by
non-FSF people. So if after the release there should still be open bugs,
please report again.