Changeset 0c20a46 in rtems for cpukit/librpc/src


Ignore:
Timestamp:
Feb 3, 2005, 3:58:18 PM (15 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
5b6111b
Parents:
abb63593
Message:

2005-02-03 Ralf Corsepius <ralf.corsepius@…>

  • librpc/include/rpc/types.h: Partial update from FreeBSD. Use stdint.h types instead of sys/types.h.
  • librpc/src/rpc/bindresvport.c: Partial update from FreeBSD.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/librpc/src/rpc/bindresvport.c

    rabb63593 r0c20a46  
     1/*      $NetBSD: bindresvport.c,v 1.19 2000/07/06 03:03:59 christos Exp $       */
     2
    13/*
    24 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
     
    4244
    4345#include <sys/types.h>
    44 #include <sys/errno.h>
    4546#include <sys/socket.h>
     47
    4648#include <netinet/in.h>
     49
     50#include <errno.h>
     51#include <string.h>
    4752#include <unistd.h>
    48 #include <string.h>
     53
     54#include <rpc/rpc.h>
    4955
    5056/*
    51  * Bind a socket to a privileged port for whatever protocol.
     57 * Bind a socket to a privileged IP port
     58 */
     59int
     60bindresvport(sd, sin)
     61        int sd;
     62        struct sockaddr_in *sin;
     63{
     64        return bindresvport_sa(sd, (struct sockaddr *)sin);
     65}
     66
     67/*
     68 * Bind a socket to a privileged IP port
    5269 */
    5370int
     
    5976        struct sockaddr myaddr;
    6077        struct sockaddr_in *sin;
    61 #if (defined(AF_INET6) && defined(IPPROTO_IPV6))
     78#ifdef INET6
    6279        struct sockaddr_in6 *sin6;
    6380#endif
     
    7895                af = sa->sa_family;
    7996
    80         if (af == AF_INET) {
     97        switch (af) {
     98        case AF_INET:
    8199                proto = IPPROTO_IP;
    82100                portrange = IP_PORTRANGE;
     
    85103                salen = sizeof(struct sockaddr_in);
    86104                port = sin->sin_port;
    87 #if (defined(AF_INET6) && defined(IPPROTO_IPV6))
    88         } else if (af == AF_INET6) {
     105                break;
     106#ifdef INET6
     107        case AF_INET6:
    89108                proto = IPPROTO_IPV6;
    90109                portrange = IPV6_PORTRANGE;
     
    93112                salen = sizeof(struct sockaddr_in6);
    94113                port = sin6->sin6_port;
     114                break;
    95115#endif
    96         } else {
     116        default:
    97117                errno = EPFNOSUPPORT;
    98118                return (-1);
     
    127147
    128148                if (sa != (struct sockaddr *)&myaddr) {
    129                         /* Hmm, what did the kernel assign... */
     149                        /* Hmm, what did the kernel assign? */
    130150                        if (getsockname(sd, sa, &salen) < 0)
    131151                                errno = saved_errno;
     
    135155        return (error);
    136156}
    137 
    138 /*
    139  * Bind a socket to a privileged IP port
    140  */
    141 int
    142 bindresvport(sd, sin)
    143         int sd;
    144         struct sockaddr_in *sin;
    145 {
    146         return bindresvport_sa(sd, (struct sockaddr *)sin);
    147 }
Note: See TracChangeset for help on using the changeset viewer.