Changeset 95bc57c in mainline for uspace/app/init/init.c


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.

File:
1 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       
Note: See TracChangeset for help on using the changeset viewer.