sosend() and mbuf

Julian Elischer julian at elischer.org
Tue Aug 4 16:40:16 UTC 2009


Maslan wrote:
> OpenKETA has its own kthread_create() with a little modification from
> kthread_create(), it associates the new thread with curthread not with
> the thread0.

hey that's horrible...
(overiding a kernel symbol)

> 
> See /usr/sys/kern/kern_kthread.c: kthread_create()
> 	error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags,
> 	    pages, &p2);
> OpenKETA:kthread_create()
> 	error = fork1(curthread, RFFDG | RFPROC | RFSTOPPED | flags,
> 	    pages, &p2);

in 8.0 you can do this..
(see man kthread)


> 
> I'll give it a try and see if it works.
> BUT i still can't understand why kern_open() don't work, except in the
> original thread.
> 
> On Tue, Aug 4, 2009 at 9:59 AM, Maslan<maslanbsd at gmail.com> wrote:
>> yes kio http://people.freebsd.org/~pjd/misc/kernio/
>> However, It's outdated.
>>
>> On Tue, Aug 4, 2009 at 9:56 AM, Ed Schouten<ed at 80386.nl> wrote:
>>> * Maslan <maslanbsd at gmail.com> wrote:
>>>>> Is it possible to call kern_open() from within a kernel thread anyway?
>>>> I think yes, It worked on the parent thread before creating a new kthread.
>>>> See OpenKETA source, its using the same approach.
>>>>> kern_open() depends on a file descriptor table, right?
>>>> Yes, it returns a fd in the curthread->td_retval[0], which i should
>>>> use within the same thread to deal with this file.
>>> Didn't someone (Jeff Roberson?) develop some nice in-kernel API for
>>> accessing files some years ago? Why not use that?
>>>
>>> --
>>>  Ed Schouten <ed at 80386.nl>
>>>  WWW: http://80386.nl/
>>>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"



More information about the freebsd-hackers mailing list