summaryrefslogtreecommitdiff
path: root/internal/process.h
Commit message (Collapse)AuthorAgeFilesLines
* Don't redefine RB_OBJ_WRITEPeter Zhu2023-01-181-0/+1
| | | | | RB_OBJ_WRITE already exists in rgengc.h, so we shouldn't redefine it in gc.h.
* process.c: Add Process._fork (#5017)Yusuke Endoh2021-10-251-1/+1
| | | | | | | | | | * process.c: Add Process._fork This API is supposed for application monitoring libraries to hook fork event. [Feature #17795] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Add support for non-blocking `Kernel.system`.Samuel Williams2021-09-221-0/+2
|
* internal/*.h: skip doxygen卜部昌平2021-09-101-1/+0
| | | | | These contents are purely implementation details, not worth appearing in CAPI documents. [ci skip]
* Allow Dir.home to work for non-login procs when $HOME not setAlan D. Salewski2020-05-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the 'Dir.home' method to reliably locate the user's home directory when all three of the following are true at the same time: 1. Ruby is running on a Unix-like OS 2. The $HOME environment variable is not set 3. The process is not a descendant of login(1) (or a work-alike) The prior behavior was that the lookup could only work for login-descended processes. This is accomplished by looking up the user's record in the password database by uid (getpwuid_r(3)) as a fallback to the lookup by name (getpwname_r(3)) which is still attempted first (based on the name, if any, returned by getlogin_r(3)). If getlogin_r(3), getpwnam_r(3), and/or getpwuid_r(3) is not available at compile time, will fallback on using their respective non-*_r() variants: getlogin(3), getpwnam(3), and/or getpwuid(3). The rationale for attempting to do the lookup by name prior to doing it by uid is to accommodate the possibility of multiple login names (each with its own record in the password database, so each with a potentially different home directory) being mapped to the same uid (as is explicitly allowed for by POSIX; see getlogin(3posix)). Preserves the existing behavior for login-descended processes, and adds the new capability of having Dir.home being able to find the user's home directory for non-login-descended processes. Fixes [Bug #16787] Related discussion: https://bugs.ruby-lang.org/issues/16787 https://github.com/ruby/ruby/pull/3034
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s/RUBY3/RBIMPL/g卜部昌平2020-05-111-1/+1
| | | | | Devs do not love "3". The only exception is RUBY3_KEYWORDS in parse.y, which seems unrelated to our interests.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* internal/process.h: forgot to guard "#ifdef HAVE_WORKING_FORK"Yusuke Endoh2020-05-021-0/+2
|
* internal/process.h: add a no-warning simple wrapper for fork(2)Yusuke Endoh2020-05-021-0/+12
| | | | | | | | | | | | As fork(2) is deprecated, its calls must be guarded by `COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)`. All usages of fork(2) in process have been alread guarded. A new call to fork(2) was added in ruby.c with f22c4ff359498ab342e4b6d6feb21af6004ee270. This caused a build failure on Solaris 11. It may hide a bug to guard big code unnecessarily, so this change introduces a simple wrapper "rb_fork" whose definition is guarded, and replaces all calls to fork(2) with the wrapper function.
* add #include guard hack卜部昌平2020-04-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | According to MSVC manual (*1), cl.exe can skip including a header file when that: - contains #pragma once, or - starts with #ifndef, or - starts with #if ! defined. GCC has a similar trick (*2), but it acts more stricter (e. g. there must be _no tokens_ outside of #ifndef...#endif). Sun C lacked #pragma once for a looong time. Oracle Developer Studio 12.5 finally implemented it, but we cannot assume such recent version. This changeset modifies header files so that each of them include strictly one #ifndef...#endif. I believe this is the most portable way to trigger compiler optimizations. [Bug #16770] *1: https://docs.microsoft.com/en-us/cpp/preprocessor/once *2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-6/+6
| | | Split ruby.h
* internal/process.h rework卜部昌平2019-12-261-17/+38
| | | | Eliminated the macro to convert into an inline function.
* split internal.h into files卜部昌平2019-12-261-0/+95
One day, I could not resist the way it was written. I finally started to make the code clean. This changeset is the beginning of a series of housekeeping commits. It is a simple refactoring; split internal.h into files, so that we can divide and concur in the upcoming commits. No lines of codes are either added or removed, except the obvious file headers/footers. The generated binary is identical to the one before.