4 ms·
Example of function pointers in the linux kernel: http://lxr.linux.no/linux+v2.6.32/include/net/sock.h#L297 http://lxr.linux.no/linux+v2.6.32/include/net/sock.h
by alexgartrell 17y ago
Example of function pointers in the linux kernel: http://lxr.linux.no/linux+v2.6.32/include/net/sock.h#L297 http://lxr.linux.no/linux+v2.6.32/include/net/sock.h#L297
The cool thing about this is that, if you want to make your kernel socket 'event-driven', you can actually use this method to overwrite them and 'hijack' the callback. Then, when you're doing doing what you wanted to do, you can punt to the original callback (which you, hopefully, saved)
Example of this taking place: http://lxr.linux.no/linux+v2.6.32/drivers/scsi/iscsi_tcp.c#L195 http://lxr.linux.no/linux+v2.6.32/drivers/scsi/iscsi_tcp.c#L...