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

Add __BSD_VISIBLE define #26

Closed
wants to merge 1 commit into from
Closed

Add __BSD_VISIBLE define #26

wants to merge 1 commit into from

Conversation

valpackett
Copy link

Some projects including this as a simple file dependency might have e.g. _ANSI_SOURCE defined in the compiler args, which unsets __BSD_VISIBLE, which hides the u_int type on FreeBSD.

Some projects including this as a simple file dependency might have e.g. _ANSI_SOURCE defined in the compiler args, which unsets __BSD_VISIBLE, which hides the u_int type on FreeBSD.
@gpakosz
Copy link
Owner

gpakosz commented Aug 17, 2021

Hello @unrelentingtech 👋

I'm not sure I understand the need for such a change: what doesn't compile in whereami.c exactly when __BSD_VISIBLE is not defined?

@valpackett
Copy link
Author

The u_int type is undefined, which is used in a cast for a sysctl argument.

__BSD_VISIBLE becomes defined to 0, hiding this type, when things like _XOPEN_SOURCE are enabled by the build system, as was the case with Darktable's inclusion of whereami.

@gpakosz
Copy link
Owner

gpakosz commented Aug 17, 2021

Maybe it's a better idea to use unsigned int instead of u_int for that single cast?

@valpackett
Copy link
Author

Maybe. I guess u_int is better from the "strict adherence to the manpage" standpoint but why not do the practical thing…

@gpakosz
Copy link
Owner

gpakosz commented Aug 18, 2021

Or

    if (sysctl(mib, 4, path, &size, NULL, 0) != 0)
        break;

In any case, force defining __BSD_VISIBLE back, while it's a system header thing, seems wrong to me.

@gpakosz
Copy link
Owner

gpakosz commented Aug 18, 2021

I committed the latest suggestion. Thanks for the report!

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 this pull request may close these issues.

2 participants