[RFC v2][PATCH 8/9] File descriprtors - dump state

Oren Laadan orenl at cs.columbia.edu
Sun Aug 24 20:28:14 PDT 2008



Louis Rilling wrote:
> On Wed, Aug 20, 2008 at 11:07:16PM -0400, Oren Laadan wrote:
>> Dump the files_struct of a task with 'struct cr_hdr_files', followed by
>> all open file descriptors. Since FDs can be shared, they are assigned a
>> tag and registered in the object hash.
>>
>> For each open FD there is a 'struct cr_hdr_fd_ent' with the FD, its tag
>> and its close-on-exec property. If the FD is to be saved (first time)
>> then this is followed by a 'struct cr_hdr_fd_data' with the FD state.
>> Then will come the next FD and so on.
>>
>> This patch only handles basic FDs - regular files, directories and also
>> symbolic links.
> 
> [...]

[...]

> 
>> @@ -114,4 +125,24 @@ struct cr_hdr_vma {
>>
>>  } __attribute__ ((aligned (8)));
>>
>> +struct cr_hdr_files {
>> +	__u32 tag;	/* sharing identifier */
>> +	__u32 nfds;
>> +} __attribute__ ((aligned (8)));
>> +
>> +struct cr_hdr_fd_ent {
>> +	__u32 tag;
>> +	__u16 fd;
>> +	__u16 close_on_exec;
>> +} __attribute__ ((aligned (8)));
>> +
>> +struct cr_hdr_fd_data {
>> +	__u16 how;
>> +	__u16 f_mode;
>> +	__u32 f_flags;
>> +	__u32 f_uid, f_gid;
> 
> We are not at a 64bits boundary here. Should add one __32 padding or reorder the
> fields.

Actually this is ok - note there are two fields on fourth row. I'll
change to one field per row so it's easily seen.

Thanks,

Oren.



More information about the Containers mailing list