mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] No such process return value in pthread_getcpuclockid
@ 2020-02-10 19:29 Alexander Scherbatiy
  2020-02-10 19:34 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Scherbatiy @ 2020-02-10 19:29 UTC (permalink / raw)
  To: musl

Hello,

It seems that pthread_getcpuclockid does not properly handle non valid 
thread id argument.

Below is a sample which calls pthread_getcpuclockid with NULL thread id. 
The expected result is ESRCH (No thread with the ID thread could be 
found). It crashes in my docker with Alpine Linux 3.11.3 (musl libc 
x86_64 1.1.24). It returns ESRCH on my Ubuntu system.

---  pthread_getcpuclockid_sample.c ---

#include <time.h>
#include <stdio.h>
#include <pthread.h>
#include <errno.h>


int main()
{
     clockid_t cid;
     int s;

     s = pthread_getcpuclockid((pthread_t) NULL, &cid);

     if (s == ESRCH) {
         printf("result: ESRCH\n");
     } else {
         printf("result: %d\n", s);
     }

     return 0;
}
--------------------------------------

 > gcc -pthread -o pthread_getcpuclockid_sample 
pthread_getcpuclockid_sample.c

 > ./pthread_getcpuclockid_sample

Segmentation fault (core dumped)


Thanks,

Alexander.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-11  9:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 19:29 [musl] No such process return value in pthread_getcpuclockid Alexander Scherbatiy
2020-02-10 19:34 ` Rich Felker
2020-02-10 19:57   ` Alexander Scherbatiy
2020-02-10 20:14     ` Rich Felker
2020-02-11  9:16       ` Alexander Scherbatiy
2020-02-10 20:23     ` Markus Wichmann

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).