开发者

Emulating file system traces by a c program

I have a file with records of the type "PID, time of call, system call" and calls made by different processes are interleaved. Now, I am writing a simulator to replay the system calls and need a call made by say PID 1 to be made by a different process from a call made by say PID 2. Moreover the same process must make all the calls made by PID 1 and in the same开发者_运维技巧 order as appears in the trace file. Would be gratefull for some help. Thank you...


A simple way would be to make a linked list with one PID member. For each call you could traverse the list (and add a node if the PID is not found) and make each node hold a filehandle or something where you can feed the process with data. If yor PID's are not "random" numbers but 1,2,3,4 etc... you can always do the same thing with an array (of pointers) to avoid the time it takes to traverse the list. Not sure if this is enough for you but again you don't really give much details...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