Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2023 10:34:21 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Yuri <yuri@aetern.org>
Cc:        =?UTF-8?B?R29yYW4gTWVracSH?= <meka@tilda.center>,  freebsd-current@freebsd.org
Subject:   Re: Infinite loop with d_write_t
Message-ID:  <CACNAnaET0DKngOqrE_%2B2B8g8MRhzjmf8Ci3RKzNo0CHwtcsKNw@mail.gmail.com>
In-Reply-To: <e418c6f4-ab10-020e-0b94-2f47d3182fb2@aetern.org>
References:  <20230319111404.a6ac2w44u4trtedy@tilda.center> <e418c6f4-ab10-020e-0b94-2f47d3182fb2@aetern.org>

index | next in thread | previous in thread | raw e-mail

On Sun, Mar 19, 2023 at 6:33 AM Yuri <yuri@aetern.org> wrote:
>
> Goran Mekić wrote:
> > Hello,
> >
> > I'm trying to assemble a minimal kernel module and user space program as
> > a skeleton, and no matter what I do I get infinite loop. The code for
> > kernel is https://github.com/mekanix/freebsd-project/blob/master/kernel/main.c.
> > The way to test:
> > # make
> > # sudo kldload ./hello.ko
> > # echo "something" >/dev/hello
> > Write done.
> > Write done.
> > ...
> >
> > What am I doing wrong and where does that infinite loop comes from?
>
> Why are you using copyin() and not uiomove() in d_write entry?
>
> There's an example that looks like you are trying to do:
>
> https://docs.freebsd.org/en/books/arch-handbook/driverbasics/#driverbasics-char
>

This... d_write/d_read need the uio accounting updated to reflect how
much data was written/read, it doesn't want to assume you were able to
do everything in a single call.

Thanks,

Kyle Evans


help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaET0DKngOqrE_%2B2B8g8MRhzjmf8Ci3RKzNo0CHwtcsKNw>