From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVAck-0001wk-Rn for qemu-devel@nongnu.org; Mon, 18 Aug 2008 15:42:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVAcj-0001wT-Di for qemu-devel@nongnu.org; Mon, 18 Aug 2008 15:42:42 -0400 Received: from [199.232.76.173] (port=58650 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVAcj-0001wP-8e for qemu-devel@nongnu.org; Mon, 18 Aug 2008 15:42:41 -0400 Received: from mail2.shareable.org ([80.68.89.115]:40684) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KVAcj-0003pj-2X for qemu-devel@nongnu.org; Mon, 18 Aug 2008 15:42:41 -0400 Date: Mon, 18 Aug 2008 20:42:39 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] pty/tty functions for BSD too Message-ID: <20080818194238.GB20308@shareable.org> References: <20080818105912.GF4686@implementation.uk.xensource.com> <48A981F1.6070606@codemonkey.ws> <20080818142333.GQ4686@implementation.uk.xensource.com> <20080818162618.GA20089@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Blue Swirl wrote: > And ptsname() is used to get the pty name, which uses either hard > coded buffer length of _PATH_DEVPTS or _PATH_TTY: > http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/ptsname.c?rev=1.15&content-type=text/x-cvsweb-markup&cvsroot=glibc > > OpenBSD forces the name to be in format "/dev/ptyXX": > http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/pty.c?rev=1.15&content-type=text/x-cvsweb-markup > > NetBSD is similar, except also /dev/ttyXX is possible: > http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libutil/pty.c?rev=1.29&content-type=text/x-cvsweb-markup Other platforms use slightly longer names, but I've never heard of one that wouldn't fit into PATH_MAX - assuming PATH_MAX is sane. I'd still use ptsname()/ptsname_r() when available though. -- Jamie