RFR: JDK-8160997 Solaris: deprecated <pwd.h> and <gid.h> interfaces should be replaced

Daniel D. Daugherty daniel.daugherty at oracle.com
Thu Jul 14 16:44:27 UTC 2016


On 7/14/16 10:33 AM, Alan Burlison wrote:
> On 14/07/2016 16:41, Daniel D. Daugherty wrote:
>
>> If we #undef'ed it right after the one or two header files that we 
>> intend
>> it to affect, then our intentions would be more clear. Yes, it will add
>> one more line of "clutter", but I think clarity is more important.
>
> I don't see how that makes intent any clearer when there's already a 
> comment that says exactly why it is being defined:
>
> /* For POSIX-compliant getpwuid_r on Solaris */
> #if defined(__solaris__)
> #define _POSIX_PTHREAD_SEMANTICS
> #endif
> #include <pwd.h>
>
> And if it is properly guarded, as it is when it is defined, it needs 3 
> lines, not 1. The guards aren't strictly necessary, so this would 
> suffice:
>
> /* For POSIX-compliant getpwuid_r on Solaris */
> #define _POSIX_PTHREAD_SEMANTICS
> #include <pwd.h>
> #undef _POSIX_PTHREAD_SEMANTICS
>
> Although I think this is verging on bikeshedding TBH.

The #undef line makes it clear that you wanted the define for
pwd.h and only pwd.h. To me that's more clear, but I'm not
going to insist.

I'll leave it up to you and David H. to work out.

Full disclosure: the sooner this review gets wrapped up, the
sooner I can push the bits since I'm the sponsor. :-)

Dan


>
>> I also think this can be done as a pre-push change and does not need to
>> go through yet another round of testing.
>



More information about the hotspot-runtime-dev mailing list