* Where is getname () defined
@ 2025-08-29 18:43 Vulturus
2025-08-29 19:19 ` Dan Bokser
2025-08-31 16:25 ` Partha P. Mukherjee
0 siblings, 2 replies; 4+ messages in thread
From: Vulturus @ 2025-08-29 18:43 UTC (permalink / raw)
To: kernelnewbies@kernelnewbies.org
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?
Thank you,
Vulturus
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Where is getname () defined
2025-08-29 18:43 Where is getname () defined Vulturus
@ 2025-08-29 19:19 ` Dan Bokser
2025-08-29 19:38 ` Alison Schofield
2025-08-31 16:25 ` Partha P. Mukherjee
1 sibling, 1 reply; 4+ messages in thread
From: Dan Bokser @ 2025-08-29 19:19 UTC (permalink / raw)
To: Vulturus; +Cc: kernelnewbies@kernelnewbies.org
[-- Attachment #1.1: Type: text/plain, Size: 1136 bytes --]
On Fri, Aug 29, 2025 at 2:43 PM Vulturus <vulturus@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?
>
> Thank you,
> Vulturus
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@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
>
>
[-- Attachment #1.2: Type: text/html, Size: 2393 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Where is getname () defined
2025-08-29 19:19 ` Dan Bokser
@ 2025-08-29 19:38 ` Alison Schofield
0 siblings, 0 replies; 4+ messages in thread
From: Alison Schofield @ 2025-08-29 19:38 UTC (permalink / raw)
To: Dan Bokser; +Cc: Vulturus, kernelnewbies@kernelnewbies.org
On Fri, Aug 29, 2025 at 03:19:59PM -0400, Dan Bokser wrote:
> On Fri, Aug 29, 2025 at 2:43 PM Vulturus <vulturus@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@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@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Where is getname () defined
2025-08-29 18:43 Where is getname () defined Vulturus
2025-08-29 19:19 ` Dan Bokser
@ 2025-08-31 16:25 ` Partha P. Mukherjee
1 sibling, 0 replies; 4+ messages in thread
From: Partha P. Mukherjee @ 2025-08-31 16:25 UTC (permalink / raw)
To: kernelnewbies
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
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-31 16:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 18:43 Where is getname () defined Vulturus
2025-08-29 19:19 ` Dan Bokser
2025-08-29 19:38 ` Alison Schofield
2025-08-31 16:25 ` Partha P. Mukherjee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).