Re: Re: Kernel module: return a number from a device

From: Rocky Hotas <rockyhotas_at_tilde.team>
Date: Sat, 06 Apr 2024 21:00:20 UTC
On apr 06 14:39, Warner Losh wrote:
> When this happens, hit ^t (control t). That will give a traceback of the
> call stack which may help you track down where it is hanging (most likely
> something is sleeping waiting for an event).

Thanks! It seems that cat itself is hanging (so, uiomove can still be
the
culprit...):

$ cat rolld 
Opened device "rolld" successfully.
load: 0.44  cmd: cat 13392 [running] 7.67r 1.25u 6.39s 38% 1936k

I also tried to modify rolld_read using only char variables:

static int
rolld_read(struct cdev *dev __unused, struct uio *uio, int ioflag
__unused)
{
        char random_out;
        char random_item;
        int error;

        random_item = (char) arc4random();
        random_out = random_item % d_size;

        if ((error = uiomove(&random_out, 1, uio)) != 0)
                uprintf("uiomove failed!\n");

        return (error);
}


But nothing changed with respect to the first version.

Rocky