Changeset fff7ef4 in mainline
- Timestamp:
- 2013-04-26T07:34:42Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 48171fc4
- Parents:
- 287d729
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dnsres/dnsres.c
r287d729 rfff7ef4 65 65 char *saddr; 66 66 67 rc = dnsr_init();68 if (rc != EOK) {69 printf(NAME ": Failed connecting to DNS resolution service "70 "(%d).\n", rc);71 return 1;72 }73 74 67 if (argc != 2) { 75 68 print_syntax(); -
uspace/app/nettest1/nettest1.c
r287d729 rfff7ef4 354 354 if (rc != EOK) { 355 355 /* Try interpreting as a host name */ 356 rc = dnsr_init();357 if (rc != EOK) {358 printf("Failed connecting DNS resolution "359 "service (%d).\n", rc);360 return rc;361 }362 363 356 rc = dnsr_name2host(argv[argc - 1], &hinfo); 364 357 if (rc != EOK) { -
uspace/app/nettest2/nettest2.c
r287d729 rfff7ef4 300 300 if (rc != EOK) { 301 301 /* Try interpreting as a host name */ 302 rc = dnsr_init();303 if (rc != EOK) {304 printf("Failed connecting DNS resolution "305 "service (%d).\n", rc);306 return rc;307 }308 309 302 rc = dnsr_name2host(argv[argc - 1], &hinfo); 310 303 if (rc != EOK) { -
uspace/app/nettest3/nettest3.c
r287d729 rfff7ef4 78 78 if (rc != EOK) { 79 79 /* Try interpreting as a host name */ 80 rc = dnsr_init();81 if (rc != EOK) {82 printf("Failed connecting DNS resolution "83 "service (%d).\n", rc);84 return rc;85 }86 87 80 rc = dnsr_name2host(argv[1], &hinfo); 88 81 if (rc != EOK) { -
uspace/app/nterm/conn.c
r287d729 rfff7ef4 85 85 if (rc != EOK) { 86 86 /* Try interpreting as a host name */ 87 rc = dnsr_init();88 if (rc != EOK) {89 printf("Failed connecting DNS resolution "90 "service (%d).\n", rc);91 goto error;92 }93 94 87 rc = dnsr_name2host(addr_s, &hinfo); 95 88 if (rc != EOK) { -
uspace/app/ping/ping.c
r287d729 rfff7ef4 245 245 if (rc != EOK) { 246 246 /* Try interpreting as a host name */ 247 rc = dnsr_init();248 if (rc != EOK) {249 printf(NAME ": Failed connecting DNS resolution "250 "service (%d).\n", rc);251 goto error;252 }253 254 247 rc = dnsr_name2host(argv[argi], &hinfo); 255 248 if (rc != EOK) { -
uspace/lib/c/generic/dnsr.c
r287d729 rfff7ef4 30 30 #include <assert.h> 31 31 #include <errno.h> 32 #include <fibril_synch.h> 32 33 #include <inet/dnsr.h> 33 34 #include <ipc/dnsr.h> … … 37 38 #include <str.h> 38 39 40 static FIBRIL_MUTEX_INITIALIZE(dnsr_sess_mutex); 41 39 42 static async_sess_t *dnsr_sess = NULL; 40 43 41 int dnsr_init(void)44 static async_exch_t *dnsr_exchange_begin(void) 42 45 { 46 async_sess_t *sess; 43 47 service_id_t dnsr_svc; 44 int rc;45 48 46 assert(dnsr_sess == NULL);49 fibril_mutex_lock(&dnsr_sess_mutex); 47 50 48 rc = loc_service_get_id(SERVICE_NAME_DNSR, &dnsr_svc, 49 IPC_FLAG_BLOCKING); 50 if (rc != EOK) 51 return ENOENT; 51 if (dnsr_sess == NULL) { 52 (void) loc_service_get_id(SERVICE_NAME_DNSR, &dnsr_svc, 53 IPC_FLAG_BLOCKING); 52 54 53 dnsr_sess = loc_service_connect(EXCHANGE_SERIALIZE, dnsr_svc, 54 IPC_FLAG_BLOCKING); 55 if (dnsr_sess == NULL) 56 return ENOENT; 55 dnsr_sess = loc_service_connect(EXCHANGE_SERIALIZE, dnsr_svc, 56 IPC_FLAG_BLOCKING); 57 } 57 58 58 return EOK; 59 sess = dnsr_sess; 60 fibril_mutex_unlock(&dnsr_sess_mutex); 61 62 return async_exchange_begin(sess); 63 } 64 65 static void dnsr_exchange_end(async_exch_t *exch) 66 { 67 async_exchange_end(exch); 59 68 } 60 69 61 70 int dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo) 62 71 { 63 async_exch_t *exch = async_exchange_begin(dnsr_sess);72 async_exch_t *exch = dnsr_exchange_begin(); 64 73 dnsr_hostinfo_t *info; 65 74 … … 68 77 sysarg_t retval = async_data_write_start(exch, name, str_size(name)); 69 78 70 async_exchange_end(exch);79 dnsr_exchange_end(exch); 71 80 72 81 if (retval != EOK) { … … 102 111 { 103 112 sysarg_t addr; 104 async_exch_t *exch = async_exchange_begin(dnsr_sess);113 async_exch_t *exch = dnsr_exchange_begin(); 105 114 106 115 int rc = async_req_0_1(exch, DNSR_GET_SRVADDR, &addr); 107 async_exchange_end(exch);116 dnsr_exchange_end(exch); 108 117 109 118 if (rc != EOK) … … 116 125 int dnsr_set_srvaddr(inet_addr_t *srvaddr) 117 126 { 118 async_exch_t *exch = async_exchange_begin(dnsr_sess);127 async_exch_t *exch = dnsr_exchange_begin(); 119 128 120 129 int rc = async_req_1_0(exch, DNSR_SET_SRVADDR, srvaddr->ipv4); 121 async_exchange_end(exch);130 dnsr_exchange_end(exch); 122 131 123 132 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.