mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-16 06:27:01 +08:00
Update to FreeBSD head 2016-08-23
Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
This commit is contained in:
@@ -111,9 +111,7 @@ static struct netbuf *got_entry(rpcb_entry_list_ptr, const struct netconfig *);
|
||||
* These are private routines that may not be provided in future releases.
|
||||
*/
|
||||
bool_t
|
||||
__rpc_control(request, info)
|
||||
int request;
|
||||
void *info;
|
||||
__rpc_control(int request, void *info)
|
||||
{
|
||||
switch (request) {
|
||||
case CLCR_GET_RPCB_TIMEOUT:
|
||||
@@ -152,8 +150,7 @@ __rpc_control(request, info)
|
||||
*/
|
||||
|
||||
static struct address_cache *
|
||||
check_cache(host, netid)
|
||||
const char *host, *netid;
|
||||
check_cache(const char *host, const char *netid)
|
||||
{
|
||||
struct address_cache *cptr;
|
||||
|
||||
@@ -173,8 +170,7 @@ check_cache(host, netid)
|
||||
}
|
||||
|
||||
static void
|
||||
delete_cache(addr)
|
||||
struct netbuf *addr;
|
||||
delete_cache(struct netbuf *addr)
|
||||
{
|
||||
struct address_cache *cptr, *prevptr = NULL;
|
||||
|
||||
@@ -185,8 +181,7 @@ delete_cache(addr)
|
||||
free(cptr->ac_netid);
|
||||
free(cptr->ac_taddr->buf);
|
||||
free(cptr->ac_taddr);
|
||||
if (cptr->ac_uaddr)
|
||||
free(cptr->ac_uaddr);
|
||||
free(cptr->ac_uaddr);
|
||||
if (prevptr)
|
||||
prevptr->ac_next = cptr->ac_next;
|
||||
else
|
||||
@@ -200,10 +195,8 @@ delete_cache(addr)
|
||||
}
|
||||
|
||||
static void
|
||||
add_cache(host, netid, taddr, uaddr)
|
||||
const char *host, *netid;
|
||||
char *uaddr;
|
||||
struct netbuf *taddr;
|
||||
add_cache(const char *host, const char *netid, struct netbuf *taddr,
|
||||
char *uaddr)
|
||||
{
|
||||
struct address_cache *ad_cache, *cptr, *prevptr;
|
||||
|
||||
@@ -224,14 +217,10 @@ add_cache(host, netid, taddr, uaddr)
|
||||
ad_cache->ac_taddr->buf = (char *) malloc(taddr->len);
|
||||
if (ad_cache->ac_taddr->buf == NULL) {
|
||||
out:
|
||||
if (ad_cache->ac_host)
|
||||
free(ad_cache->ac_host);
|
||||
if (ad_cache->ac_netid)
|
||||
free(ad_cache->ac_netid);
|
||||
if (ad_cache->ac_uaddr)
|
||||
free(ad_cache->ac_uaddr);
|
||||
if (ad_cache->ac_taddr)
|
||||
free(ad_cache->ac_taddr);
|
||||
free(ad_cache->ac_host);
|
||||
free(ad_cache->ac_netid);
|
||||
free(ad_cache->ac_uaddr);
|
||||
free(ad_cache->ac_taddr);
|
||||
free(ad_cache);
|
||||
return;
|
||||
}
|
||||
@@ -264,8 +253,7 @@ out:
|
||||
free(cptr->ac_netid);
|
||||
free(cptr->ac_taddr->buf);
|
||||
free(cptr->ac_taddr);
|
||||
if (cptr->ac_uaddr)
|
||||
free(cptr->ac_uaddr);
|
||||
free(cptr->ac_uaddr);
|
||||
|
||||
if (prevptr) {
|
||||
prevptr->ac_next = NULL;
|
||||
@@ -288,10 +276,7 @@ out:
|
||||
* On error, returns NULL and free's everything.
|
||||
*/
|
||||
static CLIENT *
|
||||
getclnthandle(host, nconf, targaddr)
|
||||
const char *host;
|
||||
const struct netconfig *nconf;
|
||||
char **targaddr;
|
||||
getclnthandle(const char *host, const struct netconfig *nconf, char **targaddr)
|
||||
{
|
||||
CLIENT *client;
|
||||
struct netbuf *addr, taddr;
|
||||
@@ -437,7 +422,7 @@ getclnthandle(host, nconf, targaddr)
|
||||
* rpcbind. Returns NULL on error and free's everything.
|
||||
*/
|
||||
static CLIENT *
|
||||
local_rpcb()
|
||||
local_rpcb(void)
|
||||
{
|
||||
CLIENT *client;
|
||||
static struct netconfig *loopnconf;
|
||||
@@ -516,6 +501,7 @@ try_nconf:
|
||||
hostname = IN6_LOCALHOST_STRING;
|
||||
}
|
||||
}
|
||||
endnetconfig(nc_handle);
|
||||
if (tmpnconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
mutex_unlock(&loopnconf_lock);
|
||||
@@ -523,7 +509,6 @@ try_nconf:
|
||||
}
|
||||
loopnconf = getnetconfigent(tmpnconf->nc_netid);
|
||||
/* loopnconf is never freed */
|
||||
endnetconfig(nc_handle);
|
||||
}
|
||||
mutex_unlock(&loopnconf_lock);
|
||||
client = getclnthandle(hostname, loopnconf, NULL);
|
||||
@@ -533,13 +518,13 @@ try_nconf:
|
||||
/*
|
||||
* Set a mapping between program, version and address.
|
||||
* Calls the rpcbind service to do the mapping.
|
||||
*
|
||||
* nconf - Network structure of transport
|
||||
* address - Services netconfig address
|
||||
*/
|
||||
bool_t
|
||||
rpcb_set(program, version, nconf, address)
|
||||
rpcprog_t program;
|
||||
rpcvers_t version;
|
||||
const struct netconfig *nconf; /* Network structure of transport */
|
||||
const struct netbuf *address; /* Services netconfig address */
|
||||
rpcb_set(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
|
||||
const struct netbuf *address)
|
||||
{
|
||||
CLIENT *client;
|
||||
bool_t rslt = FALSE;
|
||||
@@ -596,10 +581,7 @@ rpcb_set(program, version, nconf, address)
|
||||
* only for the given transport.
|
||||
*/
|
||||
bool_t
|
||||
rpcb_unset(program, version, nconf)
|
||||
rpcprog_t program;
|
||||
rpcvers_t version;
|
||||
const struct netconfig *nconf;
|
||||
rpcb_unset(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf)
|
||||
{
|
||||
CLIENT *client;
|
||||
bool_t rslt = FALSE;
|
||||
@@ -636,9 +618,7 @@ rpcb_unset(program, version, nconf)
|
||||
* From the merged list, find the appropriate entry
|
||||
*/
|
||||
static struct netbuf *
|
||||
got_entry(relp, nconf)
|
||||
rpcb_entry_list_ptr relp;
|
||||
const struct netconfig *nconf;
|
||||
got_entry(rpcb_entry_list_ptr relp, const struct netconfig *nconf)
|
||||
{
|
||||
struct netbuf *na = NULL;
|
||||
rpcb_entry_list_ptr sp;
|
||||
@@ -669,7 +649,7 @@ got_entry(relp, nconf)
|
||||
* local transport.
|
||||
*/
|
||||
static bool_t
|
||||
__rpcbind_is_up()
|
||||
__rpcbind_is_up(void)
|
||||
{
|
||||
struct netconfig *nconf;
|
||||
struct sockaddr_un sun;
|
||||
@@ -683,11 +663,11 @@ __rpcbind_is_up()
|
||||
strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
|
||||
break;
|
||||
}
|
||||
endnetconfig(localhandle);
|
||||
|
||||
if (nconf == NULL)
|
||||
return (FALSE);
|
||||
|
||||
endnetconfig(localhandle);
|
||||
|
||||
memset(&sun, 0, sizeof sun);
|
||||
sock = _socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (sock < 0)
|
||||
@@ -724,13 +704,9 @@ __rpcbind_is_up()
|
||||
* starts working properly. Also look under clnt_vc.c.
|
||||
*/
|
||||
struct netbuf *
|
||||
__rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
|
||||
rpcprog_t program;
|
||||
rpcvers_t version;
|
||||
const struct netconfig *nconf;
|
||||
const char *host;
|
||||
CLIENT **clpp;
|
||||
struct timeval *tp;
|
||||
__rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
|
||||
const struct netconfig *nconf, const char *host,
|
||||
CLIENT **clpp, struct timeval *tp)
|
||||
{
|
||||
static bool_t check_rpcbind = TRUE;
|
||||
CLIENT *client = NULL;
|
||||
@@ -818,10 +794,8 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
|
||||
malloc(remote.len)) == NULL)) {
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
clnt_geterr(client, &rpc_createerr.cf_error);
|
||||
if (address) {
|
||||
free(address);
|
||||
address = NULL;
|
||||
}
|
||||
free(address);
|
||||
address = NULL;
|
||||
goto error;
|
||||
}
|
||||
memcpy(address->buf, remote.buf, remote.len);
|
||||
@@ -1039,12 +1013,8 @@ done:
|
||||
* Assuming that the address is all properly allocated
|
||||
*/
|
||||
bool_t
|
||||
rpcb_getaddr(program, version, nconf, address, host)
|
||||
rpcprog_t program;
|
||||
rpcvers_t version;
|
||||
const struct netconfig *nconf;
|
||||
struct netbuf *address;
|
||||
const char *host;
|
||||
rpcb_getaddr(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
|
||||
struct netbuf *address, const char *host)
|
||||
{
|
||||
struct netbuf *na;
|
||||
|
||||
@@ -1075,9 +1045,7 @@ rpcb_getaddr(program, version, nconf, address, host)
|
||||
* It returns NULL on failure.
|
||||
*/
|
||||
rpcblist *
|
||||
rpcb_getmaps(nconf, host)
|
||||
const struct netconfig *nconf;
|
||||
const char *host;
|
||||
rpcb_getmaps(const struct netconfig *nconf, const char *host)
|
||||
{
|
||||
rpcblist_ptr head = NULL;
|
||||
CLIENT *client;
|
||||
@@ -1125,19 +1093,20 @@ done:
|
||||
* which will look up a service program in the address maps, and then
|
||||
* remotely call that routine with the given parameters. This allows
|
||||
* programs to do a lookup and call in one step.
|
||||
*/
|
||||
*
|
||||
* nconf -Netconfig structure
|
||||
* host - Remote host name
|
||||
* proc - Remote proc identifiers
|
||||
* xdrargs, xdrres; XDR routines
|
||||
* argsp, resp - Argument and Result
|
||||
* tout - Timeout value for this call
|
||||
* addr_ptr - Preallocated netbuf address
|
||||
*/
|
||||
enum clnt_stat
|
||||
rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
|
||||
xdrres, resp, tout, addr_ptr)
|
||||
const struct netconfig *nconf; /* Netconfig structure */
|
||||
const char *host; /* Remote host name */
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
rpcproc_t proc; /* Remote proc identifiers */
|
||||
xdrproc_t xdrargs, xdrres; /* XDR routines */
|
||||
caddr_t argsp, resp; /* Argument and Result */
|
||||
struct timeval tout; /* Timeout value for this call */
|
||||
const struct netbuf *addr_ptr; /* Preallocated netbuf address */
|
||||
rpcb_rmtcall(const struct netconfig *nconf, const char *host, rpcprog_t prog,
|
||||
rpcvers_t vers, rpcproc_t proc, xdrproc_t xdrargs, caddr_t argsp,
|
||||
xdrproc_t xdrres, caddr_t resp, struct timeval tout,
|
||||
const struct netbuf *addr_ptr)
|
||||
{
|
||||
CLIENT *client;
|
||||
enum clnt_stat stat;
|
||||
@@ -1208,9 +1177,7 @@ error:
|
||||
* Returns 1 if succeeds else 0.
|
||||
*/
|
||||
bool_t
|
||||
rpcb_gettime(host, timep)
|
||||
const char *host;
|
||||
time_t *timep;
|
||||
rpcb_gettime(const char *host, time_t *timep)
|
||||
{
|
||||
CLIENT *client = NULL;
|
||||
void *handle;
|
||||
@@ -1269,9 +1236,7 @@ rpcb_gettime(host, timep)
|
||||
* really be called because local n2a libraries are always provided.
|
||||
*/
|
||||
char *
|
||||
rpcb_taddr2uaddr(nconf, taddr)
|
||||
struct netconfig *nconf;
|
||||
struct netbuf *taddr;
|
||||
rpcb_taddr2uaddr(struct netconfig *nconf, struct netbuf *taddr)
|
||||
{
|
||||
CLIENT *client;
|
||||
char *uaddr = NULL;
|
||||
@@ -1303,9 +1268,7 @@ rpcb_taddr2uaddr(nconf, taddr)
|
||||
* really be called because local n2a libraries are always provided.
|
||||
*/
|
||||
struct netbuf *
|
||||
rpcb_uaddr2taddr(nconf, uaddr)
|
||||
struct netconfig *nconf;
|
||||
char *uaddr;
|
||||
rpcb_uaddr2taddr(struct netconfig *nconf, char *uaddr)
|
||||
{
|
||||
CLIENT *client;
|
||||
struct netbuf *taddr;
|
||||
|
Reference in New Issue
Block a user