Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/stdlib/ptsname.3
Show All 25 Lines | |||||||||||
.\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | .\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||||||||||
.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | .\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||||||||||
.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||||||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||||||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||
.\" | .\" | ||||||||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||||||||
.\" | .\" | ||||||||||
.Dd August 20, 2008 | .Dd October 9, 2020 | ||||||||||
.Dt PTSNAME 3 | .Dt PTSNAME 3 | ||||||||||
.Os | .Os | ||||||||||
.Sh NAME | .Sh NAME | ||||||||||
.Nm grantpt , | .Nm grantpt , | ||||||||||
.Nm ptsname , | .Nm ptsname , | ||||||||||
.Nm ptsname_r , | |||||||||||
.Nm unlockpt | .Nm unlockpt | ||||||||||
.Nd pseudo-terminal access functions | .Nd pseudo-terminal access functions | ||||||||||
.Sh LIBRARY | .Sh LIBRARY | ||||||||||
.Lb libc | .Lb libc | ||||||||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||||||||
.In stdlib.h | .In stdlib.h | ||||||||||
.Ft int | .Ft int | ||||||||||
.Fn grantpt "int fildes" | .Fn grantpt "int fildes" | ||||||||||
.Ft "char *" | .Ft "char *" | ||||||||||
.Fn ptsname "int fildes" | .Fn ptsname "int fildes" | ||||||||||
.Ft "int" | |||||||||||
.Fn ptsname_r "int fildes" "char *buffer" "size_t buflen" | |||||||||||
.Ft int | .Ft int | ||||||||||
.Fn unlockpt "int fildes" | .Fn unlockpt "int fildes" | ||||||||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||||||||
The | The | ||||||||||
.Fn grantpt , | .Fn grantpt , | ||||||||||
.Fn ptsname , | .Fn ptsname , | ||||||||||
and | and | ||||||||||
.Fn unlockpt | .Fn unlockpt | ||||||||||
Show All 24 Lines | |||||||||||
This value can be used | This value can be used | ||||||||||
to subsequently open the appropriate slave after | to subsequently open the appropriate slave after | ||||||||||
.Xr posix_openpt 2 | .Xr posix_openpt 2 | ||||||||||
and | and | ||||||||||
.Fn grantpt | .Fn grantpt | ||||||||||
have been called. | have been called. | ||||||||||
.Pp | .Pp | ||||||||||
The | The | ||||||||||
.Fn ptsname_r | |||||||||||
function is the thread-safe version of | |||||||||||
.Fn ptsname . | |||||||||||
The caller must provide storage for the results of the full pathname of | |||||||||||
the slave device in the | |||||||||||
.Fa buffer | |||||||||||
and | |||||||||||
.Fa bufsize | |||||||||||
arguments. | |||||||||||
.Pp | |||||||||||
The | |||||||||||
.Fn unlockpt | .Fn unlockpt | ||||||||||
function clears the lock held on the pseudo-terminal pair | function clears the lock held on the pseudo-terminal pair | ||||||||||
for the master device specified with | for the master device specified with | ||||||||||
.Fa fildes . | .Fa fildes . | ||||||||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||||||||
.Rv -std grantpt unlockpt | .Rv -std grantpt ptsname_r unlockpt | ||||||||||
.Pp | .Pp | ||||||||||
The | The | ||||||||||
.Fn ptsname | .Fn ptsname | ||||||||||
function returns a pointer to the name | function returns a pointer to the name | ||||||||||
of the slave device on success; otherwise a | of the slave device on success; otherwise a | ||||||||||
.Dv NULL | .Dv NULL | ||||||||||
pointer is returned. | pointer is returned. | ||||||||||
.Sh ERRORS | .Sh ERRORS | ||||||||||
The | The | ||||||||||
.Fn grantpt , | .Fn grantpt , | ||||||||||
.Fn ptsname | .Fn ptsname , | ||||||||||
.Fn ptsname_r | |||||||||||
jilles: I think `.Fn ptsname_r` should be added here as well. | |||||||||||
and | and | ||||||||||
.Fn unlockpt | .Fn unlockpt | ||||||||||
functions may fail and set | functions may fail and set | ||||||||||
.Va errno | .Va errno | ||||||||||
to: | to: | ||||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||||
.It Bq Er EBADF | .It Bq Er EBADF | ||||||||||
.Fa fildes | .Fa fildes | ||||||||||
is not a valid open file descriptor. | is not a valid open file descriptor. | ||||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||||
.Fa fildes | .Fa fildes | ||||||||||
is not a master pseudo-terminal device. | is not a master pseudo-terminal device. | ||||||||||
.El | |||||||||||
.Pp | |||||||||||
In addition, the | |||||||||||
.Fn ptsname_r | |||||||||||
function may set | |||||||||||
.Va errno | |||||||||||
to: | |||||||||||
.Bl -tag -width Er | |||||||||||
Done Inline Actions
Macros like Er do not expand here. It's much better to just put ERANGE here as the argument to width. 0mp: Macros like Er do not expand here. It's much better to just put `ERANGE` here as the argument… | |||||||||||
Done Inline ActionsIt looks like it's the recommended practice at https://mandoc.bsd.lv/mdoc/details/width.html#Macro_default_widths (and observing the output, using "ERANGE" would make the description wrap into its own line) so I have changed it back. delphij: It looks like it's the recommended practice at https://mandoc.bsd.lv/mdoc/details/width. | |||||||||||
.It Bq Er ERANGE | |||||||||||
The buffer was too small. | |||||||||||
Done Inline Actions
jilles: | |||||||||||
.El | .El | ||||||||||
.Pp | .Pp | ||||||||||
In addition, the | In addition, the | ||||||||||
.Fn grantpt | .Fn grantpt | ||||||||||
function may set | function may set | ||||||||||
.Va errno | .Va errno | ||||||||||
to: | to: | ||||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||||
Show All 35 Lines |
I think .Fn ptsname_r should be added here as well.