Subject: ioctl, fcntl, Bad file descriptor
To: None <port-macppc@NetBSD.org>
From: Dominik Epple <epple@tphys.physik.uni-tuebingen.de>
List: port-macppc
Date: 04/06/2005 11:47:58
Hi list,

I now have GNOME running on NetBSD/macppc on the Mac Mini. :)

Operating system is
NetBSD cork.local 3.99.1 NetBSD 3.99.1 (GENERIC) #2: Tue Mar 22 00:23:19 CET 2005  root@cork.local:/usr/obj/sys/arch/macppc/compile/GENERIC macppc

Pkgsrc is the 2005-Q1 tarball found here:
ftp://ftp.netbsd.org/pub/pkgsrc/2005Q1/pkgsrc-2005Q1.tar.bz2

I then do a 'startx' with an .xinitrc firing up only an xterm. In this
xterm I start 'gnome-session'. Then, after some seconds, the well-known
gnome desktop appears. Then, when trying to open a gnome-terminal,
I get the following messages on the xterm, and a gnome-terminal window
is visible for some fractions of a second and then closes.

========
** (gnome-terminal:19219): WARNING **: Error setting PTY size: Bad file descriptor.

** (gnome-terminal:19219): WARNING **: Error reading PTY size, using defaults: Bad file descriptor.

(gnome-terminal:19219): GLib-WARNING **: giounix.c:400Error while getting flags for FD: Bad file descriptor (9)
========

This is not http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=28364 -- although similar, but the error message differs.

The corresponding code fragments are

/usr/pkgsrc/x11/vte/work/vte-0.11.12/src/pty.c:634
        ret = ioctl(master, TIOCSWINSZ, &size);

/usr/pkgsrc/x11/vte/work/vte-0.11.12/src/pty.c:662
        ret = ioctl(master, TIOCGWINSZ, &size);

/usr/pkgsrc/devel/glib2/work/glib-2.6.3/glib/giounix.c:400:
  fcntl_flags = fcntl (unix_channel->fd, F_GETFL);

The ioctl calls are failing as well as the fcntl call.

Am I missing something in the kernel configuration? I did not change
the GENERIC configuration... Or should I upgrade my system? It is
somewhat old compared to the pace of -current (some weeks) but a
recent ./build.sh failed, so I was unable to verify this problem with
a recent kernel.

Any hints?

Regards, Dominik.
--