Subject: LWP system calls
To: None <>
From: Andrew Doran <>
List: tech-kern
Date: 09/14/2007 01:55:21

I'd like to add a few more LWP system calls. The first two are fairly
obvious. Since we have pthread_setname_np() and the kernel can name LWPs,
I'd like to add a way to pass that information into the kernel:

	int _lwp_setname(const char *);
	int _lwp_getname(char *, size_t);

The second is for caching LWPs in userspace. So from the application's POV,
the thread exits but in reality it hangs around waiting to be reused. When
recycling threads, the register state needs to be cleaned out which can be
done in userspace. Beyond that the the attributes that need changing are the
name, the signal mask and the 'suspended' state. So I'd like to add a system
call that would do the equivalent of _lwp_unpark() and also clear out the
target's name, copy the signal mask from the caller, and unsuspend the
thread if necessary (an application error). The void * argument is the
'hint' argument from _lwp_unpark() that helps to narrow the search for the
LWP to a single sleep queue:

	int _lwp_recycle(lwpid_t, const void *);