[PATCH 21/23] linux: Add kcmp
Florian Weimer
fweimer@redhat.com
Wed Nov 4 22:51:11 GMT 2026
* Adhemerval Zanella:
> +#ifndef _LINUX_KCMP_H
> +/* Types of kernel resources compared by kcmp. */
> +enum kcmp_type
> +{
> + KCMP_FILE,
> + KCMP_VM,
> + KCMP_FILES,
> + KCMP_FS,
> + KCMP_SIGHAND,
> + KCMP_IO,
> + KCMP_SYSVSEM,
> + KCMP_EPOLL_TFD,
> +
> + KCMP_TYPES
> +};
I see that it's exactly like this in the kernel UAPI header, but
KCMP_TYPES is not actual constant and will change as more operation
types are added.
> +
> +__BEGIN_DECLS
> +
> +/* Compare the kernel resource of type TYPE (one of the KCMP_* values) used by
> + the process PID1 with the one used by the process PID2. For KCMP_FILE,
> + IDX1 and IDX2 are file descriptors of the processes; for KCMP_EPOLL_TFD,
> + IDX1 is a file descriptor of PID1 and IDX2 points to a
> + struct kcmp_epoll_slot describing a target file registered in an epoll
> + set of PID2.
> + Return 0 if the resources are the same, 1 or 2 if the first one is
> + respectively less or greater than the second one (in an arbitrary
> + ordering), or -1 and set errno on failure. */
> +extern int kcmp (__pid_t __pid1, __pid_t __pid2, int __type,
> + unsigned long int __idx1, unsigned long int __idx2) __THROW;
Should we expose the sub-options as individual functions?
Thanks,
Florian
More information about the Libc-alpha
mailing list