| Main index | Section 2 | Options |
#include <unistd.h>
The following values for type may be specified:
| KCMP_FILE | |
| Compare two file descriptions referred to by file descriptors idx1 and idx2. They may be equivalent if, for example, one of the descriptors was created by applying dup(2) to the other descriptor. | |
| KCMP_FILEOBJ | |
| Perform a "deep comparison" of the file descriptions referred to by file descriptors idx1 and idx2. This tests whether the underlying object referred to by the file descriptions is the same. For example, if the same filesystem path is opened twice, the kernel will create two separate file descriptions to back the two file descriptors, but they will refer to the same underlying object, a vnode(9). When compared using the KCMP_FILE type, these descriptors will be different, but using the KCMP_FILEOBJ type, they will be equal (assuming that the path was not unlinked in between the two opens). | |
| KCMP_FILES | |
| Determine whether the two processes share the same file descriptor table. This will be the case if one of the processes was created by rfork(2) without specifying the RFFDG flag. The idx1 and idx2 parameters are ignored. | |
| KCMP_SIGHAND | |
| Determine whether the two processes share the same signal handler table. This will be the case if one of the processes was created using the RFSIGSHARE flag to rfork(2). The idx1 and idx2 parameters are ignored. | |
| KCMP_VM | Determine whether the two processes share a virtual memory address space. This may be the case if one of the processes created the other using vfork(2) or rfork(2) with the RFMEM flag. The idx1 and idx2 parameters are ignored. |
If an error occurs, the value -1 is returned and the global variable errno is set to indicate the error.
| [ENODEV] | |
| KCMP_FILEOBJ was specified and idx1 refers to a file descriptor which does not implement a comparison operator. | |
| [EINVAL] | |
| The value of type is invalid. | |
| [EBADF] | |
| One of the file descriptors referred to by idx1 or idx2 is not valid. | |
| [ESRCH] | |
| One of the processes referred to by pid1 or pid2 does not exist or is not visible (e.g., due to jail restrictions). | |
| [EPERM] | |
| The caller does not have permission to access one of the processes referred to by pid1 or pid2. | |
| KCMP (2) | January 23, 2024 |
| Main index | Section 2 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Unix’s “power tools” are more like power switchblades that slice off the operator’s fingers quickly and efficiently. | ” |
| — The Unix Haters' handbook | ||