kernel/sys/process.c
/**
 * @brief Release a process's paging data.
 *
 * If this is a thread in a POSIX process with other
 * living threads, the directory is not actually released
 * but the reference count for it is decremented.
 *
 * XXX There's probably no reason for this to take an argument;
 *     we only ever free directories in two places: on exec, or
 *     when a thread exits, and that's always the current thread.
 */
@brief Release a process's paging data.
If this is a thread in a POSIX process with other
living threads, the directory is not actually released
but the reference count for it is decremented.

XXX There's probably no reason for this to take an argument;
we only ever free directories in two places: on exec, or
when a thread exits, and that's always the current thread.
@brief Release a process ' s paging data . If this is a thread in a POSIX process with other living threads the directory is not actually released but the reference count for it is decremented . XXX There ' s probably no reason for this to take an argument ; we only ever free directories in two places : on exec or when a thread exits and that ' s always the current thread .
void process_release_directory(page_directory_t * dir) {
	spin_lock(dir->lock);
	dir->refcount--;
	if (dir->refcount < 1) {
		mmu_free(dir->directory);
		free(dir);
	} else {
		spin_unlock(dir->lock);
	}
}
void process_release_directory ( page_directory_t * dir ) { spin_lock ( dir -> lock ) ; dir -> refcount -- ; if ( dir -> refcount < 1 ) { mmu_free ( dir -> directory ) ; free ( dir ) ; } else { spin_unlock ( dir -> lock ) ; } }
@brief Release a process's paging data.
@brief Release a process ' s paging data .