Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jul 2003 01:42:18 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: ttyname_r
Message-ID:  <Pine.GSO.4.10.10307080138130.16037-100000@pcnet5.pcnet.com>
In-Reply-To: <008201c344fc$392c0760$f001a8c0@davidw2k>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 8 Jul 2003, David Xu wrote:

> I found our ttyname_r has different return type than POSIX:
> http://www.opengroup.org/onlinepubs/007904975/functions/ttyname.html
> and POSIX says:
>     If successful, the ttyname_r() function shall return zero.
>     Otherwise, an error number shall be returned to indicate the error.
> 
> libc implements it as following format:
> char * ttyname_r(int fd, char *buf, size_t len);
> and when success, it returns non-NULL pointer, it almost has opposite
> meaning with POSIX.
> This causes some pthread tests failed here.

I seem to remember this issue coming up before, but I don't
recall what the outcome was.  FWIW, Solaris defines ttyname_r
both ways (according to to ttyname_r(3C)):

	#ifdef _POSIX_PTHREAD_SEMANTICS
	int ttyname_r(int fildes, char *name, size_t namesize);
	#else
	char *ttyname_r(int fildes, char *name, int namelen);
	#endif

I'd support changing it, but I don't know whether we'd need
a library version bump to do that.

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10307080138130.16037-100000>