Fix build by using the driver API (driver converted in r266979 which should
be upstreamed).

X-MFC with:	r268854
MFC after:	5 days
ttyname(3): Fix EBADF/ENOTTY error descriptions.

Also, make sure to document the return values and errors for all three
functions in the man page.

PR:		191931
MFC after:	1 week