ia64/xen-unstable

changeset 18782:beade55d67fc

minios: add a barebone net/if.h

net/if.h is a standard header but unfortunately lwip doesn't provide
it for any target but linux. Therefore I am adding a net/if.h, with an
empty implementation of the declared functions.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Nov 11 11:03:58 2008 +0000 (2008-11-11)
parents 40668908260c
children 76e90ac5067e
files extras/mini-os/include/posix/net/if.h extras/mini-os/lib/sys.c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extras/mini-os/include/posix/net/if.h	Tue Nov 11 11:03:58 2008 +0000
     1.3 @@ -0,0 +1,85 @@
     1.4 +/*
     1.5 + * This code is mostly taken from NetBSD net/if.h 
     1.6 + * Changes: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
     1.7 + *
     1.8 + ******************************************************************************
     1.9 + *
    1.10 + * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
    1.11 + * All rights reserved.
    1.12 + *
    1.13 + * This code is derived from software contributed to The NetBSD Foundation
    1.14 + * by William Studenmund and Jason R. Thorpe.
    1.15 + *
    1.16 + * Redistribution and use in source and binary forms, with or without
    1.17 + * modification, are permitted provided that the following conditions
    1.18 + * are met:
    1.19 + * 1. Redistributions of source code must retain the above copyright
    1.20 + *    notice, this list of conditions and the following disclaimer.
    1.21 + * 2. Redistributions in binary form must reproduce the above copyright
    1.22 + *    notice, this list of conditions and the following disclaimer in the
    1.23 + *    documentation and/or other materials provided with the distribution.
    1.24 + *
    1.25 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    1.26 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    1.27 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.28 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    1.29 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.30 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.31 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.32 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.33 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.34 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.35 + * POSSIBILITY OF SUCH DAMAGE.
    1.36 + */
    1.37 +
    1.38 +/*
    1.39 + * Copyright (c) 1982, 1986, 1989, 1993
    1.40 + *      The Regents of the University of California.  All rights reserved.
    1.41 + *
    1.42 + * Redistribution and use in source and binary forms, with or without
    1.43 + * modification, are permitted provided that the following conditions
    1.44 + * are met:
    1.45 + * 1. Redistributions of source code must retain the above copyright
    1.46 + *    notice, this list of conditions and the following disclaimer.
    1.47 + * 2. Redistributions in binary form must reproduce the above copyright
    1.48 + *    notice, this list of conditions and the following disclaimer in the
    1.49 + *    documentation and/or other materials provided with the distribution.
    1.50 + * 3. Neither the name of the University nor the names of its contributors
    1.51 + *    may be used to endorse or promote products derived from this software
    1.52 + *    without specific prior written permission.
    1.53 + *
    1.54 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.55 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.56 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.57 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.58 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.59 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.60 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.61 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.62 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.63 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.64 + * SUCH DAMAGE.
    1.65 + *
    1.66 + */
    1.67 +
    1.68 +#ifndef _NET_IF_H_
    1.69 +#define _NET_IF_H_
    1.70 +
    1.71 +/*
    1.72 + * Length of interface external name, including terminating '\0'.
    1.73 + * Note: this is the same size as a generic device's external name.
    1.74 + */
    1.75 +#define IF_NAMESIZE 16
    1.76 +
    1.77 +struct if_nameindex {
    1.78 +        unsigned int    if_index;       /* 1, 2, ... */
    1.79 +        char            *if_name;       /* null terminated name: "le0", ... */
    1.80 +};
    1.81 +
    1.82 +unsigned int if_nametoindex(const char *);
    1.83 +char *  if_indextoname(unsigned int, char *);
    1.84 +struct  if_nameindex * if_nameindex(void);
    1.85 +void    if_freenameindex(struct if_nameindex *);
    1.86 +
    1.87 +#endif /* !_NET_IF_H_ */
    1.88 +
     2.1 --- a/extras/mini-os/lib/sys.c	Mon Nov 10 10:41:41 2008 +0000
     2.2 +++ b/extras/mini-os/lib/sys.c	Tue Nov 11 11:03:58 2008 +0000
     2.3 @@ -34,6 +34,7 @@
     2.4  #include <sys/unistd.h>
     2.5  #include <sys/stat.h>
     2.6  #include <sys/mman.h>
     2.7 +#include <net/if.h>
     2.8  #include <time.h>
     2.9  #include <errno.h>
    2.10  #include <fcntl.h>
    2.11 @@ -1324,6 +1325,12 @@ unsupported_function(int, tcsetattr, -1)
    2.12  unsupported_function(int, tcgetattr, 0);
    2.13  unsupported_function(int, poll, -1);
    2.14  
    2.15 +/* net/if.h */
    2.16 +unsupported_function_log(unsigned int, if_nametoindex, -1);
    2.17 +unsupported_function_log(char *, if_indextoname, (char *) NULL);
    2.18 +unsupported_function_log(struct  if_nameindex *, if_nameindex, (struct  if_nameindex *) NULL);
    2.19 +unsupported_function_crash(if_freenameindex);
    2.20 +
    2.21  /* Linuxish abi for the Caml runtime, don't support */
    2.22  unsupported_function_log(struct dirent *, readdir64, NULL);
    2.23  unsupported_function_log(int, getrusage, -1);