Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 106971
Collapse All | Expand All

(-)mono/io-layer/handles.c (-14 / +59 lines)
Lines 351-360 Link Here
351
		_wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
351
		_wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
352
	}
352
	}
353
		
353
		
354
	thr_ret = mono_mutex_unlock (&scan_mutex);
355
	g_assert (thr_ret == 0);
356
	pthread_cleanup_pop (0);
357
		
358
	/* Make sure we left the space for fd mappings */
354
	/* Make sure we left the space for fd mappings */
359
	g_assert (handle_idx >= _wapi_fd_reserve);
355
	g_assert (handle_idx >= _wapi_fd_reserve);
360
	
356
	
Lines 375-381 Link Here
375
							  handle_specific);
371
							  handle_specific);
376
			if (offset == 0) {
372
			if (offset == 0) {
377
				/* FIXME: grow the arrays */
373
				/* FIXME: grow the arrays */
378
				return (_WAPI_HANDLE_INVALID);
374
				handle = _WAPI_HANDLE_INVALID;
375
				goto done;
379
			}
376
			}
380
		}
377
		}
381
		
378
		
Lines 386-392 Link Here
386
383
387
			if (ref == 0) {
384
			if (ref == 0) {
388
				/* FIXME: grow the arrays */
385
				/* FIXME: grow the arrays */
389
				return (_WAPI_HANDLE_INVALID);
386
				handle = _WAPI_HANDLE_INVALID;
387
				goto done;
390
			}
388
			}
391
		}
389
		}
392
		
390
		
Lines 396-401 Link Here
396
			   ref);
394
			   ref);
397
#endif
395
#endif
398
	}
396
	}
397
		
398
done:
399
	thr_ret = mono_mutex_unlock (&scan_mutex);
400
	g_assert (thr_ret == 0);
401
	pthread_cleanup_pop (0);
399
	
402
	
400
	return(handle);
403
	return(handle);
401
}
404
}
Lines 403-409 Link Here
403
gpointer _wapi_handle_new_from_offset (WapiHandleType type, guint32 offset)
406
gpointer _wapi_handle_new_from_offset (WapiHandleType type, guint32 offset)
404
{
407
{
405
	guint32 handle_idx = 0;
408
	guint32 handle_idx = 0;
406
	gpointer handle;
409
	gpointer handle = INVALID_HANDLE_VALUE;
407
	int thr_ret, i, k;
410
	int thr_ret, i, k;
408
	
411
	
409
	mono_once (&shared_init_once, shared_init);
412
	mono_once (&shared_init_once, shared_init);
Lines 417-422 Link Here
417
	g_assert(_WAPI_SHARED_HANDLE(type));
420
	g_assert(_WAPI_SHARED_HANDLE(type));
418
	g_assert(offset != 0);
421
	g_assert(offset != 0);
419
		
422
		
423
	pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup,
424
			      (void *)&scan_mutex);
425
	thr_ret = mono_mutex_lock (&scan_mutex);
426
	g_assert (thr_ret == 0);
427
420
	for (i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
428
	for (i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
421
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
429
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
422
			struct _WapiHandleUnshared *handle_data = &_wapi_private_handles [i][k];
430
			struct _WapiHandleUnshared *handle_data = &_wapi_private_handles [i][k];
Lines 424-437 Link Here
424
			if (handle_data->type == type &&
432
			if (handle_data->type == type &&
425
			    handle_data->u.shared.offset == offset) {
433
			    handle_data->u.shared.offset == offset) {
426
				handle = GUINT_TO_POINTER (i * _WAPI_HANDLE_INITIAL_COUNT + k);
434
				handle = GUINT_TO_POINTER (i * _WAPI_HANDLE_INITIAL_COUNT + k);
427
				_wapi_handle_ref (handle);
435
				goto first_pass_done;
436
			}
437
		}
438
	}
428
439
440
first_pass_done:
441
	thr_ret = mono_mutex_unlock (&scan_mutex);
442
	g_assert (thr_ret == 0);
443
	pthread_cleanup_pop (0);
444
445
	if (handle != INVALID_HANDLE_VALUE) {
446
		_wapi_handle_ref (handle);
447
429
#ifdef DEBUG
448
#ifdef DEBUG
430
				g_message ("%s: Returning old handle %p referencing 0x%x", __func__, handle, offset);
449
		g_message ("%s: Returning old handle %p referencing 0x%x",
450
			   __func__, handle, offset);
431
#endif
451
#endif
432
				return (handle);
452
		return (handle);
433
			}
434
		}
435
	}
453
	}
436
454
437
	pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup,
455
	pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup,
Lines 713-720 Link Here
713
	gpointer ret = NULL;
731
	gpointer ret = NULL;
714
	guint32 i, k;
732
	guint32 i, k;
715
	gboolean found = FALSE;
733
	gboolean found = FALSE;
734
	int thr_ret;
716
735
717
736
	pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup,
737
			      (void *)&scan_mutex);
738
	thr_ret = mono_mutex_lock (&scan_mutex);
