Importing system call as a module function

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sat Jul 13 17:42:30 EDT 2013


On Sun, 14 Jul 2013 01:05:31 +0530, Saket Sinha said:

> This function long mkdir(......) has most probably imported sytem call
> sys_mkdir since no other instance of mkdir is there in the kernel source
> tree.
> http://lxr.linux.no/linux+v2.6.18/include/linux/syscalls.h#L389
>
> Please somebody explain this.

A bigger question is why a kernel module is trying to do a mkdir in the
first place.  Note that procfs and sysfs provide other APIs for modules
to create subdirectories in those pseudo filesystems.

I see it looks like yet another attempt to make a "union" filesystem - you
almost certainly want to examine the other attempts at doing such a thing,
as there's a lot of issues with doing it well.  In particular, doing whiteouts
and other operations will require more support from the VFS layer.  Just
doing a mkdir() call behind the VFS's back is almost certainly setting
yourself up for trouble (most likely on either locking or object lifetime
issues).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130713/6d139bcb/attachment.bin 


More information about the Kernelnewbies mailing list