Skip to content

Commit fe7cae2

Browse files
authored
Add getppid op (#422)
Allows a child process to get the parent process id, and thus guess if it has become orphaned. See: #381
1 parent 17fd55f commit fe7cae2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

docs/ops.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296
* [getenvhash](#getenvhash)
297297
* [backendconfig](#backendconfig)
298298
* [getpid](#getpid)
299+
* [getppid `moar`](#getppid)
299300
* [jvmclasspaths `jvm`](#jvmclasspaths-jvm)
300301
* [sha1](#sha1)
301302
* [sleep](#sleep)
@@ -2491,6 +2492,11 @@ configure and build flags.
24912492

24922493
Return the current process id, an int.
24932494

2495+
## getppid `moar`
2496+
* `getppid(--> int)`
2497+
2498+
Return the process id of the parent process, an int.
2499+
24942500
## jvmclasspaths `jvm`
24952501
* `jvmclasspaths(--> Mu)`
24962502

src/vm/moar/QAST/QASTOperationsMAST.nqp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,6 +2917,7 @@ QAST::MASTOperations.add_core_moarop_mapping('exit', 'exit', 0);
29172917
QAST::MASTOperations.add_core_moarop_mapping('sleep', 'sleep', 0);
29182918
QAST::MASTOperations.add_core_moarop_mapping('getenvhash', 'getenvhash');
29192919
QAST::MASTOperations.add_core_moarop_mapping('getpid', 'getpid');
2920+
QAST::MASTOperations.add_core_moarop_mapping('getppid', 'getppid');
29202921
QAST::MASTOperations.add_core_moarop_mapping('gethostname', 'gethostname');
29212922
QAST::MASTOperations.add_core_moarop_mapping('rand_i', 'rand_i');
29222923
QAST::MASTOperations.add_core_moarop_mapping('rand_n', 'randscale_n');

0 commit comments

Comments
 (0)