.\" .\" Copyright (c) 2002 Todd C. Miller .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY .\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL .\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, .\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $OpenBSD: isfdtype.3,v 1.1 2002/10/16 16:10:24 millert Exp $ .\" .Dd October 15, 2002 .Dt ISFDTYPE 3 .Os .Sh NAME .Nm isfdtype .Nd determine whether a file descriptor is of a specific type .Sh SYNOPSIS .Fd #include .Ft int .Fn isfdtype "int fd" "int fdtype" .Sh DESCRIPTION The .Fn isfdtype function checks whether or not the file descriptor .Fa fd is of type .Fa fdtype . .Pp A list of possible file types may be found in .Xr stat 2 and the .Cm include file. .Sh RETURN VALUES The .Fn isfdtype function returns 1 if .Fa fd is of type .Fa fdtype and 0 if it is not. If .Fn isfdtype fails, a value of \-1 is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS The following error codes may be set in .Va errno : .Bl -tag -width Er .It Bq Er EBADF .Fa fd is not a valid open file descriptor. .It Bq Er EIO An I/O error occurred while reading from or writing to the file system. .El .Sh SEE ALSO .Xr stat 2 .Sh STANDARDS The .Fn isfdtype function is expected to conform to \*(Px 1003.1g. .Sh HISTORY The .Fn isfdtype function first appeared in .Ox 3.3 .