Subversion Repositories HelenOS

Rev

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

Rev 4243 Rev 4350
Line 29... Line 29...
29
/** @addtogroup net
29
/** @addtogroup net
30
 *  @{
30
 *  @{
31
 */
31
 */
32
 
32
 
33
/** @file
33
/** @file
-
 
34
 *  Generic module functions implementation.
34
 */
35
 */
35
#include <async.h>
36
#include <async.h>
36
 
37
 
37
#include <ipc/ipc.h>
38
#include <ipc/ipc.h>
38
#include <ipc/services.h>
39
#include <ipc/services.h>
39
 
40
 
40
#include "err.h"
41
#include "err.h"
41
#include "modules.h"
42
#include "modules.h"
42
 
43
 
-
 
44
/** The time between connect requests.
-
 
45
 */
43
#define MODULE_WAIT_TIME    10000
46
#define MODULE_WAIT_TIME    10000
44
 
47
 
45
int connect_to_service( services_t need ){
48
int connect_to_service( services_t need ){
46
    int phone;
49
    int phone;
47
    int res;
50
    int res;
48
 
51
 
-
 
52
    //TODO timeout version?
49
    res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone );
53
    res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone );
50
    while(( res < 0 ) || ( phone < 0 )){
54
    while(( res < 0 ) || ( phone < 0 )){
51
        usleep( MODULE_WAIT_TIME );
55
        usleep( MODULE_WAIT_TIME );
52
        res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone );
56
        res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone );
53
    }
57
    }