On Tue, 22 Sep 2026 16:06:15 GMT, Chris Plummer <[email protected]> wrote:

>> After failing of pthread_key_create, we use perror for error-information 
>> output, but perror evaluates errno.
>> However, pthread_key_create seems not to set errno but returns an error 
>> code, so we should better print the real error code.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c line 288:
> 
>> 286:     int res = pthread_key_create(&key, NULL);
>> 287:     if (res != 0) {
>> 288:         printf("pthread_key_create failed with result %d\n", res);
> 
> Why not also include `strerror(res)` in the output?

The manpage says 'return 0 on success and a non-zero error code on failure.'
https://man7.org/linux/man-pages/man3/pthread_key_create.3.html
but is it really cross platform always the same error code that strerror 
expects?
I would guess so, but I am not sure.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32999#discussion_r4080272215

Reply via email to