Changeset 95bc57c in mainline


Ignore:
Timestamp:
2009-07-06T20:55:07Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1757ffce
Parents:
adb49f58
Message:

Servers can return value as soon as they are up. Use this with block-device drivers to start them synchronously. Eliminate ad-hoc sleeping.

Location:
uspace
Files:
4 edited

Legend:

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

    radb49f58 r95bc57c  
    137137}
    138138
     139static void srv_start(char *fname)
     140{
     141        char *argv[2];
     142        task_id_t id;
     143        task_exit_t texit;
     144        int rc, retval;
     145       
     146        printf(NAME ": Starting %s\n", fname);
     147       
     148        argv[0] = fname;
     149        argv[1] = NULL;
     150       
     151        id = task_spawn(fname, argv);
     152        if (!id) {
     153                printf(NAME ": Error spawning %s\n", fname);
     154                return;
     155        }
     156
     157        rc = task_wait(id, &texit, &retval);
     158        if (rc != EOK) {
     159                printf(NAME ": Error waiting for %s\n", fname);
     160                return;
     161        }
     162
     163        if (texit != TASK_EXIT_NORMAL || retval != 0) {
     164                printf(NAME ": Server %s failed to start (returned %d)\n",
     165                        fname, retval);
     166        }
     167}
     168
    139169static void getvc(char *dev, char *app)
    140170{
     
    198228        spawn("/srv/fhc");
    199229        spawn("/srv/obio");
    200         spawn("/srv/ata_bd");
    201         spawn("/srv/gxe_bd");
    202        
    203         usleep(250000); // FIXME
     230
     231        /*
     232         * Start these synchronously so that mount_data() can be
     233         * non-blocking.
     234         */
     235        srv_start("/srv/ata_bd");
     236        srv_start("/srv/gxe_bd");
     237       
    204238        mount_data();
    205239       
  • uspace/srv/bd/ata_bd/ata_bd.c

    radb49f58 r95bc57c  
    5555#include <errno.h>
    5656#include <bool.h>
     57#include <task.h>
    5758
    5859#include "ata_bd.h"
     
    136137
    137138        printf(NAME ": Accepting connections\n");
     139        task_retval(0);
    138140        async_manager();
    139141
  • uspace/srv/bd/file_bd/file_bd.c

    radb49f58 r95bc57c  
    5050#include <errno.h>
    5151#include <bool.h>
     52#include <task.h>
    5253
    5354#define NAME "file_bd"
     
    8788
    8889        printf(NAME ": Accepting connections\n");
     90        task_retval(0);
    8991        async_manager();
    9092
  • uspace/srv/bd/gxe_bd/gxe_bd.c

    radb49f58 r95bc57c  
    4747#include <sys/types.h>
    4848#include <errno.h>
     49#include <task.h>
    4950
    5051#define NAME "gxe_bd"
     
    111112
    112113        printf(NAME ": Accepting connections\n");
     114        task_retval(0);
    113115        async_manager();
    114116
Note: See TracChangeset for help on using the changeset viewer.