scripts/bash_aliases: tfix
[man-pages.git] / man2 / lookup_dcookie.2
blob6c178e367d7eacf4b9f78da58a78f848cc3ad876
1 .\" Copyright (C) 2003 John Levon <levon@movementarian.org>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified 2004-06-17 Michael Kerrisk <mtk.manpages@gmail.com>
26 .\"
27 .TH LOOKUP_DCOOKIE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 lookup_dcookie \- return a directory entry's path
30 .SH SYNOPSIS
31 .nf
32 .BR "#include <sys/syscall.h>" "      /* Definition of " SYS_* " constants */"
33 .B #include <unistd.h>
34 .PP
35 .BI "int syscall(SYS_lookup_dcookie, uint64_t " cookie ", char *" buffer ,
36 .BI "            size_t " len );
37 .fi
38 .PP
39 .IR Note :
40 glibc provides no wrapper for
41 .BR lookup_dcookie (),
42 necessitating the use of
43 .BR syscall (2).
44 .SH DESCRIPTION
45 Look up the full path of the directory entry specified by the value
46 .IR cookie .
47 The cookie is an opaque identifier uniquely identifying a particular
48 directory entry.
49 The buffer given is filled in with the full path of the directory entry.
50 .PP
51 For
52 .BR lookup_dcookie ()
53 to return successfully,
54 the kernel must still hold a cookie reference to the directory entry.
55 .SH RETURN VALUE
56 On success,
57 .BR lookup_dcookie ()
58 returns the length of the path string copied into the buffer.
59 On error, \-1 is returned, and
60 .I errno
61 is set to indicate the error.
62 .SH ERRORS
63 .TP
64 .B EFAULT
65 The buffer was not valid.
66 .TP
67 .B EINVAL
68 The kernel has no registered cookie/directory entry mappings at the
69 time of lookup, or the cookie does not refer to a valid directory entry.
70 .TP
71 .B ENAMETOOLONG
72 The name could not fit in the buffer.
73 .TP
74 .B ENOMEM
75 The kernel could not allocate memory for the temporary buffer holding
76 the path.
77 .TP
78 .B EPERM
79 The process does not have the capability
80 .B CAP_SYS_ADMIN
81 required to look up cookie values.
82 .TP
83 .B ERANGE
84 The buffer was not large enough to hold the path of the directory entry.
85 .SH VERSIONS
86 Available since Linux 2.5.43.
87 The
88 .B ENAMETOOLONG
89 error return was added in 2.5.70.
90 .SH CONFORMING TO
91 .BR lookup_dcookie ()
92 is Linux-specific.
93 .SH NOTES
94 .BR lookup_dcookie ()
95 is a special-purpose system call, currently used only by the
96 .BR oprofile (1)
97 profiler.
98 It relies on a kernel driver to register cookies for directory entries.
99 .PP
100 The path returned may be suffixed by the string " (deleted)" if the directory
101 entry has been removed.
102 .SH SEE ALSO
103 .BR oprofile (1)