aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-10-05 14:52:47 +0200
committerMicael Karlberg <[email protected]>2018-10-05 14:52:47 +0200
commit6e931258872c15404aa1dfd5198f2b490452b30b (patch)
tree5ca9404bc26eb9d734bfa8cd16372cc447a7be5a /erts/emulator/nifs
parent4e3f42da1dae7166faeb9f9e07adc40bc3b22d75 (diff)
downloadotp-6e931258872c15404aa1dfd5198f2b490452b30b.tar.gz
otp-6e931258872c15404aa1dfd5198f2b490452b30b.tar.bz2
otp-6e931258872c15404aa1dfd5198f2b490452b30b.zip
[socket-nif] Add *preliminary* new function supports/0,1
Diffstat (limited to 'erts/emulator/nifs')
-rw-r--r--erts/emulator/nifs/common/socket_nif.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c
index 0ef88162bc..4def45f869 100644
--- a/erts/emulator/nifs/common/socket_nif.c
+++ b/erts/emulator/nifs/common/socket_nif.c
@@ -860,6 +860,9 @@ typedef struct {
static ERL_NIF_TERM nif_info(ErlNifEnv* env,
int argc,
const ERL_NIF_TERM argv[]);
+static ERL_NIF_TERM nif_supports(ErlNifEnv* env,
+ int argc,
+ const ERL_NIF_TERM argv[]);
/*
This is a *global* debug function (enable or disable for all
operations and all sockets.
@@ -2536,6 +2539,7 @@ static SocketData data;
* Utility and admin functions:
* ----------------------------
* nif_info/0
+ * nif_supports/1
* (nif_debug/1)
*
* The "proper" socket functions:
@@ -2619,6 +2623,31 @@ ERL_NIF_TERM nif_info(ErlNifEnv* env,
}
+
+/* ----------------------------------------------------------------------
+ * nif_supports
+ *
+ * Description:
+ * This function is intended to answer the question: "Is X supported?"
+ * Currently only one key is "supported": options
+ * That results in a list of all *known options* (known by us) and if
+ * the platform supports (OS) it or not.
+ */
+
+static
+ERL_NIF_TERM nif_support(ErlNifEnv* env,
+ int argc,
+ const ERL_NIF_TERM argv[])
+{
+ if (argc != 1) {
+ return enif_make_badarg(env);
+ } else {
+ return MKEL(env); // PLACEHOLDER
+ }
+}
+
+
+
/* ----------------------------------------------------------------------
* nif_open
*
@@ -15412,9 +15441,11 @@ void socket_down_reader(ErlNifEnv* env,
static
ErlNifFunc socket_funcs[] =
{
- // Some utility functions
- {"nif_info", 0, nif_info, 0},
- // {"nif_debug", 1, nif_debug_, 0},
+ // Some utility and support functions
+ {"nif_info", 0, nif_info, 0},
+ {"nif_supports", 1, nif_supports, 0},
+ // {"nif_debug", 1, nif_debug, 0},
+ // {"nif_command", 1, nif_command, 0},
// The proper "socket" interface
// nif_open/1 is used when we already have a file descriptor