This is my first gsoc report.
because this application is much related to
some muiti-process operations,I took me some time to understand.
The first problem is to use pdfork.
because fork() is disallowed in capability mode,
we use pdfork() to replace – same sematics, but
returns a file descriptor.
cpid = fork(pfd,0);
I spent some time to understand the behavior of it to make it successfully compiled.
The second problem is to limit the file descriptor used by open.
fd = open(path, O_WRONLY|O_NONBLOCK, 0))
it sets up a specific right (write) for a file descriptor and then attempts to enforce the limitation. If the operation fails, the program will terminate with a specific error message.
(void)setlocale(LC_CTYPE, "");
the character type locale to the system default.
I speculate that it might related to NLS data,therefore, I decided to use caph_cache_catpages() to cache native language support data.
rights reference
https://man.freebsd.org/cgi/man.cgi?rights(4)