Changeset ead7fdc in rtems-libbsd for libbsd.txt


Ignore:
Timestamp:
05/16/14 11:35:21 (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
8e2e9b3
Parents:
14ba206
git-author:
Sebastian Huber <sebastian.huber@…> (05/16/14 11:35:21)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/16/14 11:37:19)
Message:

doc: Clarify initialization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libbsd.txt

    r14ba206 read7fdc  
    5050. Clone the Git repository +git clone git://git.rtems.org/rtems-libbsd.git+.
    5151. Change into the RTEMS BSD library root directory.
    52 . Edit the 'config.inc' Makefile configuration file and adjust it to your environment.
     52. Edit the `config.inc` Makefile configuration file and adjust it to your environment.
    5353. Run +make clean+.
    5454. Run +make install+.
     
    116116=== BSD Library Configuration and Build ===
    117117
    118 In the BSD library source directory edit the file 'config.inc'.  Continuing on
    119 the above, the 'config.inc' used to match the above is:
     118In the BSD library source directory edit the file `config.inc`.  Continuing on
     119the above, the `config.inc` used to match the above is:
    120120
    121121-------------------------------------------------------------------------------
     
    173173-------------------------------------------------------------------------------
    174174#include <assert.h>
    175 
     175#include <sysexits.h>
     176
     177#include <machine/rtems-bsd-commands.h>
    176178#include <rtems/bsd/bsd.h>
    177179
    178 void do_init(void)
     180static void
     181network_ifconfig_lo0(void)
    179182{
    180         rtems_status_code sc;
    181 
    182         sc = rtems_bsd_initialize();
    183         assert(sc == RTEMS_SUCCESSFUL);
     183        int exit_code;
     184        char *lo0[] = {
     185                "ifconfig",
     186                "lo0",
     187                "inet",
     188                "127.0.0.1",
     189                "netmask",
     190                "255.255.255.0",
     191                NULL
     192        };
     193        char *lo0_inet6[] = {
     194                "ifconfig",
     195                "lo0",
     196                "inet6",
     197                "::1",
     198                "prefixlen",
     199                "128",
     200                NULL
     201        };
     202
     203        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0), lo0);
     204        assert(exit_code == EX_OK);
     205
     206        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0_inet6), lo0_inet6);
     207        assert(exit_code == EX_OK);
    184208}
    185 -------------------------------------------------------------------------------
     209
     210void
     211network_init(void)
     212{
     213        rtems_status_code sc;
     214
     215        sc = rtems_bsd_initialize();
     216        assert(sc == RTEMS_SUCCESSFUL);
     217
     218        network_ifconfig_lo0();
     219}
     220-------------------------------------------------------------------------------
     221
     222This performs the basic network stack initialization with a loopback interface.
     223Further initialization must be done using the standard BSD network
     224configuration commands
     225http://www.freebsd.org/cgi/man.cgi?query=ifconfig&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[IFCONFIG(8)]
     226using `rtems_bsd_command_ifconfig()` and
     227http://www.freebsd.org/cgi/man.cgi?query=route&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[ROUTE(8)]
     228using `rtems_bsd_command_route()`.  For an example please have a look at
     229`testsuite/include/rtems/bsd/test/default-network-init.h`.
    186230
    187231== Network Stack Features
Note: See TracChangeset for help on using the changeset viewer.