Direct, unsafe Rust bindings for Linux's perf_event_open system call

This crate exports unsafe Rust wrappers for Linux system calls for accessing

Direct, unsafe Rust bindings for Linux's perf_event_open system call

This crate exports unsafe Rust wrappers for Linux system calls for accessing performance monitoring counters and tracing facilities. This includes:

  • the processor's own performance monitoring registers
  • kernel counters for things like context switches and page faults
  • kernel tracepoints, kprobe, and uprobes
  • processor tracing facilities like Intel's Branch Trace Store (BTS)
  • hardware breakpoints

This crate provides:

  • a Rust wrapper the Linux perf_event_open system call
  • Rust wrappers for the ioctls you can apply to a file descriptor returned by perf_event_open
  • bindings for perf_event_open's associated header files, automatically generated by bindgen

All functions are direct, unsafe wrappers for the underlying calls. They operate on raw pointers and raw file descriptors.

For a type-safe API for basic functionality, see the perf-event crate.

Updating the System Call Bindings

The bindings module defines Rust equivalents for the types and constants used by the Linux perf_event_open system call and its related ioctls. These are generated automatically from the kernel's C header files, using bindgen. Both the interface and the underlying functionality are quite complex, and new features are added at a steady pace. To update the generated bindings:

  • Run the regenerate.sh script, found in the same directory as this README.md file. This runs bindgen and splices its output in the bindings module's source code, preserving the documentation.

  • Fix the comments in src/lib.rs explaining exactly which version of the kernel headers you generated the bindings from.

  • Update the crate's major version. Newer versions of the kernel headers may add fields to structs, which is a breaking change. (As explained in the module documentation, properly written user crates should not be affected, but it seems unnecessary to risk cargo update breaking builds. When users need new functionality from the bindings, they can update the major version number of this crate they request.)

Information - Updated Dec 31, 2021

Stars: 2
Forks: 3
Issues: 0

Linux Kernel Manager and Activity Monitor 🐧💻

modprobe or rmmod is used for loading or unloading a kernel module

Linux Kernel Manager and Activity Monitor 🐧💻

truck - Truck is a rust CAD kernel

Truck is an open-source shape processing kernel by Rust

truck - Truck is a rust CAD kernel

A lib crate for gathering system info such as cpu, distro, environment, kernel, etc in...

A lib crate for gathering system info such as cpu, distro, environment, kernel, etc in Rust

A lib crate for gathering system info such as cpu, distro, environment, kernel, etc in...

Rust OS kernel based on tutorial

Rust OS kernel based on rustup

Rust OS kernel based on tutorial

a minimal Linux kernel module written in rust

A recent build of Rust (latest nightly)

a minimal Linux kernel module written in rust

This program aims to collect Linux system information including hostname, kernel version, uptime, RTC time,...

This program aims to collect Linux system information including hostname, kernel version, uptime, RTC time, load average, CPU, memory, network interfaces, block devices and processes

This program aims to collect Linux system information including hostname, kernel version, uptime, RTC time,...

Kernel downloader writing in rust :+1:

Rust and regular expressions :

Kernel downloader writing in rust :+1:

Builds the sel4 kernel and generates Rust bindings around it,

as configured by a feL4 manifest

Builds the sel4 kernel and generates Rust bindings around it,

A playground for the Kernel Virtual Machine (KVM) in rust to

A playground for the rust ffi and x86_64

A playground for the Kernel Virtual Machine (KVM) in rust to
Facebook Instagram Twitter GitHub Dribbble
Privacy