Skip to content

futimesat

Intro

futimesat - sets file access and modification times of a given file

Description

The futimesat() system call is used to set the access and modification times of the file that is referenced by the dirfd argument, or the file at pathname relative to the current working directory, if dirfd is the specially defined value AT_FDCWD. The times argument points to a struct timeval type that contains the new time, in the form of seconds and microseconds, to be set.

The futimesat() system call has a few advantages over its counterpart utimes() which is limited to modifying the time of a file pathname provided by its argument, as opposted to a file descriptor. Additionally, this system call can provide better performance than others if the file descriptor is already known.

Arguments

  • dirfd:int[K] - file descriptor that points to the directory containing the target file for the futimesat() system call.
  • pathname:const char*[K] - string that contains the relative path from the directory specified by dirfd to the target file for the futimesat() system call.
  • times:struct timeval*[K] - pointer to the struct timeval type that stores two time specifiers, each consisting of seconds and microseconds, to be set as the new access and modification times of the target file.

Available Tags

  • K - Originated from kernel-space.

Hooks

sys_futimesat

Type

kprobe

Purpose

Hooked to capture detailed information about the system call argumetns used, like the file descriptor and relative path.

Example Use Case

An example use case of futimesat() could include an application that keeps track of activity associated with a certain file, such as when it was last modified. This system call can be used to update the time of the file so that the application can have accurate data.

Issues

The futimesat() system call is not available in some older versions of Linux, or in their respective glibc libraries, and has been replaced by the utimensat system call.

  • utimes() - similar system call for setting access and modification times for only pathname specified by user.

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.