Skip to content



fcntl64 - Used to manipulate file descriptor.


fcntl64() is a system call that is used to manipulate or get information about a file descriptor. It allows the caller to perform operations such as reading and writing to the descriptor, setting or clearing flags associated with the descriptor, or partitioning locks between processes.

When manipulating file descriptors, there are several actions that can be performed: - F_DUPFD: Duplicates an existing file descriptor - F_GETFD: Gets the descriptor flags associated with the file descriptor - F_SETFD: Sets the descriptor flags associated with the file descriptor - F_GETFL: Gets the file status flags for the file descriptor - F_SETFL: Sets the file status flags for the file descriptor - F_SETLK: Sets a file lock - F_GETLK: Gets an existing lock from a given file

When dealing with locks, it is important to note that there are two types of locks: - F_RDLCK: Places a read lock on a file - F_WRLCK: Places a write lock on a file

There are also several advantages and drawbacks to using fcntl64(): - Advantage: Allows users to set or clear flags associated with a file descriptor without having to know the actual flag values themselves - Disadvantage: The fcntl() family of functions can be tricky to use correctly and require careful checking of return values to make sure that the desired actions were actually performed correctly


  • fd:int[K] - File descriptor to manipulate or get information about
  • cmd:int[K] - Desired action to take on the file descriptor
  • arg:unsigned long[K] - Parameter associated with the command to be executed

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 requests to manipulate file descriptors.

Example Use Case

A use case could be setting a read lock on a file before accessing it and then removing it immediately after, making sure that no other process can access it while it is being accessed.


There are no known issues with using fcntl64().

  • open() - Used to open a file descriptor.
  • close() - Used to close a file descriptor.
  • dup() - Used to duplicate a file descriptor.

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.