Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22024

Why is the difference between a task_struct pointer and a field inside that struct so large?

$
0
0

This statement:

pr_err("init=%p head=%p offset=%zd\n", 
        &init_task, &init_task.thread_group,
        offsetof(struct task_struct, thread_group));

produces this output when compiled into a kernel module and insmod'ed:

init=00000000b0561be0 head=00000000cab9146b offset=2416

My question is why are the two addresses so far apart when they should only be 2416 bytes apart ? When printing the symbol offsets in GDB, I also get expected values, and I'm not sure where else to look:

(gdb) p &init_task
$1 = (struct task_struct *) 0xffffffff82613780 <init_task>
(gdb) p &init_task.thread_group 
$2 = (struct list_head *) 0xffffffff826140f0 <init_task+2416>

EDIT: %zx instead of %p yields correct numbers. So, no %p support in printk() I guess ?


Viewing all articles
Browse latest Browse all 22024

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>