Skip to content

Commit

Permalink
Add posix_fork/1 & posix_getpid/1 etc
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Nov 27, 2023
1 parent 1e2e78c commit 3b2a2db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,7 @@ Non-standard predicates
posix_localtime/2 # posix_localtime(+seconds,-tm(NNN,...))
posix_ctime/2 # posix_time(+seconds,-atom)
posix_time/1 # posix_time(-seconds)
posix_gettid/1 # posix_ppid(-tid)
posix_getpid/1 # posix_pid(-pid)
posix_getppid/1 # posix_ppid(-ppid)
posix_fork/1 # posix_fork(-pid)

nb_setval(K,V)
Expand Down
26 changes: 0 additions & 26 deletions src/bif_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,6 @@ static bool bif_posix_time_1(query *q)
return unify(q, p1, p1_ctx, &tmp, q->st.curr_frame);
}

static bool bif_posix_gettid_1(query *q)
{
GET_FIRST_ARG(p1,var);
cell tmp;
#if defined(linux) && !defined(__wasi__)
make_int(&tmp, gettid());
#else
make_int(&tmp, 42);
#endif
return unify(q, p1, p1_ctx, &tmp, q->st.curr_frame);
}

static bool bif_posix_getpid_1(query *q)
{
GET_FIRST_ARG(p1,var);
Expand All @@ -242,18 +230,6 @@ static bool bif_posix_getpid_1(query *q)
return unify(q, p1, p1_ctx, &tmp, q->st.curr_frame);
}

static bool bif_posix_getppid_1(query *q)
{
GET_FIRST_ARG(p1,var);
cell tmp;
#if defined(linux) && !defined(__wasi__)
make_int(&tmp, getppid());
#else
make_int(&tmp, -1);
#endif
return unify(q, p1, p1_ctx, &tmp, q->st.curr_frame);
}

static bool bif_posix_fork_1(query *q)
{
GET_FIRST_ARG(p1,var);
Expand All @@ -280,9 +256,7 @@ builtins g_posix_bifs[] =
{"posix_ctime", 2, bif_posix_ctime_2, "+integer,-atom", false, false, BLAH},
{"posix_time", 1, bif_posix_time_1, "-integer", false, false, BLAH},

{"posix_gettid", 1, bif_posix_gettid_1, "-integer", false, false, BLAH},
{"posix_getpid", 1, bif_posix_getpid_1, "-integer", false, false, BLAH},
{"posix_getppid", 1, bif_posix_getppid_1, "-integer", false, false, BLAH},
{"posix_fork", 1, bif_posix_fork_1, "-integer", false, false, BLAH},

{0}
Expand Down

0 comments on commit 3b2a2db

Please sign in to comment.