rust-vmm / vmm-sys-util

Helpers and utilities used by multiple rust-vmm components and VMMs
BSD 3-Clause "New" or "Revised" License
78 stars 64 forks source link

Update SyscallReturnCode to support types other than i32. #201

Closed JBYoshi closed 1 year ago

JBYoshi commented 1 year ago

Summary of the PR

Currently, SyscallReturnCode is limited to system call return values of type i32. However, not all system calls return 32-bit integer values. For example, the read system call returns an ssize_t type, which will map to a 64-bit integer on 64-bit systems.

This PR updates SyscallReturnCode to be a generic type that can contain any signed integer value, so it can be used with other integer types. Since existing code may not specify generic type values, I set the type parameter to default to the existing type of c_int to try and preserve compatibility.

Requirements

Before submitting your PR, please make sure you addressed the following requirements: