Skip to content

Commit

Permalink
Add getppid op (#422)
Browse files Browse the repository at this point in the history
Allows a child process to get the parent process id, and thus
guess if it has become orphaned.

See: #381
  • Loading branch information
ugexe committed Feb 24, 2018
1 parent 17fd55f commit fe7cae2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/ops.markdown
Expand Up @@ -296,6 +296,7 @@
* [getenvhash](#getenvhash)
* [backendconfig](#backendconfig)
* [getpid](#getpid)
* [getppid `moar`](#getppid)
* [jvmclasspaths `jvm`](#jvmclasspaths-jvm)
* [sha1](#sha1)
* [sleep](#sleep)
Expand Down Expand Up @@ -2491,6 +2492,11 @@ configure and build flags.

Return the current process id, an int.

## getppid `moar`
* `getppid(--> int)`

Return the process id of the parent process, an int.

## jvmclasspaths `jvm`
* `jvmclasspaths(--> Mu)`

Expand Down
1 change: 1 addition & 0 deletions src/vm/moar/QAST/QASTOperationsMAST.nqp
Expand Up @@ -2917,6 +2917,7 @@ QAST::MASTOperations.add_core_moarop_mapping('exit', 'exit', 0);
QAST::MASTOperations.add_core_moarop_mapping('sleep', 'sleep', 0);
QAST::MASTOperations.add_core_moarop_mapping('getenvhash', 'getenvhash');
QAST::MASTOperations.add_core_moarop_mapping('getpid', 'getpid');
QAST::MASTOperations.add_core_moarop_mapping('getppid', 'getppid');
QAST::MASTOperations.add_core_moarop_mapping('gethostname', 'gethostname');
QAST::MASTOperations.add_core_moarop_mapping('rand_i', 'rand_i');
QAST::MASTOperations.add_core_moarop_mapping('rand_n', 'randscale_n');
Expand Down

0 comments on commit fe7cae2

Please sign in to comment.