Remove obsolete rpc usage

Fix compilation fail with glibc 2.27.
The latest version of glibc (2.27 at this time)
is compiled without --enable-obsolete-rpc flag.
This commit is contained in:
Konstantin Makarchev 2018-05-30 13:08:12 +03:00
parent 5478eb4be9
commit a971b9e8e1
2 changed files with 0 additions and 109 deletions

View File

@ -618,38 +618,6 @@ sigar_file_system_list_destroy(sigar_t *sigar,
#define NFS_VERSION 2
#endif
SIGAR_DECLARE(int)
sigar_file_system_ping(sigar_t *sigar,
sigar_file_system_t *fs)
{
int status = SIGAR_OK;
#ifndef WIN32
char *ptr;
if ((fs->type == SIGAR_FSTYPE_NETWORK) &&
strEQ(fs->sys_type_name, "nfs") &&
(ptr = strchr(fs->dev_name, ':')))
{
*ptr = '\0'; /* "hostname:/mount" -> "hostname" */
status = sigar_rpc_ping(fs->dev_name,
SIGAR_NETCONN_UDP,
NFS_PROGRAM, NFS_VERSION);
if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[fs_ping] %s -> %s: %s",
fs->dir_name, fs->dev_name,
((status == SIGAR_OK) ?
"OK" : sigar_rpc_strerror(status)));
}
*ptr = ':'; /* "hostname" -> "hostname:/mount" */
}
#endif
return status;
}
int sigar_cpu_info_list_create(sigar_cpu_info_list_t *cpu_infos)
{
cpu_infos->number = 0;

View File

@ -739,9 +739,6 @@ int sigar_cpu_mhz_from_model(char *model)
#if !defined(WIN32) && !defined(NETWARE)
#include <netdb.h>
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#ifdef SIGAR_HPUX
#include <nfs/nfs.h>
#endif
@ -749,84 +746,10 @@ int sigar_cpu_mhz_from_model(char *model)
#include <arpa/inet.h>
#endif
#if defined(__sun) || defined(SIGAR_HPUX)
#include <rpc/clnt_soc.h>
#endif
#if defined(_AIX) || defined(SIGAR_HPUX) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/socket.h>
#endif
static enum clnt_stat get_sockaddr(struct sockaddr_in *addr, char *host)
{
register struct hostent *hp;
sigar_hostent_t data;
memset(addr, 0, sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
if ((addr->sin_addr.s_addr = inet_addr(host)) == -1) {
if (!(hp = sigar_gethostbyname(host, &data))) {
return RPC_UNKNOWNHOST;
}
memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
}
return RPC_SUCCESS;
}
char *sigar_rpc_strerror(int err)
{
return (char *)clnt_sperrno(err);
}
SIGAR_DECLARE(int) sigar_rpc_ping(char *host,
int protocol,
unsigned long program,
unsigned long version)
{
CLIENT *client;
struct sockaddr_in addr;
int sock;
struct timeval timeout;
unsigned short port = 0;
enum clnt_stat rpc_stat;
rpc_stat = get_sockaddr(&addr, host);
if (rpc_stat != RPC_SUCCESS) {
return rpc_stat;
}
timeout.tv_sec = 2;
timeout.tv_usec = 0;
addr.sin_port = htons(port);
sock = RPC_ANYSOCK;
if (protocol == SIGAR_NETCONN_UDP) {
client =
clntudp_create(&addr, program, version,
timeout, &sock);
}
else if (protocol == SIGAR_NETCONN_TCP) {
client =
clnttcp_create(&addr, program, version,
&sock, 0, 0);
}
else {
return RPC_UNKNOWNPROTO;
}
if (!client) {
return rpc_createerr.cf_stat;
}
timeout.tv_sec = 10;
timeout.tv_usec = 0;
rpc_stat = clnt_call(client, NULLPROC, (xdrproc_t)xdr_void, NULL,
(xdrproc_t)xdr_void, NULL, timeout);
clnt_destroy(client);
return rpc_stat;
}
#endif
int sigar_file2str(const char *fname, char *buffer, int buflen)