Changeset 192565b in mainline for uspace/srv
- Timestamp:
- 2013-05-27T13:18:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f2c19b0
- Parents:
- d120133 (diff), c90aed4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/srv
- Files:
-
- 9 added
- 1 deleted
- 25 edited
- 1 moved
-
devman/main.c (modified) (1 diff)
-
fs/cdfs/cdfs_ops.c (modified) (1 diff)
-
fs/fat/fat_dentry.c (modified) (3 diffs)
-
fs/fat/fat_dentry.h (modified) (3 diffs)
-
fs/fat/fat_directory.c (modified) (1 diff)
-
fs/fat/fat_ops.c (modified) (3 diffs)
-
fs/mfs/mfs_dentry.c (modified) (1 diff)
-
fs/mfs/mfs_ops.c (modified) (1 diff)
-
fs/udf/udf_volume.c (modified) (2 diffs)
-
hid/compositor/Makefile (modified) (1 diff)
-
hid/compositor/compositor.c (modified) (17 diffs)
-
hid/compositor/gfx/helenos.tga (deleted)
-
hid/console/console.c (modified) (3 diffs)
-
hid/remcons/remcons.c (modified) (3 diffs)
-
net/dnsrsrv/Makefile (added)
-
net/dnsrsrv/dns_msg.c (added)
-
net/dnsrsrv/dns_msg.h (added)
-
net/dnsrsrv/dns_std.h (added)
-
net/dnsrsrv/dns_type.h (added)
-
net/dnsrsrv/dnsrsrv.c (added)
-
net/dnsrsrv/query.c (added)
-
net/dnsrsrv/query.h (moved) (moved from kernel/genarch/include/genarch/fb/logo-196x66.h ) (2 diffs)
-
net/dnsrsrv/transport.c (added)
-
net/dnsrsrv/transport.h (added)
-
net/ethip/ethip.c (modified) (1 diff)
-
net/inetsrv/addrobj.c (modified) (1 diff)
-
net/inetsrv/inet_link.c (modified) (2 diffs)
-
net/inetsrv/inetsrv.c (modified) (1 diff)
-
net/inetsrv/inetsrv.h (modified) (2 diffs)
-
net/udp/assoc.c (modified) (2 diffs)
-
net/udp/assoc.h (modified) (1 diff)
-
net/udp/sock.c (modified) (2 diffs)
-
net/udp/ucall.c (modified) (2 diffs)
-
net/udp/ucall.h (modified) (1 diff)
-
net/udp/udp_type.h (modified) (2 diffs)
-
ns/task.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rd120133 r192565b 735 735 { 736 736 client_t *client; 737 driver_t *driver ;737 driver_t *driver = NULL; 738 738 739 739 /* Accept the connection. */ -
uspace/srv/fs/cdfs/cdfs_ops.c
rd120133 r192565b 660 660 */ 661 661 if ((vol_desc->type != VOL_DESC_PRIMARY) || 662 ( bcmp(vol_desc->standard_ident, CDFS_STANDARD_IDENT, 5) != 0) ||662 (memcmp(vol_desc->standard_ident, CDFS_STANDARD_IDENT, 5) != 0) || 663 663 (vol_desc->version != 1)) { 664 664 block_put(block); -
uspace/srv/fs/fat/fat_dentry.c
rd120133 r192565b 44 44 #include <assert.h> 45 45 #include <unistd.h> 46 #include <sys/types.h> 46 47 47 48 /** Compare path component with the name read from the dentry. … … 232 233 /** Get number of bytes in a string with size limit. 233 234 * 234 * @param str NULL-terminated (or not) string. 235 * @param str NULL-terminated (or not) string. The pointer comes from a packed 236 * structure and as such is expected to be unaligned. 235 237 * @param size Maximum number of bytes to consider. 236 238 * … … 238 240 * 239 241 */ 240 size_t fat_lfn_str_nlength(const u int16_t *str, size_t size)242 size_t fat_lfn_str_nlength(const unaligned_uint16_t *str, size_t size) 241 243 { 242 244 size_t offset = 0; -
uspace/srv/fs/fat/fat_dentry.h
rd120133 r192565b 37 37 #include <stdint.h> 38 38 #include <stdbool.h> 39 #include <sys/types.h> 39 40 40 41 #define IS_D_CHAR(ch) (isalnum(ch) || ch == '_') … … 132 133 } __attribute__ ((packed)) fat_dentry_t; 133 134 134 135 135 extern int fat_dentry_namecmp(char *, const char *); 136 136 extern void fat_dentry_name_get(const fat_dentry_t *, char *); … … 139 139 extern uint8_t fat_dentry_chksum(uint8_t *); 140 140 141 extern size_t fat_lfn_str_nlength(const u int16_t *, size_t);141 extern size_t fat_lfn_str_nlength(const unaligned_uint16_t *, size_t); 142 142 extern size_t fat_lfn_size(const fat_dentry_t *); 143 143 extern size_t fat_lfn_get_entry(const fat_dentry_t *, uint16_t *, size_t *); -
uspace/srv/fs/fat/fat_directory.c
rd120133 r192565b 516 516 return false; 517 517 case FAT_DENTRY_VALID: 518 if ( bcmp(de->name, d->name,519 FAT_NAME_LEN + FAT_EXT_LEN) ==0)518 if (memcmp(de->name, d->name, 519 FAT_NAME_LEN + FAT_EXT_LEN) == 0) 520 520 return true; 521 521 break; -
uspace/srv/fs/fat/fat_ops.c
rd120133 r192565b 651 651 d = (fat_dentry_t *) b->data; 652 652 if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) || 653 ( bcmp(d->name, FAT_NAME_DOT, FAT_NAME_LEN)) == 0) {653 (memcmp(d->name, FAT_NAME_DOT, FAT_NAME_LEN)) == 0) { 654 654 memset(d, 0, sizeof(fat_dentry_t)); 655 655 memcpy(d->name, FAT_NAME_DOT, FAT_NAME_LEN); … … 661 661 d++; 662 662 if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) || 663 ( bcmp(d->name, FAT_NAME_DOT_DOT, FAT_NAME_LEN) == 0)) {663 (memcmp(d->name, FAT_NAME_DOT_DOT, FAT_NAME_LEN) == 0)) { 664 664 memset(d, 0, sizeof(fat_dentry_t)); 665 665 memcpy(d->name, FAT_NAME_DOT_DOT, FAT_NAME_LEN); … … 1042 1042 info = (fat32_fsinfo_t *) b->data; 1043 1043 1044 if ( bcmp(info->sig1, FAT32_FSINFO_SIG1, sizeof(info->sig1))||1045 bcmp(info->sig2, FAT32_FSINFO_SIG2, sizeof(info->sig2))||1046 bcmp(info->sig3, FAT32_FSINFO_SIG3, sizeof(info->sig3))) {1044 if (memcmp(info->sig1, FAT32_FSINFO_SIG1, sizeof(info->sig1)) != 0 || 1045 memcmp(info->sig2, FAT32_FSINFO_SIG2, sizeof(info->sig2)) != 0 || 1046 memcmp(info->sig3, FAT32_FSINFO_SIG3, sizeof(info->sig3)) != 0) { 1047 1047 (void) block_put(b); 1048 1048 return EINVAL; -
uspace/srv/fs/mfs/mfs_dentry.c
rd120133 r192565b 178 178 179 179 if (name_len == d_name_len && 180 !bcmp(d_info.d_name, d_name, name_len)) {180 memcmp(d_info.d_name, d_name, name_len) == 0) { 181 181 182 182 d_info.d_inum = 0; -
uspace/srv/fs/mfs/mfs_ops.c
rd120133 r192565b 452 452 453 453 if (comp_size == dentry_name_size && 454 !bcmp(component, d_info.d_name, dentry_name_size)) {454 memcmp(component, d_info.d_name, dentry_name_size) == 0) { 455 455 /* Hit! */ 456 456 mfs_node_core_get(rfn, mnode->instance, -
uspace/srv/fs/udf/udf_volume.c
rd120133 r192565b 262 262 * and Descriptor char set field. 263 263 */ 264 if (( bcmp((uint8_t *) pvd[i].volume_id,264 if ((memcmp((uint8_t *) pvd[i].volume_id, 265 265 (uint8_t *) desc->volume_id, 32) == 0) && 266 ( bcmp((uint8_t *) pvd[i].volume_set_id,266 (memcmp((uint8_t *) pvd[i].volume_set_id, 267 267 (uint8_t *) desc->volume_set_id, 128) == 0) && 268 ( bcmp((uint8_t *) &pvd[i].descriptor_charset,268 (memcmp((uint8_t *) &pvd[i].descriptor_charset, 269 269 (uint8_t *) &desc->descriptor_charset, 64) == 0) && 270 270 (FLE32(desc->sequence_number) > FLE32(pvd[i].sequence_number))) { … … 301 301 * Logic Volume Identifier and Descriptor char set field. 302 302 */ 303 if (( bcmp((uint8_t *) lvd[i].logical_volume_id,303 if ((memcmp((uint8_t *) lvd[i].logical_volume_id, 304 304 (uint8_t *) desc->logical_volume_id, 128) == 0) && 305 ( bcmp((uint8_t *) &lvd[i].charset,305 (memcmp((uint8_t *) &lvd[i].charset, 306 306 (uint8_t *) &desc->charset, 64) == 0) && 307 307 (FLE32(desc->sequence_number) > FLE32(lvd[i].sequence_number))) { -
uspace/srv/hid/compositor/Makefile
rd120133 r192565b 38 38 39 39 IMAGES = \ 40 gfx/helenos.tga \41 40 gfx/nameic.tga 42 41 -
uspace/srv/hid/compositor/compositor.c
rd120133 r192565b 90 90 typedef struct { 91 91 link_t link; 92 atomic_t ref_cnt; 92 93 service_id_t in_dsid; 93 94 service_id_t out_dsid; … … 138 139 } viewport_t; 139 140 141 static desktop_rect_t viewport_bound_rect; 140 142 static FIBRIL_MUTEX_INITIALIZE(viewport_list_mtx); 141 143 static LIST_INITIALIZE(viewport_list); … … 215 217 216 218 link_initialize(&win->link); 219 atomic_set(&win->ref_cnt, 0); 217 220 prodcons_initialize(&win->queue); 218 221 transform_identity(&win->transform); … … 232 235 static void window_destroy(window_t *win) 233 236 { 234 if (win) { 237 if (win && atomic_get(&win->ref_cnt) == 0) { 238 while (!list_empty(&win->queue.list)) { 239 window_event_t *event = (window_event_t *) list_first(&win->queue.list); 240 list_remove(&event->link); 241 free(event); 242 } 243 235 244 if (win->surface) { 236 245 surface_destroy(win->surface); … … 310 319 } 311 320 321 static void comp_restrict_pointers(void) 322 { 323 fibril_mutex_lock(&viewport_list_mtx); 324 325 sysarg_t x_res = coord_origin; 326 sysarg_t y_res = coord_origin; 327 sysarg_t w_res = 0; 328 sysarg_t h_res = 0; 329 330 if (!list_empty(&viewport_list)) { 331 viewport_t *vp = (viewport_t *) list_first(&viewport_list); 332 x_res = vp->pos.x; 333 y_res = vp->pos.y; 334 surface_get_resolution(vp->surface, &w_res, &h_res); 335 } 336 337 list_foreach(viewport_list, link) { 338 viewport_t *vp = list_get_instance(link, viewport_t, link); 339 sysarg_t w_vp, h_vp; 340 surface_get_resolution(vp->surface, &w_vp, &h_vp); 341 rectangle_union( 342 x_res, y_res, w_res, h_res, 343 vp->pos.x, vp->pos.y, w_vp, h_vp, 344 &x_res, &y_res, &w_res, &h_res); 345 } 346 347 viewport_bound_rect.x = x_res; 348 viewport_bound_rect.y = y_res; 349 viewport_bound_rect.w = w_res; 350 viewport_bound_rect.h = h_res; 351 352 fibril_mutex_unlock(&viewport_list_mtx); 353 354 fibril_mutex_lock(&pointer_list_mtx); 355 356 list_foreach(pointer_list, link) { 357 pointer_t *ptr = list_get_instance(link, pointer_t, link); 358 ptr->pos.x = ptr->pos.x > viewport_bound_rect.x ? ptr->pos.x : viewport_bound_rect.x; 359 ptr->pos.y = ptr->pos.y > viewport_bound_rect.y ? ptr->pos.y : viewport_bound_rect.y; 360 ptr->pos.x = ptr->pos.x < viewport_bound_rect.x + viewport_bound_rect.w ? 361 ptr->pos.x : viewport_bound_rect.x + viewport_bound_rect.w; 362 ptr->pos.y = ptr->pos.y < viewport_bound_rect.y + viewport_bound_rect.h ? 363 ptr->pos.y : viewport_bound_rect.y + viewport_bound_rect.h; 364 } 365 366 fibril_mutex_unlock(&pointer_list_mtx); 367 } 368 312 369 static void comp_damage(sysarg_t x_dmg_glob, sysarg_t y_dmg_glob, 313 370 sysarg_t w_dmg_glob, sysarg_t h_dmg_glob) … … 695 752 } 696 753 754 loc_service_unregister(win->in_dsid); 755 loc_service_unregister(win->out_dsid); 756 757 /* In case the client was killed, input fibril of the window might be 758 * still blocked on the condition within comp_window_get_event. */ 759 window_event_t *event_dummy = (window_event_t *) malloc(sizeof(window_event_t)); 760 if (event_dummy) { 761 link_initialize(&event_dummy->link); 762 prodcons_produce(&win->queue, &event_dummy->link); 763 } 764 697 765 /* Calculate damage. */ 698 766 sysarg_t x = 0; … … 706 774 } 707 775 708 /* Release window resources. */709 loc_service_unregister(win->in_dsid);710 loc_service_unregister(win->out_dsid);711 while (!list_empty(&win->queue.list)) {712 list_remove(list_first(&win->queue.list));713 }714 window_destroy(win);715 716 776 comp_damage(x, y, width, height); 717 777 … … 813 873 814 874 if (win) { 875 atomic_inc(&win->ref_cnt); 815 876 async_answer_0(iid, EOK); 816 877 } else { … … 825 886 826 887 if (!IPC_GET_IMETHOD(call)) { 827 async_answer_0(callid, EINVAL); 888 async_answer_0(callid, EOK); 889 atomic_dec(&win->ref_cnt); 890 window_destroy(win); 828 891 return; 829 892 } … … 842 905 843 906 if (!IPC_GET_IMETHOD(call)) { 844 async_answer_0(callid, EINVAL); 907 comp_window_close(win, callid, &call); 908 atomic_dec(&win->ref_cnt); 909 window_destroy(win); 845 910 return; 846 911 } … … 857 922 break; 858 923 case WINDOW_CLOSE: 859 comp_window_close(win, callid, &call); 924 /* Postpone the closing until the phone is hung up to cover 925 * the case when the client is killed abruptly. */ 926 async_answer_0(callid, EOK); 860 927 break; 861 928 case WINDOW_CLOSE_REQUEST: … … 911 978 async_answer_0(iid, EOK); 912 979 980 comp_restrict_pointers(); 913 981 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 914 982 } … … 956 1024 fibril_mutex_unlock(&viewport_list_mtx); 957 1025 async_answer_0(iid, EOK); 1026 1027 comp_restrict_pointers(); 1028 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 958 1029 } 959 1030 } … … 1391 1462 surface_get_resolution(pointer->cursor.states[pointer->state], 1392 1463 &cursor_width, &cursor_height); 1464 if (pointer->pos.x + dx < viewport_bound_rect.x) { 1465 dx = -1 * (pointer->pos.x - viewport_bound_rect.x); 1466 } 1467 if (pointer->pos.y + dy < viewport_bound_rect.y) { 1468 dy = -1 * (pointer->pos.y - viewport_bound_rect.y); 1469 } 1470 if (pointer->pos.x + dx > viewport_bound_rect.x + viewport_bound_rect.w) { 1471 dx = (viewport_bound_rect.x + viewport_bound_rect.w - pointer->pos.x); 1472 } 1473 if (pointer->pos.y + dy > viewport_bound_rect.y + viewport_bound_rect.h) { 1474 dy = (viewport_bound_rect.y + viewport_bound_rect.h - pointer->pos.y); 1475 } 1393 1476 pointer->pos.x += dx; 1394 1477 pointer->pos.y += dy; … … 1910 1993 fibril_mutex_unlock(&viewport_list_mtx); 1911 1994 1995 comp_restrict_pointers(); 1912 1996 comp_damage(x, y, width, height); 1913 1997 } else { … … 1962 2046 } 1963 2047 list_prepend(&blue_win->link, &window_list); 1964 1965 window_t *helenos_win = window_create(0, 0); 1966 helenos_win->surface = decode_tga((void *) helenos_tga, helenos_tga_size, 0); 1967 list_prepend(&helenos_win->link, &window_list); 1968 2048 1969 2049 window_t *nameic_win = window_create(0, 0); 1970 2050 nameic_win->surface = decode_tga((void *) nameic_tga, nameic_tga_size, 0); … … 2131 2211 return -1; 2132 2212 } 2133 2213 2214 comp_restrict_pointers(); 2134 2215 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 2135 2216 -
uspace/srv/hid/console/console.c
rd120133 r192565b 129 129 static void cons_set_rgb_color(con_srv_t *, pixel_t, pixel_t); 130 130 static void cons_set_cursor_visibility(con_srv_t *, bool); 131 static int cons_get_event(con_srv_t *, kbd_event_t *);131 static int cons_get_event(con_srv_t *, cons_event_t *); 132 132 133 133 static con_ops_t con_ops = { … … 490 490 } 491 491 492 static int cons_get_event(con_srv_t *srv, kbd_event_t *event)492 static int cons_get_event(con_srv_t *srv, cons_event_t *event) 493 493 { 494 494 console_t *cons = srv_to_console(srv); … … 496 496 kbd_event_t *kevent = list_get_instance(link, kbd_event_t, link); 497 497 498 *event = *kevent; 498 event->type = CEV_KEY; 499 event->ev.key = *kevent; 499 500 free(kevent); 500 501 return EOK; -
uspace/srv/hid/remcons/remcons.c
rd120133 r192565b 80 80 static int remcons_get_size(con_srv_t *, sysarg_t *, sysarg_t *); 81 81 static int remcons_get_color_cap(con_srv_t *, console_caps_t *); 82 static int remcons_get_event(con_srv_t *, kbd_event_t *);82 static int remcons_get_event(con_srv_t *, cons_event_t *); 83 83 84 84 static con_ops_t con_ops = { … … 185 185 } 186 186 187 static int remcons_get_event(con_srv_t *srv, kbd_event_t *event) 188 { 189 telnet_user_t *user = srv_to_user(srv); 187 static int remcons_get_event(con_srv_t *srv, cons_event_t *event) 188 { 189 telnet_user_t *user = srv_to_user(srv); 190 kbd_event_t kevent; 190 191 int rc; 191 192 192 rc = telnet_user_get_next_keyboard_event(user, event);193 rc = telnet_user_get_next_keyboard_event(user, &kevent); 193 194 if (rc != EOK) { 194 195 /* XXX What? */ … … 196 197 return EOK; 197 198 } 199 200 event->type = CEV_KEY; 201 event->ev.key = kevent; 198 202 199 203 return EOK; -
uspace/srv/net/dnsrsrv/query.h
rd120133 r192565b 1 1 /* 2 * Copyright (c) 20 08 Martin Decky2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup genarch29 /** @addtogroup dnsres 30 30 * @{ 31 31 */ 32 /** @file 32 /** 33 * @file 33 34 */ 34 35 35 #ifndef KERN_LOGO_196X66_H_36 #define KERN_LOGO_196X66_H_36 #ifndef QUERY_H 37 #define QUERY_H 37 38 38 #define LOGO_WIDTH 196 39 #define LOGO_HEIGHT 66 40 #define LOGO_COLOR 0xffffff 39 #include "dns_type.h" 41 40 42 #include <typedefs.h> 43 44 extern uint32_t fb_logo[LOGO_WIDTH * LOGO_HEIGHT]; 41 extern int dns_name2host(const char *, dns_host_info_t **); 42 extern void dns_hostinfo_destroy(dns_host_info_t *); 45 43 46 44 #endif -
uspace/srv/net/ethip/ethip.c
rd120133 r192565b 221 221 case ETYPE_IP: 222 222 log_msg(LOG_DEFAULT, LVL_DEBUG, " - construct SDU"); 223 sdu.lsrc.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 1;224 sdu.ldest.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 4;223 sdu.lsrc.ipv4 = 0; 224 sdu.ldest.ipv4 = 0; 225 225 sdu.data = frame.data; 226 226 sdu.size = frame.size; -
uspace/srv/net/inetsrv/addrobj.c
rd120133 r192565b 221 221 222 222 lsrc_addr.ipv4 = addr->naddr.ipv4; 223 ldest_addr = &dgram->dest;223 ldest_addr = ldest; 224 224 225 225 return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest_addr, dgram, -
uspace/srv/net/inetsrv/inet_link.c
rd120133 r192565b 196 196 197 197 static int first = 1; 198 /* XXX For testing: set static IP address 1 92.168.0.4/24 */198 /* XXX For testing: set static IP address 10.0.2.15/24 */ 199 199 addr = inet_addrobj_new(); 200 200 if (first) { … … 202 202 first = 0; 203 203 } else { 204 addr->naddr.ipv4 = (1 92 << 24) + (168 << 16) + (0 << 8) + 4;204 addr->naddr.ipv4 = (10 << 24) + (0 << 16) + (2 << 8) + 15; 205 205 } 206 206 addr->naddr.bits = 24; -
uspace/srv/net/inetsrv/inetsrv.c
rd120133 r192565b 98 98 } 99 99 100 rc = inet_link_discovery_start(); 100 inet_sroute_t *sroute = inet_sroute_new(); 101 if (sroute == NULL) { 102 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating default route (%d).", rc); 103 return ENOMEM; 104 } 105 106 sroute->dest.ipv4 = 0; 107 sroute->dest.bits = 0; 108 sroute->router.ipv4 = (10 << 24) | (0 << 16) | (2 << 8) | 2; 109 sroute->name = str_dup("default"); 110 inet_sroute_add(sroute); 111 112 rc = inet_link_discovery_start(); 101 113 if (rc != EOK) 102 114 return EEXIST; -
uspace/srv/net/inetsrv/inetsrv.h
rd120133 r192565b 40 40 #include <adt/list.h> 41 41 #include <stdbool.h> 42 #include <inet/addr.h> 42 43 #include <inet/iplink.h> 43 44 #include <ipc/loc.h> … … 61 62 link_t client_list; 62 63 } inetping_client_t; 63 64 /** Host address */65 typedef struct {66 uint32_t ipv4;67 } inet_addr_t;68 69 /** Network address */70 typedef struct {71 /** Address */72 uint32_t ipv4;73 /** Number of valid bits in @c ipv4 */74 int bits;75 } inet_naddr_t;76 64 77 65 /** Address object info */ -
uspace/srv/net/udp/assoc.c
rd120133 r192565b 279 279 280 280 fibril_mutex_lock(&assoc->lock); 281 while (list_empty(&assoc->rcv_queue) ) {281 while (list_empty(&assoc->rcv_queue) && !assoc->reset) { 282 282 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - waiting"); 283 283 fibril_condvar_wait(&assoc->rcv_queue_cv, &assoc->lock); 284 } 285 286 if (assoc->reset) { 287 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - association was reset"); 288 fibril_mutex_unlock(&assoc->lock); 289 return ECONNABORTED; 284 290 } 285 291 … … 323 329 } 324 330 331 /** Reset association. 332 * 333 * This causes any pendingreceive operations to return immediately with 334 * UDP_ERESET. 335 */ 336 void udp_assoc_reset(udp_assoc_t *assoc) 337 { 338 fibril_mutex_lock(&assoc->lock); 339 assoc->reset = true; 340 fibril_condvar_broadcast(&assoc->rcv_queue_cv); 341 fibril_mutex_unlock(&assoc->lock); 342 } 343 325 344 static int udp_assoc_queue_msg(udp_assoc_t *assoc, udp_sockpair_t *sp, 326 345 udp_msg_t *msg) -
uspace/srv/net/udp/assoc.h
rd120133 r192565b 51 51 extern int udp_assoc_recv(udp_assoc_t *, udp_msg_t **, udp_sock_t *); 52 52 extern void udp_assoc_received(udp_sockpair_t *, udp_msg_t *); 53 53 extern void udp_assoc_reset(udp_assoc_t *); 54 54 55 55 #endif -
uspace/srv/net/udp/sock.c
rd120133 r192565b 537 537 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close()"); 538 538 int socket_id = SOCKET_GET_SOCKET_ID(call); 539 539 540 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - find core"); 540 541 socket_core_t *sock_core = 541 542 socket_cores_find(&client->sockets, socket_id); 542 543 if (sock_core == NULL) { 544 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - core not found"); 543 545 async_answer_0(callid, ENOTSOCK); 544 546 return; 545 547 } 546 548 549 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - spec data"); 547 550 udp_sockdata_t *socket = 548 551 (udp_sockdata_t *) sock_core->specific_data; 552 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - lock socket"); 549 553 fibril_mutex_lock(&socket->lock); 550 554 555 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - lock socket buffer"); 556 fibril_mutex_lock(&socket->recv_buffer_lock); 557 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - set socket->sock_core = NULL"); 558 socket->sock_core = NULL; 559 fibril_mutex_unlock(&socket->recv_buffer_lock); 560 561 udp_uc_reset(socket->assoc); 562 551 563 int rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock, 552 564 udp_free_sock_data); 553 565 if (rc != EOK) { 566 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - socket_destroy failed"); 554 567 fibril_mutex_unlock(&socket->lock); 555 568 async_answer_0(callid, rc); 556 569 return; 557 570 } 558 571 572 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - broadcast recv_buffer_cv"); 573 fibril_condvar_broadcast(&socket->recv_buffer_cv); 574 559 575 fibril_mutex_unlock(&socket->lock); 560 576 async_answer_0(callid, EOK); … … 582 598 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril()"); 583 599 600 fibril_mutex_lock(&sock->recv_buffer_lock); 601 584 602 while (true) { 585 603 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] wait for rcv buffer empty()"); 586 fibril_mutex_lock(&sock->recv_buffer_lock); 587 while (sock->recv_buffer_used != 0) { 604 while (sock->recv_buffer_used != 0 && sock->sock_core != NULL) { 588 605 fibril_condvar_wait(&sock->recv_buffer_cv, 589 606 &sock->recv_buffer_lock); 590 607 } 591 608 609 fibril_mutex_unlock(&sock->recv_buffer_lock); 610 592 611 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] call udp_uc_receive()"); 593 612 urc = udp_uc_receive(sock->assoc, sock->recv_buffer, 594 613 UDP_FRAGMENT_SIZE, &rcvd, &xflags, &sock->recv_fsock); 614 fibril_mutex_lock(&sock->recv_buffer_lock); 595 615 sock->recv_error = urc; 596 597 udp_sock_notify_data(sock->sock_core); 598 616 617 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] udp_uc_receive -> %d", urc); 618 619 if (sock->sock_core != NULL) 620 udp_sock_notify_data(sock->sock_core); 621 599 622 if (urc != UDP_EOK) { 623 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] urc != UDP_EOK, break"); 600 624 fibril_condvar_broadcast(&sock->recv_buffer_cv); 601 fibril_mutex_unlock(&sock->recv_buffer_lock); 602 break; 603 } 604 625 break; 626 } 627 605 628 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] got data - broadcast recv_buffer_cv"); 606 629 607 630 sock->recv_buffer_used = rcvd; 608 fibril_mutex_unlock(&sock->recv_buffer_lock);609 631 fibril_condvar_broadcast(&sock->recv_buffer_cv); 610 632 } 611 633 634 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() exited loop"); 635 fibril_mutex_unlock(&sock->recv_buffer_lock); 612 636 udp_uc_destroy(sock->assoc); 637 638 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() terminated"); 613 639 614 640 return 0; -
uspace/srv/net/udp/ucall.c
rd120133 r192565b 113 113 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_uc_receive()", assoc->name); 114 114 rc = udp_assoc_recv(assoc, &msg, fsock); 115 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv -> %d", rc); 115 116 switch (rc) { 117 case EOK: 118 break; 119 case ECONNABORTED: 120 return UDP_ERESET; 121 default: 122 assert(false); 116 123 } 117 124 … … 133 140 { 134 141 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_uc_destroy()"); 142 udp_assoc_reset(assoc); 135 143 udp_assoc_remove(assoc); 136 144 udp_assoc_delete(assoc); 145 } 146 147 void udp_uc_reset(udp_assoc_t *assoc) 148 { 149 udp_assoc_reset(assoc); 137 150 } 138 151 -
uspace/srv/net/udp/ucall.h
rd120133 r192565b 49 49 extern void udp_uc_status(udp_assoc_t *, udp_assoc_status_t *); 50 50 extern void udp_uc_destroy(udp_assoc_t *); 51 extern void udp_uc_reset(udp_assoc_t *); 51 52 52 53 #endif -
uspace/srv/net/udp/udp_type.h
rd120133 r192565b 51 51 UDP_EUNSPEC, 52 52 /* No route to destination */ 53 UDP_ENOROUTE 53 UDP_ENOROUTE, 54 /** Association reset by user */ 55 UDP_ERESET 54 56 } udp_error_t; 55 57 … … 119 121 udp_sockpair_t ident; 120 122 123 /** True if association was reset by user */ 124 bool reset; 125 121 126 /** True if association was deleted by user */ 122 127 bool deleted; -
uspace/srv/ns/task.c
rd120133 r192565b 208 208 sysarg_t retval; 209 209 task_exit_t texit; 210 bool remove = false; 210 211 211 212 ht_link_t *link = hash_table_find(&task_hash_table, &id); … … 235 236 } 236 237 237 hash_table_remove_item(&task_hash_table, link);238 remove = true; 238 239 retval = EOK; 239 240 … … 243 244 ipc_answer_2(callid, retval, texit, ht->retval); 244 245 } 246 if (remove) 247 hash_table_remove_item(&task_hash_table, link); 245 248 } 246 249
Note:
See TracChangeset
for help on using the changeset viewer.
