[PATCH bpf-next] bpf: uapi: Document front truncation in bpf_d_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



bpf_d_path() will truncate the resolved path from the front if the
provided buffer is too small. This is somewhat non-intuitive but makes
sense when you think about it. So document it.

Signed-off-by: Daniel Xu <dxu@xxxxxxxxx>
---
 include/uapi/linux/bpf.h       | 4 ++++
 tools/include/uapi/linux/bpf.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 2acf9b336371..91218c5fd207 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -4845,6 +4845,10 @@ union bpf_attr {
  *		including the trailing NUL character. On error, a negative
  *		value.
  *
+ *		If *buf* is too small, the resolved path is truncated from
+ *		the front and -ENAMETOOLONG is returned. The buffer is valid
+ *		in this case.
+ *
  * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)
  * 	Description
  * 		Read *size* bytes from user space address *user_ptr* and store
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 2acf9b336371..91218c5fd207 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -4845,6 +4845,10 @@ union bpf_attr {
  *		including the trailing NUL character. On error, a negative
  *		value.
  *
+ *		If *buf* is too small, the resolved path is truncated from
+ *		the front and -ENAMETOOLONG is returned. The buffer is valid
+ *		in this case.
+ *
  * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)
  * 	Description
  * 		Read *size* bytes from user space address *user_ptr* and store
-- 
2.47.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux