/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
tv.tv_sec = 1;
tv.tv_usec = 0;
bzero(&sopt, sizeof sopt);
+ sopt.sopt_dir = SOPT_SET;
sopt.sopt_level = SOL_SOCKET;
sopt.sopt_name = SO_RCVTIMEO;
sopt.sopt_val = &tv;
printf("RPC timeout for server " IP_FORMAT "\n",
IP_LIST(&(sin->sin_addr.s_addr)));
+ /*
+ * soreceive is now conditionally using this pointer
+ * if present, it updates per-proc stats
+ */
+ auio.uio_procp = NULL;
+
/*
* Wait for up to timo seconds for a reply.
* The socket receive timeout was set to 1 second.
if (reply->rp_astatus != 0) {
error = ntohl(reply->rp_u.rpu_errno);
printf("rpc denied, error=%d\n", error);
- continue;
+ /* convert rpc error to errno */
+ switch (error) {
+ case RPC_MISMATCH:
+ error = ERPCMISMATCH;
+ break;
+ case RPC_AUTHERR:
+ error = EAUTH;
+ break;
+ }
+ goto out;
}
/* Did the call succeed? */
if ((error = ntohl(reply->rp_u.rpu_ok.rp_rstatus)) != 0) {
printf("rpc status=%d\n", error);
- continue;
+ /* convert rpc error to errno */
+ switch (error) {
+ case RPC_PROGUNAVAIL:
+ error = EPROGUNAVAIL;
+ break;
+ case RPC_PROGMISMATCH:
+ error = EPROGMISMATCH;
+ break;
+ case RPC_PROCUNAVAIL:
+ error = EPROCUNAVAIL;
+ break;
+ case RPC_GARBAGE:
+ error = EINVAL;
+ break;
+ case RPC_SYSTEM_ERR:
+ error = EIO;
+ break;
+ }
+ goto out;
}
goto gotreply; /* break two levels */