aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/process.cc
AgeCommit message (Collapse)AuthorLines
2018-06-13process.cc: don't allocate after forkAvatar Johannes Nixdorf -170/+528
In multithreaded processes POSIX specifies that after fork only AS-safe functions may be called. [1] This fixes a race condition I observed in "cave generate-metadata" with musl libc. This does happen regularily with musl libc, but the general problem also affects glibc. (test [2] if you don't believe me - with glibc it happens more rarely and causes a deadlock inside of malloc locks instead of a crash). This does not fix these problems for as_main_process, as there never will be an exec in the child process that way, which makes it impossible to do safely this way. [1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html [2]: https://shadowice.org/~mixi/examples/never-fork-and-malloc-in-multiple-threads.c
2016-08-06modernize: use default method synthesisAvatar Saleem Abdulrasool -3/+1
Convert a number of destructors to default synthesized functions. Try to inline a few instances into the header. It should be possible to inline all of them, however, gcc seems to emit a number of warnings. Furthermore, some of the destructors are pure-virtualed, but provide an implementation. Placing the definition into the header causes ODR violations.
2016-08-04modernize: convert to range based for-loopsAvatar Saleem Abdulrasool -3/+2
Automated conversion to range based for loops. NFC
2016-01-21paludis: POSIX_ME_HARDER accounts repositoryAvatar Saleem Abdulrasool -8/+6
POSIX permits an indefinite required buffer size for querying GECOS fields. This is currently used in three locations. Previously, paludis would assume that it could perform a sysconf call to retrieve the requisite buffer size for ensuring that the subsequent GECOS field query would not receive a -ERANGE error. However, as it turns out, this is actually a problem even with GLIBC where the NSS may end up querying a service which has a larger field value for the `struct pwd` (glibc sets the return value to the NSS buffer length, aka 1k, but may end up querying a service which provides a larger response). Use local wrappers which perform the size adjustment to avoid an undersized buffer. Localise the functions which query the various GECOS fields which comprise the persona into util.
2015-08-21throw() -> noexceptAvatar Wouter van Kesteren -1/+1
Change-Id: I461abfda8b7297c1bd04f1090f8d58fa96364616 Reviewed-on: https://galileo.mailstation.de/gerrit/1892 Reviewed-by: Saleem Abdulrasool <compnerd@compnerd.org> Reviewed-by: Kylie McClain <somasis@exherbo.org>
2014-01-18Be a little less noisyAvatar David Leverton -2/+8
2014-01-16Give PTYs a sensible sizeAvatar David Leverton -2/+40
Fixes: ticket:1298, Gentoo#484298
2013-12-15build: assume full C++11 supportAvatar Saleem Abdulrasool -1/+1
paludis requires C++11 support. Remove checks and compatibility code to permit building with partial C++11 support. This mostly removes the configure checks for support for C++11 features. noexcept and std::next (part of the C++11 standard library) had compatibility code which is no longer exercised and should be safe to excise. Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
2013-10-26Use SIGCHLD instead of SIGCLDAvatar Michael Forney -2/+2
SIGCLD is a synonym anyway and is not specified by POSIX.
2013-06-23C++11: auto convert to nullptr via cpp11-migrateAvatar Saleem Abdulrasool -22/+22
This is a blanket migration via the clang C++11 migration tool to convert NULL pointer to nullptr usage. Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
2013-05-22Use std::threadAvatar Ciaran McCreesh -4/+10
2013-05-03Use StreamHolderAvatar Wouter van Kesteren -2/+2
2013-04-28Mark ~RunningProcessHandle() as noexcept(false)Avatar Wouter van Kesteren -1/+1
2011-09-04Process::extra_newlines_if_any_output_existsAvatar Ciaran McCreesh -0/+36
2011-03-20Move env var names into headerAvatar Ciaran McCreesh -2/+3
2011-01-27ProcessCommand::append_argsAvatar Ciaran McCreesh -0/+6
2011-01-09Rework Pimp to avoid ImpPtr ickinessAvatar Ciaran McCreesh -7/+7
Fixes: ticket:1070
2010-12-16Show fork errorsAvatar Ciaran McCreesh -2/+6
2010-12-10Do our own buffering for SafeOFStreamAvatar Ciaran McCreesh -2/+2
2010-08-30fix includesAvatar Saleem Abdulrasool -0/+1
2010-08-24FSEntry -> FSPath, FSStatAvatar Ciaran McCreesh -2/+2
Fixes: ticket:967
2010-08-22Don't try to exit before we're done feedingAvatar Ciaran McCreesh -4/+15
2010-08-22Fix 4.5 compileAvatar Ciaran McCreesh -4/+4
2010-08-21Process::as_main_processAvatar Ciaran McCreesh -6/+43
2010-08-21Process::send_input_to_fdAvatar Ciaran McCreesh -1/+88
2010-08-21Make Process signal-safeAvatar Ciaran McCreesh -0/+23
2010-08-21ProcessCommand(string)Avatar Ciaran McCreesh -18/+47
2010-08-21Process::{syd,sand}boxAvatar Ciaran McCreesh -0/+64
2010-08-21Process::clearenvAvatar Ciaran McCreesh -0/+29
2010-08-21Process::prefix_std{out,err}Avatar Ciaran McCreesh -2/+117
2010-08-21Process::pipe_command_handlerAvatar Ciaran McCreesh -0/+83
2010-08-21Process::set_stdin_fdAvatar Ciaran McCreesh -0/+15
2010-08-21Process::capture_output_to_fdAvatar Ciaran McCreesh -2/+83
2010-08-21Process::setuid_setgidAvatar Ciaran McCreesh -1/+37
2010-08-21Process::use_ptysAvatar Ciaran McCreesh -4/+20
2010-08-21Process::chdirAvatar Ciaran McCreesh -0/+14
2010-08-21Process::setenvAvatar Ciaran McCreesh -0/+15
2010-08-21New, less horrible way of running processesAvatar Ciaran McCreesh -0/+355