| 1 |
.\" Copyright 2003, John Levon <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH lookup_dcookie 2 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
lookup_dcookie \- return a directory entry's path |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" |
| 15 |
.B #include <unistd.h> |
| 16 |
.P |
| 17 |
.BR "int syscall(" "size_t size;" |
| 18 |
.BI " SYS_lookup_dcookie, uint64_t " cookie ", char " buffer [ size ], |
| 19 |
.BI " size_t " size ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.IR Note : |
| 23 |
glibc provides no wrapper for |
| 24 |
.BR lookup_dcookie (), |
| 25 |
necessitating the use of |
| 26 |
.BR syscall (2). |
| 27 |
.SH DESCRIPTION |
| 28 |
Look up the full path of the directory entry specified by the value |
| 29 |
.IR cookie . |
| 30 |
The cookie is an opaque identifier uniquely identifying a particular |
| 31 |
directory entry. |
| 32 |
The buffer given is filled in with the full path of the directory entry. |
| 33 |
.P |
| 34 |
For |
| 35 |
.BR lookup_dcookie () |
| 36 |
to return successfully, |
| 37 |
the kernel must still hold a cookie reference to the directory entry. |
| 38 |
.SH RETURN VALUE |
| 39 |
On success, |
| 40 |
.BR lookup_dcookie () |
| 41 |
returns the length of the path string copied into the buffer. |
| 42 |
On error, \-1 is returned, and |
| 43 |
.I errno |
| 44 |
is set to indicate the error. |
| 45 |
.SH ERRORS |
| 46 |
.TP |
| 47 |
.B EFAULT |
| 48 |
The buffer was not valid. |
| 49 |
.TP |
| 50 |
.B EINVAL |
| 51 |
The kernel has no registered cookie/directory entry mappings at the |
| 52 |
time of lookup, or the cookie does not refer to a valid directory entry. |
| 53 |
.TP |
| 54 |
.B ENAMETOOLONG |
| 55 |
The name could not fit in the buffer. |
| 56 |
.TP |
| 57 |
.B ENOMEM |
| 58 |
The kernel could not allocate memory for the temporary buffer holding |
| 59 |
the path. |
| 60 |
.TP |
| 61 |
.B EPERM |
| 62 |
The process does not have the capability |
| 63 |
.B CAP_SYS_ADMIN |
| 64 |
required to look up cookie values. |
| 65 |
.TP |
| 66 |
.B ERANGE |
| 67 |
The buffer was not large enough to hold the path of the directory entry. |
| 68 |
.SH STANDARDS |
| 69 |
Linux. |
| 70 |
.SH HISTORY |
| 71 |
Linux 2.5.43. |
| 72 |
.P |
| 73 |
The |
| 74 |
.B ENAMETOOLONG |
| 75 |
error was added in Linux 2.5.70. |
| 76 |
.SH NOTES |
| 77 |
.BR lookup_dcookie () |
| 78 |
is a special-purpose system call, currently used only by the |
| 79 |
.BR oprofile (1) |
| 80 |
profiler. |
| 81 |
It relies on a kernel driver to register cookies for directory entries. |
| 82 |
.P |
| 83 |
The path returned may be suffixed by the string " (deleted)" if the directory |
| 84 |
entry has been removed. |
| 85 |
.SH SEE ALSO |
| 86 |
.BR oprofile (1) |