Extend dupfrom(2) into copyfd(2)

This single function allows copying file descriptors from and to
processes, and closing a previously copied remote file descriptor.
This function replaces the five FD-related UDS backcalls. While it
limits the total number of in-flight file descriptors to OPEN_MAX,
this change greatly improves crash recovery support of UDS, since all
in-flight file descriptors will be closed instead of keeping them
open indefinitely (causing VFS to crash on system shutdown). With the
new copyfd call, UDS becomes simpler, and the concept of filps is no
longer exposed outside of VFS.

This patch also moves the checkperms(2) stub into libminlib, thus
fully abstracting away message details of VFS communication from UDS.

Change-Id: Idd32ad390a566143c8ef66955e5ae2c221cff966
This commit is contained in:
David van Moolenbroek
2013-10-05 16:31:35 +02:00
committed by Lionel Sambuc
parent 50685cbec3
commit e5cc85fdc4
20 changed files with 194 additions and 531 deletions

View File

@@ -698,7 +698,7 @@ service vnd
ipc
SYSTEM vfs rs vm
;
uid 0; # only for dupfrom(2)
uid 0; # only for copyfd(2)
};
service uds
@@ -706,5 +706,5 @@ service uds
ipc
SYSTEM vfs rs vm
;
uid 0; # for various VFS backcalls, until we have ACLs
uid 0; # only for checkperms(2) and copyfd(2)
};