With commit d5e6ee0dac64b64e the usage of functions name_to_handle_at() and
open_by_handle_at() are introduced. But these function are not available
e.g. in uclibc-ng < 1.0.35. To have a backward compatibility check for the
availability in the configure script and in case of absence do a direct
syscall.
Signed-off-by: Heiko Thiery <redacted>
---
v2:
- small correction to subject
- removed IP_CONFIG_HANDLE_AT:=y option since it is not required
- fix indentation in check function
- removed empty lines (thanks to Petr Vorel)
- add #define _GNU_SOURCE in check (thanks to Petr Vorel)
- check only for name_to_handle_at (thanks to Peter Vorel)
configure | 28 ++++++++++++++++++++++++++++
lib/fs.c | 21 +++++++++++++++++++++
2 files changed, 49 insertions(+)
@@ -30,6 +30,27 @@/* if not already mounted cgroup2 is mounted here for iproute2's use */#define MNT_CGRP2_PATH "/var/run/cgroup2"++#ifndef defined HAVE_HANDLE_AT+structfile_handle{+unsignedhandle_bytes;+inthandle_type;+unsignedcharf_handle[];+};++intname_to_handle_at(intdirfd,constchar*pathname,+structfile_handle*handle,int*mount_id,intflags)+{+returnsyscall(name_to_handle_at,5,dirfd,pathname,handle,+mount_id,flags);+}++intopen_by_handle_at(intmount_fd,structfile_handle*handle,intflags)+{+returnsyscall(open_by_handle_at,3,mount_fd,handle,flags);+}+#endif+/* return mount path of first occurrence of given fstype */staticchar*find_fs_mount(constchar*fs_to_find){
I overlooked this in v1. name_to_handle_at must be replaced by __NR_name_to_handle_at:
(name_to_handle_at is the function name, not a syscall number).
It also requires to include <sys/syscall.h>:
#include <sys/syscall.h>
...
return syscall(__NR_name_to_handle_at, 5, dirfd, pathname, handle,
mount_id, flags);
And here 3, correct version is is:
return syscall(__NR_open_by_handle_at, mount_fd, handle, flags);
+ adding at the top:
#ifndef HAVE_HANDLE_AT
# include <sys/syscall.h>
#endif
Kind regards,
Petr
Uh, one more typo on my side, sorry (dfd => dirfd):
return syscall(__NR_name_to_handle_at, dirfd, pathname, handle,
mount_id, flags);
Kind regards,
Petr
From: David Ahern <hidden> Date: 2021-05-01 15:03:51
On 4/30/21 12:26 AM, Heiko Thiery wrote:
With commit d5e6ee0dac64b64e the usage of functions name_to_handle_at() and
that is a change to ss:
d5e6ee0dac64 ss: introduce cgroup2 cache and helper functions
open_by_handle_at() are introduced. But these function are not available
e.g. in uclibc-ng < 1.0.35. To have a backward compatibility check for the
availability in the configure script and in case of absence do a direct
syscall.
When you find the proper commit add a Fixes line before the Signed-off-by:
Fixes: <id> ("subject line")
Signed-off-by: Heiko Thiery <redacted>
---
make sure you cc the author of the original commit.
v2:
- small correction to subject
- removed IP_CONFIG_HANDLE_AT:=y option since it is not required
- fix indentation in check function
- removed empty lines (thanks to Petr Vorel)
- add #define _GNU_SOURCE in check (thanks to Petr Vorel)
- check only for name_to_handle_at (thanks to Peter Vorel)
you have 3 responses to this commit. Please send an updated patch with
all the changes and the the above comments addressed.
Thanks,
Uh, one more typo on my side, sorry (dfd => dirfd):
return syscall(__NR_name_to_handle_at, dirfd, pathname, handle,
mount_id, flags);
Thanks for the review and finding the sloppiness. I really should test
the changes before. Nevertheless, I will prepare a new version and
test it this time.
BR,
--
Heiko
Hi David,
Am Sa., 1. Mai 2021 um 17:03 Uhr schrieb David Ahern [off-list ref]:
On 4/30/21 12:26 AM, Heiko Thiery wrote:
quoted
With commit d5e6ee0dac64b64e the usage of functions name_to_handle_at() and
that is a change to ss:
d5e6ee0dac64 ss: introduce cgroup2 cache and helper functions
quoted
open_by_handle_at() are introduced. But these function are not available
e.g. in uclibc-ng < 1.0.35. To have a backward compatibility check for the
availability in the configure script and in case of absence do a direct
syscall.
When you find the proper commit add a Fixes line before the Signed-off-by:
What do you mean with finding the right commit? This (d5e6ee0dac64) is
the commit that introduced the usage of the missing functions. Or have
I overlooked something?
Fixes: <id> ("subject line")
quoted
Signed-off-by: Heiko Thiery <redacted>
---
make sure you cc the author of the original commit.
Ok.
quoted
v2:
- small correction to subject
- removed IP_CONFIG_HANDLE_AT:=y option since it is not required
- fix indentation in check function
- removed empty lines (thanks to Petr Vorel)
- add #define _GNU_SOURCE in check (thanks to Petr Vorel)
- check only for name_to_handle_at (thanks to Peter Vorel)
you have 3 responses to this commit. Please send an updated patch with
all the changes and the the above comments addressed.
I will implement the comments and send a new version.
Uh, one more typo on my side, sorry (dfd => dirfd):
return syscall(__NR_name_to_handle_at, dirfd, pathname, handle,
mount_id, flags);
Thanks for the review and finding the sloppiness. I really should test
the changes before. Nevertheless, I will prepare a new version and
test it this time.
I tested ss with changed I proposed and it looks like it's ok.
But I run ss on qemu without any daemon running => I'll retest your v3 once you
post it with some daemons running so that the code is really triggered.
Kind regards,
Petr
From: Petr Vorel <hidden> Date: 2021-05-02 11:20:54
Hi David,
Am Sa., 1. Mai 2021 um 17:03 Uhr schrieb David Ahern [off-list ref]:
quoted
On 4/30/21 12:26 AM, Heiko Thiery wrote:
quoted
With commit d5e6ee0dac64b64e the usage of functions name_to_handle_at() and
quoted
that is a change to ss:
quoted
d5e6ee0dac64 ss: introduce cgroup2 cache and helper functions
quoted
quoted
open_by_handle_at() are introduced. But these function are not available
e.g. in uclibc-ng < 1.0.35. To have a backward compatibility check for the
availability in the configure script and in case of absence do a direct
syscall.
quoted
When you find the proper commit add a Fixes line before the Signed-off-by:
What do you mean with finding the right commit? This (d5e6ee0dac64) is
the commit that introduced the usage of the missing functions. Or have
I overlooked something?
Just put into commit message before your Signed-off-by tag this:
Fixes: d5e6ee0d ("ss: introduce cgroup2 cache and helper functions")
From: David Ahern <hidden> Date: 2021-05-02 13:07:21
On 5/2/21 5:20 AM, Petr Vorel wrote:
quoted
What do you mean with finding the right commit? This (d5e6ee0dac64) is
the commit that introduced the usage of the missing functions. Or have
I overlooked something?
your right; d5e6ee0dac64 is the commit.
Just put into commit message before your Signed-off-by tag this:
Fixes: d5e6ee0d ("ss: introduce cgroup2 cache and helper functions")