Confirmed users
398
edits
No edit summary |
|||
| Line 22: | Line 22: | ||
== PIPE and Socketpair == | == PIPE and Socketpair == | ||
For B2G, a lot of PIPEs and sockets are used for synchronization between threads for dispatching tasks among threads. For Linux, file descriptors will be shared after a fork without out a CLOEXEC. It is fine for normal file but not for communication channels. So, PIPEs and sockets should be recreated. Nuwa remember what pipes and socketpairs are created by Nuwa process and create new ones for them for each parasited process. Since file descriptors of new PIPEs and sockets are not the same as what in Nuwa process, dup2() is called for replace the file description of old file descriptor by | For B2G, a lot of PIPEs and sockets are used for synchronization between threads for dispatching tasks among threads. For Linux, file descriptors will be shared after a fork without out a CLOEXEC. It is fine for normal file but not for communication channels. So, PIPEs and sockets should be recreated. Nuwa remember what pipes and socketpairs are created by Nuwa process and create new ones for them for each parasited process. Since file descriptors of new PIPEs and sockets are not the same as what in Nuwa process, dup2() is called for replace the file description of old file descriptor by a new PIPE or socket. | ||
== Mutics and Conditions == | == Mutics and Conditions == | ||