• Home
  • Raw
  • Download

Lines Matching refs:area

156   ShmArea *area;  member
186 static void sp_close_shm (ShmArea * area);
189 static void sp_shm_area_dec (ShmPipe * self, ShmArea * area);
261 area->use_count--; \
262 sp_close_shm (area); \
276 ShmArea *area = spalloc_new (ShmArea); in sp_open_shm() local
282 memset (area, 0, sizeof (ShmArea)); in sp_open_shm()
284 area->shm_area_buf = MAP_FAILED; in sp_open_shm()
285 area->use_count = 1; in sp_open_shm()
287 area->shm_area_len = size; in sp_open_shm()
289 area->is_writer = (path == NULL); in sp_open_shm()
301 area->shm_fd = -1; in sp_open_shm()
304 area->shm_fd = shm_open (path, flags, perms); in sp_open_shm()
308 area->shm_fd = shm_open (tmppath, flags, perms); in sp_open_shm()
309 } while (area->shm_fd < 0 && errno == EEXIST); in sp_open_shm()
312 if (area->shm_fd < 0) in sp_open_shm()
317 area->shm_area_name = strdup (tmppath); in sp_open_shm()
319 if (ftruncate (area->shm_fd, size)) in sp_open_shm()
325 area->shm_area_name = strdup (path); in sp_open_shm()
329 area->shm_area_buf = mmap (NULL, size, prot, MAP_SHARED, area->shm_fd, 0); in sp_open_shm()
331 if (area->shm_area_buf == MAP_FAILED) in sp_open_shm()
334 area->id = id; in sp_open_shm()
337 area->allocspace = shm_alloc_space_new (area->shm_area_len); in sp_open_shm()
339 return area; in sp_open_shm()
345 sp_close_shm (ShmArea * area) in sp_close_shm() argument
347 assert (area->use_count == 0); in sp_close_shm()
349 if (area->allocspace) in sp_close_shm()
350 shm_alloc_space_free (area->allocspace); in sp_close_shm()
352 if (area->shm_area_buf != MAP_FAILED) in sp_close_shm()
353 munmap (area->shm_area_buf, area->shm_area_len); in sp_close_shm()
355 if (area->shm_fd >= 0) in sp_close_shm()
356 close (area->shm_fd); in sp_close_shm()
358 if (area->shm_area_name) { in sp_close_shm()
359 if (area->is_writer) in sp_close_shm()
360 shm_unlink (area->shm_area_name); in sp_close_shm()
361 free (area->shm_area_name); in sp_close_shm()
364 spalloc_free (ShmArea, area); in sp_close_shm()
368 sp_shm_area_inc (ShmArea * area) in sp_shm_area_inc() argument
370 area->use_count++; in sp_shm_area_inc()
374 sp_shm_area_dec (ShmPipe * self, ShmArea * area) in sp_shm_area_dec() argument
376 assert (area->use_count > 0); in sp_shm_area_dec()
377 area->use_count--; in sp_shm_area_dec()
379 if (area->use_count == 0) { in sp_shm_area_dec()
384 if (item == area) { in sp_shm_area_dec()
395 sp_close_shm (area); in sp_shm_area_dec()
462 ShmArea *area; in sp_writer_setperms_shm() local
465 for (area = self->shm_area; area; area = area->next) in sp_writer_setperms_shm()
466 ret |= fchmod (area->shm_fd, perms); in sp_writer_setperms_shm()
547 block->area = self->shm_area; in sp_writer_alloc_block()
556 return block->area->shm_area_buf + in sp_writer_block_get_buf()
570 sp_shm_area_dec (block->pipe, block->area); in sp_writer_free_block()
580 ShmArea *area = NULL; in sp_writer_send_buf() local
592 for (area = self->shm_area; area; area = area->next) { in sp_writer_send_buf()
593 if (buf >= area->shm_area_buf && in sp_writer_send_buf()
594 buf < (area->shm_area_buf + area->shm_area_len)) { in sp_writer_send_buf()
595 offset = buf - area->shm_area_buf; in sp_writer_send_buf()
596 ablock = shm_alloc_space_block_get (area->allocspace, offset); in sp_writer_send_buf()
608 sb->shm_area = area; in sp_writer_send_buf()
630 sp_shm_area_inc (area); in sp_writer_send_buf()
659 ShmArea *area; in sp_client_recv() local
692 for (area = self->shm_area; area; area = area->next) { in sp_client_recv()
693 if (area->id == cb.area_id) { in sp_client_recv()
694 sp_shm_area_dec (self, area); in sp_client_recv()
702 for (area = self->shm_area; area; area = area->next) { in sp_client_recv()
703 if (area->id == cb.area_id) { in sp_client_recv()
704 *buf = area->shm_area_buf + cb.payload.buffer.offset; in sp_client_recv()
705 sp_shm_area_inc (area); in sp_client_recv()