From 3b2a2dbbbb97773f3d1674455d1d225d417c82c3 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Mon, 27 Nov 2023 17:00:11 +1000 Subject: [PATCH] Add posix_fork/1 & posix_getpid/1 etc --- README.md | 2 -- src/bif_posix.c | 26 -------------------------- 2 files changed, 28 deletions(-) diff --git a/README.md b/README.md index 36dea4576..b5c3a0a1c 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/src/bif_posix.c b/src/bif_posix.c index 6c0d7d125..f32eb319e 100644 --- a/src/bif_posix.c +++ b/src/bif_posix.c @@ -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); @@ -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); @@ -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}