/*
 *	smpstuff.h - SMP processor locking system calls
 *	Copyright (C) 1999/2000 Fred Barnes <frmb2@ukc.ac.uk>
 *	This file (and any related kernel patches) are GPL
 */

/*
 *	The functions are:
 *	int smp_processor( void )		Returns the processor this process is running on
 *	int smp_lockto( int proc_id )		Locks current processor to a specified processor (proc_id)
 *						Locking to -1 returns to the default behaviour
 *	int smp_num_cpus( void )		How many CPUs do we have ?
 */

#ifndef _SMPSTUFF_H
#define _SMPSTUFF_H

#include <unistd.h>
#include <linux/unistd.h>

_syscall0( int, smp_processor );
_syscall1( int, smp_lockto, int, proc_id );
_syscall0( int, smp_num_cpus );

static inline int smp_rlockto( int proc_id )
{
	if( smp_lockto( proc_id ) < 0 ) {
		return -1;
	}
	usleep( 1 );
	return 0;
}

#endif	/* !_SMPSTUFF_H */

