DynamoRIO
_dr_syscall_result_info_t Struct Reference

#include <dr_tools.h>

Data Fields

size_t size
 
bool succeeded
 
reg_t value
 
reg_t high
 
bool use_high
 
bool use_errno
 
uint errno_value
 

Detailed Description

Data structure used to obtain or modify the result of an application system call by dr_syscall_get_result_ex() and dr_syscall_set_result_ex().

Field Documentation

◆ errno_value

uint _dr_syscall_result_info_t::errno_value

If requested by use_errno, if a system call fails (i.e., succeeded is false) dr_syscall_get_result_ex() will set this field to the absolute value of the error code returned (i.e., on Linux, it will be inverted from what the kernel directly returns, in order to facilitate cross-platform clients that operate on both Linux and MacOS). For Linux and Macos, when succeeded is true, errno_value is set to 0.

If use_errno is set for dr_syscall_set_result_ex(), then this value will be stored as the system call's return value, negated if necessary for the underlying platform. In that case, value will be ignored.

◆ high

reg_t _dr_syscall_result_info_t::high

On some platforms (such as MacOS), a 32-bit application's system call can return a 64-bit value. For such calls, this field will hold the top 32 bit bits, if requested by use_high. It is up to the caller to know which system calls have 64-bit return values. System calls that return only 32-bit values do not clear the upper bits. Consider using the "drsyscall" Extension in order to obtain per-system-call semantic information, including return type.

◆ size

size_t _dr_syscall_result_info_t::size

The caller should set this to the size of the structure.

◆ succeeded

bool _dr_syscall_result_info_t::succeeded

Indicates whether the system call succeeded or failed. For dr_syscall_set_result_ex(), this requests that DR set any additional machine state, if any, used by the particular plaform that is not part of value to indicate success or failure (e.g., on MacOS the carry flag is used to indicate success).

For Windows, the success result from dr_syscall_get_result_ex() should only be relied upon for ntoskrnl system calls. For other Windows system calls (such as win32k.sys graphical (NtGdi) or user (NtUser) system calls), computing success depends on each particular call semantics and is beyond the scope of this routine (consider using the "drsyscall" Extension instead).

For Mach syscalls on MacOS, the success result from dr_syscall_get_result_ex() should not be relied upon. Computing success depends on each particular call semantics and is beyond the scope of this routine (consider using the "drsyscall" Extension instead).

◆ use_errno

bool _dr_syscall_result_info_t::use_errno

This should be set by the caller. For dr_syscall_get_result_ex(), this requests that DR fill in the errno_value field. For dr_syscall_set_result_ex(), this requests that DR set the value to indicate the particular error code in errno_value.

◆ use_high

bool _dr_syscall_result_info_t::use_high

This should be set by the caller, and only applies to 32-bit system calls. For dr_syscall_get_result_ex(), this requests that DR fill in the high field. For dr_syscall_set_result_ex(), this requests that DR set the high 32 bits of the application-facing result to the value in the high field.

◆ value

reg_t _dr_syscall_result_info_t::value

The raw main value returned by the system call. See also the high field.


The documentation for this struct was generated from the following file:
  • /home/runner/work/dynamorio/dynamorio/build_release-64/include/dr_tools.h