Skip to content
View 5-pebbles's full-sized avatar
🌸
Statistically speaking, I'm debugging...
🌸
Statistically speaking, I'm debugging...

Block or report 5-pebbles

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
5-pebbles/README.md

I am starting to see why these codebases (glibc, musl, etc...) are so hard to read as a beginner:

In programming, we usually rely on abstraction to simplify our jobs. We make structures to contain and compartmentalize complex or dangerous code. However, at this level, those just obfuscate an already confusing system.

You start to find looking up definitions annoying; it's a null terminated list of elements; just treat it that way. On top of that, laziness works in that ideas favor:

pub(crate) const AT_NULL: usize = 0;
pub(crate) const AT_PAGE_SIZE: usize = 6;
pub(crate) const AT_BASE: usize = 7;
pub(crate) const AT_ENTRY: usize = 9;

#[repr(C)]
#[derive(Clone, Copy)]
pub(crate) struct AuxiliaryVectorItem {
    pub a_type: usize,
    pub a_val: usize,
}

#[derive(Clone, Copy)]
pub(crate) struct AuxiliaryVectorIter(*const AuxiliaryVectorItem);

impl AuxiliaryVectorIter {
    pub(crate) fn new(auxiliary_vector_pointer: *const AuxiliaryVectorItem) -> Self {
        Self(auxiliary_vector_pointer)
    }

    pub(crate) fn into_inner(self) -> *const AuxiliaryVectorItem {
        self.0
    }
}

impl Iterator for AuxiliaryVectorIter {
    type Item = AuxiliaryVectorItem;

    fn next(&mut self) -> Option<Self::Item> {
        let this = unsafe { *self.0 };
        if this.a_type == AT_NULL {
            return None;
        }
        self.0 = unsafe { self.0.add(1) };
        Some(this)
    }
}

The truth is you are only going to use that struct 3 or so times; why not just write:

(0..).map(|i| unsafe { *auxiliary_vector_pointer.add(i) }).take_while(|t| t.a_type != AT_NULL)

The same goes for naming; is AuxiliaryVector really any more helpful than auxv? Many of these things you can only find in pdfs from the 90s; if you change the name to something more descriptive, you run the risk of no one being able to understand you.

Either way, what is a more descriptive name? It's just an assortment of possibly useful stuff passed to the linker by the Linux kernel... You are going to have to look it all up anyway.

Pinned Loading

  1. dianac Public

    This compiler converts an ASM-like language to machine code for the Diana-II 6-bit MISC-CPU.

    Rust 1

  2. AlexvZyl/nordic.nvim Public

    🌒 Nord for Neovim, but warmer and darker. Supports a variety of plugins and other platforms.

    Lua 811 47

  3. miros Public

    A modern ELF interpreter (dynamic linker/loader) written in Rust.

    Rust 3 1

  4. rect-lib Public

    A simple library for working with anything vaguely rectangular in rust.

    Rust 1

  5. tuna Public

    A open source music api, designed to allow client side automation & contributions.

    Rust 1

  6. kotarac/totp Public

    CLI tool for generating TOTP codes.

    Rust 6 1

825 contributions in the last year

Contribution Graph
Day of Week March April May June July August September October November December January February
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Less
No contributions.
Low contributions.
Medium-low contributions.
Medium-high contributions.
High contributions.
More

Activity overview

Contributed to 5-pebbles/tuna, 5-pebbles/dianac, 5-pebbles/auxv-dot-org and 34 other repositories
Loading A graph representing 5-pebbles's contributions from February 25, 2024 to February 25, 2025. The contributions are 87% commits, 6% pull requests, 5% code review, 2% issues.

Contribution activity

February 2025

Created 15 commits in 2 repositories
Loading

Seeing something unexpected? Take a look at the GitHub profile guide.