ttyname_r
Daniel Eischen
eischen at vigrid.com
Mon Jul 7 22:42:20 PDT 2003
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
More information about the freebsd-threads
mailing list