diff options
author | Sverker Eriksson <[email protected]> | 2019-01-31 19:36:01 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-01-31 19:36:01 +0100 |
commit | 14fe4c3ccf93c023f851512e573e2bac7d00b232 (patch) | |
tree | 2300a8b2b96e6b6f43d009f72a3e82e818a9eb9d /erts/emulator/beam | |
parent | 81487129feb5823bf4c3a1721ce655d1e1616781 (diff) | |
parent | 780c5a2c43591fc17925177120b67b99d26e70e7 (diff) | |
download | otp-14fe4c3ccf93c023f851512e573e2bac7d00b232.tar.gz otp-14fe4c3ccf93c023f851512e573e2bac7d00b232.tar.bz2 otp-14fe4c3ccf93c023f851512e573e2bac7d00b232.zip |
Merge branch 'sverker/port-control-badarg/OTP-15555' into maint
* sverker/port-control-badarg/OTP-15555:
erts: Add doc warnings for erlang:port_command|call|control
erts: Add magic port control numbers
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_port.h | 2 | ||||
-rw-r--r-- | erts/emulator/beam/io.c | 2 | ||||
-rw-r--r-- | erts/emulator/beam/sys.h | 9 |
3 files changed, 11 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_port.h b/erts/emulator/beam/erl_port.h index 25976d38cc..039d8cf67a 100644 --- a/erts/emulator/beam/erl_port.h +++ b/erts/emulator/beam/erl_port.h @@ -1018,6 +1018,6 @@ int erts_port_output_async(Port *, Eterm, Eterm); /* * Signals from ports to ports. Used by sys drivers. */ -int erl_drv_port_control(Eterm, char, char*, ErlDrvSizeT); +int erl_drv_port_control(Eterm, unsigned int, char*, ErlDrvSizeT); #endif diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index 5325480901..7322239a73 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -4073,7 +4073,7 @@ done: * to the caller. */ int -erl_drv_port_control(Eterm port_num, char cmd, char* buff, ErlDrvSizeT size) +erl_drv_port_control(Eterm port_num, unsigned int cmd, char* buff, ErlDrvSizeT size) { ErtsProc2PortSigData *sigdp = erts_port_task_alloc_p2p_sig_data(); diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h index 869a575cb4..a69da4d762 100644 --- a/erts/emulator/beam/sys.h +++ b/erts/emulator/beam/sys.h @@ -1291,4 +1291,13 @@ erts_raw_env_next_char(byte *p, int encoding) #endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */ +/* + * Magic numbers for our driver port_control callbacks. + * Kept them below 1<<27 to not inflict extra bignum garbage on 32-bit. + */ +#define ERTS_TTYSL_DRV_CONTROL_MAGIC_NUMBER 0x018b0900U +#define ERTS_INET_DRV_CONTROL_MAGIC_NUMBER 0x03f1a300U +#define ERTS_SPAWN_DRV_CONTROL_MAGIC_NUMBER 0x04c76a00U +#define ERTS_FORKER_DRV_CONTROL_MAGIC_NUMBER 0x050a7800U + #endif |