1.\" $OpenBSD: ypconnect.2,v 1.3 2022/07/21 22:45:06 deraadt Exp $ 2.\" 3.\" Copyright (c) 2022 Theo de Raadt <deraadt@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: July 21 2022 $ 18.Dt YPCONNECT 2 19.Os 20.Sh NAME 21.Nm ypconnect 22.Nd create connected socket to a YP server 23.Sh SYNOPSIS 24.In sys/socket.h 25.Ft int 26.Fn ypconnect "int type" 27.Sh DESCRIPTION 28The 29.Fn ypconnect 30system call creates a pre-connected 31.Va SOCK_STREAM 32or 33.Va SOCK_DGRAM 34socket to a YP server (either the original 35.Xr ypserv 8 36or 37.Xr ypldap 8 ) 38for use by internal library routines. 39It verifies that the domainname is set, that 40.Xr ypbind 8 41has found a server and created an advisory locked binding file, 42and then creates the connected socket based upon the binding file. 43This type of socket is restricted in various ways and is not 44general purpose. 45.Nm 46is only intended for use by internal libc YP functions. 47.Sh RETURN VALUES 48If successful, 49.Fn ypconnect 50returns a non-negative integer, the socket file descriptor. 51Otherwise, a value of \-1 is returned and 52.Va errno 53is set to indicate the error. 54.Sh ERRORS 55.Fn ypconnect 56will fail if: 57.Bl -tag -width Er 58.It Bq Er EAFNOSUPPORT 59The YP subsystem is not active. 60.It Bq Er EFTYPE 61The YP binding file is strange. 62.It Bq Er EOWNERDEAD 63The YP binding file is not locked. 64YP subsystem is not active. 65.It Bq Er EMFILE 66The per-process descriptor table is full. 67.It Bq Er ENFILE 68The system file table is full. 69.It Bq Er ENOBUFS 70Insufficient resources were available in the system to perform the operation. 71.El 72.Sh SEE ALSO 73.Xr connect 2 , 74.Xr socket 2 , 75.Xr ypbind 8 76.Sh HISTORY 77The 78.Fn ypconnect 79function first appeared in 80.Ox 7.2 . 81