Subject: Re: p_flag in struct proc: int -> uint64_t
To: None <tech-kern@netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 10/05/2006 14:20:17
On Wed, Oct 04, 2006 at 11:39:13PM -0700, Jason Thorpe wrote:
> 
> On Oct 4, 2006, at 10:40 AM, Jason Thorpe wrote:
> 
> >
> >On Oct 3, 2006, at 9:31 AM, YAMAMOTO Takashi wrote:
> >
> >>>>i have an implementation of lwp-specific data.
> >>(attached.  i wrote it to replace l_emuldata, l_savp, etc.)
> >>proc-specific data can be similar except locking.
> >
> >Ok, I hereby volunteer to generalize this and make it something that  
> >we can use with procs, lwps, and possibly sessions (I can see some  
> >value in extensible per-session data as well).
> >
> >I'll work on it this week.
> 
> Ok, here is a generalized (and currently untested) "specificdata"  
> implementation, based on Yamamoto-san's.  proc, lwp, and session  
> specific-data could be built on top of this, a'la (note this is  
> incomplete):
> 
> ...
> static specificdata_domain_t proc_specificdata_domain;
> ...
> 
> void
> proc_init(void)
> {
> 	...
> 	proc_specificdata_domain = specificdata_domain_create();
> 	...
> }
> 
> int
> proc_specific_key_create(specificdata_key_t key,
>                          specificdata_dtor_t dtor)
> {
> 	return (specificdata_key_create(proc_specificdata_domain,
> 	                                key, dtor));
> }
> 
> void
> proc_specifc_key_delete(specificdata_key_t key)
> {
> 	specificdata_key_delete(proc_specificdata_domain, key);
> }
> 
> void *
> proc_getspecific(specificdata_key_t key)
> {
> 	struct proc *p = curproc;
> 
> 	return (specificdata_getspecific(proc_specificdata_domain,
> 	                                 &p->p_specdataref, key));
> }
> 
> void
> proc_setspecific(specificdata_key_t key, void *data)
> {
> 	struct proc *p = curproc;
> 
> 	specificdata_setspecific(proc_specificdata_domain,
> 	                         &p->p_specdataref, key, data));
> }
> 
> 
> Comments?
> 
> 

As my upcoming file system transactions should use this interface to store
a list in lwp-context I'm missing two things:

- Specificdata_setspecific() and the functions using it should also work
  (and possibly fail) if called from a non-sleepable context.  Either a
  flag (WAIT/NOWAIT) or a special function xxx_nowait().

- It would be nice to have a static __link_set_xxx based creator so a subsystem
  may create a key without the need of an explicit init() function.

> 
> -- thorpej
> 


-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)