Where is getname () defined

Alison Schofield alison.schofield at intel.com
Fri Aug 29 15:38:20 EDT 2025


On Fri, Aug 29, 2025 at 03:19:59PM -0400, Dan Bokser wrote:
> On Fri, Aug 29, 2025 at 2:43 PM Vulturus <vulturus at vulturus.xyz> wrote:
> 
> > Dear kernelnewbies subscribers,
> >
> > I was reading the kernel source tree in an
> > attempt to understand how the chroot syscall workes.
> > (I was using the linux-6.17-rc3 tarball from kernel.org.)
> >
> > At line 1429 of the fs/open.c file, inside the
> > definition of the do_sys_openat2() function getname() is called.
> >
> > I am having trouble finding its definition.
> >
> > In particular,
> > $ grep -rn 'getname' fs
> > doesn't return a line like 'struct file *getname (args)'
> > or similar, as I would expect.
> >
> > Can someone point me to the file/line where getname() is defined?

See include/linux/fs.h

The search directory scope was too high, not in fs.
You may find cscope, ctags, or bootlin[1] useful.

[1] https://elixir.bootlin.com/linux/v6.17-rc3/source/include/linux/fs.h#L2916


> >
> > Thank you,
> > Vulturus
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> 
> Looks like it's an inline function defined in a header in
> /include/linux/fs.h:
> https://elixir.bootlin.com/linux/v6.17-rc3/source/include/linux/fs.h#L2916
> 
> Bootlin is a fantastic tool to find where things are defined in the kernel.
> 
> -Daniel
> 
> >
> >

> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




More information about the Kernelnewbies mailing list