Maybe copy the relevant declaration/definitions into your own header file, but wrap them in a #ifndef <SOME_SYMBOL> block to prevent double include? Not sure how to ensure your private header would always be included second if this symbol reappeared in future releases.
Also, submit a notification of the maintainer of the header to get it re-included?
Sandor
> On Feb 17, 2020, at 11:17, Pascal via Darwin-dev <darwi...@lists.apple.com> wrote:
>
> Hello,
>
> I've come up on a compilation issue which asks for group_member.
> It is part of unistd.h:
> http://man7.org/linux/man-pages/man3/group_member.3.html
>
> It seems missing in macOS / Darwin includes.
> Is there a way to emulate it?
>
> Thanks, Pascal.
> https://blady.pagesperso-orange.fr
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (Darwi...@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/darwin-dev/admin.szatmari.net%40gmail.com
>
> This email sent to admin.sza...@gmail.com
On Feb 17, 2020, at 9:51 AM, Sandor Szatmari via Darwin-dev <darwi...@lists.apple.com> wrote:I’m assuming you mean the precompile/compile fails with a ‘can’t find the header’ and not a linker error that the symbol doesn’t exist.
On Feb 17, 2020, at 13:00, Jens Alfke <je...@mooseyard.com> wrote:
Hello,
I haven't found how to use the previous link for groups.
But after I've found the following link:
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/getgrouplist.3.html
And an example:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fg%2Fgetgrouplist.html
My emulation code is then:
#ifdef __APPLE__
int group_member(gid_t gid) {
int ngroups, i, ret;
int groups[NGROUPS_MAX];
ngroups = NGROUPS_MAX;
if (getgrouplist(getlogin(), -1, groups, &ngroups) == -1) {
printf ("Groups array is too small: %d\n", ngroups);
}
ret = 0;
for (i = 0; i < ngroups; i++) {
if (gid == groups[i])
ret = i;
}
return ret;
}
#endif
Regards, Pascal.
https://blady.pagesperso-orange.fr
Le 17 févr. 2020 à 19:23, Sandor Szatmari <admin.sza...@gmail.com> a écrit :
Ahh, Got it.
This is what I’ve used for that in the past
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/getpwuid.3.html
Pascal,
Could you emulate your needs with it?
Hello,
I haven't found how to use the previous link for groups.
But after I've found the following link:
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/getgrouplist.3.html
And an example:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fg%2Fgetgrouplist.html
My emulation code is then:
#ifdef __APPLE__
int group_member(gid_t gid) {
int ngroups, i, ret;
int groups[NGROUPS_MAX];
ngroups = NGROUPS_MAX;
if (getgrouplist(getlogin(), -1, groups, &ngroups) == -1) {
printf ("Groups array is too small: %d\n", ngroups);
}
ret = 0;
for (i = 0; i < ngroups; i++) {
if (gid == groups[i]){
Thanks Sandor for the fix.
I've corrected my code with your's.