In the kernel, you should call file_open(file_close...)
instead open(close...) to avoid the problem you described below.

On Fri, Jan 28, 2022 at 7:43 PM Michael Jung <mij...@gmx.net> wrote:

> Hello everybody,
>
> I am developing a device driver, which is exposed as a character device
> (i.e. /dev/pcd) and which mostly uses ioctl for device control.  Within a
> specific ioctl command implementation I am starting a new kernel thread via
> kthread_create_with_stack.  Once this thread's main function exits, the
> NuttX scheduler calls 'close' on all open file descriptors, which causes
> undesired side effects.
>
> What is the correct way to start a lightweight kernel thread without
> copying the open file descriptors from the original thread? (workqueues are
> probably not an option since the thread's main function might run for an
> extended period of time).
>
> Your help is much appreciated
>
> Thanks!
> Michael
>

Reply via email to