BUS_GET_RESOURCE(9)
π BUS_GET_RESOURCE(9) β bus_get_resource
okay so bestie, this is a page from the Kernel Developer's Manual (section 9, kernel dev stuff, iykyk) and it's about one little function that justβ¦ reads a resource. that's it. that's the whole vibe. and honestly? iconic. β¨
π¦ NAME
bus_get_resource β read a resource range/value with a given resource ID
like, you give it an ID and it hands you back the range or the value. lowkey the whole personality right there. π
πΈ SYNOPSIS
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/rman.h>
int
bus_get_resource(device_t dev, int type, int rid, rman_res_t *startp,
rman_res_t *countp);
three includes, one function, zero drama. copy it exactly, please, do not freestyle the headers. π«Ά
β¨ DESCRIPTION
so the bus_get_resource() function reads the range or the value of the resource type, rid pair and stores it in the startp and countp arguments. that's the tea. π₯
the arguments are, and I'm gonna go through every single one because I would never leave you guessing:
devβ the device to read the resource from. the main character, basically. πtypeβ the type of resource you want to read. it is one of:SYS_RES_IRQβ for IRQsSYS_RES_DRQβ for ISA DMA linesSYS_RES_MEMORYβ for I/O memorySYS_RES_IOPORTβ for I/O ports
ridβ a bus-specific handle that identifies the resource being read. yes it's bus-specific, no you can't just make one up and expect it to slay. πstartpβ a pointer to the start address of this resource. it's a pointer, bestie, so make sure it points somewhere real. πcountpβ a pointer to the length of the resource. for example, the size of the memory in bytes. so like, a number. a length. the whole point. π
β RETURN VALUES
zero is returned on success, otherwise an error is returned.
no cap, that's it β 0 means you ate, anything else means something went sideways. do with that what you will. π
π SEE ALSO
go read them, they're friends of this page, fr fr. π
π· AUTHORS
this manual page was written by Sascha Wildner. credit where credit is due, periodt. π
β οΈ heads up bestie:startpandcountpare pointers, so you're handing the function somewhere to write. make sure those pointers are valid before you call this, okay? love you, mean it. π
and that's the whole page!! written with love, shipped by Debian on September 26, 2015 β yeah she's a little vintage but she still serves π β¨π stay hydrated and check your return codes, mwah π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2008 The DragonFly Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms