Where is getname () defined

Partha P. Mukherjee ppm.floss at gmail.com
Sun Aug 31 12:25:37 EDT 2025


On 8/29/25 2:43 PM, Vulturus 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?

You can use GNU Global [1] to find definition and references.

$ make gtags
$ global -x getname
getname          2916 include/linux/fs.h static inline struct filename *getname(const char __user *name)
$ global -xr getname
getname           484 crypto/af_alg.c  	.getname	=	sock_no_getname,
...
<snip>

[1] https://www.gnu.org/software/global/

> Thank you,
> Vulturus



More information about the Kernelnewbies mailing list