Changeset b40bfac in mainline for uspace/app/netstart/netstart.c


Ignore:
Timestamp:
2010-11-08T07:13:25Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63a1e60
Parents:
d70a463 (diff), 3da12d74 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/netstart/netstart.c

    rd70a463 rb40bfac  
    3232
    3333/** @file
    34  *
    3534 * Start the networking subsystem.
    36  * Perform networking self-test if executed
    37  * with the -s argument.
    38  *
    3935 */
    4036
     
    4541#include <task.h>
    4642#include <str_error.h>
    47 #include <err.h>
    4843#include <ipc/ipc.h>
    4944#include <ipc/services.h>
     
    5247#include <net/modules.h>
    5348
    54 #include "self_test.h"
    55 
    5649/** Start a module.
    5750 *
    58  * @param[in] desc The module description
    59  * @param[in] path The module absolute path.
    60  *
    61  * @returns true on succesful spanwning
    62  * @returns false on failure
    63  *
     51 * @param[in] desc      The module description
     52 * @param[in] path      The module absolute path.
     53 * @returns             True on succesful spanwning.
     54 * @returns             False on failure
    6455 */
    6556static bool spawn(const char *desc, const char *path)
    6657{
     58        int rc;
     59
    6760        printf("%s: Spawning %s (%s)\n", NAME, desc, path);
    68        
    69         const char *argv[2];
    70        
    71         argv[0] = path;
    72         argv[1] = NULL;
    73        
    74         int err;
    75         if (task_spawn(path, argv, &err) == 0) {
     61        rc = task_spawnl(NULL, path, path, NULL);
     62        if (rc != EOK) {
    7663                fprintf(stderr, "%s: Error spawning %s (%s)\n", NAME, path,
    77                     str_error(err));
     64                    str_error(rc));
    7865                return false;
    7966        }
     
    8471int main(int argc, char *argv[])
    8572{
    86         ERROR_DECLARE;
    87        
    88         /* Run self-tests */
    89         if ((argc > 1) && (str_cmp(argv[1], "-s") == 0))
    90                 ERROR_PROPAGATE(self_test());
     73        int rc;
    9174       
    9275        if (!spawn("networking service", "/srv/net"))
     
    9679       
    9780        int net_phone = connect_to_service(SERVICE_NETWORKING);
    98         if (ERROR_OCCURRED(ipc_call_sync_0_0(net_phone, NET_NET_STARTUP))) {
    99                 fprintf(stderr, "%s: Startup error %d\n", NAME, ERROR_CODE);
    100                 return ERROR_CODE;
     81        rc = ipc_call_sync_0_0(net_phone, NET_NET_STARTUP);
     82        if (rc != EOK) {
     83                fprintf(stderr, "%s: Startup error %d\n", NAME, rc);
     84                return rc;
    10185        }
    10286       
Note: See TracChangeset for help on using the changeset viewer.