MCPcopy Create free account
hub / github.com/GJDuck/e9patch / mutex_gettid

Function mutex_gettid

examples/stdlib.c:1479–1487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1477#ifndef MUTEX_SAFE
1478
1479static pid_t mutex_gettid(void)
1480{
1481 // Warning: this assumes the thread ID is stored at %fs:0x2d0.
1482 pid_t tid;
1483 asm volatile (
1484 "mov %%fs:0x2d0,%0\n" : "=a"(tid)
1485 );
1486 return tid;
1487}
1488
1489static void mutex_settid(pid_t tid)
1490{

Callers 4

mutex_lockFunction · 0.85
mutex_trylockFunction · 0.85
mutex_unlockFunction · 0.85
gettidFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected