2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1989, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * Portions of this source code were derived from Berkeley 2N/A * 4.3 BSD under license from the Regents of the University of 2N/A * Generic client creation with version checking the value of 2N/A * vers_out is set to the highest server supported value 2N/A * vers_low <= vers_out <= vers_high AND an error results 2N/A * if this can not be done. 2N/A * It calls clnt_create_vers_timed() with a NULL value for the timeout 2N/A * pointer, which indicates that the default timeout should be used. 2N/A * This routine has the same definition as clnt_create_vers(), 2N/A * except it takes an additional timeout parameter - a pointer to 2N/A * a timeval structure. A NULL value for the pointer indicates 2N/A * that the default timeout value should be used. 2N/A * Top level client creation routine. 2N/A * Generic client creation: takes (servers name, program-number, nettype) and 2N/A * returns client handle. Default options are set, which the user can 2N/A * change using the rpc equivalent of ioctl()'s. 2N/A * It tries for all the netids in that particular class of netid until 2N/A * XXX The error message in the case of failure will be the one 2N/A * pertaining to the last create error. 2N/A * It calls clnt_create_timed() with the default timeout. 2N/A * This the routine has the same definition as clnt_create(), 2N/A * except it takes an additional timeout parameter - a pointer to 2N/A * a timeval structure. A NULL value for the pointer indicates 2N/A * that the default timeout value should be used. 2N/A * This function calls clnt_tp_create_timed(). 2N/A * Check to see if a rendezvous over doors should be attempted. 2N/A * Make sure this is the local host. 2N/A * Since we didn't get a name-to-address 2N/A * translation failure here, we remember 2N/A * this particular error. The object of 2N/A * this is to enable us to return to the 2N/A * caller a more-specific error than the 2N/A * unhelpful ``Name to address translation 2N/A * failed'' which might well occur if we 2N/A * merely returned the last error (because 2N/A * the local loopbacks are typically the 2N/A * likely to be unable to translate a host 2N/A * name). We also check for a more 2N/A * meaningful error than ``unknown host 2N/A * name'' for the same reasons. 2N/A "RPC_SYSTEMERROR.");
2N/A * Attempt to return an error more specific than ``Name to address 2N/A * translation failed'' or ``unknown host name'' 2N/A * Create a client handle for a well known service or a specific port on 2N/A * host. This routine bypasses rpcbind and can be use to construct a client 2N/A * handle to services that are not registered with rpcbind or where the remote 2N/A * rpcbind is not available, e.g., the remote rpcbind port is blocked by a 2N/A * firewall. We construct a client handle and then ping the service's NULL 2N/A * proc to see that the service is really available. If the caller supplies 2N/A * a non zero port number, the service name is ignored and the port will be 2N/A * used. A non-zero port number limits the protocol family to inet or inet6. 2N/A * handle const of netclass 2N/A * Sinct host, and service are const 2N/A * Check to see if a rendezvous over doors should be attempted. 2N/A * Make sure this is the local host. 2N/A * Check if we can reach the server with this clnt handle 2N/A * Other clnt_create calls do a ping by contacting the 2N/A * remote rpcbind, here will just try to execute the service's 2N/A * Generic client creation: takes (servers name, program-number, netconf) and 2N/A * returns client handle. Default options are set, which the user can 2N/A * change using the rpc equivalent of ioctl()'s : clnt_control() 2N/A * It finds out the server address from rpcbind and calls clnt_tli_create(). 2N/A * It calls clnt_tp_create_timed() with the default timeout. 2N/A * This has the same definition as clnt_tp_create(), except it 2N/A * takes an additional parameter - a pointer to a timeval structure. 2N/A * A NULL value for the timeout pointer indicates that the default 2N/A * value for the timeout should be used. 2N/A * Get the address of the server 2N/A /* appropriate error number is set by rpcbind libraries */ 2N/A /* Reuse the CLIENT handle and change the appropriate fields */ 2N/A "clnt_tp_create_timed: " 2N/A "clnt_tp_create_timed: " 2N/A * Generic client creation: returns client handle. 2N/A * Default options are set, which the user can 2N/A * change using the rpc equivalent of ioctl()'s : clnt_control(). 2N/A * If fd is RPC_ANYFD, it will be opened using nconf. 2N/A * It will be bound if not so. 2N/A * If sizes are 0; appropriate defaults will be chosen. 2N/A * This has the same definition as clnt_tli_create(), except it 2N/A * takes an additional parameter - a pointer to a timeval structure. 2N/A * Not a public interface. This is for clnt_create_timed, 2N/A * clnt_create_vers_times, clnt_tp_create_timed to pass down the 2N/A * timeout value to COTS creation routine. 2N/A * (for bug 4049792: clnt_create_timed does not time out) 2N/A int state;
/* Current state of provider */ 2N/A * Sync the opened fd. 2N/A * Check whether bound or not, else bind it 2N/A "clnt_tli_create: strdup failed");
2N/A "clnt_tli_create: strdup failed");
2N/A/* (void) CLNT_CONTROL(cl, CLSET_POP_TIMOD, NULL); */ 2N/A * To avoid conflicts with the "magic" file descriptors (0, 1, and 2), 2N/A * we try to not use them. The __rpc_raise_fd() routine will dup 2N/A * a descriptor to a higher value. If we fail to do it, we continue 2N/A * to use the old one (and hope for the best). 2N/A /* this is okay, we will syslog an error, then use the new fd */ 2N/A "could not t_close() fd %d; mem & fd leak",
fd);