How can I remove file in kext

I am developing the kext which have to monitor the directory on filesystem, get contents of that directory and remove some files there if neccessary.

I can't find public interface to do that.

Replies

Is there a particular reason you are trying to do this from the kernel as opposed to using a daemon in user space? As you have discovered kernel extensions have very limited access to the filesystem. IOKit kernel extensions, which are what I'm most familiar with, have nearly zero access.

Yes. It is one of subsystems of kext. To do it in user space daemon I need implement some kind of communication between kext and daemon. Our kext creates files in directory and periodically it need to be cleaned. So I can create file, read and write it, but I can't get list of files and remove files.