Skip to contentSkip to conversation

pause()

DISCUSSION Florian Lohoff 2 participants 4 messages Mar 31, 2000 – Apr 2, 2000 1 message not in the archive MIPS

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · Ralf Baechle

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 ...

Flo

Signature · 3 lines
Florian Lohoff		[email protected]		      	+49-5241-470566
"Technology is a constant battle between manufacturers producing bigger and
more idiot-proof systems and nature producing bigger and better idiots."
#2 lore raw
Quoted 10 lines · Florian Lohoff
Quoted 5 lines · Ralf Baechle

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.

Ralf

#3 lore raw
Quoted 7 lines · Ralf Baechle
Quoted 7 lines · Ralf Baechle
Quoted 5 lines

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.

Quoted 7 lines
Quoted 3 lines

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 about Tuesday.

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. */

#include <errno.h>
#include <signal.h>
#include <unistd.h>

/* Suspend the process until a signal arrives.
This always returns -1 and sets errno to EINTR. */

extern int __sys_pause(void);

int
__libc_pause (void)
{
static int must_emulate = 0;

  if (!must_emulate)
    {
      int errno_saved = errno;
      int retval = __sys_pause();
      if (retval >= 0 || errno != ENOSYS)
	return retval;

      __set_errno(errno_saved);
      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.

Ralf

#4 lore raw
Quoted 5 lines · Ralf Baechle

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:

As we are still quiet experimental and nobody else complained about pause syscall wouldnt it be overkill to do a pause emulation ? Just fix the kernel and other glibc bugs and document this in the MIPS-FAQ that people seeing this problem should upgrade to <blafasel>.

Quoted 4 lines

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.

I have made a glibc 2.0.7 package (debian) from the original slink debian package + the mips patches - I have problems building without hacking as binarys like "zic" etc dont work with the old glibc installed natively (They are compiled against the fresh glibc and run with the old glibc something IIRC so they segfault - Makefile bugs). This package has not been used by me but other debian people afaik - Probably they should speak up and report problems/success.

Flo

Signature · 3 lines
Florian Lohoff		[email protected]		      	+49-5241-470566
"Technology is a constant battle between manufacturers producing bigger and
more idiot-proof systems and nature producing bigger and better idiots."