Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kcmp in cmd/sort.c conflicts with FreeBSD system header file #648

Open
VoxSciurorum opened this issue Apr 3, 2024 · 3 comments · May be fixed by #655
Open

kcmp in cmd/sort.c conflicts with FreeBSD system header file #648

VoxSciurorum opened this issue Apr 3, 2024 · 3 comments · May be fixed by #655

Comments

@VoxSciurorum
Copy link

Recent development versions of FreeBSD define a function kcmp in <unistd.h>

     kcmp(pid_t pid1, pid_t pid2, int type, uintptr_t idx1, uintptr_t idx2);

This conflicts with int kcmp(Key *ka, Key *kb) defined in src/cmd/sort.c causing a compilation error.

The kcmp system call also exists on Linux but there is no C library wrapper to conflict. kcmp(2): "Glibc does not provide a wrapper for this system call; call it using syscall(2)."

@bakul
Copy link
Contributor

bakul commented May 11, 2024

kcmp was added to /usr/include/unicode.h post FreeBSD-14.0.

As kcmp is local to src/cmd/sort.c , renaming it to keycmp would fix this without impacting anything else.

@danfe
Copy link

danfe commented Sep 9, 2024

I'll rename it to ${PORTNAME}_kcmp() for the time being to unbreak the FreeBSD port, but admittedly keycmp() looks more descriptive. If it's local to sort.c, perhaps it could be also declared as static?

@bakul
Copy link
Contributor

bakul commented Sep 9, 2024

Declaring it static (and no name change) would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants