Changes

Jump to navigation Jump to search
940 bytes added ,  12:49, 10 February 2015
Added KCMP
Line 18: Line 18:     
It is also worth noting, that we have a unique number for all kinds of custom protobuf options(see [[Images#Notes_about_protobuf]]), so you don't have to worry that it might collide with others.
 
It is also worth noting, that we have a unique number for all kinds of custom protobuf options(see [[Images#Notes_about_protobuf]]), so you don't have to worry that it might collide with others.
 +
 +
== Sharing of kernel objects ==
 +
 +
It's well known that some kernel objects can be shared between tasks. For example, if a task calls <code>open()</code> to obtain a file descriptor and then <code>fork()</code>-s the file object referenced by the file descriptor becomes shared between the parent and its child. The similar thing happens when a task <code>dup()</code>-s a file -- he gets two file descriptors that reference the same file. Unlike this two subsequent <code>open()</code>-s result in two different file objects.
 +
 +
In kernel there's no API that can just reveal the tasks-to-objects map. Instead, there's an API called <code>kcmp()</code> that compares two e.g. file descriptors and reports back whether the file referenced by them is the same or not. In CRIU we have a [https://github.com/xemul/criu/blob/master/kcmp-ids.c KCMPIDS] engine that uses this API and turns the equals-notequals answers into a list of IDs of objects.
    
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Under the hood]]
 
[[Category:Under the hood]]

Navigation menu