diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-10-07 15:10:20 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-01-10 09:53:31 +0100 |
commit | c40e45b75eb76d79a05c7fa85c1fa9b5c728a12f (patch) | |
tree | ad4f2519067709f00ab98b3c591186c26dc3a21f /freebsd/lib/libc/rpc/auth_time.c | |
parent | userspace-header-gen.py: Simplify program ports (diff) | |
download | rtems-libbsd-c40e45b75eb76d79a05c7fa85c1fa9b5c728a12f.tar.bz2 |
Update to FreeBSD head 2016-08-23
Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
Diffstat (limited to 'freebsd/lib/libc/rpc/auth_time.c')
-rw-r--r-- | freebsd/lib/libc/rpc/auth_time.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/freebsd/lib/libc/rpc/auth_time.c b/freebsd/lib/libc/rpc/auth_time.c index 09e197a7..a685ebb5 100644 --- a/freebsd/lib/libc/rpc/auth_time.c +++ b/freebsd/lib/libc/rpc/auth_time.c @@ -63,8 +63,7 @@ extern int _rpc_dtablesize( void ); static int saw_alarm = 0; static void -alarm_hndler(s) - int s; +alarm_hndler(int s) { saw_alarm = 1; return; @@ -85,12 +84,7 @@ alarm_hndler(s) * Turn a 'universal address' into a struct sockaddr_in. * Bletch. */ -static int uaddr_to_sockaddr(uaddr, sin) -#ifdef foo - endpoint *endpt; -#endif - char *uaddr; - struct sockaddr_in *sin; +static int uaddr_to_sockaddr(char *uaddr, struct sockaddr_in *sin) { unsigned char p_bytes[2]; int i; @@ -120,9 +114,7 @@ static int uaddr_to_sockaddr(uaddr, sin) * Free the strings that were strduped into the eps structure. */ static void -free_eps(eps, num) - endpoint eps[]; - int num; +free_eps(endpoint eps[], int num) { int i; @@ -144,14 +136,15 @@ free_eps(eps, num) * fact that gethostbyname() could do an NIS search. Ideally, the * NIS+ server will call __rpc_get_time_offset() with the nis_server * structure already populated. + * + * host - name of the time host + * srv - nis_server struct to use. + * eps[] - array of endpoints + * maxep - max array size */ static nis_server * -get_server(sin, host, srv, eps, maxep) - struct sockaddr_in *sin; - char *host; /* name of the time host */ - nis_server *srv; /* nis_server struct to use. */ - endpoint eps[]; /* array of endpoints */ - int maxep; /* max array size */ +get_server(struct sockaddr_in *sin, char *host, nis_server *srv, + endpoint eps[], int maxep) { char hname[256]; int num_ep = 0, i; @@ -238,14 +231,16 @@ get_server(sin, host, srv, eps, maxep) * structure and to then contact the machine for the time. * * td = "server" - "client" + * + * td - Time difference + * srv - NIS Server description + * thost - if no server, this is the timehost + * uaddr - known universal address + * netid - known network identifier */ int -__rpc_get_time_offset(td, srv, thost, uaddr, netid) - struct timeval *td; /* Time difference */ - nis_server *srv; /* NIS Server description */ - char *thost; /* if no server, this is the timehost */ - char **uaddr; /* known universal address */ - struct sockaddr_in *netid; /* known network identifier */ +__rpc_get_time_offset(struct timeval *td, nis_server *srv, char *thost, + char **uaddr, struct sockaddr_in *netid) { CLIENT *clnt; /* Client handle */ endpoint *ep, /* useful endpoints */ @@ -262,7 +257,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) char ut[64], ipuaddr[64]; endpoint teps[32]; nis_server tsrv; - void (*oldsig)() = NULL; /* old alarm handler */ + void (*oldsig)(int) = NULL; /* old alarm handler */ struct sockaddr_in sin; socklen_t len; int s = RPC_ANYSOCK; @@ -431,7 +426,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) } else { int res; - oldsig = (void (*)())signal(SIGALRM, alarm_hndler); + oldsig = (void (*)(int))signal(SIGALRM, alarm_hndler); saw_alarm = 0; /* global tracking the alarm */ alarm(20); /* only wait 20 seconds */ res = _connect(s, (struct sockaddr *)&sin, sizeof(sin)); |