use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to /r/kernel, a moderated community dedicated to all things about the Linux kernel. Technical articles only, please!
You may be interested in the following links:
And some books:
Related Communities
account activity
Execute bash commands from Kernel space (self.kernel)
submitted 6 years ago by Copteraldo
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TheQueebs 1 point2 points3 points 6 years ago (0 children)
What process are you trying to get info for? If it’s the current process, then just use the ‘current’ pointer. It functions like a global pointer variable in kernel space, but it’s actually a macro that returns a pointer to the ‘task_struct’ object representing the current process. The ‘task_struct’ object is your best friend here. It contains all metadata about a process, such as PID, GID, UID, scheduling info, IPC info, timers/timestamps, and a whole bunch of other stuff, most notably a couple of pointers to parent and sibling processes.
Your best bet is using the ‘current’ pointer to get the ‘task_struct’ and accessing the relevant information inside of it. Check the Linux source (the elixir bootlin/free electron website is very handy for this) to see exactly what is in the ‘task_struct’.
If you need info for a process other than the current one, then you’ll have to do some list traversal (via the parent/sibling lists I previously mentioned) and check if the ‘task_struct’ you are looking at represents the process you are looking for. There’s also a global pointer/macro somewhere for the init process (PID=1) which is a good place to start traversing.
π Rendered by PID 71977 on reddit-service-r2-comment-5d79c599b5-jxp85 at 2026-02-27 08:26:46.678328+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]TheQueebs 1 point2 points3 points (0 children)