Ignore:
Timestamp:
May 2, 2018, 6:58:48 AM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, 4a77611a223ea883fb548679b516d326a020d447
Children:
b2eb48c
Parents:
bd09f9f
git-author:
Sebastian Huber <sebastian.huber@…> (05/02/18 06:58:48)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/08/18 04:50:17)
Message:

dhcpcd: Add rtems_dhcpcd_start()

Use it throughout to start the DHCP client (dhcpcd).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuite/include/rtems/bsd/test/default-network-init.h

    rbd09f9f r8bd38d6  
    4949#include <rtems/bsd/bsd.h>
    5050#include <rtems/bsd/modules.h>
     51#include <rtems/dhcpcd.h>
    5152
    5253#if defined(DEFAULT_NETWORK_DHCPCD_ENABLE) && \
     
    127128#endif
    128129
     130static void
     131default_network_dhcpcd(void)
     132{
    129133#ifdef DEFAULT_NETWORK_DHCPCD_ENABLE
    130 static void
    131 default_network_dhcpcd_task(rtems_task_argument arg)
    132 {
    133134        static const char default_cfg[] = "clientid libbsd test client\n";
    134         int exit_code;
    135         char *dhcpcd[] = {
    136                 "dhcpcd",
    137                 NULL
    138         };
     135        rtems_status_code sc;
    139136        int fd;
    140137        int rv;
    141138        ssize_t n;
    142139
    143         (void)arg;
    144 
    145140        fd = open("/etc/dhcpcd.conf", O_CREAT | O_WRONLY,
    146141            S_IRWXU | S_IRWXG | S_IRWXO);
     
    160155        assert(rv == 0);
    161156
    162         exit_code = rtems_bsd_command_dhcpcd(RTEMS_BSD_ARGC(dhcpcd), dhcpcd);
    163         assert(exit_code == EXIT_SUCCESS);
    164 }
    165 #endif
    166 
    167 static void
    168 default_network_dhcpcd(void)
    169 {
    170 #ifdef DEFAULT_NETWORK_DHCPCD_ENABLE
    171         rtems_status_code sc;
    172         rtems_id id;
    173 
    174         sc = rtems_task_create(
    175                 rtems_build_name('D', 'H', 'C', 'P'),
    176                 RTEMS_MAXIMUM_PRIORITY - 1,
    177                 2 * RTEMS_MINIMUM_STACK_SIZE,
    178                 RTEMS_DEFAULT_MODES,
    179                 RTEMS_FLOATING_POINT,
    180                 &id
    181         );
    182         assert(sc == RTEMS_SUCCESSFUL);
    183 
    184         sc = rtems_task_start(id, default_network_dhcpcd_task, 0);
     157        sc = rtems_dhcpcd_start(NULL);
    185158        assert(sc == RTEMS_SUCCESSFUL);
    186159#endif
Note: See TracChangeset for help on using the changeset viewer.