Skip to content

Commit 4786f23

Browse files
authored
Merge pull request #358 from filmor/otp24
Update supported NIF API version to 2.16
2 parents 51908ff + f5b34ef commit 4786f23

File tree

7 files changed

+36
-6
lines changed

7 files changed

+36
-6
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,11 @@ jobs:
140140
strategy:
141141
matrix:
142142
pair:
143-
- erlang: "23.1"
144-
elixir: "1.11.1"
143+
- erlang: "24.0"
144+
elixir: "1.11.4"
145+
- erlang: "23.3"
146+
elixir: "1.11.4"
147+
145148
- erlang: "23.0.3"
146149
elixir: "1.10.3"
147150

rustler/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::process::Command;
44

55
// keep this sorted by version number
66
const NIF_VERSION: &[&str] = &[
7-
"2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15",
7+
"2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15", "2.16",
88
];
99

1010
fn main() {

rustler_mix/lib/rustler.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ defmodule Rustler do
131131
'2.12',
132132
'2.13',
133133
'2.14',
134-
'2.15'
134+
'2.15',
135+
'2.16'
135136
]
136137
end

rustler_sys/gen_api.erl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ version_opts("2.14") -> [{major,2}, {minor,14}, exception, getenv, time, % erl
3636
version_opts("2.15") -> [{major,2}, {minor,15}, exception, getenv, time, % erlang 22.0
3737
dirty_scheduler_opt, nif_2_11, nif_2_12, nif_2_13,
3838
nif_2_14, nif_2_15];
39+
version_opts("2.16") -> [{major,2}, {minor,16}, exception, getenv, time, % erlang 24.0
40+
dirty_scheduler_opt, nif_2_11, nif_2_12, nif_2_13,
41+
nif_2_14, nif_2_15, nif_2_16];
3942
version_opts(Ver) ->
4043
io:format(
4144
"This OTP release uses the unsupported Erlang NIF version ~p.\n\n"
@@ -364,6 +367,13 @@ api_list(Opts) -> [
364367
{"ERL_NIF_TERM", "enif_make_monitor_term", "env: *mut ErlNifEnv, mon: *const ErlNifMonitor"}
365368
];
366369
false -> []
370+
end ++
371+
case proplists:get_bool(nif_2_16, Opts) of
372+
true -> [
373+
{"*const ErlNifResourceType", "enif_init_resource_type", "env: *mut ErlNifEnv, name_str: *const c_uchar, init: *const ErlNifResourceTypeInit, flags: ErlNifResourceFlags, tried: *mut ErlNifResourceFlags"},
374+
{"c_int", "enif_dynamic_resource_call", "env: *mut ErlNifEnv, module: ERL_NIF_TERM, name: ERL_NIF_TERM, rsrc: ERL_NIF_TERM, call_data: *const c_void"}
375+
];
376+
false -> []
367377
end.
368378

369379

rustler_sys/precompiled/nif_api.4.snippet

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub const ERL_NIF_ENTRY_OPTIONS: c_uint = ERL_NIF_DIRTY_NIF_OPTION;
22
pub const NIF_MAJOR_VERSION: c_int = 2;
3-
pub const NIF_MINOR_VERSION: c_int = 15;
3+
pub const NIF_MINOR_VERSION: c_int = 16;
44

55
extern "C" {
66
/// See [enif_priv_data](http://www.erlang.org/doc/man/erl_nif.html#enif_priv_data) in the Erlang docs.
@@ -245,6 +245,10 @@ pub fn enif_is_pid_undefined(pid: *const ErlNifPid) -> c_int;
245245
pub fn enif_set_pid_undefined(pid: *mut ErlNifPid);
246246
/// See [enif_make_monitor_term](http://www.erlang.org/doc/man/erl_nif.html#enif_make_monitor_term) in the Erlang docs.
247247
pub fn enif_make_monitor_term(env: *mut ErlNifEnv, mon: *const ErlNifMonitor) -> ERL_NIF_TERM;
248+
/// See [enif_init_resource_type](http://www.erlang.org/doc/man/erl_nif.html#enif_init_resource_type) in the Erlang docs.
249+
pub fn enif_init_resource_type(env: *mut ErlNifEnv, name_str: *const c_uchar, init: *const ErlNifResourceTypeInit, flags: ErlNifResourceFlags, tried: *mut ErlNifResourceFlags) -> *const ErlNifResourceType;
250+
/// See [enif_dynamic_resource_call](http://www.erlang.org/doc/man/erl_nif.html#enif_dynamic_resource_call) in the Erlang docs.
251+
pub fn enif_dynamic_resource_call(env: *mut ErlNifEnv, module: ERL_NIF_TERM, name: ERL_NIF_TERM, rsrc: ERL_NIF_TERM, call_data: *const c_void) -> c_int;
248252
}
249253

250254
extern "C" {

rustler_sys/precompiled/nif_api.8.snippet

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub const ERL_NIF_ENTRY_OPTIONS: c_uint = ERL_NIF_DIRTY_NIF_OPTION;
22
pub const NIF_MAJOR_VERSION: c_int = 2;
3-
pub const NIF_MINOR_VERSION: c_int = 15;
3+
pub const NIF_MINOR_VERSION: c_int = 16;
44

55
extern "C" {
66
/// See [enif_priv_data](http://www.erlang.org/doc/man/erl_nif.html#enif_priv_data) in the Erlang docs.
@@ -237,6 +237,10 @@ pub fn enif_is_pid_undefined(pid: *const ErlNifPid) -> c_int;
237237
pub fn enif_set_pid_undefined(pid: *mut ErlNifPid);
238238
/// See [enif_make_monitor_term](http://www.erlang.org/doc/man/erl_nif.html#enif_make_monitor_term) in the Erlang docs.
239239
pub fn enif_make_monitor_term(env: *mut ErlNifEnv, mon: *const ErlNifMonitor) -> ERL_NIF_TERM;
240+
/// See [enif_init_resource_type](http://www.erlang.org/doc/man/erl_nif.html#enif_init_resource_type) in the Erlang docs.
241+
pub fn enif_init_resource_type(env: *mut ErlNifEnv, name_str: *const c_uchar, init: *const ErlNifResourceTypeInit, flags: ErlNifResourceFlags, tried: *mut ErlNifResourceFlags) -> *const ErlNifResourceType;
242+
/// See [enif_dynamic_resource_call](http://www.erlang.org/doc/man/erl_nif.html#enif_dynamic_resource_call) in the Erlang docs.
243+
pub fn enif_dynamic_resource_call(env: *mut ErlNifEnv, module: ERL_NIF_TERM, name: ERL_NIF_TERM, rsrc: ERL_NIF_TERM, call_data: *const c_void) -> c_int;
240244
}
241245

242246
extern "C" {

rustler_sys/src/rustler_sys_api.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,19 @@ pub type ErlNifResourceDown = unsafe extern "C" fn(
138138
mon: *const ErlNifMonitor,
139139
) -> ();
140140

141+
/// See [ErlNifResourceDynCall](http://www.erlang.org/doc/man/erl_nif.html#ErlNifResourceDynCall) in the Erlang Docs.
142+
pub type ErlNifResourceDynCall =
143+
unsafe extern "C" fn(env: *mut ErlNifEnv, obj: *mut c_void, call_data: *const c_void) -> ();
144+
141145
/// See [ErlNifResourceTypeInit](http://www.erlang.org/doc/man/erl_nif.html#ErlNifResourceTypeInit) in the Erlang docs.
142146
#[derive(Debug, Copy, Clone)]
143147
#[repr(C)]
144148
pub struct ErlNifResourceTypeInit {
145149
dtor: *const ErlNifResourceDtor,
146150
stop: *const ErlNifResourceStop, // at ERL_NIF_SELECT_STOP event
147151
down: *const ErlNifResourceDown, // enif_monitor_process
152+
members: c_int,
153+
dyncall: *const ErlNifResourceDynCall,
148154
}
149155

150156
/// See [ErlNifSelectFlags](http://erlang.org/doc/man/erl_nif.html#ErlNifSelectFlags) in the Erlang docs.
@@ -156,6 +162,8 @@ pub const ERL_NIF_SELECT_STOP: ErlNifSelectFlags = 1 << 2;
156162
pub const ERL_NIF_SELECT_FAILED: ErlNifSelectFlags = 1 << 3;
157163
pub const ERL_NIF_SELECT_READ_CANCELLED: ErlNifSelectFlags = 1 << 4;
158164
pub const ERL_NIF_SELECT_WRITE_CANCELLED: ErlNifSelectFlags = 1 << 5;
165+
pub const ERL_NIF_SELECT_ERROR_CANCELLED: ErlNifSelectFlags = 1 << 6;
166+
pub const ERL_NIF_SELECT_NOTSUP: ErlNifSelectFlags = 1 << 7;
159167

160168
/// See [ErlNifMonitor](http://www.erlang.org/doc/man/erl_nif.html#ErlNifMonitor) in the Erlang docs.
161169
#[derive(Debug, Copy, Clone)]

0 commit comments

Comments
 (0)