739
	g_assert (thr_ret == 0);
740
	
718
	for (i = SLOT_INDEX (0); !found && _wapi_private_handles [i] != NULL; i++) {
741
	for (i = SLOT_INDEX (0); !found && _wapi_private_handles [i] != NULL; i++) {
719
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
742
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
720
			handle_data = &_wapi_private_handles [i][k];
743
			handle_data = &_wapi_private_handles [i][k];
Lines 729-734 Link Here
729
		}
752
		}
730
	}
753
	}
731
754
755
	thr_ret = mono_mutex_unlock (&scan_mutex);
756
	g_assert (thr_ret == 0);
757
	pthread_cleanup_pop (0);
758
732
	if (!found && _WAPI_SHARED_HANDLE (type)) {
759
	if (!found && _WAPI_SHARED_HANDLE (type)) {
733
		/* Not found yet, so search the shared memory too */
760
		/* Not found yet, so search the shared memory too */
734
#ifdef DEBUG
761
#ifdef DEBUG
Lines 1564-1570 Link Here
1564
{
1591
{
1565
	struct _WapiHandleUnshared *handle_data;
1592
	struct _WapiHandleUnshared *handle_data;
1566
	guint32 i, k;
1593
	guint32 i, k;
1567
1594
	int thr_ret;
1595
	
1596
	pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup,
1597
			      (void *)&scan_mutex);
1598
	thr_ret = mono_mutex_lock (&scan_mutex);
1599
	g_assert (thr_ret == 0);
1600
	
1568
	for(i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
1601
	for(i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
1569
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
1602
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
1570
			handle_data = &_wapi_private_handles [i][k];
1603
			handle_data = &_wapi_private_handles [i][k];
Lines 1582-1587 Link Here
1582
			g_print ("\n");
1615
			g_print ("\n");
1583
		}
1616
		}
1584
	}
1617
	}
1618
1619
	thr_ret = mono_mutex_unlock (&scan_mutex);
1620
	g_assert (thr_ret == 0);
1621
	pthread_cleanup_pop (0);
1585
}
1622
}
1586
1623
1587
static void _wapi_shared_details (gpointer handle_info)
1624
static void _wapi_shared_details (gpointer handle_info)
Lines 1602-1607 Link Here
1602
	thr_ret = _wapi_shm_sem_lock (_WAPI_SHARED_SEM_SHARE);
1639
	thr_ret = _wapi_shm_sem_lock (_WAPI_SHARED_SEM_SHARE);
1603
	g_assert(thr_ret == 0);
1640
	g_assert(thr_ret == 0);
1604
1641
1642
	pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup,
1643
			      (void *)&scan_mutex);
1644
	thr_ret = mono_mutex_lock (&scan_mutex);
1645
	
1605
	for(i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
1646
	for(i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
1606
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
1647
		for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
1607
			struct _WapiHandleUnshared *handle = &_wapi_private_handles [i][k];
1648
			struct _WapiHandleUnshared *handle = &_wapi_private_handles [i][k];
Lines 1644-1649 Link Here
1644
			}
1685
			}
1645
		}
1686
		}
1646
	}
1687
	}
1688
1689
	thr_ret = mono_mutex_unlock (&scan_mutex);
1690
	g_assert (thr_ret == 0);
1691
	pthread_cleanup_pop (0);
1647
	
1692
	
1648
	thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_SHARE);
1693
	thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_SHARE);
1649
1694
(-)mono/io-layer/processes.c (-3 / +8 lines)
Lines 97-102 Link Here
97
	int status;
97
	int status;
98
	pid_t ret;
98
	pid_t ret;
99
	
99
	
100
	if (_wapi_handle_issignalled (test)) {
101
		/* We've already done this one */
102
		return (FALSE);
103
	}
104
	
100
	ok = _wapi_lookup_handle (test, WAPI_HANDLE_PROCESS,
105
	ok = _wapi_lookup_handle (test, WAPI_HANDLE_PROCESS,
101
				  (gpointer *)&process);
106
				  (gpointer *)&process);
102
	if (ok == FALSE) {
107
	if (ok == FALSE) {
Lines 104-117 Link Here
104
	}
109
	}
105
	
110
	
106
	do {
111
	do {
107
		ret == waitpid (process->id, &status, WNOHANG);
112
		ret = waitpid (process->id, &status, WNOHANG);
108
	} while (errno == EINTR);
113
	} while (errno == EINTR);
109
	
114
	
110
	if (ret <= 0) {
115
	if (ret <= 0) {
111
		/* Process not ready for wait */
116
		/* Process not ready for wait */
112
#ifdef DEBUG
117
#ifdef DEBUG
113
		g_message ("%s: Process %d not ready for waiting for",
118
		g_message ("%s: Process %d not ready for waiting for: %s",
114
			   __func__, ret);
119
			   __func__, process->id, g_strerror (errno));
115
#endif
120
#endif
116
121
117
		return (FALSE);
122
		return (FALSE);

Return to bug 106971