Subversion Repositories HelenOS

Rev

Rev 4243 | Rev 4603 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4243 Rev 4307
Line 29... Line 29...
29
/** @addtogroup net
29
/** @addtogroup net
30
 *  @{
30
 *  @{
31
 */
31
 */
32
 
32
 
33
/** @file
33
/** @file
34
 *  Starts the networking subsystem.
34
 *  Starts the net subsystem.
35
 *  Performs self test if configured so.
35
 *  Performs self test if configured so.
36
 *  @see configuration.h
36
 *  @see configuration.h
37
 */
37
 */
38
 
38
 
39
#include <async.h>
39
#include <async.h>
Line 54... Line 54...
54
 
54
 
55
/** Module entry point.
55
/** Module entry point.
56
 *  @param argc The number of command line parameters. Input parameter.
56
 *  @param argc The number of command line parameters. Input parameter.
57
 *  @param argv The command line parameters. Input parameter.
57
 *  @param argv The command line parameters. Input parameter.
58
 *  @returns EOK on success.
58
 *  @returns EOK on success.
59
 *  @returns EINVAL if the networking module cannot be started.
59
 *  @returns EINVAL if the net module cannot be started.
60
 *  @returns Other error codes as defined for the self_test() function.
60
 *  @returns Other error codes as defined for the self_test() function.
61
 *  @returns Other error codes as defined for the NET_NET_STARTUP message.
61
 *  @returns Other error codes as defined for the NET_NET_STARTUP message.
62
 */
62
 */
63
int     main( int argc, char * argv[] );
63
int     main( int argc, char * argv[] );
64
 
64
 
Line 70... Line 70...
70
task_id_t   spawn( char * fname );
70
task_id_t   spawn( char * fname );
71
 
71
 
72
int main( int argc, char * argv[] ){
72
int main( int argc, char * argv[] ){
73
    ERROR_DECLARE;
73
    ERROR_DECLARE;
74
 
74
 
75
    int     networking_phone;
75
    int     net_phone;
76
 
76
 
77
    printf( "\nTask %d - ", task_get_id());
77
    printf( "Task %d - ", task_get_id());
78
    printf( "%s", NAME );
78
    printf( "%s\n", NAME );
79
    // run self tests
79
    // run self tests
80
    ERROR_PROPAGATE( self_test());
80
    ERROR_PROPAGATE( self_test());
81
    // start networking service
81
    // start net service
82
    if( ! spawn( "/srv/net" )){
82
    if( ! spawn( "/srv/net" )){
83
        printf( "\nCould not spawn networking" );
83
        printf( "Could not spawn net\n" );
84
        return EINVAL;
84
        return EINVAL;
85
    }
85
    }
86
    // start networking
86
    // start net
87
    networking_phone = connect_to_service( SERVICE_NETWORKING );
87
    net_phone = connect_to_service( SERVICE_NETWORKING );
88
    if( ERROR_OCCURRED( ipc_call_sync_0_0( networking_phone, NET_NET_STARTUP ))){
88
    if( ERROR_OCCURRED( ipc_call_sync_0_0( net_phone, NET_NET_STARTUP ))){
89
        printf( "\nERROR %d\n", ERROR_CODE );
89
        printf( "ERROR %d\n", ERROR_CODE );
90
        return ERROR_CODE;
90
        return ERROR_CODE;
91
    }
91
    }
92
    printf( "\nOK\n" );
92
    printf( "OK\n" );
93
 
93
 
94
    return EOK;
94
    return EOK;
95
}
95
}
96
 
96
 
97
task_id_t spawn( char * fname ){
97
task_id_t spawn( char * fname ){