aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-20 14:01:14 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit84f62ae80dd08874d0d5fbedc532605394e897c1 (patch)
treeef3b59230b5e80fded78d5ff9c610347e35fe449 /erts/emulator
parent75498c0dd7682bae7787c4e2cd8d2680fa2b9c45 (diff)
downloadotp-84f62ae80dd08874d0d5fbedc532605394e897c1.tar.gz
otp-84f62ae80dd08874d0d5fbedc532605394e897c1.tar.bz2
otp-84f62ae80dd08874d0d5fbedc532605394e897c1.zip
[socket-nif] Add support for socket (level socket) option timestamp
Added support for socket level socket option TIMESTAMP. OTP-14831
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/nifs/common/socket_nif.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c
index 365cbd541b..6df2020e5e 100644
--- a/erts/emulator/nifs/common/socket_nif.c
+++ b/erts/emulator/nifs/common/socket_nif.c
@@ -509,6 +509,7 @@ typedef union {
#define SOCKET_OPT_SOCK_SNDBUF 27
#define SOCKET_OPT_SOCK_SNDLOWAT 29
#define SOCKET_OPT_SOCK_SNDTIMEO 30
+#define SOCKET_OPT_SOCK_TIMESTAMP 31
#define SOCKET_OPT_SOCK_TYPE 32
#define SOCKET_OPT_IP_ADD_MEMBERSHIP 1
@@ -1049,6 +1050,11 @@ static ERL_NIF_TERM nsetopt_lvl_sock_sndtimeo(ErlNifEnv* env,
SocketDescriptor* descP,
ERL_NIF_TERM eVal);
#endif
+#if defined(SO_TIMESTAMP)
+static ERL_NIF_TERM nsetopt_lvl_sock_timestamp(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal);
+#endif
static ERL_NIF_TERM nsetopt_lvl_ip(ErlNifEnv* env,
SocketDescriptor* descP,
int eOpt,
@@ -1391,6 +1397,10 @@ static ERL_NIF_TERM ngetopt_lvl_sock_sndlowat(ErlNifEnv* env,
static ERL_NIF_TERM ngetopt_lvl_sock_sndtimeo(ErlNifEnv* env,
SocketDescriptor* descP);
#endif
+#if defined(SO_TIMESTAMP)
+static ERL_NIF_TERM ngetopt_lvl_sock_timestamp(ErlNifEnv* env,
+ SocketDescriptor* descP);
+#endif
#if defined(SO_TYPE)
static ERL_NIF_TERM ngetopt_lvl_sock_type(ErlNifEnv* env,
SocketDescriptor* descP);
@@ -4441,6 +4451,12 @@ ERL_NIF_TERM nsetopt_lvl_socket(ErlNifEnv* env,
break;
#endif
+#if defined(SO_TIMESTAMP)
+ case SOCKET_OPT_SOCK_TIMESTAMP:
+ result = nsetopt_lvl_sock_timestamp(env, descP, eVal);
+ break;
+#endif
+
default:
result = esock_make_error(env, esock_atom_einval);
break;
@@ -4664,6 +4680,17 @@ ERL_NIF_TERM nsetopt_lvl_sock_sndtimeo(ErlNifEnv* env,
#endif
+#if defined(SO_TIMESTAMP)
+static
+ERL_NIF_TERM nsetopt_lvl_sock_timestamp(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal)
+{
+ return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_TIMESTAMP, eVal);
+}
+#endif
+
+
/* nsetopt_lvl_ip - Level *IP* option(s)
*/
@@ -6959,6 +6986,12 @@ ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env,
break;
#endif
+#if defined(SO_TIMESTAMP)
+ case SOCKET_OPT_SOCK_TIMESTAMP:
+ result = ngetopt_lvl_sock_timestamp(env, descP);
+ break;
+#endif
+
#if defined(SO_TYPE)
case SOCKET_OPT_SOCK_TYPE:
result = ngetopt_lvl_sock_type(env, descP);
@@ -7276,6 +7309,16 @@ ERL_NIF_TERM ngetopt_lvl_sock_sndtimeo(ErlNifEnv* env,
#endif
+#if defined(SO_TIMESTAMP)
+static
+ERL_NIF_TERM ngetopt_lvl_sock_timestamp(ErlNifEnv* env,
+ SocketDescriptor* descP)
+{
+ return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_TIMESTAMP);
+}
+#endif
+
+
#if defined(SO_TYPE)
static
ERL_NIF_TERM ngetopt_lvl_sock_type(ErlNifEnv* env,