# Troubles with calling kern_execve from kthread_create



## botcser (May 23, 2016)

Hello, Everyone.

I'm loading kernel module by kldload(8)...
I'm trying to call kern_execve() from kthread_create(): if I call kern_execve() directly from start() - everything works fine, but if I call kthread_create() from start() and then call kern_execve() from the created child - I'm getting the following error 
	
	



```
errno 2 "No such file or directory"
```
 Why do I get this error? 

Or, how do I execute a binary file from loading kernel module, while loading parallel and not wait until this binary will finish his work


----------



## botcser (May 27, 2016)

Get from reverse: 
	
	



```
curthread->td_proc->p_fd->fd_cdir ?= 0 -> return errno 2
```
 And for what this check...


----------

