Problem with screen
Matthias Apitz
guru at unixarea.de
Wed May 9 14:39:35 UTC 2018
El día Wednesday, May 09, 2018 a las 03:44:56PM +0200, Albert Shih escribió:
> Hi,
>
> I've got a freebsd 11.1-RELEASE-p6 on bare-metal and I've got a very
> strange problem.
>
> When I launch screen it's take very long time to create a screen.
>
> So I try truss screen, in a typescript, and I got
>
> close(11285153) ERR#9 'Bad file descriptor'
> close(11285152) ERR#9 'Bad file descriptor'
> ..............
> close(1) ERR#9 'Bad file descriptor'
>
> between those I got
>
> 11285150 lines of
>
> close(....) ERR#9 'Bad file descriptor'
>
> Everything are up2date on the server.
>
> Anyone got a idea ?
I'd say a bug. It wants to close all possible
filedescriptors, regardless if they're open or not, from some (wrong
deduced) maximal value to 1.
I checked out the port and modified the function closing the files in
misc.c:
void
closeallfiles(except)
int except;
{
int f;
#ifdef SVR4
struct rlimit rl;
if ((getrlimit(RLIMIT_NOFILE, &rl) == 0) && rl.rlim_max != RLIM_INFINITY) {
f = rl.rlim_max;
printf("1: closeallfiles: %d\n", f);
} else
#endif /* SVR4 */
#if defined(SYSV) && defined(NOFILE) && !defined(ISC)
f = NOFILE;
printf("2: closeallfiles: %d\n", f);
#else /* SYSV && !ISC */
f = getdtablesize();
printf("3: closeallfiles: %d\n", f);
#endif /* SYSV && !ISC */
printf("closeallfiles: %d\n", f);
exit(1);
while (--f > 2)
if (f != except)
close(f);
}
it prints:
./screen
1: closeallfiles: 116973
3: closeallfiles: 116973
closeallfiles: 116973
So you see where the bug comes from ...
matthias
--
Matthias Apitz, ✉ guru at unixarea.de, ⌂ http://www.unixarea.de/ 📱 +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
More information about the freebsd-questions
mailing list