STRUCT VDSO_CLOCK(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct vdso_clock(9) β€” like, the whole kernel API manual vibe

okay bestie, buckle up, we're reading a manpage from the Kernel API Manual and honestly? it's iconic. this one's all about struct vdso_clock, which is the vdso per clocksource datapage representation. yes, that's a mouthful, no, i'm not gonna dumb it down for you 🫢


✨ NAME ✨

struct vdso_clock β€” the vdso per clocksource datapage representation, periodt.


🌸 SYNOPSIS 🌸

struct vdso_clock {
    u32 seq;
    s32 clock_mode;
    u64 cycle_last;
  #ifdef CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT;
    u64 max_cycles;
  #endif;
    u64 mask;
    u32 mult;
    u32 shift;
    union {
      struct vdso_timestamp   basetime[VDSO_BASES];
      struct timens_offset    offset[VDSO_BASES];
    };
 };

look at her. absolutely stunning structure. no notes. πŸ’œ


πŸŽ€ Members πŸŽ€

okay so let's meet the cast, one field at a time:

  • seq β€” the timebase sequence counter. she's keeping track of the order of things, main character energy fr.
  • clock_mode β€” clock mode. that's it, that's the field. 😌
  • cycle_last β€” timebase at clocksource init. the og snapshot, if you will.
  • max_cycles β€” maximum cycles which won't overflow 64bit multiplication. she's the safety rail, the vibe check for overflow πŸ”₯
  • mask β€” clocksource mask.
  • mult β€” clocksource multiplier.
  • shift β€” clocksource shift.
  • {unnamed_union} β€” anonymous. literally no name. mysterious. lowkey slaying πŸ™ˆ
  • basetime β€” basetime per clock_id.
  • offset β€” time namespace offset per clock_id.

πŸ¦‹ Description πŸ¦‹

so like, first things first: go see also struct vdso_time_data for the basic access and ordering information, because struct vdso_clock is used there. they're a package deal, iykyk πŸ’–

basetime is used to store the base time for the system wide time getter VVAR page. that's her job, that's her purpose, she ate.

offset is what the special time namespace VVAR pages use β€” the ones installed instead of the real VVAR page. and here's the important bit, bestie, don't miss it: these namespace pages must set seq to 1 and clock_mode to VDSO_CLOCKMODE_TIMENS to force the code into the time namespace slow path. no cap, those two things are required. the namespace aware functions retrieve the real system wide VVAR page, read host time, and add the per clock offset. and for clocks which are not affected by time namespace adjustment, the offset must be zero. literally zero. not "close to zero". zero. 🎯


πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/vdso/datapage.h
  • struct vdso_timestamp(9)
  • struct vdso_time_data(9)
  • struct vdso_rng_data(9)

and that's the whole page, bestie! this lil beauty lives in ./include/vdso, it's dated October 2026, and the footer says struct vdso_clock(9) β€” same as the top, cute symmetry ✨ go read struct vdso_time_data(9) next, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from