Skip to content



semtimedop - acquire a semaphore in a timed manner


The semtimedop() system call is used to acquire a semaphore in an asynchronous manner with a timeout. It is designed to acquire one or multiple semaphores atomically. If the specified timeout is reached, the call will fail with an EAGAIN error. The return value of the call will contain information about the number of semaphores actually acquired.


  • semid:int - ID of the semaphore set.
  • sops:struct sembuf* - Pointer to an array of sembuf structs. Each struct contains the index of the semaphore inside the semaphore array and condition of the operation (unlock/lock).
  • nsops:size_t - Size of the array of sembuf structs.
  • timeout:const struct timespec*[K, OPT] - Pointer to a timespec struct describing the time duration of the wait.

Available Tags

  • K - Originated from kernel-space.
  • U - Originated from user space (for example, pointer to user space memory used to get it)
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
  • OPT - Optional argument - might not always be available (passed with null value)






To monitor the execution of semtimedop() and modify behavior when needed.

Example Use Case

semtimedop() is especially useful when implementing synchronization mechanisms into a system. These synchronization mechanisms could be related to multi-threaded application, and the semtimedop() could be used to allow access to shared resources in a controlled manner.


At the time of writing, the timeout argument does not work as expected on all supported architectures.

  • semop()
  • semtimedop_time64()

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.