httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens-Uwe Mager <>
Subject Anonymous shared memory on MACH based systems
Date Thu, 25 Jun 1998 20:27:53 GMT
I have also stumbled across the problem of Rhapsody aka NeXTStep aka
Mach based systems not supporting anonymous memory in several of my
applications.  But Mach does support anonymous shared memory, just not
in the standard Unix way. I finally used a logic like that below to get
that using the Mach system calls. Probably this mechanism could also be
used for Apache?

#ifdef __MACH__
	if ((ret = vm_allocate(task_self(), (vm_address_t *)&st, mem_len, TRUE))
	    != KERN_SUCCESS) {
		DEB(D_SHARE, mach_error("share_init vm_allocate", ret));
		Slog(LOG_ERR, "share_init vm_allocate: %s",
		return -1;
	if ((ret = vm_inherit(task_self(), (vm_address_t)st, mem_len,
		DEB(D_SHARE, mach_error("share_init vm_inherit", ret));
		Slog(LOG_ERR, "share_init vm_inherit: %s",
		return -1;

The vm_allocate call just allocates some page aligned memory and the
vm_inherit call arranges for the memory to be shared across fork'ed
children. For quick synchronization I also used a Mach cthread mutex
to protect the memory area against concurrent updates.

Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen

Phone:		+49 5131 709320
FAX:		+49 5131 709325

View raw message