summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2011-12-09 12:33:08 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2011-12-09 12:33:08 +0100
commit7bd353a976a0bf4d93b962376daa0d38958335d0 (patch)
tree2fac432e0077eed23aa4df31500928628628b362
parent4a7dfc9733d8af85955baefc79bcff7d72971d68 (diff)
parentdeca218163838f88ade8f62eca60d8d67db00f0d (diff)
downloaderlang-7bd353a976a0bf4d93b962376daa0d38958335d0.tar.gz
Merge branch 'raimo/64-bit-driver-api/OTP-9795'
* raimo/64-bit-driver-api/OTP-9795: (22 commits) driver_SUITE.erl: Fix sys info drivers emulator test drivers: Conform to updated driver API runtime_tools's drivers: Conform to updated driver API ws's xwe_driver.c: Conform to updated driver API megaco's flex scanner: Conform to updated driver API seq_trace_SUITE_data/echo_drv.c: Conform to updated driver API erl_interface tests: Conform port_call_drv.c updated driver API erl_drv_thread_SUITE_data/testcase_driver.c: Conform to updated driver API float_SUITE_data/fp_drv.c: Conform to updated driver API port_SUITE_data/*_drv.c: Conform to updated driver API port_bif_SUITE_data/control_drv.c: Conform to updated driver API send_term_SUITE_data/send_term_drv.c: Conform to updated driver API system_profile_SUITE_data/echo_drv.c: Conform to updated driver API trace_port_SUITE_data/echo_drv.c: Conform to updated driver API Remove support for old drivers without ERL_DRV_EXTENDED_MARKER built-in drivers: Add ERL_DRV_EXTENDED_MARKER and version numbers Bump driver version to 2.0 erl_driver.h: Enlarge type on return value from call erl_driver.h: Enlarge types on driver callbacks output, control and call erl_driver.h: Enlarge types in driver output functions ... Conflicts: erts/emulator/test/driver_SUITE_data/monitor_drv.c erts/emulator/test/driver_SUITE_data/timer_drv.c
-rw-r--r--erts/emulator/beam/dist.c12
-rw-r--r--erts/emulator/beam/erl_bif_ddll.c18
-rw-r--r--erts/emulator/beam/erl_bif_port.c10
-rw-r--r--erts/emulator/beam/erl_debug.h4
-rw-r--r--erts/emulator/beam/erl_driver.h87
-rw-r--r--erts/emulator/beam/global.h28
-rw-r--r--erts/emulator/beam/io.c176
-rw-r--r--erts/emulator/beam/utils.c18
-rw-r--r--erts/emulator/drivers/common/efile_drv.c23
-rw-r--r--erts/emulator/drivers/common/inet_drv.c245
-rw-r--r--erts/emulator/drivers/common/ram_file_drv.c82
-rw-r--r--erts/emulator/drivers/common/zlib_drv.c19
-rw-r--r--erts/emulator/drivers/unix/ttsl_drv.c21
-rw-r--r--erts/emulator/drivers/win32/registry_drv.c21
-rw-r--r--erts/emulator/drivers/win32/ttsl_drv.c35
-rw-r--r--erts/emulator/sys/unix/sys.c29
-rw-r--r--erts/emulator/sys/vxworks/sys.c4
-rw-r--r--erts/emulator/sys/win32/erl_win_dyn_driver.h36
-rwxr-xr-xerts/emulator/sys/win32/sys.c8
-rw-r--r--erts/emulator/test/a_SUITE_data/timer_driver.c20
-rw-r--r--erts/emulator/test/alloc_SUITE_data/testcase_driver.c25
-rw-r--r--erts/emulator/test/busy_port_SUITE_data/busy_drv.c19
-rw-r--r--erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c14
-rw-r--r--erts/emulator/test/ddll_SUITE_data/dummy_drv.c19
-rw-r--r--erts/emulator/test/ddll_SUITE_data/echo_drv.c26
-rw-r--r--erts/emulator/test/ddll_SUITE_data/echo_drv_fail_init.c26
-rw-r--r--erts/emulator/test/ddll_SUITE_data/initfail_drv.c19
-rw-r--r--erts/emulator/test/ddll_SUITE_data/lock_drv.c26
-rw-r--r--erts/emulator/test/ddll_SUITE_data/noinit_drv.c21
-rw-r--r--erts/emulator/test/ddll_SUITE_data/wrongname_drv.c19
-rw-r--r--erts/emulator/test/driver_SUITE.erl24
-rw-r--r--erts/emulator/test/driver_SUITE_data/Makefile.src4
-rw-r--r--erts/emulator/test/driver_SUITE_data/async_blast_drv.c4
-rw-r--r--erts/emulator/test/driver_SUITE_data/caller_drv.c30
-rw-r--r--erts/emulator/test/driver_SUITE_data/chkio_drv.c90
-rw-r--r--erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c31
-rw-r--r--erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c15
-rw-r--r--erts/emulator/test/driver_SUITE_data/many_events_drv.c28
-rw-r--r--erts/emulator/test/driver_SUITE_data/monitor_drv.c12
-rw-r--r--erts/emulator/test/driver_SUITE_data/otp_6879_drv.c20
-rw-r--r--erts/emulator/test/driver_SUITE_data/otp_9302_drv.c6
-rw-r--r--erts/emulator/test/driver_SUITE_data/outputv_drv.c16
-rw-r--r--erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c13
-rw-r--r--erts/emulator/test/driver_SUITE_data/queue_drv.c23
-rw-r--r--erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c (renamed from erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c)26
-rw-r--r--erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c11
-rw-r--r--erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c (renamed from erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c)20
-rw-r--r--erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c16
-rw-r--r--erts/emulator/test/driver_SUITE_data/thr_free_drv.c10
-rw-r--r--erts/emulator/test/driver_SUITE_data/timer_drv.c15
-rw-r--r--erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c26
-rw-r--r--erts/emulator/test/float_SUITE_data/fp_drv.c12
-rw-r--r--erts/emulator/test/port_SUITE_data/echo_drv.c30
-rw-r--r--erts/emulator/test/port_SUITE_data/exit_drv.c33
-rw-r--r--erts/emulator/test/port_SUITE_data/failure_drv.c29
-rw-r--r--erts/emulator/test/port_bif_SUITE_data/control_drv.c25
-rw-r--r--erts/emulator/test/send_term_SUITE_data/send_term_drv.c20
-rw-r--r--erts/emulator/test/system_profile_SUITE_data/echo_drv.c30
-rw-r--r--erts/emulator/test/trace_port_SUITE_data/echo_drv.c37
-rw-r--r--lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c25
-rw-r--r--lib/kernel/test/seq_trace_SUITE_data/echo_drv.c21
-rw-r--r--lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src37
-rw-r--r--lib/runtime_tools/c_src/trace_file_drv.c33
-rw-r--r--lib/runtime_tools/c_src/trace_ip_drv.c19
-rw-r--r--lib/wx/c_src/wxe_driver.c22
65 files changed, 1156 insertions, 767 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index cfcdb72636..bee61e7273 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -54,9 +54,9 @@
#endif
#if defined(ERTS_DIST_MSG_DBG) || defined(ERTS_RAW_DIST_MSG_DBG)
-static void bw(byte *buf, int sz)
+static void bw(byte *buf, ErlDrvSizeT sz)
{
- bin_write(ERTS_PRINT_STDERR,NULL,buf,sz);
+ bin_write(ERTS_PRINT_STDERR, NULL, buf, sz);
}
#endif
@@ -897,9 +897,9 @@ erts_dsig_send_group_leader(ErtsDSigData *dsdp, Eterm leader, Eterm remote)
int erts_net_message(Port *prt,
DistEntry *dep,
byte *hbuf,
- int hlen,
+ ErlDrvSizeT hlen,
byte *buf,
- int len)
+ ErlDrvSizeT len)
{
#define DIST_CTL_DEFAULT_SIZE 64
ErtsDistExternal ede;
@@ -924,7 +924,7 @@ int erts_net_message(Port *prt,
Uint tuple_arity;
int res;
#ifdef ERTS_DIST_MSG_DBG
- int orig_len = len;
+ ErlDrvSizeT orig_len = len;
#endif
UseTmpHeapNoproc(DIST_CTL_DEFAULT_SIZE);
@@ -940,7 +940,7 @@ int erts_net_message(Port *prt,
UnUseTmpHeapNoproc(DIST_CTL_DEFAULT_SIZE);
return 0;
}
- if (hlen > 0)
+ if (hlen != 0)
goto data_error;
if (len == 0) { /* HANDLE TICK !!! */
UnUseTmpHeapNoproc(DIST_CTL_DEFAULT_SIZE);
diff --git a/erts/emulator/beam/erl_bif_ddll.c b/erts/emulator/beam/erl_bif_ddll.c
index b2d5722e9b..37d540b41b 100644
--- a/erts/emulator/beam/erl_bif_ddll.c
+++ b/erts/emulator/beam/erl_bif_ddll.c
@@ -1580,24 +1580,6 @@ static int do_load_driver_entry(DE_Handle *dh, char *path, char *name)
}
switch (dp->extended_marker) {
- case 0:
- /*
- * This may be an old driver that has been recompiled. If so,
- * at least the fields that existed in extended driver version
- * 1.0 should be zero. If not, a it is a bad driver. We cannot
- * be completely certain that this is a valid driver but this is
- * the best we can do with old drivers...
- */
- if (dp->major_version != 0
- || dp->minor_version != 0
- || dp->driver_flags != 0
- || dp->handle2 != NULL
- || dp->process_exit != NULL) {
- /* Old driver; needs to be recompiled... */
- res = ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
- goto error;
- }
- break;
case ERL_DRV_EXTENDED_MARKER:
if (ERL_DRV_EXTENDED_MAJOR_VERSION != dp->major_version
|| ERL_DRV_EXTENDED_MINOR_VERSION < dp->minor_version) {
diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c
index 1f6b62817d..cd423eb200 100644
--- a/erts/emulator/beam/erl_bif_port.c
+++ b/erts/emulator/beam/erl_bif_port.c
@@ -254,13 +254,13 @@ port_call(Process* c_p, Eterm arg1, Eterm arg2, Eterm arg3)
Uint size;
byte *bytes;
byte *endp;
- size_t real_size;
+ ErlDrvSizeT real_size;
erts_driver_t *drv;
byte port_input[256]; /* Default input buffer to encode in */
byte port_result[256]; /* Buffer for result from port. */
byte* port_resp; /* Pointer to result buffer. */
char *prc;
- int ret;
+ ErlDrvSSizeT ret;
Eterm res;
Sint result_size;
Eterm *hp;
@@ -366,9 +366,9 @@ port_call(Process* c_p, Eterm arg1, Eterm arg2, Eterm arg3)
erts_smp_proc_lock(c_p, ERTS_PROC_LOCK_MAIN);
#ifdef HARDDEBUG
{
- int z;
- printf("real_size = %ld,%d, ret = %d\r\n",real_size,
- (int) real_size, ret);
+ ErlDrvSizeT z;
+ printf("real_size = %ld,%d, ret = %ld,%d\r\n", (unsigned long) real_size,
+ (int) real_size, (unsigned long)ret, (int) ret);
printf("[");
for(z = 0; z < real_size; ++z) {
printf("%d, ",(int) bytes[z]);
diff --git a/erts/emulator/beam/erl_debug.h b/erts/emulator/beam/erl_debug.h
index bdfbaddbbf..c49354a2b3 100644
--- a/erts/emulator/beam/erl_debug.h
+++ b/erts/emulator/beam/erl_debug.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2004-2010. All Rights Reserved.
+ * Copyright Ericsson AB 2004-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -51,7 +51,7 @@
extern Uint32 verbose;
-void upp(byte*, int);
+void upp(byte*, size_t);
void pat(Eterm);
void pinfo(void);
void pp(Process*);
diff --git a/erts/emulator/beam/erl_driver.h b/erts/emulator/beam/erl_driver.h
index 25483380ed..e80eae0b86 100644
--- a/erts/emulator/beam/erl_driver.h
+++ b/erts/emulator/beam/erl_driver.h
@@ -85,6 +85,7 @@
#include "erl_drv_nif.h"
#include <stdlib.h>
+#include <string.h> /* ssize_t on Mac OS X */
#if defined(VXWORKS)
# include <ioLib.h>
@@ -134,8 +135,8 @@ typedef struct {
#define DO_WRITE ERL_DRV_WRITE
#define ERL_DRV_EXTENDED_MARKER (0xfeeeeeed)
-#define ERL_DRV_EXTENDED_MAJOR_VERSION 1
-#define ERL_DRV_EXTENDED_MINOR_VERSION 5
+#define ERL_DRV_EXTENDED_MAJOR_VERSION 2
+#define ERL_DRV_EXTENDED_MINOR_VERSION 0
/*
* The emulator will refuse to load a driver with different major
@@ -183,6 +184,14 @@ typedef long long ErlDrvSInt64;
#error No 64-bit integer type
#endif
+#if defined(__WIN32__)
+typedef ErlDrvUInt ErlDrvSizeT;
+typedef ErlDrvSInt ErlDrvSSizeT;
+#else
+typedef size_t ErlDrvSizeT;
+typedef ssize_t ErlDrvSSizeT;
+#endif
+
/*
* A binary as seen in a driver. Note that a binary should never be
* altered by the driver when it has been sent to Erlang.
@@ -249,7 +258,7 @@ typedef struct {
typedef struct erl_io_vec {
int vsize; /* length of vectors */
- int size; /* total size in bytes */
+ ErlDrvSizeT size; /* total size in bytes */
SysIOVec* iov;
ErlDrvBinary** binv;
} ErlIOVec;
@@ -290,8 +299,8 @@ typedef struct erl_drv_entry {
void (*stop)(ErlDrvData drv_data);
/* called when port is closed, and when the
emulator is halted. */
- void (*output)(ErlDrvData drv_data, char *buf, int len);
- /* called when we have output from erlang to
+ void (*output)(ErlDrvData drv_data, char *buf, ErlDrvSizeT len);
+ /* called when we have output from erlang to
the port */
void (*ready_input)(ErlDrvData drv_data, ErlDrvEvent event);
/* called when we have input from one of
@@ -304,10 +313,10 @@ typedef struct erl_drv_entry {
void (*finish)(void); /* called before unloading the driver -
DYNAMIC DRIVERS ONLY */
void *handle; /* Reserved -- Used by emulator internally */
- int (*control)(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen);
- /* "ioctl" for drivers - invoked by
- port_control/3 */
+ ErlDrvSSizeT (*control)(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len, char **rbuf,
+ ErlDrvSizeT rlen); /* "ioctl" for drivers - invoked by
+ port_control/3 */
void (*timeout)(ErlDrvData drv_data); /* Handling of timeout in driver */
void (*outputv)(ErlDrvData drv_data, ErlIOVec *ev);
/* called when we have output from erlang
@@ -318,10 +327,12 @@ typedef struct erl_drv_entry {
closed, and there is data in the
driver queue that needs to be flushed
before 'stop' can be called */
- int (*call)(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned int *flags);
- /* Works mostly like 'control', a synchronous
- call into the driver. */
+ ErlDrvSSizeT (*call)(ErlDrvData drv_data,
+ unsigned int command, char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
+ unsigned int *flags); /* Works mostly like 'control',
+ a synchronous
+ call into the driver. */
void (*event)(ErlDrvData drv_data, ErlDrvEvent event,
ErlDrvEventData event_data);
/* Called when an event selected by
@@ -373,14 +384,16 @@ typedef struct erl_drv_entry {
EXTERN int driver_select(ErlDrvPort port, ErlDrvEvent event, int mode, int on);
EXTERN int driver_event(ErlDrvPort port, ErlDrvEvent event,
ErlDrvEventData event_data);
-EXTERN int driver_output(ErlDrvPort port, char *buf, int len);
-EXTERN int driver_output2(ErlDrvPort port, char *hbuf, int hlen,
- char *buf, int len);
-EXTERN int driver_output_binary(ErlDrvPort port, char *hbuf, int hlen,
- ErlDrvBinary* bin, int offset, int len);
-EXTERN int driver_outputv(ErlDrvPort port, char* hbuf, int hlen, ErlIOVec *ev,
- int skip);
-EXTERN int driver_vec_to_buf(ErlIOVec *ev, char *buf, int len);
+
+EXTERN int driver_output(ErlDrvPort port, char *buf, ErlDrvSizeT len);
+EXTERN int driver_output2(ErlDrvPort port, char *hbuf, ErlDrvSizeT hlen,
+ char *buf, ErlDrvSizeT len);
+EXTERN int driver_output_binary(ErlDrvPort port, char *hbuf, ErlDrvSizeT hlen,
+ ErlDrvBinary* bin,
+ ErlDrvSizeT offset, ErlDrvSizeT len);
+EXTERN int driver_outputv(ErlDrvPort port, char* hbuf, ErlDrvSizeT hlen,
+ ErlIOVec *ev, ErlDrvSizeT skip);
+EXTERN ErlDrvSizeT driver_vec_to_buf(ErlIOVec *ev, char *buf, ErlDrvSizeT len);
EXTERN int driver_set_timer(ErlDrvPort port, unsigned long time);
EXTERN int driver_cancel_timer(ErlDrvPort port);
EXTERN int driver_read_timer(ErlDrvPort port, unsigned long *time_left);
@@ -441,8 +454,8 @@ EXTERN int get_port_flags(ErlDrvPort port);
* since the binary is a shared object it MUST be written once.
*/
-EXTERN ErlDrvBinary* driver_alloc_binary(int size);
-EXTERN ErlDrvBinary* driver_realloc_binary(ErlDrvBinary *bin, int size);
+EXTERN ErlDrvBinary* driver_alloc_binary(ErlDrvSizeT size);
+EXTERN ErlDrvBinary* driver_realloc_binary(ErlDrvBinary *bin, ErlDrvSizeT size);
EXTERN void driver_free_binary(ErlDrvBinary *bin);
/* Referenc count on driver binaries */
@@ -451,24 +464,24 @@ EXTERN ErlDrvSInt driver_binary_inc_refc(ErlDrvBinary *dbp);
EXTERN ErlDrvSInt driver_binary_dec_refc(ErlDrvBinary *dbp);
/* Allocation interface */
-EXTERN void *driver_alloc(size_t size);
-EXTERN void *driver_realloc(void *ptr, size_t size);
+EXTERN void *driver_alloc(ErlDrvSizeT size);
+EXTERN void *driver_realloc(void *ptr, ErlDrvSizeT size);
EXTERN void driver_free(void *ptr);
/* Queue interface */
-EXTERN int driver_enq(ErlDrvPort port, char* buf, int len);
-EXTERN int driver_pushq(ErlDrvPort port, char* buf, int len);
-EXTERN int driver_deq(ErlDrvPort port, int size);
-EXTERN int driver_sizeq(ErlDrvPort port);
-EXTERN int driver_enq_bin(ErlDrvPort port, ErlDrvBinary *bin, int offset,
- int len);
-EXTERN int driver_pushq_bin(ErlDrvPort port, ErlDrvBinary *bin, int offset,
- int len);
-
-EXTERN int driver_peekqv(ErlDrvPort port, ErlIOVec *ev);
+EXTERN int driver_enq(ErlDrvPort port, char* buf, ErlDrvSizeT len);
+EXTERN int driver_pushq(ErlDrvPort port, char* buf, ErlDrvSizeT len);
+EXTERN ErlDrvSizeT driver_deq(ErlDrvPort port, ErlDrvSizeT size);
+EXTERN ErlDrvSizeT driver_sizeq(ErlDrvPort port);
+EXTERN int driver_enq_bin(ErlDrvPort port, ErlDrvBinary *bin, ErlDrvSizeT offset,
+ ErlDrvSizeT len);
+EXTERN int driver_pushq_bin(ErlDrvPort port, ErlDrvBinary *bin, ErlDrvSizeT offset,
+ ErlDrvSizeT len);
+
+EXTERN ErlDrvSizeT driver_peekqv(ErlDrvPort port, ErlIOVec *ev);
EXTERN SysIOVec* driver_peekq(ErlDrvPort port, int *vlen);
-EXTERN int driver_enqv(ErlDrvPort port, ErlIOVec *ev, int skip);
-EXTERN int driver_pushqv(ErlDrvPort port, ErlIOVec *ev, int skip);
+EXTERN int driver_enqv(ErlDrvPort port, ErlIOVec *ev, ErlDrvSizeT skip);
+EXTERN int driver_pushqv(ErlDrvPort port, ErlIOVec *ev, ErlDrvSizeT skip);
/*
* Add and remove driver entries.
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index f98232246b..f1335f600d 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -47,7 +47,7 @@ typedef struct erts_driver_t_ erts_driver_t;
#define SMALL_IO_QUEUE 5 /* Number of fixed elements */
typedef struct {
- int size; /* total size in bytes */
+ ErlDrvSizeT size; /* total size in bytes */
SysIOVec* v_start;
SysIOVec* v_end;
@@ -63,9 +63,9 @@ typedef struct {
} ErlIOQueue;
typedef struct line_buf { /* Buffer used in line oriented I/O */
- int bufsiz; /* Size of character buffer */
- int ovlen; /* Length of overflow data */
- int ovsiz; /* Actual size of overflow buffer */
+ ErlDrvSizeT bufsiz; /* Size of character buffer */
+ ErlDrvSizeT ovlen; /* Length of overflow data */
+ ErlDrvSizeT ovsiz; /* Actual size of overflow buffer */
char data[1]; /* Starting point of buffer data,
data[0] is a flag indicating an unprocess CR,
The rest is the overflow buffer. */
@@ -323,12 +323,15 @@ struct erts_driver_t_ {
void (*stop)(ErlDrvData drv_data);
void (*finish)(void);
void (*flush)(ErlDrvData drv_data);
- void (*output)(ErlDrvData drv_data, char *buf, int len);
+ void (*output)(ErlDrvData drv_data, char *buf, ErlDrvSizeT len);
void (*outputv)(ErlDrvData drv_data, ErlIOVec *ev); /* Might be NULL */
- int (*control)(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen); /* Might be NULL */
- int (*call)(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned int *flags); /* Might be NULL */
+ ErlDrvSSizeT (*control)(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen); /* Might be NULL */
+ ErlDrvSSizeT (*call)(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen, /* Might be NULL */
+ unsigned int *flags);
void (*event)(ErlDrvData drv_data, ErlDrvEvent event,
ErlDrvEventData event_data);
void (*ready_input)(ErlDrvData drv_data, ErlDrvEvent event);
@@ -1053,7 +1056,8 @@ extern int erts_do_net_exits(DistEntry*, Eterm);
extern int distribution_info(int, void *);
extern int is_node_name_atom(Eterm a);
-extern int erts_net_message(Port *, DistEntry *, byte *, int, byte *, int);
+extern int erts_net_message(Port *, DistEntry *,
+ byte *, ErlDrvSizeT, byte *, ErlDrvSizeT);
extern void init_dist(void);
extern int stop_dist(void);
@@ -1661,7 +1665,7 @@ do { \
#define ERTS_SMP_CHK_PEND_TRACE_MSGS(ESDP)
#endif
-void bin_write(int, void*, byte*, int);
+void bin_write(int, void*, byte*, size_t);
int intlist_to_buf(Eterm, char*, int); /* most callers pass plain char*'s */
struct Sint_buf {
@@ -1677,7 +1681,7 @@ char* Sint_to_buf(Sint, struct Sint_buf*);
#define ERTS_IOLIST_OVERFLOW 1
#define ERTS_IOLIST_TYPE 2
-Eterm buf_to_intlist(Eterm**, char*, int, Eterm); /* most callers pass plain char*'s */
+Eterm buf_to_intlist(Eterm**, char*, size_t, Eterm); /* most callers pass plain char*'s */
int io_list_to_buf(Eterm, char*, int);
int io_list_to_buf2(Eterm, char*, int);
int erts_iolist_size(Eterm, Uint *);
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 759621d3c2..49cd0e5f53 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -164,8 +164,8 @@ erts_port_ioq_size(Port *pp)
typedef struct line_buf_context {
LineBuf **b;
char *buf;
- int left;
- int retlen;
+ ErlDrvSizeT left;
+ ErlDrvSizeT retlen;
} LineBufContext;
#define LINEBUF_EMPTY 0
@@ -828,13 +828,13 @@ io_list_to_vec(Eterm obj, /* io-list */
SysIOVec* iov, /* io vector */
ErlDrvBinary** binv, /* binary reference vector */
ErlDrvBinary* cbin, /* binary to store characters */
- int bin_limit) /* small binaries limit */
+ ErlDrvSizeT bin_limit) /* small binaries limit */
{
DECLARE_ESTACK(s);
Eterm* objp;
char *buf = cbin->orig_bytes;
- int len = cbin->orig_size;
- int csize = 0;
+ ErlDrvSizeT len = cbin->orig_size;
+ ErlDrvSizeT csize = 0;
int vlen = 0;
char* cptr = buf;
@@ -874,7 +874,7 @@ io_list_to_vec(Eterm obj, /* io-list */
Eterm real_bin;
Uint offset;
Eterm* bptr;
- int size;
+ ErlDrvSizeT size;
int bitoffs;
int bitsize;
@@ -949,7 +949,7 @@ io_list_to_vec(Eterm obj, /* io-list */
#define IO_LIST_VEC_COUNT(obj) \
do { \
- int _size = binary_size(obj); \
+ ErlDrvSizeT _size = binary_size(obj); \
Eterm _real; \
ERTS_DECLARE_DUMMY(Uint _offset); \
int _bitoffs; \
@@ -1104,7 +1104,7 @@ int erts_write_to_port(Eterm caller_id, Port *p, Eterm list)
Uint csize;
Uint pvsize;
Uint pcsize;
- int blimit;
+ ErlDrvSizeT blimit;
SysIOVec iv[SMALL_WRITE_VEC];
ErlDrvBinary* bv[SMALL_WRITE_VEC];
SysIOVec* ivp;
@@ -1360,7 +1360,8 @@ int bufsiz;
* buf - A buffer containing the data to be read and split to lines.
* len - The number of bytes in buf.
*/
-static int init_linebuf_context(LineBufContext *lc, LineBuf **lb, char *buf, int len)
+static int init_linebuf_context(LineBufContext *lc, LineBuf **lb,
+ char *buf, ErlDrvSizeT len)
{
if(lc == NULL || lb == NULL)
return -1;
@@ -1529,10 +1530,10 @@ deliver_result(Eterm sender, Eterm pid, Eterm res)
*/
static void deliver_read_message(Port* prt, Eterm to,
- char *hbuf, int hlen,
- char *buf, int len, int eol)
+ char *hbuf, ErlDrvSizeT hlen,
+ char *buf, ErlDrvSizeT len, int eol)
{
- int need;
+ ErlDrvSizeT need;
Eterm listp;
Eterm tuple;
Process* rp;
@@ -1612,8 +1613,8 @@ static void deliver_read_message(Port* prt, Eterm to,
* deliver_read_message, and takes the same parameters.
*/
static void deliver_linebuf_message(Port* prt, Eterm to,
- char* hbuf, int hlen,
- char *buf, int len)
+ char* hbuf, ErlDrvSizeT hlen,
+ char *buf, ErlDrvSizeT len)
{
LineBufContext lc;
int ret;
@@ -1656,14 +1657,14 @@ static void
deliver_vec_message(Port* prt, /* Port */
Eterm to, /* Receiving pid */
char* hbuf, /* "Header" buffer... */
- int hlen, /* ... and its length */
+ ErlDrvSizeT hlen, /* ... and its length */
ErlDrvBinary** binv, /* Vector of binaries */
SysIOVec* iov, /* I/O vector */
int vsize, /* Size of binv & iov */
- int csize) /* Size of characters in
+ ErlDrvSizeT csize) /* Size of characters in
iov (not hlen) */
{
- int need;
+ ErlDrvSizeT need;
Eterm listp;
Eterm tuple;
Process* rp;
@@ -1744,7 +1745,7 @@ deliver_vec_message(Port* prt, /* Port */
}
}
- if (hlen > 0) { /* Prepend the header */
+ if (hlen != 0) { /* Prepend the header */
Eterm* thp = hp;
listp = buf_to_intlist(&thp, hbuf, hlen, listp);
hp = thp;
@@ -1764,10 +1765,10 @@ deliver_vec_message(Port* prt, /* Port */
static void deliver_bin_message(Port* prt, /* port */
Eterm to, /* receiving pid */
char* hbuf, /* "header" buffer */
- int hlen, /* and it's length */
+ ErlDrvSizeT hlen, /* and it's length */
ErlDrvBinary* bin, /* binary data */
- int offs, /* offset into binary */
- int len) /* length of binary */
+ ErlDrvSizeT offs, /* offset into binary */
+ ErlDrvSizeT len) /* length of binary */
{
SysIOVec vec;
@@ -2155,8 +2156,9 @@ erts_port_control(Process* p, Port* prt, Uint command, Eterm iolist)
int must_free = 0; /* True if the buffer should be freed. */
char port_result[ERL_ONHEAP_BIN_LIMIT]; /* Default buffer for result from port. */
char* port_resp; /* Pointer to result buffer. */
- int n;
- int (*control)(ErlDrvData, unsigned, char*, int, char**, int);
+ ErlDrvSSizeT n;
+ ErlDrvSSizeT (*control)
+ (ErlDrvData, unsigned, char*, ErlDrvSizeT, char**, ErlDrvSizeT);
int fpe_was_unmasked;
ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt));
@@ -3239,8 +3241,8 @@ driver_send_term(ErlDrvPort ix, ErlDrvTermData to, ErlDrvTermData* data, int len
* and data is len length of bin starting from offset offs.
*/
-int driver_output_binary(ErlDrvPort ix, char* hbuf, int hlen,
- ErlDrvBinary* bin, int offs, int len)
+int driver_output_binary(ErlDrvPort ix, char* hbuf, ErlDrvSizeT hlen,
+ ErlDrvBinary* bin, ErlDrvSizeT offs, ErlDrvSizeT len)
{
Port* prt = erts_drvport2port(ix);
@@ -3273,7 +3275,8 @@ int driver_output_binary(ErlDrvPort ix, char* hbuf, int hlen,
** Example: if hlen = 3 then the port owner will receive the data
** [H1,H2,H3 | T]
*/
-int driver_output2(ErlDrvPort ix, char* hbuf, int hlen, char* buf, int len)
+int driver_output2(ErlDrvPort ix, char* hbuf, ErlDrvSizeT hlen,
+ char* buf, ErlDrvSizeT len)
{
Port* prt = erts_drvport2port(ix);
@@ -3310,27 +3313,29 @@ int driver_output2(ErlDrvPort ix, char* hbuf, int hlen, char* buf, int len)
/* Interface functions available to driver writers */
-int driver_output(ErlDrvPort ix, char* buf, int len)
+int driver_output(ErlDrvPort ix, char* buf, ErlDrvSizeT len)
{
ERTS_SMP_CHK_NO_PROC_LOCKS;
return driver_output2(ix, NULL, 0, buf, len);
}
-int driver_outputv(ErlDrvPort ix, char* hbuf, int hlen, ErlIOVec* vec, int skip)
+int driver_outputv(ErlDrvPort ix, char* hbuf, ErlDrvSizeT hlen,
+ ErlIOVec* vec, ErlDrvSizeT skip)
{
int n;
- int len;
- int size;
+ ErlDrvSizeT len;
+ ErlDrvSizeT size;
SysIOVec* iov;
ErlDrvBinary** binv;
Port* prt;
ERTS_SMP_CHK_NO_PROC_LOCKS;
- size = vec->size - skip; /* Size of remaining bytes in vector */
- ASSERT(size >= 0);
- if (size <= 0)
+ ASSERT(vec->size >= skip);
+ if (vec->size <= skip)
return driver_output2(ix, hbuf, hlen, NULL, 0);
+ size = vec->size - skip; /* Size of remaining bytes in vector */
+
ASSERT(hlen >= 0); /* debug only */
if (hlen < 0)
hlen = 0;
@@ -3374,17 +3379,14 @@ int driver_outputv(ErlDrvPort ix, char* hbuf, int hlen, ErlIOVec* vec, int skip)
** input is a vector a buffer and a max length
** return bytes copied
*/
-int driver_vec_to_buf(vec, buf, len)
-ErlIOVec* vec;
-char* buf;
-int len;
+ErlDrvSizeT driver_vec_to_buf(ErlIOVec *vec, char *buf, ErlDrvSizeT len)
{
SysIOVec* iov = vec->iov;
int n = vec->vsize;
- int orig_len = len;
+ ErlDrvSizeT orig_len = len;
while(n--) {
- int ilen = iov->iov_len;
+ size_t ilen = iov->iov_len;
if (ilen < len) {
sys_memcpy(buf, iov->iov_base, ilen);
len -= ilen;
@@ -3436,13 +3438,10 @@ driver_binary_dec_refc(ErlDrvBinary *dbp)
*/
ErlDrvBinary*
-driver_alloc_binary(int size)
+driver_alloc_binary(ErlDrvSizeT size)
{
Binary* bin;
- if (size < 0)
- return NULL;
-
bin = erts_bin_drv_alloc_fnf((Uint) size);
if (!bin)
return NULL; /* The driver write must take action */
@@ -3454,25 +3453,19 @@ driver_alloc_binary(int size)
/* Reallocate space hold by binary */
-ErlDrvBinary* driver_realloc_binary(ErlDrvBinary* bin, int size)
+ErlDrvBinary* driver_realloc_binary(ErlDrvBinary* bin, ErlDrvSizeT size)
{
Binary* oldbin;
Binary* newbin;
- if (!bin || size < 0) {
+ if (!bin) {
erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf();
erts_dsprintf(dsbufp,
- "Bad use of driver_realloc_binary(%p, %d): "
+ "Bad use of driver_realloc_binary(%p, %lu): "
"called with ",
- bin, size);
+ bin, (unsigned long)size);
if (!bin) {
erts_dsprintf(dsbufp, "NULL pointer as first argument");
- if (size < 0)
- erts_dsprintf(dsbufp, ", and ");
- }
- if (size < 0) {
- erts_dsprintf(dsbufp, "negative size as second argument");
- size = 0;
}
erts_send_warning_to_logger_nogl(dsbufp);
if (!bin)
@@ -3512,12 +3505,12 @@ ErlDrvBinary* dbin;
* Allocation/deallocation of memory for drivers
*/
-void *driver_alloc(size_t size)
+void *driver_alloc(ErlDrvSizeT size)
{
return erts_alloc_fnf(ERTS_ALC_T_DRV, (Uint) size);
}
-void *driver_realloc(void *ptr, size_t size)
+void *driver_realloc(void *ptr, ErlDrvSizeT size)
{
return erts_realloc_fnf(ERTS_ALC_T_DRV, ptr, (Uint) size);
}
@@ -3779,11 +3772,11 @@ static int expandq(ErlIOQueue* q, int n, int tail)
/* Put elements from vec at q tail */
-int driver_enqv(ErlDrvPort ix, ErlIOVec* vec, int skip)
+int driver_enqv(ErlDrvPort ix, ErlIOVec* vec, ErlDrvSizeT skip)
{
int n;
- int len;
- int size;
+ size_t len;
+ ErlDrvSizeT size;
SysIOVec* iov;
ErlDrvBinary** binv;
ErlDrvBinary* b;
@@ -3792,10 +3785,10 @@ int driver_enqv(ErlDrvPort ix, ErlIOVec* vec, int skip)
if (q == NULL)
return -1;
- size = vec->size - skip;
- ASSERT(size >= 0); /* debug only */
- if (size <= 0)
+ ASSERT(vec->size >= skip); /* debug only */
+ if (vec->size <= skip)
return 0;
+ size = vec->size - skip;
iov = vec->iov;
binv = vec->binv;
@@ -3845,11 +3838,11 @@ int driver_enqv(ErlDrvPort ix, ErlIOVec* vec, int skip)
}
/* Put elements from vec at q head */
-int driver_pushqv(ErlDrvPort ix, ErlIOVec* vec, int skip)
+int driver_pushqv(ErlDrvPort ix, ErlIOVec* vec, ErlDrvSizeT skip)
{
int n;
- int len;
- int size;
+ size_t len;
+ ErlDrvSizeT size;
SysIOVec* iov;
ErlDrvBinary** binv;
ErlDrvBinary* b;
@@ -3858,8 +3851,10 @@ int driver_pushqv(ErlDrvPort ix, ErlIOVec* vec, int skip)
if (q == NULL)
return -1;
- if ((size = vec->size - skip) <= 0)
+ if (vec->size <= skip)
return 0;
+ size = vec->size - skip;
+
iov = vec->iov;
binv = vec->binv;
n = vec->vsize;
@@ -3914,15 +3909,14 @@ int driver_pushqv(ErlDrvPort ix, ErlIOVec* vec, int skip)
** Remove size bytes from queue head
** Return number of bytes that remain in queue
*/
-int driver_deq(ErlDrvPort ix, int size)
+ErlDrvSizeT driver_deq(ErlDrvPort ix, ErlDrvSizeT size)
{
ErlIOQueue* q = drvport2ioq(ix);
int len;
- int sz;
- if ((q == NULL) || (sz = (q->size - size)) < 0)
+ if ((q == NULL) || (q->size < size))
return -1;
- q->size = sz;
+ q->size -= size;
while (size > 0) {
ASSERT(q->v_head != q->v_tail);
@@ -3945,16 +3939,16 @@ int driver_deq(ErlDrvPort ix, int size)
q->v_head = q->v_tail = q->v_start;
q->b_head = q->b_tail = q->b_start;
}
- return sz;
+ return q->size;
}
-int driver_peekqv(ErlDrvPort ix, ErlIOVec *ev) {
+ErlDrvSizeT driver_peekqv(ErlDrvPort ix, ErlIOVec *ev) {
ErlIOQueue *q = drvport2ioq(ix);
ASSERT(ev);
if (! q) {
- return -1;
+ return (ErlDrvSizeT) -1;
} else {
if ((ev->vsize = q->v_tail - q->v_head) == 0) {
ev->size = 0;
@@ -3983,12 +3977,12 @@ SysIOVec* driver_peekq(ErlDrvPort ix, int* vlenp) /* length of io-vector */
}
-int driver_sizeq(ErlDrvPort ix)
+ErlDrvSizeT driver_sizeq(ErlDrvPort ix)
{
ErlIOQueue* q = drvport2ioq(ix);
if (q == NULL)
- return -1;
+ return (size_t) -1;
return q->size;
}
@@ -3996,7 +3990,8 @@ int driver_sizeq(ErlDrvPort ix)
/* Utils */
/* Enqueue a binary */
-int driver_enq_bin(ErlDrvPort ix, ErlDrvBinary* bin, int offs, int len)
+int driver_enq_bin(ErlDrvPort ix, ErlDrvBinary* bin,
+ ErlDrvSizeT offs, ErlDrvSizeT len)
{
SysIOVec iov;
ErlIOVec ev;
@@ -4013,7 +4008,7 @@ int driver_enq_bin(ErlDrvPort ix, ErlDrvBinary* bin, int offs, int len)
return driver_enqv(ix, &ev, 0);
}
-int driver_enq(ErlDrvPort ix, char* buffer, int len)
+int driver_enq(ErlDrvPort ix, char* buffer, ErlDrvSizeT len)
{
int code;
ErlDrvBinary* bin;
@@ -4029,7 +4024,8 @@ int driver_enq(ErlDrvPort ix, char* buffer, int len)
return code;
}
-int driver_pushq_bin(ErlDrvPort ix, ErlDrvBinary* bin, int offs, int len)
+int driver_pushq_bin(ErlDrvPort ix, ErlDrvBinary* bin,
+ ErlDrvSizeT offs, ErlDrvSizeT len)
{
SysIOVec iov;
ErlIOVec ev;
@@ -4046,7 +4042,7 @@ int driver_pushq_bin(ErlDrvPort ix, ErlDrvBinary* bin, int offs, int len)
return driver_pushqv(ix, &ev, 0);
}
-int driver_pushq(ErlDrvPort ix, char* buffer, int len)
+int driver_pushq(ErlDrvPort ix, char* buffer, ErlDrvSizeT len)
{
int code;
ErlDrvBinary* bin;
@@ -4767,7 +4763,7 @@ get_current_port(void)
*/
static void
-no_output_callback(ErlDrvData drv_data, char *buf, int len)
+no_output_callback(ErlDrvData drv_data, char *buf, ErlDrvSizeT len)
{
}
@@ -4818,16 +4814,11 @@ static int
init_driver(erts_driver_t *drv, ErlDrvEntry *de, DE_Handle *handle)
{
drv->name = de->driver_name;
- if (de->extended_marker == ERL_DRV_EXTENDED_MARKER) {
- drv->version.major = de->major_version;
- drv->version.minor = de->minor_version;
- drv->flags = de->driver_flags;
- }
- else {
- drv->version.major = 0;
- drv->version.minor = 0;
- drv->flags = 0;
- }
+ ASSERT(de->extended_marker == ERL_DRV_EXTENDED_MARKER);
+ ASSERT(de->major_version >= 2);
+ drv->version.major = de->major_version;
+ drv->version.minor = de->minor_version;
+ drv->flags = de->driver_flags;
drv->handle = handle;
#ifdef ERTS_SMP
if (drv->flags & ERL_DRV_FLAG_USE_PORT_LOCKING)
@@ -4860,11 +4851,8 @@ init_driver(erts_driver_t *drv, ErlDrvEntry *de, DE_Handle *handle)
drv->ready_output = de->ready_output ? de->ready_output : no_ready_output_callback;
drv->timeout = de->timeout ? de->timeout : no_timeout_callback;
drv->ready_async = de->ready_async;
- if (de->extended_marker == ERL_DRV_EXTENDED_MARKER)
- drv->process_exit = de->process_exit;
- else
- drv->process_exit = NULL;
- if (de->minor_version >= 3/*R13A*/ && de->stop_select)
+ drv->process_exit = de->process_exit;
+ if (de->stop_select)
drv->stop_select = de->stop_select;
else
drv->stop_select = no_stop_select_callback;
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 4105f194a9..49b6618f73 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -2865,9 +2865,9 @@ store_external_or_ref_in_proc_(Process *proc, Eterm ns)
return store_external_or_ref_(&hp, &MSO(proc), ns);
}
-void bin_write(int to, void *to_arg, byte* buf, int sz)
+void bin_write(int to, void *to_arg, byte* buf, size_t sz)
{
- int i;
+ size_t i;
for (i=0;i<sz;i++) {
if (IS_DIGIT(buf[i]))
@@ -2942,15 +2942,15 @@ char* Sint_to_buf(Sint n, struct Sint_buf *buf)
*/
Eterm
-buf_to_intlist(Eterm** hpp, char *buf, int len, Eterm tail)
+buf_to_intlist(Eterm** hpp, char *buf, size_t len, Eterm tail)
{
Eterm* hp = *hpp;
- int i = len - 1;
+ size_t i = len;
- while(i >= 0) {
+ while(i != 0) {
+ --i;
tail = CONS(hp, make_small((Uint)(byte)buf[i]), tail);
hp += 2;
- --i;
}
*hpp = hp;
@@ -3459,11 +3459,9 @@ void erts_silence_warn_unused_result(long unused)
* Handy functions when using a debugger - don't use in the code!
*/
-void upp(buf,sz)
-byte* buf;
-int sz;
+void upp(byte *buf, size_t sz)
{
- bin_write(ERTS_PRINT_STDERR,NULL,buf,sz);
+ bin_write(ERTS_PRINT_STDERR, NULL, buf, sz);
}
void pat(Eterm atom)
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index d9282dbb12..b132991a3b 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -241,9 +241,10 @@ typedef unsigned char uchar;
static ErlDrvData file_start(ErlDrvPort port, char* command);
static int file_init(void);
static void file_stop(ErlDrvData);
-static void file_output(ErlDrvData, char* buf, int len);
-static int file_control(ErlDrvData, unsigned int command,
- char* buf, int len, char **rbuf, int rlen);
+static void file_output(ErlDrvData, char* buf, ErlDrvSizeT len);
+static ErlDrvSSizeT file_control(ErlDrvData, unsigned int command,
+ char* buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen);
static void file_timeout(ErlDrvData);
static void file_outputv(ErlDrvData, ErlIOVec*);
static void file_async_ready(ErlDrvData, ErlDrvThreadData);
@@ -1083,7 +1084,7 @@ static void invoke_read_line(void *data)
d->c.read_line.read_offset - d->c.read_line.read_size;
if (size == 0) {
/* Need more place */
- size_t need = (d->c.read_line.read_size >= DEFAULT_LINEBUF_SIZE) ?
+ ErlDrvSizeT need = (d->c.read_line.read_size >= DEFAULT_LINEBUF_SIZE) ?
d->c.read_line.read_size + DEFAULT_LINEBUF_SIZE : DEFAULT_LINEBUF_SIZE;
ErlDrvBinary *newbin = driver_alloc_binary(need);
if (newbin == NULL) {
@@ -2291,7 +2292,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
* Driver entry point -> output
*/
static void
-file_output(ErlDrvData e, char* buf, int count)
+file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
{
file_descriptor* desc = (file_descriptor*)e;
Efile_error errInfo; /* The error codes for the last operation. */
@@ -2668,9 +2669,9 @@ file_flush(ErlDrvData e) {
/*********************************************************************
* Driver entry point -> control
*/
-static int
+static ErlDrvSSizeT
file_control(ErlDrvData e, unsigned int command,
- char* buf, int len, char **rbuf, int rlen) {
+ char* buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen) {
/*
* warning: variable ‘desc’ set but not used
* [-Wunused-but-set-variable]
@@ -2971,8 +2972,8 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
cq_enq(desc, d);
} goto done;
case FILE_WRITE: {
- int skip = 1;
- int size = ev->size - skip;
+ ErlDrvSizeT skip = 1;
+ ErlDrvSizeT size = ev->size - skip;
if (lseek_flush_read(desc, &err) < 0) {
reply_posix_error(desc, err);
goto done;
@@ -2981,7 +2982,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_posix_error(desc, EBADF);
goto done;
}
- if (size <= 0) {
+ if (size == 0) {
reply_Uint(desc, size);
goto done;
}
@@ -3095,7 +3096,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
EF_FREE(d);
reply_Uint(desc, 0);
} else {
- size_t skip = 1 + 4 + 8*(2*n);
+ ErlDrvSizeT skip = 1 + 4 + 8*(2*n);
if (skip + total != ev->size) {
/* Actual amount of data does not match
* total of all pos/size specs
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index ee5ebdf646..eeaa4d24ea 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -80,6 +80,13 @@
#endif
#ifdef __WIN32__
+#define LLU "%I64u"
+#else
+#define LLU "%llu"
+#endif
+typedef unsigned long long llu_t;
+
+#ifdef __WIN32__
#define STRNCASECMP strncasecmp
#define INCL_WINSOCK_API_TYPEDEFS 1
@@ -965,13 +972,14 @@ typedef struct {
static int tcp_inet_init(void);
static void tcp_inet_stop(ErlDrvData);
-static void tcp_inet_command(ErlDrvData, char*, int);
+static void tcp_inet_command(ErlDrvData, char*, ErlDrvSizeT);
static void tcp_inet_commandv(ErlDrvData, ErlIOVec*);
static void tcp_inet_flush(ErlDrvData drv_data);
static void tcp_inet_drv_input(ErlDrvData, ErlDrvEvent);
static void tcp_inet_drv_output(ErlDrvData data, ErlDrvEvent event);
static ErlDrvData tcp_inet_start(ErlDrvPort, char* command);
-static int tcp_inet_ctl(ErlDrvData, unsigned int, char*, int, char**, int);
+static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData, unsigned int,
+ char*, ErlDrvSizeT, char**, ErlDrvSizeT);
static void tcp_inet_timeout(ErlDrvData);
static void tcp_inet_process_exit(ErlDrvData, ErlDrvMonitor *);
static void inet_stop_select(ErlDrvEvent, void*);
@@ -1016,15 +1024,15 @@ static struct erl_drv_entry tcp_inet_driver_entry =
static int packet_inet_init(void);
static void packet_inet_stop(ErlDrvData);
-static void packet_inet_command(ErlDrvData, char*, int);
+static void packet_inet_command(ErlDrvData, char*, ErlDrvSizeT);
static void packet_inet_drv_input(ErlDrvData data, ErlDrvEvent event);
static void packet_inet_drv_output(ErlDrvData data, ErlDrvEvent event);
static ErlDrvData udp_inet_start(ErlDrvPort, char* command);
#ifdef HAVE_SCTP
static ErlDrvData sctp_inet_start(ErlDrvPort, char* command);
#endif
-static int packet_inet_ctl(ErlDrvData, unsigned int, char*,
- int, char**, int);
+static ErlDrvSSizeT packet_inet_ctl(ErlDrvData, unsigned int, char*,
+ ErlDrvSizeT, char**, ErlDrvSizeT);
static void packet_inet_timeout(ErlDrvData);
#ifdef __WIN32__
static void packet_inet_event(ErlDrvData, ErlDrvEvent);
@@ -1118,7 +1126,7 @@ typedef struct {
} tcp_descriptor;
/* send function */
-static int tcp_send(tcp_descriptor* desc, char* ptr, int len);
+static int tcp_send(tcp_descriptor* desc, char* ptr, ErlDrvSizeT len);
static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev);
static int tcp_recv(tcp_descriptor* desc, int request_len);
static int tcp_deliver(tcp_descriptor* desc, int len);
@@ -1185,7 +1193,7 @@ static ErlDrvTermData am_tos;
static int inet_init(void);
-static int ctl_reply(int, char*, int, char**, int);
+static ErlDrvSSizeT ctl_reply(int, char*, ErlDrvSizeT, char**, ErlDrvSizeT);
struct erl_drv_entry inet_driver_entry =
{
@@ -1195,7 +1203,23 @@ struct erl_drv_entry inet_driver_entry =
NULL, /* output */
NULL, /* ready_input */
NULL, /* ready_output */
- "inet"
+ "inet",
+ NULL,
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL, /* event */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
/* XXX: is this a driver interface function ??? */
@@ -1209,7 +1233,7 @@ void erl_exit(int n, char*, ...);
#ifdef FATAL_MALLOC
-static void *alloc_wrapper(size_t size){
+static void *alloc_wrapper(ErlDrvSizeT size){
void *ret = driver_alloc(size);
if(ret == NULL)
erl_exit(1,"Out of virtual memory in malloc (%s)", __FILE__);
@@ -1217,7 +1241,7 @@ static void *alloc_wrapper(size_t size){
}
#define ALLOC(X) alloc_wrapper(X)
-static void *realloc_wrapper(void *current, size_t size){
+static void *realloc_wrapper(void *current, ErlDrvSizeT size){
void *ret = driver_realloc(current,size);
if(ret == NULL)
erl_exit(1,"Out of virtual memory in realloc (%s)", __FILE__);
@@ -1446,11 +1470,11 @@ static InetDrvBufStk *get_bufstk(void)
return bs;
}
-static ErlDrvBinary* alloc_buffer(long minsz)
+static ErlDrvBinary* alloc_buffer(ErlDrvSizeT minsz)
{
InetDrvBufStk *bs = get_bufstk();
- DEBUGF(("alloc_buffer: %ld\r\n", minsz));
+ DEBUGF(("alloc_buffer: "LLU"\r\n", (llu_t)minsz));
if (bs && bs->buf.pos > 0) {
long size;
@@ -1526,7 +1550,7 @@ static void release_buffer(ErlDrvBinary* buf)
}
}
-static ErlDrvBinary* realloc_buffer(ErlDrvBinary* buf, long newsz)
+static ErlDrvBinary* realloc_buffer(ErlDrvBinary* buf, ErlDrvSizeT newsz)
{
return driver_realloc_binary(buf, newsz);
}
@@ -1555,8 +1579,9 @@ static ErlDrvData dummy_start(ErlDrvPort port, char* command)
return (ErlDrvData)port;
}
-static int dummy_ctl(ErlDrvData data, unsigned int cmd, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT dummy_ctl(ErlDrvData data, unsigned int cmd,
+ char* buf, ErlDrvSizeT len, char** rbuf,
+ ErlDrvSizeT rsize)
{
static char error[] = "no_winsock2";
@@ -1564,7 +1589,7 @@ static int dummy_ctl(ErlDrvData data, unsigned int cmd, char* buf, int len,
return ctl_reply(INET_REP_ERROR, error, sizeof(error), rbuf, rsize);
}
-static void dummy_command(ErlDrvData data, char* buf, int len)
+static void dummy_command(ErlDrvData data, char* buf, ErlDrvSizeT len)
{
}
@@ -1621,7 +1646,8 @@ static struct erl_drv_entry dummy_sctp_driver_entry =
#endif
/* general control reply function */
-static int ctl_reply(int rep, char* buf, int len, char** rbuf, int rsize)
+static ErlDrvSSizeT ctl_reply(int rep, char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
char* ptr;
@@ -1637,7 +1663,7 @@ static int ctl_reply(int rep, char* buf, int len, char** rbuf, int rsize)
}
/* general control error reply function */
-static int ctl_error(int err, char** rbuf, int rsize)
+static ErlDrvSSizeT ctl_error(int err, char** rbuf, ErlDrvSizeT rsize)
{
char response[256]; /* Response buffer. */
char* s;
@@ -1648,7 +1674,7 @@ static int ctl_error(int err, char** rbuf, int rsize)
return ctl_reply(INET_REP_ERROR, response, t-response, rbuf, rsize);
}
-static int ctl_xerror(char* xerr, char** rbuf, int rsize)
+static ErlDrvSSizeT ctl_xerror(char* xerr, char** rbuf, ErlDrvSizeT rsize)
{
int n = strlen(xerr);
return ctl_reply(INET_REP_ERROR, xerr, n, rbuf, rsize);
@@ -3665,7 +3691,8 @@ static int inet_init()
** and is set to actual length of dst on return
** return NULL on error and ptr after port address on success
*/
-static char* inet_set_address(int family, inet_address* dst, char* src, int* len)
+static char* inet_set_address(int family, inet_address* dst,
+ char* src, ErlDrvSizeT* len)
{
short port;
@@ -3701,7 +3728,7 @@ static char* inet_set_address(int family, inet_address* dst, char* src, int* len
** src = [TAG,P1,P0,X1,X2,...] when TAG = INET_AF_INET | INET_AF_INET6
*/
static char *inet_set_faddress(int family, inet_address* dst,
- char *src, int* len) {
+ char *src, ErlDrvSizeT* len) {
int tag;
if (*len < 1) return NULL;
@@ -3865,8 +3892,8 @@ static int erl_inet_close(inet_descriptor* desc)
}
-static int inet_ctl_open(inet_descriptor* desc, int domain, int type,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_open(inet_descriptor* desc, int domain, int type,
+ char** rbuf, ErlDrvSizeT rsize)
{
if (desc->state != INET_STATE_CLOSED)
return ctl_xerror(EXBADSEQ, rbuf, rsize);
@@ -3886,8 +3913,8 @@ static int inet_ctl_open(inet_descriptor* desc, int domain, int type,
/* as inet_open but pass in an open socket (MUST BE OF RIGHT TYPE) */
-static int inet_ctl_fdopen(inet_descriptor* desc, int domain, int type,
- SOCKET s, char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_fdopen(inet_descriptor* desc, int domain, int type,
+ SOCKET s, char** rbuf, ErlDrvSizeT rsize)
{
inet_address name;
unsigned int sz = sizeof(name);
@@ -4091,14 +4118,15 @@ static char* buf_to_sockaddr(char* ptr, char* end, struct sockaddr* addr)
#if defined(__WIN32__) && defined(SIO_GET_INTERFACE_LIST)
-static int inet_ctl_getiflist(inet_descriptor* desc, char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_getiflist(inet_descriptor* desc,
+ char** rbuf, ErlDrvSizeT rsize)
{
char ifbuf[BUFSIZ];
char sbuf[BUFSIZ];
char* sptr;
INTERFACE_INFO* ifp;
DWORD len;
- int n;
+ ErlDrvSizeT n;
int err;
ifp = (INTERFACE_INFO*) ifbuf;
@@ -4128,8 +4156,8 @@ static int inet_ctl_getiflist(inet_descriptor* desc, char** rbuf, int rsize)
/* input is an ip-address in string format i.e A.B.C.D
** scan the INTERFACE_LIST to get the options
*/
-static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_ifget(inet_descriptor* desc, char* buf,
+ ErlDrvSizeT len, char** rbuf, ErlDrvSizeT rsize)
{
char ifbuf[BUFSIZ];
int n;
@@ -4230,8 +4258,9 @@ static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len,
}
/* not supported */
-static int inet_ctl_ifset(inet_descriptor* desc, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_ifset(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize);
}
@@ -4274,12 +4303,13 @@ static void free_ifconf(struct ifconf *ifcp) {
FREE(ifcp->ifc_buf);
}
-static int inet_ctl_getiflist(inet_descriptor* desc, char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_getiflist(inet_descriptor* desc,
+ char** rbuf, ErlDrvSizeT rsize)
{
struct ifconf ifc;
struct ifreq *ifrp;
char *sbuf, *sp;
- int i;
+ ErlDrvSizeT i;
/* Courtesy of Per Bergqvist and W. Richard Stevens */
@@ -4291,7 +4321,7 @@ static int inet_ctl_getiflist(inet_descriptor* desc, char** rbuf, int rsize)
*sp++ = INET_REP_OK;
i = 0;
for (;;) {
- int n;
+ ErlDrvSizeT n;
ifrp = (struct ifreq *) VOIDP(ifc.ifc_buf + i);
n = sizeof(ifrp->ifr_name) + SIZEA(ifrp->ifr_addr);
@@ -4347,8 +4377,9 @@ static int hwaddr_libdlpi_lookup(const char *ifnm,
#define IFHWADDRLEN 6
#endif
-static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_ifget(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
char sbuf[BUFSIZ];
char* sptr;
@@ -4542,8 +4573,9 @@ static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len,
}
-static int inet_ctl_ifset(inet_descriptor* desc, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_ifset(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
struct ifreq ifreq;
int namlen;
@@ -4566,19 +4598,19 @@ static int inet_ctl_ifset(inet_descriptor* desc, char* buf, int len,
break;
case INET_IFOPT_HWADDR: {
- unsigned int len;
+ unsigned int hwalen;
buf_check(buf, b_end, 2);
- len = get_int16(buf); buf += 2;
- buf_check(buf, b_end, len);
+ hwalen = get_int16(buf); buf += 2;
+ buf_check(buf, b_end, hwalen);
#ifdef SIOCSIFHWADDR
/* raw memcpy (fix include autoconf later) */
sys_memset((char*)(&ifreq.ifr_hwaddr.sa_data),
'\0', sizeof(ifreq.ifr_hwaddr.sa_data));
- sys_memcpy((char*)(&ifreq.ifr_hwaddr.sa_data), buf, len);
+ sys_memcpy((char*)(&ifreq.ifr_hwaddr.sa_data), buf, hwalen);
(void) ioctl(desc->s, SIOCSIFHWADDR, (char *)&ifreq);
#endif
- buf += len;
+ buf += hwalen;
break;
}
@@ -4664,21 +4696,24 @@ static int inet_ctl_ifset(inet_descriptor* desc, char* buf, int len,
#else
-static int inet_ctl_getiflist(inet_descriptor* desc, char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_getiflist(inet_descriptor* desc,
+ char** rbuf, ErlDrvSizeT rsize)
{
return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize);
}
-static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_ifget(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize);
}
-static int inet_ctl_ifset(inet_descriptor* desc, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl_ifset(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize);
}
@@ -4735,8 +4770,8 @@ int eq_masked_bytes(char *a, char *b, int pref_len) {
return !0;
}
-static int inet_ctl_getifaddrs(inet_descriptor* desc_p,
- char **rbuf_pp, int rsize)
+static ErlDrvSSizeT inet_ctl_getifaddrs(inet_descriptor* desc_p,
+ char **rbuf_pp, ErlDrvSizeT rsize)
{
int i;
DWORD ret, n;
@@ -4746,7 +4781,7 @@ static int inet_ctl_getifaddrs(inet_descriptor* desc_p,
char *buf_p;
char *buf_alloc_p;
- int buf_size =512;
+ ErlDrvSizeT buf_size = 512;
# define BUF_ENSURE(Size) \
do { \
int NEED_, GOT_ = buf_p - buf_alloc_p; \
@@ -5120,12 +5155,12 @@ done:
#elif defined(HAVE_GETIFADDRS)
-static int inet_ctl_getifaddrs(inet_descriptor* desc_p,
- char **rbuf_pp, int rsize)
+static ErlDrvSSizeT inet_ctl_getifaddrs(inet_descriptor* desc_p,
+ char **rbuf_pp, ErlDrvSizeT rsize)
{
struct ifaddrs *ifa_p, *ifa_free_p;
- int buf_size;
+ ErlDrvSizeT buf_size;
char *buf_p;
char *buf_alloc_p;
@@ -5228,8 +5263,8 @@ static int inet_ctl_getifaddrs(inet_descriptor* desc_p,
#else
-static int inet_ctl_getifaddrs(inet_descriptor* desc_p,
- char **rbuf_pp, int rsize)
+static ErlDrvSSizeT inet_ctl_getifaddrs(inet_descriptor* desc_p,
+ char **rbuf_pp, ErlDrvSizeT rsize)
{
return ctl_error(ENOTSUP, rbuf_pp, rsize);
}
@@ -6030,7 +6065,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
case SCTP_OPT_PRIMARY_ADDR:
case SCTP_OPT_SET_PEER_PRIMARY_ADDR:
{
- int alen;
+ ErlDrvSizeT alen;
char *after;
CHKLEN(curr, ASSOC_ID_LEN);
@@ -6072,7 +6107,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
}
case SCTP_OPT_PEER_ADDR_PARAMS:
{
- int alen;
+ ErlDrvSizeT alen;
char *after;
# ifdef HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_FLAGS
int eflags, cflags, hb_enable, hb_disable,
@@ -6248,8 +6283,9 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
** ptr should point to a buffer with 9*len +1 to be safe!!
*/
-static int inet_fill_opts(inet_descriptor* desc,
- char* buf, int len, char** dest, int destlen)
+static ErlDrvSSizeT inet_fill_opts(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT len,
+ char** dest, ErlDrvSizeT destlen)
{
int type;
int proto;
@@ -6259,8 +6295,8 @@ static int inet_fill_opts(inet_descriptor* desc,
char* arg_ptr;
unsigned int arg_sz;
char *ptr = NULL;
- int dest_used = 0;
- int dest_allocated = destlen;
+ ErlDrvSizeT dest_used = 0;
+ ErlDrvSizeT dest_allocated = destlen;
char *orig_dest = *dest;
/* Ptr is a name parameter */
@@ -6275,7 +6311,7 @@ static int inet_fill_opts(inet_descriptor* desc,
#define PLACE_FOR(Size,Ptr) \
do { \
- int need = dest_used + (Size); \
+ ErlDrvSizeT need = dest_used + (Size); \
if (need > INET_MAX_OPT_BUFFER) { \
RETURN_ERROR(); \
} \
@@ -6296,7 +6332,7 @@ static int inet_fill_opts(inet_descriptor* desc,
/* Ptr is a name parameter */
#define TRUNCATE_TO(Size,Ptr) \
do { \
- int new_need = ((Ptr) - (*dest)) + (Size); \
+ ErlDrvSizeT new_need = ((Ptr) - (*dest)) + (Size); \
if (new_need > dest_used) { \
erl_exit(1,"Internal error in inet_drv, " \
"miscalculated buffer size"); \
@@ -6586,8 +6622,9 @@ static int load_paddrinfo (ErlDrvTermData * spec, int i,
/*
** "sctp_fill_opts": Returns {ok, Results}, or an error:
*/
-static int sctp_fill_opts(inet_descriptor* desc, char* buf, int buflen,
- char** dest, int destlen)
+static ErlDrvSSizeT sctp_fill_opts(inet_descriptor* desc,
+ char* buf, ErlDrvSizeT buflen,
+ char** dest, ErlDrvSizeT destlen)
{
/* In contrast to the generic "inet_fill_opts", the output here is
represented by tuples/records, which are formed in the "spec":
@@ -6977,7 +7014,7 @@ static int sctp_fill_opts(inet_descriptor* desc, char* buf, int buflen,
unsigned int sz = sizeof(ap);
int n;
char *after;
- int alen;
+ ErlDrvSizeT alen;
if (buflen < ASSOC_ID_LEN) RETURN_ERROR(spec, -EINVAL);
ap.spp_assoc_id = GET_ASSOC_ID(buf);
@@ -7217,7 +7254,7 @@ static int sctp_fill_opts(inet_descriptor* desc, char* buf, int buflen,
struct sctp_paddrinfo pai;
unsigned int sz = sizeof(pai);
char *after;
- int alen;
+ ErlDrvSizeT alen;
if (buflen < ASSOC_ID_LEN) RETURN_ERROR(spec, -EINVAL);
pai.spinfo_assoc_id = GET_ASSOC_ID(buf);
@@ -7274,7 +7311,8 @@ static int sctp_fill_opts(inet_descriptor* desc, char* buf, int buflen,
/* fill statistics reply, op codes from src and result in dest
** dst area must be a least 5*len + 1 bytes
*/
-static int inet_fill_stat(inet_descriptor* desc, char* src, int len, char* dst)
+static ErlDrvSSizeT inet_fill_stat(inet_descriptor* desc,
+ char* src, ErlDrvSizeT len, char* dst)
{
unsigned long val;
int op;
@@ -7307,7 +7345,7 @@ static int inet_fill_stat(inet_descriptor* desc, char* src, int len, char* dst)
val = (unsigned long) desc->send_avg;
break;
case INET_STAT_SEND_PND:
- val = driver_sizeq(desc->port);
+ val = (unsigned long) driver_sizeq(desc->port);
break;
case INET_STAT_RECV_OCT:
put_int32(desc->recv_oct[1], dst); /* write high 32bit */
@@ -7352,7 +7390,8 @@ send_empty_out_q_msgs(inet_descriptor* desc)
/* subscribe and fill subscription reply, op codes from src and
** result in dest dst area must be a least 5*len + 1 bytes
*/
-static int inet_subscribe(inet_descriptor* desc, char* src, int len, char* dst)
+static ErlDrvSSizeT inet_subscribe(inet_descriptor* desc,
+ char* src, ErlDrvSizeT len, char* dst)
{
unsigned long val;
int op;
@@ -7452,14 +7491,14 @@ static ErlDrvData inet_start(ErlDrvPort port, int size, int protocol)
/*
** common TCP/UDP/SCTP control command
*/
-static int inet_ctl(inet_descriptor* desc, int cmd, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT inet_ctl(inet_descriptor* desc, int cmd, char* buf,
+ ErlDrvSizeT len, char** rbuf, ErlDrvSizeT rsize)
{
switch (cmd) {
case INET_REQ_GETSTAT: {
char* dst;
- int i;
+ ErlDrvSizeT i;
int dstlen = 1; /* Reply code */
for (i = 0; i < len; i++) {
@@ -7499,7 +7538,7 @@ static int inet_ctl(inet_descriptor* desc, int cmd, char* buf, int len,
}
case INET_REQ_GETOPTS: { /* get options */
- int replen;
+ ErlDrvSSizeT replen;
DEBUGF(("inet_ctl(%ld): GETOPTS\r\n", (long)desc->port));
#ifdef HAVE_SCTP
if (IS_SCTP(desc))
@@ -7810,7 +7849,7 @@ static int inet_ctl(inet_descriptor* desc, int cmd, char* buf, int len,
}
/* update statistics on output packets */
-static void inet_output_count(inet_descriptor* desc, int len)
+static void inet_output_count(inet_descriptor* desc, ErlDrvSizeT len)
{
unsigned long n = desc->send_cnt + 1;
unsigned long t = desc->send_oct[0] + len;
@@ -7830,7 +7869,7 @@ static void inet_output_count(inet_descriptor* desc, int len)
}
/* update statistics on input packets */
-static void inet_input_count(inet_descriptor* desc, int len)
+static void inet_input_count(inet_descriptor* desc, ErlDrvSizeT len)
{
unsigned long n = desc->recv_cnt + 1;
unsigned long t = desc->recv_oct[0] + len;
@@ -7953,7 +7992,7 @@ static void tcp_clear_input(tcp_descriptor* desc)
static void tcp_clear_output(tcp_descriptor* desc)
{
ErlDrvPort ix = desc->inet.port;
- int qsz = driver_sizeq(ix);
+ ErlDrvSizeT qsz = driver_sizeq(ix);
driver_deq(ix, qsz);
send_empty_out_q_msgs(INETP(desc));
@@ -8121,8 +8160,9 @@ static void tcp_inet_stop(ErlDrvData e)
/* TCP requests from Erlang */
-static int tcp_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd,
+ char* buf, ErlDrvSizeT len,
+ char** rbuf, ErlDrvSizeT rsize)
{
tcp_descriptor* desc = (tcp_descriptor*)e;
@@ -8523,7 +8563,7 @@ static void tcp_inet_multi_timeout(ErlDrvData e, ErlDrvTermData caller)
** but distribution still uses the tcp_inet_command!!
*/
-static void tcp_inet_command(ErlDrvData e, char *buf, int len)
+static void tcp_inet_command(ErlDrvData e, char *buf, ErlDrvSizeT len)
{
tcp_descriptor* desc = (tcp_descriptor*)e;
desc->inet.caller = driver_caller(desc->inet.port);
@@ -9352,12 +9392,12 @@ static int tcp_send_error(tcp_descriptor* desc, int err)
*/
static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev)
{
- int sz;
+ ErlDrvSizeT sz;
char buf[4];
- int h_len;
- int n;
+ ErlDrvSizeT h_len;
+ ssize_t n;
ErlDrvPort ix = desc->inet.port;
- int len = ev->size;
+ ErlDrvSizeT len = ev->size;
switch(desc->inet.htype) {
case TCP_PB_1:
@@ -9405,8 +9445,8 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev)
else {
int vsize = (ev->vsize > MAX_VSIZE) ? MAX_VSIZE : ev->vsize;
- DEBUGF(("tcp_sendv(%ld): s=%d, about to send %d,%d bytes\r\n",
- (long)desc->inet.port, desc->inet.s, h_len, len));
+ DEBUGF(("tcp_sendv(%ld): s=%d, about to send "LLU","LLU" bytes\r\n",
+ (long)desc->inet.port, desc->inet.s, (llu_t)h_len, (llu_t)len));
if (INETP(desc)->is_ignored) {
INETP(desc)->is_ignored |= INET_IGNORE_WRITE;
@@ -9432,8 +9472,10 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev)
return 0;
}
else {
- DEBUGF(("tcp_sendv(%ld): s=%d, only sent %d/%d of %d/%d bytes/items\r\n",
- (long)desc->inet.port, desc->inet.s, n, vsize, ev->size, ev->vsize));
+ DEBUGF(("tcp_sendv(%ld): s=%d, only sent "
+ LLU"/%d of "LLU"/%d bytes/items\r\n",
+ (long)desc->inet.port, desc->inet.s,
+ (llu_t)n, vsize, (llu_t)ev->size, ev->vsize));
}
DEBUGF(("tcp_sendv(%ld): s=%d, Send failed, queuing\r\n",
@@ -9448,7 +9490,7 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev)
/*
** Send non blocking data
*/
-static int tcp_send(tcp_descriptor* desc, char* ptr, int len)
+static int tcp_send(tcp_descriptor* desc, char* ptr, ErlDrvSizeT len)
{
int sz;
char buf[4];
@@ -9503,8 +9545,8 @@ static int tcp_send(tcp_descriptor* desc, char* ptr, int len)
iov[1].iov_base = ptr;
iov[1].iov_len = len;
- DEBUGF(("tcp_send(%ld): s=%d, about to send %d,%d bytes\r\n",
- (long)desc->inet.port, desc->inet.s, h_len, len));
+ DEBUGF(("tcp_send(%ld): s=%d, about to send "LLU","LLU" bytes\r\n",
+ (long)desc->inet.port, desc->inet.s, (llu_t)h_len, (llu_t)len));
if (INETP(desc)->is_ignored) {
INETP(desc)->is_ignored |= INET_IGNORE_WRITE;
n = 0;
@@ -9616,7 +9658,7 @@ static int tcp_inet_output(tcp_descriptor* desc, HANDLE event)
else if (IS_CONNECTED(INETP(desc))) {
for (;;) {
int vsize;
- int n;
+ ssize_t n;
SysIOVec* iov;
if ((iov = driver_peekq(ix, &vsize)) == NULL) {
@@ -9827,10 +9869,10 @@ static int packet_error(udp_descriptor* udesc, int err)
/*
** Various functions accessible via "port_control" on the Erlang side:
*/
-static int packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int len,
- char** rbuf, int rsize)
+static ErlDrvSSizeT packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf,
+ ErlDrvSizeT len, char** rbuf, ErlDrvSizeT rsize)
{
- int replen;
+ ErlDrvSSizeT replen;
udp_descriptor * udesc = (udp_descriptor *) e;
inet_descriptor* desc = INETP(udesc);
int type = SOCK_DGRAM;
@@ -9940,7 +9982,6 @@ static int packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int len,
DEBUGF(("packet_inet_ctl(%ld): CLOSE\r\n", (long)desc->port));
erl_inet_close(desc);
return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize);
- return 0;
case INET_REQ_CONNECT: {
@@ -10086,7 +10127,7 @@ static int packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int len,
/* List item format: Port(2), IP(4|16) -- compatible with
"inet_set_address": */
inet_address tmp;
- int alen = buf + len - curr;
+ ErlDrvSizeT alen = buf + len - curr;
curr = inet_set_address(desc->sfamily, &tmp, curr, &alen);
if (curr == NULL)
return ctl_error(EINVAL, rbuf, rsize);
@@ -10211,13 +10252,13 @@ static void packet_inet_timeout(ErlDrvData e)
** There is no destination address -- SCTYP send is performed over
** an existing association, using "sctp_sndrcvinfo" specified.
*/
-static void packet_inet_command(ErlDrvData e, char* buf, int len)
+static void packet_inet_command(ErlDrvData e, char* buf, ErlDrvSizeT len)
{
udp_descriptor * udesc= (udp_descriptor*) e;
inet_descriptor* desc = INETP(udesc);
char* ptr = buf;
char* qtr;
- int sz;
+ ErlDrvSizeT sz;
int code;
inet_address other;
@@ -10235,7 +10276,7 @@ static void packet_inet_command(ErlDrvData e, char* buf, int len)
#ifdef HAVE_SCTP
if (IS_SCTP(desc))
{
- int data_len;
+ ErlDrvSizeT data_len;
struct iovec iov[1]; /* For real data */
struct msghdr mhdr; /* Message wrapper */
struct sctp_sndrcvinfo *sri; /* The actual ancilary data */
@@ -10983,7 +11024,7 @@ int erts_sock_connect(erts_sock_t socket, byte *ip_addr, int len, Uint16 port)
{
SOCKET s = (SOCKET) socket;
char buf[2 + 4];
- int blen = 6;
+ ErlDrvSizeT blen = 6;
inet_address addr;
if (socket == ERTS_SOCK_INVALID_SOCKET || len != 4)
diff --git a/erts/emulator/drivers/common/ram_file_drv.c b/erts/emulator/drivers/common/ram_file_drv.c
index abedcc933a..a109e40333 100644
--- a/erts/emulator/drivers/common/ram_file_drv.c
+++ b/erts/emulator/drivers/common/ram_file_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1997-2010. All Rights Reserved.
+ * Copyright Ericsson AB 1997-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -98,7 +98,7 @@ typedef unsigned char uchar;
static ErlDrvData rfile_start(ErlDrvPort, char*);
static int rfile_init(void);
static void rfile_stop(ErlDrvData);
-static void rfile_command(ErlDrvData, char*, int);
+static void rfile_command(ErlDrvData, char*, ErlDrvSizeT);
struct erl_drv_entry ram_file_driver_entry = {
@@ -108,7 +108,23 @@ struct erl_drv_entry ram_file_driver_entry = {
rfile_command,
NULL,
NULL,
- "ram_file_drv"
+ "ram_file_drv",
+ NULL,
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL, /* event */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
/* A File is represented as a array of bytes, this array is
@@ -121,9 +137,9 @@ typedef struct ram_file {
int flags; /* flags read/write */
ErlDrvBinary* bin; /* binary to hold binary file */
char* buf; /* buffer start (in binary) */
- int size; /* buffer size (allocated) */
- int cur; /* current position in buffer */
- int end; /* end position in buffer */
+ ErlDrvSSizeT size; /* buffer size (allocated) */
+ ErlDrvSSizeT cur; /* current position in buffer */
+ ErlDrvSSizeT end; /* end position in buffer */
} RamFile;
#ifdef LOADABLE
@@ -211,7 +227,7 @@ static int reply(RamFile *f, int ok, int err)
return 0;
}
-static int numeric_reply(RamFile *f, int result)
+static int numeric_reply(RamFile *f, ErlDrvSSizeT result)
{
char tmp[5];
@@ -231,7 +247,8 @@ static int numeric_reply(RamFile *f, int result)
/* install bin as the new binary reset all pointer */
-static void ram_file_set(RamFile *f, ErlDrvBinary *bin, int bsize, int len)
+static void ram_file_set(RamFile *f, ErlDrvBinary *bin,
+ ErlDrvSSizeT bsize, ErlDrvSSizeT len)
{
f->size = bsize;
f->buf = bin->orig_bytes;
@@ -240,9 +257,9 @@ static void ram_file_set(RamFile *f, ErlDrvBinary *bin, int bsize, int len)
f->bin = bin;
}
-static int ram_file_init(RamFile *f, char *buf, int count, int *error)
+static int ram_file_init(RamFile *f, char *buf, ErlDrvSSizeT count, int *error)
{
- int bsize;
+ ErlDrvSSizeT bsize;
ErlDrvBinary* bin;
if (count < 0) {
@@ -268,9 +285,9 @@ static int ram_file_init(RamFile *f, char *buf, int count, int *error)
return count;
}
-static int ram_file_expand(RamFile *f, int size, int *error)
+static ErlDrvSSizeT ram_file_expand(RamFile *f, ErlDrvSSizeT size, int *error)
{
- int bsize;
+ ErlDrvSSizeT bsize;
ErlDrvBinary* bin;
if (size < 0) {
@@ -298,10 +315,10 @@ static int ram_file_expand(RamFile *f, int size, int *error)
}
-static int ram_file_write(RamFile *f, char *buf, int len,
- int *location, int *error)
+static ErlDrvSSizeT ram_file_write(RamFile *f, char *buf, ErlDrvSSizeT len,
+ ErlDrvSSizeT *location, int *error)
{
- int cur = f->cur;
+ ErlDrvSSizeT cur = f->cur;
if (!(f->flags & RAM_FILE_MODE_WRITE)) {
*error = EBADF;
@@ -322,11 +339,11 @@ static int ram_file_write(RamFile *f, char *buf, int len,
return len;
}
-static int ram_file_read(RamFile *f, int len, ErlDrvBinary **bp,
- int *location, int *error)
+static ErlDrvSSizeT ram_file_read(RamFile *f, ErlDrvSSizeT len, ErlDrvBinary **bp,
+ ErlDrvSSizeT *location, int *error)
{
ErlDrvBinary* bin;
- int cur = f->cur;
+ ErlDrvSSizeT cur = f->cur;
if (!(f->flags & RAM_FILE_MODE_READ)) {
*error = EBADF;
@@ -352,9 +369,10 @@ static int ram_file_read(RamFile *f, int len, ErlDrvBinary **bp,
return len;
}
-static int ram_file_seek(RamFile *f, int offset, int whence, int *error)
+static ErlDrvSSizeT ram_file_seek(RamFile *f, ErlDrvSSizeT offset, int whence,
+ int *error)
{
- int pos;
+ ErlDrvSSizeT pos;
if (f->flags == 0) {
*error = EBADF;
@@ -389,13 +407,13 @@ static int ram_file_seek(RamFile *f, int offset, int whence, int *error)
static int ram_file_uuencode(RamFile *f)
{
- int code_len = UULINE(UNIX_LINE);
- int len = f->end;
- int usize = 4*((len+2)/3) + 2*((len+code_len-1)/code_len) + 2;
+ ErlDrvSSizeT code_len = UULINE(UNIX_LINE);
+ ErlDrvSSizeT len = f->end;
+ ErlDrvSSizeT usize = 4*((len+2)/3) + 2*((len+code_len-1)/code_len) + 2;
ErlDrvBinary* bin;
uchar* inp;
uchar* outp;
- int count = 0;
+ ErlDrvSSizeT count = 0;
if ((bin = driver_alloc_binary(usize)) == NULL)
return error_reply(f, ENOMEM);
@@ -447,8 +465,8 @@ static int ram_file_uuencode(RamFile *f)
static int ram_file_uudecode(RamFile *f)
{
- int len = f->end;
- int usize = ( (len+3) / 4 ) * 3;
+ ErlDrvSSizeT len = f->end;
+ ErlDrvSSizeT usize = ( (len+3) / 4 ) * 3;
ErlDrvBinary* bin;
uchar* inp;
uchar* outp;
@@ -510,7 +528,7 @@ static int ram_file_uudecode(RamFile *f)
static int ram_file_compress(RamFile *f)
{
- int size = f->end;
+ ErlDrvSSizeT size = f->end;
ErlDrvBinary* bin;
if ((bin = erts_gzdeflate_buffer(f->buf, size)) == NULL) {
@@ -528,7 +546,7 @@ static int ram_file_compress(RamFile *f)
static int ram_file_uncompress(RamFile *f)
{
- int size = f->end;
+ ErlDrvSSizeT size = f->end;
ErlDrvBinary* bin;
if ((bin = erts_gzinflate_buffer(f->buf, size)) == NULL) {
@@ -541,15 +559,15 @@ static int ram_file_uncompress(RamFile *f)
}
-static void rfile_command(ErlDrvData e, char* buf, int count)
+static void rfile_command(ErlDrvData e, char* buf, ErlDrvSizeT count)
{
RamFile* f = (RamFile*)e;
int error = 0;
ErlDrvBinary* bin;
char header[5]; /* result code + count */
- int offset;
- int origin; /* Origin of seek. */
- int n;
+ ErlDrvSSizeT offset;
+ ErlDrvSSizeT origin; /* Origin of seek. */
+ ErlDrvSSizeT n;
count--;
switch(*(uchar*)buf++) {
diff --git a/erts/emulator/drivers/common/zlib_drv.c b/erts/emulator/drivers/common/zlib_drv.c
index f50899a730..da4a17db1a 100644
--- a/erts/emulator/drivers/common/zlib_drv.c
+++ b/erts/emulator/drivers/common/zlib_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2003-2010. All Rights Reserved.
+ * Copyright Ericsson AB 2003-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -64,8 +64,8 @@
static int zlib_init(void);
static ErlDrvData zlib_start(ErlDrvPort port, char* buf);
static void zlib_stop(ErlDrvData e);
-static int zlib_ctl(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen);
+static ErlDrvSSizeT zlib_ctl(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen);
static void zlib_outputv(ErlDrvData drv_data, ErlIOVec *ev);
ErlDrvEntry zlib_driver_entry = {
@@ -162,12 +162,12 @@ static char* zlib_reason(int code, int* err)
}
-static int zlib_return(int code, char** rbuf, int rlen)
+static ErlDrvSSizeT zlib_return(int code, char** rbuf, ErlDrvSizeT rlen)
{
int msg_code = 0; /* 0=ok, 1=error */
char* dst = *rbuf;
char* src;
- int len = 0;
+ ErlDrvSizeT len = 0;
src = zlib_reason(code, &msg_code);
*dst++ = msg_code;
@@ -182,7 +182,8 @@ static int zlib_return(int code, char** rbuf, int rlen)
return len;
}
-static int zlib_value2(int msg_code, int value, char** rbuf, int rlen)
+static ErlDrvSSizeT zlib_value2(int msg_code, int value,
+ char** rbuf, ErlDrvSizeT rlen)
{
char* dst = *rbuf;
@@ -197,7 +198,7 @@ static int zlib_value2(int msg_code, int value, char** rbuf, int rlen)
return 5;
}
-static int zlib_value(int value, char** rbuf, int rlen)
+static ErlDrvSSizeT zlib_value(int value, char** rbuf, ErlDrvSizeT rlen)
{
return zlib_value2(2, value, rbuf, rlen);
}
@@ -409,8 +410,8 @@ static void zlib_stop(ErlDrvData e)
driver_free(d);
}
-static int zlib_ctl(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen)
+static ErlDrvSSizeT zlib_ctl(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen)
{
ZLibData* d = (ZLibData*)drv_data;
int res;
diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c
index 45d39a559f..b29f80a8ba 100644
--- a/erts/emulator/drivers/unix/ttsl_drv.c
+++ b/erts/emulator/drivers/unix/ttsl_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2010. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -106,7 +106,7 @@ static int lpos; /* The current "cursor position" in the line buf
/* Main interface functions. */
static void ttysl_stop(ErlDrvData);
-static void ttysl_from_erlang(ErlDrvData, char*, int);
+static void ttysl_from_erlang(ErlDrvData, char*, ErlDrvSizeT);
static void ttysl_from_tty(ErlDrvData, ErlDrvEvent);
static void ttysl_stop_select(ErlDrvEvent, void*);
static Sint16 get_sint16(char*);
@@ -141,7 +141,8 @@ static void update_cols(void);
static int tty_init(int,int,int,int);
static int tty_set(int);
static int tty_reset(int);
-static int ttysl_control(ErlDrvData, unsigned int, char *, int, char **, int);
+static ErlDrvSSizeT ttysl_control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
#ifdef ERTS_NOT_USED
static RETSIGTYPE suspend(int);
#endif
@@ -345,13 +346,13 @@ static void ttysl_get_window_size(Uint32 *width, Uint32 *height)
*height = DEF_HEIGHT;
}
-static int ttysl_control(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+static ErlDrvSSizeT ttysl_control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
char resbuff[2*sizeof(Uint32)];
- int res_size;
+ ErlDrvSizeT res_size;
switch (command) {
case CTRL_OP_GET_WINSIZE:
{
@@ -633,14 +634,14 @@ static int check_buf_size(byte *s, int n)
}
-static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, int count)
+static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, ErlDrvSizeT count)
{
if (lpos > MAXSIZE)
put_chars((byte*)"\n", 1);
switch (buf[0]) {
case OP_PUTC:
- DEBUGLOG(("OP: Putc(%d)",count-1));
+ DEBUGLOG(("OP: Putc(%lu)",(unsigned long) count-1));
if (check_buf_size((byte*)buf+1, count-1) == 0)
return;
put_chars((byte*)buf+1, count-1);
diff --git a/erts/emulator/drivers/win32/registry_drv.c b/erts/emulator/drivers/win32/registry_drv.c
index 05fd2ea55f..1fad34e380 100644
--- a/erts/emulator/drivers/win32/registry_drv.c
+++ b/erts/emulator/drivers/win32/registry_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1997-2009. All Rights Reserved.
+ * Copyright Ericsson AB 1997-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -84,7 +84,7 @@ static int maperror(DWORD error);
static int reg_init(void);
static ErlDrvData reg_start(ErlDrvPort, char*);
static void reg_stop(ErlDrvData);
-static void reg_from_erlang(ErlDrvData, char*, int);
+static void reg_from_erlang(ErlDrvData, char*, ErlDrvSizeT);
struct erl_drv_entry registry_driver_entry = {
reg_init,
@@ -95,10 +95,21 @@ struct erl_drv_entry registry_driver_entry = {
NULL,
"registry__drv__",
NULL,
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL, /* event */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
NULL,
NULL,
NULL,
- NULL
};
static int
@@ -158,7 +169,7 @@ reg_stop(ErlDrvData clientData)
}
static void
-reg_from_erlang(ErlDrvData clientData, char* buf, int count)
+reg_from_erlang(ErlDrvData clientData, char* buf, ErlDrvSizeT count)
{
RegPort* rp = (RegPort *) clientData;
int cmd;
@@ -301,7 +312,7 @@ reg_from_erlang(ErlDrvData clientData, char* buf, int count)
buf = (char *) &dword;
ASSERT(count == 4);
}
- result = RegSetValueEx(rp->hkey, name, 0, type, buf, count);
+ result = RegSetValueEx(rp->hkey, name, 0, type, buf, (DWORD)count);
reply(rp, result);
}
break;
diff --git a/erts/emulator/drivers/win32/ttsl_drv.c b/erts/emulator/drivers/win32/ttsl_drv.c
index e636761c67..1a74d21e99 100644
--- a/erts/emulator/drivers/win32/ttsl_drv.c
+++ b/erts/emulator/drivers/win32/ttsl_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2009. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -83,8 +83,9 @@ int lpos; /* The current "cursor position" in the line buf
static int ttysl_init(void);
static ErlDrvData ttysl_start(ErlDrvPort, char*);
static void ttysl_stop(ErlDrvData);
-static int ttysl_control(ErlDrvData, unsigned int, char *, int, char **, int);
-static void ttysl_from_erlang(ErlDrvData, char*, int);
+static ErlDrvSSizeT ttysl_control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
+static void ttysl_from_erlang(ErlDrvData, char*, ErlDrvSizeT);
static void ttysl_from_tty(ErlDrvData, ErlDrvEvent);
static Sint16 get_sint16(char *s);
@@ -120,7 +121,19 @@ struct erl_drv_entry ttsl_driver_entry = {
NULL,
NULL,
ttysl_control,
- NULL
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL, /* event */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
static int utf8_mode = 0;
@@ -154,13 +167,13 @@ static void ttysl_get_window_size(Uint32 *width, Uint32 *height)
}
-static int ttysl_control(ErlDrvData drv_data,
+static ErlDrvSSizeT ttysl_control(ErlDrvData drv_data,
unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
char resbuff[2*sizeof(Uint32)];
- int res_size;
+ ErlDrvSizeT res_size;
switch (command) {
case CTRL_OP_GET_WINSIZE:
{
@@ -176,7 +189,7 @@ static int ttysl_control(ErlDrvData drv_data,
res_size = 1;
break;
case CTRL_OP_SET_UNICODE_STATE:
- if (len > 0) {
+ if (len != 0) {
int m = (int) *buf;
*resbuff = (utf8_mode) ? 1 : 0;
res_size = 1;
@@ -438,14 +451,14 @@ static int check_buf_size(byte *s, int n)
}
-static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, int count)
+static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, ErlDrvSizeT count)
{
if (lpos > MAXSIZE)
put_chars((byte*)"\n", 1);
switch (buf[0]) {
case OP_PUTC:
- DEBUGLOG(("OP: Putc(%d)",count-1));
+ DEBUGLOG(("OP: Putc(%I64u)",(unsigned long long)count-1));
if (check_buf_size((byte*)buf+1, count-1) == 0)
return;
put_chars((byte*)buf+1, count-1);
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 52477467b3..f94e0f2296 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -1033,14 +1033,15 @@ static struct driver_data {
/* Driver interfaces */
static ErlDrvData spawn_start(ErlDrvPort, char*, SysDriverOpts*);
static ErlDrvData fd_start(ErlDrvPort, char*, SysDriverOpts*);
-static int fd_control(ErlDrvData, unsigned int, char *, int, char **, int);
+static ErlDrvSSizeT fd_control(ErlDrvData, unsigned int, char *, ErlDrvSizeT,
+ char **, ErlDrvSizeT);
static ErlDrvData vanilla_start(ErlDrvPort, char*, SysDriverOpts*);
static int spawn_init(void);
static void fd_stop(ErlDrvData);
static void stop(ErlDrvData);
static void ready_input(ErlDrvData, ErlDrvEvent);
static void ready_output(ErlDrvData, ErlDrvEvent);
-static void output(ErlDrvData, char*, int);
+static void output(ErlDrvData, char*, ErlDrvSizeT);
static void outputv(ErlDrvData, ErlIOVec*);
static void stop_select(ErlDrvEvent, void*);
@@ -1726,10 +1727,10 @@ static int fd_get_window_size(int fd, Uint32 *width, Uint32 *height)
return -1;
}
-static int fd_control(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+static ErlDrvSSizeT fd_control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
int fd = (int)(long)drv_data;
char resbuff[2*sizeof(Uint32)];
@@ -2001,18 +2002,20 @@ static void outputv(ErlDrvData e, ErlIOVec* ev)
int ix = driver_data[fd].port_num;
int pb = driver_data[fd].packet_bytes;
int ofd = driver_data[fd].ofd;
- int n;
- int sz;
+ ssize_t n;
+ ErlDrvSizeT sz;
char lb[4];
char* lbp;
- int len = ev->size;
+ ErlDrvSizeT len = ev->size;
/* (len > ((unsigned long)-1 >> (4-pb)*8)) */
+ /* if (pb >= 0 && (len & (((ErlDrvSizeT)1 << (pb*8))) - 1) != len) {*/
if (((pb == 2) && (len > 0xffff)) || (pb == 1 && len > 0xff)) {
driver_failure_posix(ix, EINVAL);
return; /* -1; */
}
- put_int32(len, lb);
+ /* Handles 0 <= pb <= 4 only */
+ put_int32((Uint32) len, lb);
lbp = lb + (4-pb);
ev->iov[0].iov_base = lbp;
@@ -2043,14 +2046,14 @@ static void outputv(ErlDrvData e, ErlIOVec* ev)
}
-static void output(ErlDrvData e, char* buf, int len)
+static void output(ErlDrvData e, char* buf, ErlDrvSizeT len)
{
int fd = (int)(long)e;
int ix = driver_data[fd].port_num;
int pb = driver_data[fd].packet_bytes;
int ofd = driver_data[fd].ofd;
- int n;
- int sz;
+ ssize_t n;
+ ErlDrvSizeT sz;
char lb[4];
char* lbp;
struct iovec iv[2];
diff --git a/erts/emulator/sys/vxworks/sys.c b/erts/emulator/sys/vxworks/sys.c
index d6d1fe64e0..739b026fb1 100644
--- a/erts/emulator/sys/vxworks/sys.c
+++ b/erts/emulator/sys/vxworks/sys.c
@@ -565,7 +565,7 @@ static void fd_stop(ErlDrvData);
static void stop(ErlDrvData);
static void ready_input(ErlDrvData fd, ErlDrvEvent ready_fd);
static void ready_output(ErlDrvData fd, ErlDrvEvent ready_fd);
-static void output(ErlDrvData fd, char *buf, int len);
+static void output(ErlDrvData fd, char *buf, ErlDrvSizeT len);
static void stop_select(ErlDrvEvent, void*);
struct erl_drv_entry spawn_driver_entry = {
@@ -1187,7 +1187,7 @@ static int sched_write(int port_num,int fd, char *buf, int len, int pb)
}
/* Fd is the value returned as drv_data by the start func */
-static void output(ErlDrvData drv_data, char *buf, int len)
+static void output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len)
{
int buf_done, port_num, wval, pb, ofd;
byte lb[4];
diff --git a/erts/emulator/sys/win32/erl_win_dyn_driver.h b/erts/emulator/sys/win32/erl_win_dyn_driver.h
index afc72bb898..ec5141838a 100644
--- a/erts/emulator/sys/win32/erl_win_dyn_driver.h
+++ b/erts/emulator/sys/win32/erl_win_dyn_driver.h
@@ -39,11 +39,11 @@ WDD_TYPEDEF(int, driver_exit, (ErlDrvPort, int));
WDD_TYPEDEF(int, driver_failure_eof, (ErlDrvPort));
WDD_TYPEDEF(int, driver_select, (ErlDrvPort, ErlDrvEvent, int, int));
WDD_TYPEDEF(int, driver_event, (ErlDrvPort, ErlDrvEvent,ErlDrvEventData));
-WDD_TYPEDEF(int, driver_output, (ErlDrvPort, char *, int));
-WDD_TYPEDEF(int, driver_output2, (ErlDrvPort, char *, int,char *, int));
-WDD_TYPEDEF(int, driver_output_binary, (ErlDrvPort, char *, int,ErlDrvBinary*, int, int));
-WDD_TYPEDEF(int, driver_outputv, (ErlDrvPort, char*, int, ErlIOVec *,int));
-WDD_TYPEDEF(int, driver_vec_to_buf, (ErlIOVec *, char *, int));
+WDD_TYPEDEF(int, driver_output, (ErlDrvPort, char *, ErlDrvSizeT));
+WDD_TYPEDEF(int, driver_output2, (ErlDrvPort, char *, ErlDrvSizeT ,char *, ErlDrvSizeT));
+WDD_TYPEDEF(int, driver_output_binary, (ErlDrvPort, char *, ErlDrvSizeT, ErlDrvBinary*, ErlDrvSizeT, ErlDrvSizeT));
+WDD_TYPEDEF(int, driver_outputv, (ErlDrvPort, char*, ErlDrvSizeT, ErlIOVec *, ErlDrvSizeT));
+WDD_TYPEDEF(ErlDrvSizeT, driver_vec_to_buf, (ErlIOVec *, char *, ErlDrvSizeT));
WDD_TYPEDEF(int, driver_set_timer, (ErlDrvPort, unsigned long));
WDD_TYPEDEF(int, driver_cancel_timer, (ErlDrvPort));
WDD_TYPEDEF(int, driver_read_timer, (ErlDrvPort, unsigned long *));
@@ -51,22 +51,22 @@ WDD_TYPEDEF(char *, erl_errno_id, (int));
WDD_TYPEDEF(void, set_busy_port, (ErlDrvPort, int));
WDD_TYPEDEF(void, set_port_control_flags, (ErlDrvPort, int));
WDD_TYPEDEF(int, get_port_flags, (ErlDrvPort));
-WDD_TYPEDEF(ErlDrvBinary *, driver_alloc_binary, (int));
-WDD_TYPEDEF(ErlDrvBinary *, driver_realloc_binary, (ErlDrvBinary *, int));
+WDD_TYPEDEF(ErlDrvBinary *, driver_alloc_binary, (ErlDrvSizeT));
+WDD_TYPEDEF(ErlDrvBinary *, driver_realloc_binary, (ErlDrvBinary *, ErlDrvSizeT));
WDD_TYPEDEF(void, driver_free_binary, (ErlDrvBinary *));
-WDD_TYPEDEF(void *, driver_alloc, (size_t));
-WDD_TYPEDEF(void *, driver_realloc, (void *, size_t));
+WDD_TYPEDEF(void *, driver_alloc, (ErlDrvSizeT));
+WDD_TYPEDEF(void *, driver_realloc, (void *, ErlDrvSizeT));
WDD_TYPEDEF(void, driver_free, (void *));
-WDD_TYPEDEF(int, driver_enq, (ErlDrvPort, char*, int));
-WDD_TYPEDEF(int, driver_pushq, (ErlDrvPort, char*, int));
-WDD_TYPEDEF(int, driver_deq, (ErlDrvPort, int));
-WDD_TYPEDEF(int, driver_sizeq, (ErlDrvPort));
-WDD_TYPEDEF(int, driver_enq_bin, (ErlDrvPort, ErlDrvBinary *, int,int));
-WDD_TYPEDEF(int, driver_pushq_bin, (ErlDrvPort, ErlDrvBinary *, int,int));
-WDD_TYPEDEF(int, driver_peekqv, (ErlDrvPort, ErlIOVec *));
+WDD_TYPEDEF(int, driver_enq, (ErlDrvPort, char*, ErlDrvSizeT));
+WDD_TYPEDEF(int, driver_pushq, (ErlDrvPort, char*, ErlDrvSizeT));
+WDD_TYPEDEF(ErlDrvSizeT, driver_deq, (ErlDrvPort, ErlDrvSizeT));
+WDD_TYPEDEF(ErlDrvSizeT, driver_sizeq, (ErlDrvPort));
+WDD_TYPEDEF(int, driver_enq_bin, (ErlDrvPort, ErlDrvBinary *, ErlDrvSizeT, ErlDrvSizeT));
+WDD_TYPEDEF(int, driver_pushq_bin, (ErlDrvPort, ErlDrvBinary *, ErlDrvSizeT, ErlDrvSizeT));
+WDD_TYPEDEF(ErlDrvSizeT, driver_peekqv, (ErlDrvPort, ErlIOVec *));
WDD_TYPEDEF(SysIOVec *, driver_peekq, (ErlDrvPort, int *));
-WDD_TYPEDEF(int, driver_enqv, (ErlDrvPort, ErlIOVec *, int));
-WDD_TYPEDEF(int, driver_pushqv, (ErlDrvPort, ErlIOVec *, int));
+WDD_TYPEDEF(int, driver_enqv, (ErlDrvPort, ErlIOVec *, ErlDrvSizeT));
+WDD_TYPEDEF(int, driver_pushqv, (ErlDrvPort, ErlIOVec *, ErlDrvSizeT));
WDD_TYPEDEF(void, add_driver_entry, (ErlDrvEntry *));
WDD_TYPEDEF(int, remove_driver_entry, (ErlDrvEntry *));
WDD_TYPEDEF(ErlDrvTermData, driver_mk_atom, (char*));
diff --git a/erts/emulator/sys/win32/sys.c b/erts/emulator/sys/win32/sys.c
index a701747b78..b106f0932d 100755
--- a/erts/emulator/sys/win32/sys.c
+++ b/erts/emulator/sys/win32/sys.c
@@ -474,7 +474,7 @@ static int spawn_init(void);
static int fd_init(void);
static void fd_stop(ErlDrvData);
static void stop(ErlDrvData);
-static void output(ErlDrvData, char*, int);
+static void output(ErlDrvData, char*, ErlDrvSizeT);
static void ready_input(ErlDrvData, ErlDrvEvent);
static void ready_output(ErlDrvData, ErlDrvEvent);
static void stop_select(ErlDrvEvent, void*);
@@ -2431,13 +2431,13 @@ threaded_exiter(LPVOID param)
*/
static void
-output(ErlDrvData drv_data, char* buf, int len)
+output(ErlDrvData drv_data, char* buf, ErlDrvSizeT len)
/* long drv_data; /* The slot to use in the driver data table.
* For Windows NT, this is *NOT* a file handle.
* The handle is found in the driver data.
*/
-/* char *buf; /* Pointer to data to write to the port program. */
-/* int len; /* Number of bytes to write. */
+/* char *buf; /* Pointer to data to write to the port program. */
+/* ErlDrvSizeT len; /* Number of bytes to write. */
{
DriverData* dp;
int pb; /* The header size for this port. */
diff --git a/erts/emulator/test/a_SUITE_data/timer_driver.c b/erts/emulator/test/a_SUITE_data/timer_driver.c
index ef4dcdf501..44be94e0f0 100644
--- a/erts/emulator/test/a_SUITE_data/timer_driver.c
+++ b/erts/emulator/test/a_SUITE_data/timer_driver.c
@@ -17,7 +17,9 @@
#define CANCELLED 4
static ErlDrvData timer_start(ErlDrvPort, char*);
-static void timer_stop(ErlDrvData), timer_read(ErlDrvData, char*, int), timer(ErlDrvData);
+static void timer_stop(ErlDrvData),
+ timer_read(ErlDrvData, char*, ErlDrvSizeT),
+ timer(ErlDrvData);
static ErlDrvEntry timer_driver_entry =
{
@@ -33,6 +35,16 @@ static ErlDrvEntry timer_driver_entry =
NULL,
timer,
NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -47,8 +59,9 @@ static ErlDrvData timer_start(ErlDrvPort port, char *buf)
}
/* set the timer, this is monitored from erlang measuring the time */
-static void timer_read(ErlDrvData port, char *buf, int len)
+static void timer_read(ErlDrvData p, char *buf, ErlDrvSizeT len)
{
+ ErlDrvPort port = (ErlDrvPort) p;
char reply[1];
if (buf[0] == START_TIMER) {
@@ -62,8 +75,9 @@ static void timer_read(ErlDrvData port, char *buf, int len)
}
}
-static void timer_stop(ErlDrvData port)
+static void timer_stop(ErlDrvData p)
{
+ ErlDrvPort port = (ErlDrvPort) p;
driver_cancel_timer(port);
}
diff --git a/erts/emulator/test/alloc_SUITE_data/testcase_driver.c b/erts/emulator/test/alloc_SUITE_data/testcase_driver.c
index 1e98844838..66971654a2 100644
--- a/erts/emulator/test/alloc_SUITE_data/testcase_driver.c
+++ b/erts/emulator/test/alloc_SUITE_data/testcase_driver.c
@@ -50,13 +50,32 @@ typedef struct {
ErlDrvData testcase_drv_start(ErlDrvPort port, char *command);
void testcase_drv_stop(ErlDrvData drv_data);
-void testcase_drv_run(ErlDrvData drv_data, char *buf, int len);
+void testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len);
static ErlDrvEntry testcase_drv_entry = {
NULL,
testcase_drv_start,
testcase_drv_stop,
- testcase_drv_run
+ testcase_drv_run,
+ NULL,
+ NULL,
+ "testcase_drv",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
};
@@ -92,7 +111,7 @@ testcase_drv_stop(ErlDrvData drv_data)
}
void
-testcase_drv_run(ErlDrvData drv_data, char *buf, int len)
+testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len)
{
InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) drv_data;
ErlDrvTermData result_atom;
diff --git a/erts/emulator/test/busy_port_SUITE_data/busy_drv.c b/erts/emulator/test/busy_port_SUITE_data/busy_drv.c
index 1273d610ba..75106d3757 100644
--- a/erts/emulator/test/busy_port_SUITE_data/busy_drv.c
+++ b/erts/emulator/test/busy_port_SUITE_data/busy_drv.c
@@ -11,7 +11,8 @@
#define YES 1
static ErlDrvData busy_start(ErlDrvPort, char*);
-static void busy_stop(ErlDrvData), busy_from_erlang(ErlDrvData, char*, int);
+static void busy_stop(ErlDrvData),
+ busy_from_erlang(ErlDrvData, char*, ErlDrvSizeT);
ErlDrvEntry busy_driver_entry =
{
@@ -23,6 +24,20 @@ ErlDrvEntry busy_driver_entry =
NULL,
"busy_drv",
NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -73,7 +88,7 @@ static void busy_stop(ErlDrvData port)
}
static void
-busy_from_erlang(ErlDrvData port, char* buf, int count)
+busy_from_erlang(ErlDrvData port, char* buf, ErlDrvSizeT count)
{
if ((ErlDrvPort)port == slave_port) {
set_busy_port(slave_port, next_slave_state);
diff --git a/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c b/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c
index 35919da2d0..9f6bd310c6 100644
--- a/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c
+++ b/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2009. All Rights Reserved.
+ * Copyright Ericsson AB 2009-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -21,9 +21,9 @@
#include "erl_driver.h"
ErlDrvData start(ErlDrvPort port, char *command);
-void output(ErlDrvData drv_data, char *buf, int len);
-int control(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen);
+void output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len);
+ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen);
static ErlDrvEntry busy_drv_entry = {
NULL /* init */,
@@ -61,7 +61,7 @@ ErlDrvData start(ErlDrvPort port, char *command)
return (ErlDrvData) port;
}
-void output(ErlDrvData drv_data, char *buf, int len)
+void output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len)
{
int res;
ErlDrvPort port = (ErlDrvPort) drv_data;
@@ -76,8 +76,8 @@ void output(ErlDrvData drv_data, char *buf, int len)
driver_failure_atom(port, "driver_output_term failed");
}
-int control(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen)
+ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen)
{
switch (command) {
case 'B': /* busy */
diff --git a/erts/emulator/test/ddll_SUITE_data/dummy_drv.c b/erts/emulator/test/ddll_SUITE_data/dummy_drv.c
index e0d5067743..86f2abf1b1 100644
--- a/erts/emulator/test/ddll_SUITE_data/dummy_drv.c
+++ b/erts/emulator/test/ddll_SUITE_data/dummy_drv.c
@@ -7,7 +7,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData dummy_start(ErlDrvPort, char*);
-static void dummy_read(ErlDrvData port, char *buf, int count);
+static void dummy_read(ErlDrvData port, char *buf, ErlDrvSizeT count);
static void dummy_stop(ErlDrvData), easy_read(ErlDrvData, char*, int);
static ErlDrvEntry dummy_driver_entry = {
@@ -18,6 +18,21 @@ static ErlDrvEntry dummy_driver_entry = {
NULL,
NULL,
"dummy_drv",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -37,7 +52,7 @@ static ErlDrvData dummy_start(ErlDrvPort port,char *buf)
return (ErlDrvData)port;
}
-static void dummy_read(ErlDrvData port, char *buf, int count)
+static void dummy_read(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
driver_output(erlang_port, buf, count);
}
diff --git a/erts/emulator/test/ddll_SUITE_data/echo_drv.c b/erts/emulator/test/ddll_SUITE_data/echo_drv.c
index edf78a979d..2b3510c641 100644
--- a/erts/emulator/test/ddll_SUITE_data/echo_drv.c
+++ b/erts/emulator/test/ddll_SUITE_data/echo_drv.c
@@ -3,9 +3,10 @@
static ErlDrvPort erlang_port;
static ErlDrvData echo_start(ErlDrvPort, char *);
-static void from_erlang(ErlDrvData, char*, int);
-static int echo_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags);
+static void from_erlang(ErlDrvData, char*, ErlDrvSizeT);
+static ErlDrvSSizeT echo_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen, unsigned *ret_flags);
static ErlDrvEntry echo_driver_entry = {
NULL, /* Init */
echo_start,
@@ -21,7 +22,15 @@ static ErlDrvEntry echo_driver_entry = {
NULL,
NULL,
NULL,
- echo_call
+ echo_call,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
};
DRIVER_INIT(echo_drv)
@@ -36,14 +45,15 @@ echo_start(ErlDrvPort port, char *buf)
}
static void
-from_erlang(ErlDrvData data, char *buf, int count)
+from_erlang(ErlDrvData data, char *buf, ErlDrvSizeT count)
{
driver_output((ErlDrvPort) data, buf, count);
}
-static int
-echo_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags)
+static ErlDrvSSizeT
+echo_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen,
+ unsigned *ret_flags)
{
*rbuf = buf;
*ret_flags |= DRIVER_CALL_KEEP_BUFFER;
diff --git a/erts/emulator/test/ddll_SUITE_data/echo_drv_fail_init.c b/erts/emulator/test/ddll_SUITE_data/echo_drv_fail_init.c
index 3b2a44d907..26aa03a012 100644
--- a/erts/emulator/test/ddll_SUITE_data/echo_drv_fail_init.c
+++ b/erts/emulator/test/ddll_SUITE_data/echo_drv_fail_init.c
@@ -3,9 +3,10 @@
static ErlDrvPort erlang_port;
static ErlDrvData echo_start(ErlDrvPort, char *);
-static void from_erlang(ErlDrvData, char*, int);
-static int echo_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags);
+static void from_erlang(ErlDrvData, char*, ErlDrvSizeT);
+static ErlDrvSSizeT echo_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen, unsigned *ret_flags);
static int echo_failing_init(void);
static ErlDrvEntry echo_driver_entry = {
@@ -23,7 +24,15 @@ static ErlDrvEntry echo_driver_entry = {
NULL,
NULL,
NULL,
- echo_call
+ echo_call,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
};
DRIVER_INIT(echo_drv)
@@ -43,14 +52,15 @@ echo_start(ErlDrvPort port, char *buf)
}
static void
-from_erlang(ErlDrvData data, char *buf, int count)
+from_erlang(ErlDrvData data, char *buf, ErlDrvSizeT count)
{
driver_output((ErlDrvPort) data, buf, count);
}
-static int
-echo_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags)
+static ErlDrvSSizeT
+echo_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen,
+ unsigned *ret_flags)
{
*rbuf = buf;
*ret_flags |= DRIVER_CALL_KEEP_BUFFER;
diff --git a/erts/emulator/test/ddll_SUITE_data/initfail_drv.c b/erts/emulator/test/ddll_SUITE_data/initfail_drv.c
index b676ff5121..ad241b9c4f 100644
--- a/erts/emulator/test/ddll_SUITE_data/initfail_drv.c
+++ b/erts/emulator/test/ddll_SUITE_data/initfail_drv.c
@@ -3,7 +3,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData easy_start(ErlDrvPort, char*);
-static void easy_stop(ErlDrvData), easy_read(ErlDrvData, char*, int);
+static void easy_stop(ErlDrvData), easy_read(ErlDrvData, char*, ErlDrvSizeT);
static ErlDrvEntry easy_driver_entry =
{
@@ -14,6 +14,21 @@ static ErlDrvEntry easy_driver_entry =
NULL,
NULL,
"easy",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -34,7 +49,7 @@ static ErlDrvData easy_start(ErlDrvPort port, char *buf)
return (ErlDrvData)port;
}
-static void easy_read(ErlDrvData port, char *buf, int count)
+static void easy_read(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
driver_output(erlang_port, buf, count);
}
diff --git a/erts/emulator/test/ddll_SUITE_data/lock_drv.c b/erts/emulator/test/ddll_SUITE_data/lock_drv.c
index 2ec8fa3a29..d2605c5bfc 100644
--- a/erts/emulator/test/ddll_SUITE_data/lock_drv.c
+++ b/erts/emulator/test/ddll_SUITE_data/lock_drv.c
@@ -3,9 +3,10 @@
static ErlDrvPort erlang_port;
static ErlDrvData echo_start(ErlDrvPort, char *);
-static void from_erlang(ErlDrvData, char*, int);
-static int echo_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags);
+static void from_erlang(ErlDrvData, char*, ErlDrvSizeT);
+static ErlDrvSSizeT echo_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen, unsigned *ret_flags);
static ErlDrvEntry echo_driver_entry = {
NULL, /* Init */
echo_start,
@@ -21,7 +22,15 @@ static ErlDrvEntry echo_driver_entry = {
NULL,
NULL,
NULL,
- echo_call
+ echo_call,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
};
DRIVER_INIT(echo_drv)
@@ -37,14 +46,15 @@ echo_start(ErlDrvPort port, char *buf)
}
static void
-from_erlang(ErlDrvData data, char *buf, int count)
+from_erlang(ErlDrvData data, char *buf, ErlDrvSizeT count)
{
driver_output((ErlDrvPort) data, buf, count);
}
-static int
-echo_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags)
+static ErlDrvSSizeT
+echo_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen,
+ unsigned *ret_flags)
{
ErlDrvPort port = (ErlDrvPort) drv_data;
driver_lock_driver(port);
diff --git a/erts/emulator/test/ddll_SUITE_data/noinit_drv.c b/erts/emulator/test/ddll_SUITE_data/noinit_drv.c
index 931386a305..5abf5c4dc6 100644
--- a/erts/emulator/test/ddll_SUITE_data/noinit_drv.c
+++ b/erts/emulator/test/ddll_SUITE_data/noinit_drv.c
@@ -3,7 +3,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData easy_start(ErlDrvPort, char*);
-static void easy_stop(ErlDrvData), easy_read(ErlDrvData, char*, int);
+static void easy_stop(ErlDrvData), easy_read(ErlDrvData, char*, ErlDrvSizeT);
static ErlDrvEntry easy_driver_entry =
{
@@ -14,6 +14,21 @@ static ErlDrvEntry easy_driver_entry =
NULL,
NULL,
"easy",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -28,7 +43,7 @@ DRIVER_INIT(noinit_drv)
/*
* Provoke an error when loading the module.
*/
-int no_driver_init(void *handle)
+ErlDrvEntry* no_driver_init(void *handle)
#endif
{
erlang_port = (ErlDrvPort)-1;
@@ -46,7 +61,7 @@ static ErlDrvData easy_start(ErlDrvPort port,char *buf)
return (ErlDrvData)port;
}
-static void easy_read(ErlDrvData port, char *buf, int count)
+static void easy_read(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
driver_output(erlang_port, buf, count);
}
diff --git a/erts/emulator/test/ddll_SUITE_data/wrongname_drv.c b/erts/emulator/test/ddll_SUITE_data/wrongname_drv.c
index 3a35820ee7..ac7efa30de 100644
--- a/erts/emulator/test/ddll_SUITE_data/wrongname_drv.c
+++ b/erts/emulator/test/ddll_SUITE_data/wrongname_drv.c
@@ -7,7 +7,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData easy_start(ErlDrvPort, char*);
-static void easy_stop(ErlDrvData), easy_read(ErlDrvData, char*, int);
+static void easy_stop(ErlDrvData), easy_read(ErlDrvData, char*, ErlDrvSizeT);
static ErlDrvEntry easy_driver_entry =
{
@@ -18,6 +18,21 @@ static ErlDrvEntry easy_driver_entry =
NULL,
NULL,
"easy",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -38,7 +53,7 @@ static ErlDrvData easy_start(ErlDrvPort port,char *buf)
return (ErlDrvData)port;
}
-static void easy_read(ErlDrvData port, char *buf, int count)
+static void easy_read(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
driver_output(erlang_port, buf, count);
}
diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl
index d64ec2e97b..643357263c 100644
--- a/erts/emulator/test/driver_SUITE.erl
+++ b/erts/emulator/test/driver_SUITE.erl
@@ -47,8 +47,8 @@
fd_change/1,
steal_control/1,
otp_6602/1,
- 'driver_system_info_ver1.0'/1,
- 'driver_system_info_ver1.1'/1,
+ driver_system_info_base_ver/1,
+ driver_system_info_prev_ver/1,
driver_system_info_current_ver/1,
driver_monitor/1,
@@ -135,8 +135,8 @@ all() ->
[outputv_errors, outputv_echo, queue_echo, {group, timer},
driver_unloaded, io_ready_exit, use_fallback_pollset,
bad_fd_in_pollset, driver_event, fd_change,
- steal_control, otp_6602, 'driver_system_info_ver1.0',
- 'driver_system_info_ver1.1',
+ steal_control, otp_6602, driver_system_info_base_ver,
+ driver_system_info_prev_ver,
driver_system_info_current_ver, driver_monitor,
{group, ioq_exit}, zero_extended_marker_garb_drv,
invalid_extended_marker_drv, larger_major_vsn_drv,
@@ -1083,19 +1083,19 @@ otp_6602(Config) when is_list(Config) ->
-define(EXPECTED_SYSTEM_INFO_NAMES, ?EXPECTED_SYSTEM_INFO_NAMES2).
-'driver_system_info_ver1.0'(doc) ->
+'driver_system_info_base_ver'(doc) ->
[];
-'driver_system_info_ver1.0'(suite) ->
+'driver_system_info_base_ver'(suite) ->
[];
-'driver_system_info_ver1.0'(Config) when is_list(Config) ->
- ?line driver_system_info_test(Config, sys_info_1_0_drv).
+'driver_system_info_base_ver'(Config) when is_list(Config) ->
+ ?line driver_system_info_test(Config, sys_info_base_drv).
-'driver_system_info_ver1.1'(doc) ->
+'driver_system_info_prev_ver'(doc) ->
[];
-'driver_system_info_ver1.1'(suite) ->
+'driver_system_info_prev_ver'(suite) ->
[];
-'driver_system_info_ver1.1'(Config) when is_list(Config) ->
- ?line driver_system_info_test(Config, sys_info_1_1_drv).
+'driver_system_info_prev_ver'(Config) when is_list(Config) ->
+ ?line driver_system_info_test(Config, sys_info_prev_drv).
driver_system_info_current_ver(doc) ->
[];
diff --git a/erts/emulator/test/driver_SUITE_data/Makefile.src b/erts/emulator/test/driver_SUITE_data/Makefile.src
index dd48f6a0f7..9cc107cc66 100644
--- a/erts/emulator/test/driver_SUITE_data/Makefile.src
+++ b/erts/emulator/test/driver_SUITE_data/Makefile.src
@@ -16,8 +16,8 @@ MISC_DRVS = outputv_drv@dll@ \
thr_free_drv@dll@ \
async_blast_drv@dll@
-SYS_INFO_DRVS = sys_info_1_0_drv@dll@ \
- sys_info_1_1_drv@dll@ \
+SYS_INFO_DRVS = sys_info_base_drv@dll@ \
+ sys_info_prev_drv@dll@ \
sys_info_curr_drv@dll@
VSN_MISMATCH_DRVS = zero_extended_marker_garb_drv@dll@ \
diff --git a/erts/emulator/test/driver_SUITE_data/async_blast_drv.c b/erts/emulator/test/driver_SUITE_data/async_blast_drv.c
index 3821f7e3dc..c2086c5860 100644
--- a/erts/emulator/test/driver_SUITE_data/async_blast_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/async_blast_drv.c
@@ -25,7 +25,7 @@ static void stop(ErlDrvData drv_data);
static ErlDrvData start(ErlDrvPort port,
char *command);
static void output(ErlDrvData drv_data,
- char *buf, int len);
+ char *buf, ErlDrvSizeT len);
static void ready_async(ErlDrvData drv_data,
ErlDrvThreadData thread_data);
@@ -107,7 +107,7 @@ static void ready_async(ErlDrvData drv_data,
}
static void output(ErlDrvData drv_data,
- char *buf, int len)
+ char *buf, ErlDrvSizeT len)
{
async_blast_data_t *abd = (async_blast_data_t *) drv_data;
if (abd->counter == 0) {
diff --git a/erts/emulator/test/driver_SUITE_data/caller_drv.c b/erts/emulator/test/driver_SUITE_data/caller_drv.c
index a78d51966f..1ed20b0638 100644
--- a/erts/emulator/test/driver_SUITE_data/caller_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/caller_drv.c
@@ -23,17 +23,17 @@
static ErlDrvData start(ErlDrvPort port,
char *command);
static void output(ErlDrvData drv_data,
- char *buf, int len);
+ char *buf, ErlDrvSizeT len);
static void outputv(ErlDrvData drv_data,
ErlIOVec *ev);
-static int control(ErlDrvData drv_data,
- unsigned int command, char *buf,
- int len, char **rbuf, int rlen);
-static int call(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen,
- unsigned int *flags);
+static ErlDrvSSizeT control(ErlDrvData drv_data,
+ unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen);
+static ErlDrvSSizeT call(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
+ unsigned int *flags);
static ErlDrvEntry caller_drv_entry = {
NULL /* init */,
@@ -98,7 +98,7 @@ start(ErlDrvPort port, char *command)
}
static void
-output(ErlDrvData drv_data, char *buf, int len)
+output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len)
{
send_caller(drv_data, "output");
}
@@ -109,20 +109,20 @@ outputv(ErlDrvData drv_data, ErlIOVec *ev)
send_caller(drv_data, "outputv");
}
-static int
+static ErlDrvSSizeT
control(ErlDrvData drv_data,
unsigned int command, char *buf,
- int len, char **rbuf, int rlen)
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen)
{
send_caller(drv_data, "control");
return 0;
}
-static int
+static ErlDrvSSizeT
call(ErlDrvData drv_data,
unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
unsigned int *flags)
{
/* echo call */
diff --git a/erts/emulator/test/driver_SUITE_data/chkio_drv.c b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
index bbdb09cfcb..40f1ad4fea 100644
--- a/erts/emulator/test/driver_SUITE_data/chkio_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
@@ -141,8 +141,8 @@ static void chkio_drv_stop(ErlDrvData);
static void chkio_drv_ready_input(ErlDrvData, ErlDrvEvent);
static void chkio_drv_ready_output(ErlDrvData, ErlDrvEvent);
static void chkio_drv_ready_event(ErlDrvData, ErlDrvEvent, ErlDrvEventData);
-static int chkio_drv_control(ErlDrvData, unsigned int,
- char *, int, char **, int);
+static ErlDrvSSizeT chkio_drv_control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
static void chkio_drv_timeout(ErlDrvData);
static void chkio_drv_stop_select(ErlDrvEvent, void*);
@@ -188,7 +188,7 @@ stop_use_fallback_pollset(ChkioDrvData *cddp)
for (i = 0; i < CHKIO_FALLBACK_FDS; i++) {
if (cbdp->dev_null[i].fd >= 0) {
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->dev_null[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->dev_null[i].fd,
DO_WRITE,
0) != 0) {
fprintf(stderr,
@@ -200,7 +200,7 @@ stop_use_fallback_pollset(ChkioDrvData *cddp)
}
if (cbdp->dev_zero[i].fd >= 0) {
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->dev_zero[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->dev_zero[i].fd,
DO_READ,
0) != 0) {
fprintf(stderr,
@@ -212,7 +212,7 @@ stop_use_fallback_pollset(ChkioDrvData *cddp)
}
if (cbdp->pipe_in[i].fd >= 0) {
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->pipe_in[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->pipe_in[i].fd,
DO_READ,
0) != 0) {
fprintf(stderr,
@@ -224,7 +224,7 @@ stop_use_fallback_pollset(ChkioDrvData *cddp)
}
if (cbdp->pipe_out[i].fd >= 0) {
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->pipe_out[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->pipe_out[i].fd,
DO_WRITE,
0) != 0) {
fprintf(stderr,
@@ -249,11 +249,11 @@ stop_driver_event(ChkioDrvData *cddp)
cddp->test_data = NULL;
if (cdep->in_fd >= 0) {
- driver_event(cddp->port, (ErlDrvEvent) cdep->in_fd, NULL);
+ driver_event(cddp->port, (ErlDrvEvent) (ErlDrvSInt) cdep->in_fd, NULL);
close(cdep->in_fd);
}
if (cdep->out_fd >= 0) {
- driver_event(cddp->port, (ErlDrvEvent) cdep->out_fd, NULL);
+ driver_event(cddp->port, (ErlDrvEvent) (ErlDrvSInt) cdep->out_fd, NULL);
close(cdep->out_fd);
}
driver_free(cdep);
@@ -268,7 +268,7 @@ stop_fd_change(ChkioDrvData *cddp)
cddp->test_data = NULL;
driver_cancel_timer(cddp->port);
if (cfcp->fds[0] >= 0) {
- driver_select(cddp->port, (ErlDrvEvent) cfcp->fds[0], DO_READ, 0);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) cfcp->fds[0], DO_READ, 0);
close(cfcp->fds[0]);
close(cfcp->fds[1]);
}
@@ -282,8 +282,8 @@ stop_bad_fd_in_pollset(ChkioDrvData *cddp)
if (cddp->test_data) {
ChkioBadFdInPollset *bfipp = (ChkioBadFdInPollset *) cddp->test_data;
cddp->test_data = NULL;
- driver_select(cddp->port, (ErlDrvEvent) bfipp->fds[0], DO_WRITE, 0);
- driver_select(cddp->port, (ErlDrvEvent) bfipp->fds[1], DO_READ, 0);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) bfipp->fds[0], DO_WRITE, 0);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) bfipp->fds[1], DO_READ, 0);
driver_free((void *) bfipp);
}
}
@@ -296,21 +296,21 @@ stop_steal(ChkioDrvData *cddp)
cddp->test_data = NULL;
if (csp->driver_select_fds[0] >= 0)
driver_select(cddp->port,
- (ErlDrvEvent) csp->driver_select_fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_select_fds[0],
DO_READ,
0);
if (csp->driver_select_fds[1] >= 0)
driver_select(cddp->port,
- (ErlDrvEvent) csp->driver_select_fds[1],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_select_fds[1],
DO_WRITE,
0);
if (csp->driver_event_fds[0] >= 0)
driver_event(cddp->port,
- (ErlDrvEvent) csp->driver_event_fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_event_fds[0],
NULL);
if (csp->driver_event_fds[1] >= 0)
driver_event(cddp->port,
- (ErlDrvEvent) csp->driver_event_fds[1],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_event_fds[1],
NULL);
driver_free(csp);
}
@@ -353,7 +353,7 @@ static void free_smp_select(ChkioSmpSelect* pip, ErlDrvPort port)
abort();
}
case Selected:
- driver_select(port, (ErlDrvEvent)pip->read_fd, DO_READ, 0);
+ driver_select(port, (ErlDrvEvent)(ErlDrvSInt)pip->read_fd, DO_READ, 0);
/*fall through*/
case Opened:
close(pip->read_fd);
@@ -475,8 +475,8 @@ chkio_drv_stop(ErlDrvData drv_data) {
fprintf(stderr, "%s:%d: Failed to open /dev/null\n",
__FILE__, __LINE__);
}
- driver_select(cddp->port, (ErlDrvEvent) fd, DO_WRITE, 1);
- driver_select(cddp->port, (ErlDrvEvent) fd, DO_WRITE, 0);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) fd, DO_WRITE, 1);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) fd, DO_WRITE, 0);
close(fd);
@@ -491,7 +491,7 @@ chkio_drv_ready_output(ErlDrvData drv_data, ErlDrvEvent event)
{
#ifdef UNIX
ChkioDrvData *cddp = (ChkioDrvData *) drv_data;
- int fd = (int) event;
+ int fd = (int) (ErlDrvSInt) event;
switch (cddp->test) {
case CHKIO_USE_FALLBACK_POLLSET: {
@@ -533,7 +533,7 @@ chkio_drv_ready_input(ErlDrvData drv_data, ErlDrvEvent event)
{
#ifdef UNIX
ChkioDrvData *cddp = (ChkioDrvData *) drv_data;
- int fd = (int) event;
+ int fd = (int) (ErlDrvSInt) event;
switch (cddp->test) {
case CHKIO_USE_FALLBACK_POLLSET: {
@@ -630,7 +630,7 @@ chkio_drv_ready_event(ErlDrvData drv_data,
case CHKIO_DRIVER_EVENT: {
#ifdef HAVE_POLL_H
ChkioDriverEvent *cdep = cddp->test_data;
- int fd = (int) event;
+ int fd = (int) (ErlDrvSInt) event;
if (fd == cdep->in_fd) {
if (event_data->events == POLLIN
&& event_data->revents == POLLIN) {
@@ -679,7 +679,7 @@ chkio_drv_timeout(ErlDrvData drv_data)
int in_fd = cfcp->fds[0];
int out_fd = cfcp->fds[1];
if (in_fd >= 0) {
- if (driver_select(cddp->port, (ErlDrvEvent) in_fd, DO_READ, 0) < 0)
+ if (driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) in_fd, DO_READ, 0) < 0)
driver_failure_atom(cddp->port, "deselect_failed");
(void) write(out_fd, (void *) "!", 1);
close(out_fd);
@@ -689,7 +689,7 @@ chkio_drv_timeout(ErlDrvData drv_data)
driver_failure_posix(cddp->port, errno);
}
else {
- if (driver_select(cddp->port, (ErlDrvEvent) cfcp->fds[0],
+ if (driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) cfcp->fds[0],
DO_READ, 1) < 0)
driver_failure_atom(cddp->port, "select_failed");
if (cfcp->fds[0] == in_fd)
@@ -709,14 +709,14 @@ chkio_drv_timeout(ErlDrvData drv_data)
#endif /* UNIX */
}
-static int
+static ErlDrvSSizeT
chkio_drv_control(ErlDrvData drv_data,
unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
char *res_str;
- int res_len = -1;
+ ErlDrvSSizeT res_len = -1;
#ifndef UNIX
#ifdef __WIN32__
res_str = "skip: windows_different";
@@ -854,7 +854,7 @@ chkio_drv_control(ErlDrvData drv_data,
int fds[2];
cbdp->dev_null[i].fd = open("/dev/null", O_WRONLY);
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->dev_null[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->dev_null[i].fd,
DO_WRITE,
1) != 0) {
driver_failure_posix(cddp->port, errno);
@@ -862,7 +862,7 @@ chkio_drv_control(ErlDrvData drv_data,
}
cbdp->dev_zero[i].fd = open("/dev/zero", O_RDONLY);
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->dev_zero[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->dev_zero[i].fd,
DO_READ,
1) != 0) {
driver_failure_posix(cddp->port, errno);
@@ -873,7 +873,7 @@ chkio_drv_control(ErlDrvData drv_data,
cbdp->pipe_in[i].fd = fds[0];
cbdp->pipe_out[i].fd = fds[1];
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->pipe_in[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->pipe_in[i].fd,
DO_READ,
1) != 0) {
driver_failure_posix(cddp->port, EIO);
@@ -882,7 +882,7 @@ chkio_drv_control(ErlDrvData drv_data,
if (i % 2 == 0)
(void) write(cbdp->pipe_out[i].fd, "!", 1);
if (driver_select(cddp->port,
- (ErlDrvEvent) cbdp->pipe_out[i].fd,
+ (ErlDrvEvent) (ErlDrvSInt) cbdp->pipe_out[i].fd,
DO_WRITE,
1) != 0) {
driver_failure_posix(cddp->port, EIO);
@@ -928,8 +928,8 @@ chkio_drv_control(ErlDrvData drv_data,
bfipp->fds[0] = fds[9];
bfipp->fds[1] = fds[10];
cddp->test_data = (void *) bfipp;
- driver_select(cddp->port, (ErlDrvEvent) fds[9], DO_WRITE, 1);
- driver_select(cddp->port, (ErlDrvEvent) fds[10], DO_READ, 1);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) fds[9], DO_WRITE, 1);
+ driver_select(cddp->port, (ErlDrvEvent) (ErlDrvSInt) fds[10], DO_READ, 1);
}
}
res_str = "ok";
@@ -965,7 +965,7 @@ chkio_drv_control(ErlDrvData drv_data,
cdep->in_ok = 0;
res = driver_event(cddp->port,
- (ErlDrvEvent) in_fd,
+ (ErlDrvEvent) (ErlDrvSInt) in_fd,
&cdep->in_data);
if (res < 0) {
res_str = "skip: driver_event() not supported";
@@ -985,7 +985,7 @@ chkio_drv_control(ErlDrvData drv_data,
cdep->out_ok = 0;
res = driver_event(cddp->port,
- (ErlDrvEvent) out_fd,
+ (ErlDrvEvent) (ErlDrvSInt) out_fd,
&cdep->out_data);
if (res < 0) {
close(out_fd);
@@ -1062,7 +1062,7 @@ chkio_drv_control(ErlDrvData drv_data,
csp->event_data[0].events = POLLIN;
csp->event_data[0].revents = 0;
res = driver_event(cddp->port,
- (ErlDrvEvent) csp->driver_event_fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_event_fds[0],
&csp->event_data[0]);
if (res < 0)
driver_failure_atom(cddp->port,
@@ -1071,7 +1071,7 @@ chkio_drv_control(ErlDrvData drv_data,
csp->event_data[1].events = POLLOUT;
csp->event_data[1].revents = 0;
res = driver_event(cddp->port,
- (ErlDrvEvent) csp->driver_event_fds[1],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_event_fds[1],
&csp->event_data[1]);
if (res < 0)
driver_failure_atom(cddp->port,
@@ -1083,7 +1083,7 @@ chkio_drv_control(ErlDrvData drv_data,
/* Steal with driver_select() */
if (res >= 0) {
res = driver_select(cddp->port,
- (ErlDrvEvent) csp->driver_select_fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_select_fds[0],
DO_READ,
1);
if (res < 0)
@@ -1092,7 +1092,7 @@ chkio_drv_control(ErlDrvData drv_data,
}
if (res >= 0) {
res = driver_select(cddp->port,
- (ErlDrvEvent) csp->driver_select_fds[1],
+ (ErlDrvEvent) (ErlDrvSInt) csp->driver_select_fds[1],
DO_WRITE,
1);
if (res < 0)
@@ -1159,14 +1159,14 @@ chkio_drv_control(ErlDrvData drv_data,
csap->driver_event_fds[1] = write_fds[1];
res = driver_select(cddp->port,
- (ErlDrvEvent) csap->driver_select_fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) csap->driver_select_fds[0],
DO_READ,
1);
if (res < 0)
driver_failure_atom(cddp->port, "driver_select_failed");
if (res >= 0) {
res = driver_select(cddp->port,
- (ErlDrvEvent) csap->driver_select_fds[1],
+ (ErlDrvEvent) (ErlDrvSInt) csap->driver_select_fds[1],
DO_WRITE,
1);
if (res < 0)
@@ -1177,7 +1177,7 @@ chkio_drv_control(ErlDrvData drv_data,
csap->event_data[0].events = POLLIN;
csap->event_data[0].revents = 0;
res = driver_event(cddp->port,
- (ErlDrvEvent) csap->driver_event_fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) csap->driver_event_fds[0],
&csap->event_data[0]);
if (res < 0) {
close(csap->driver_event_fds[0]);
@@ -1190,7 +1190,7 @@ chkio_drv_control(ErlDrvData drv_data,
csap->event_data[1].events = POLLOUT;
csap->event_data[1].revents = 0;
res = driver_event(cddp->port,
- (ErlDrvEvent) csap->driver_event_fds[1],
+ (ErlDrvEvent) (ErlDrvSInt) csap->driver_event_fds[1],
&csap->event_data[1]);
if (res < 0)
driver_failure_atom(cddp->port,
@@ -1285,7 +1285,7 @@ chkio_drv_control(ErlDrvData drv_data,
}
else {
TRACEF(("%T: Select on pipe [%d->%d]\n", cddp->id, pip->write_fd, pip->read_fd));
- if (driver_select(cddp->port, (ErlDrvEvent)pip->read_fd, DO_READ, 1)) {
+ if (driver_select(cddp->port, (ErlDrvEvent)(ErlDrvSInt)pip->read_fd, DO_READ, 1)) {
fprintf(stderr, "driver_select failed for fd=%d\n", pip->read_fd);
abort();
}
@@ -1314,7 +1314,7 @@ chkio_drv_control(ErlDrvData drv_data,
op >>= 1;
if (op & 1) {
TRACEF(("%T: Deselect on pipe [%d->%d]\n", cddp->id, pip->write_fd, pip->read_fd));
- if (driver_select(cddp->port, (ErlDrvEvent)pip->read_fd, DO_READ, 0)) {
+ if (driver_select(cddp->port, (ErlDrvEvent)(ErlDrvSInt)pip->read_fd, DO_READ, 0)) {
fprintf(stderr, "driver_(de)select failed for fd=%d\n", pip->read_fd);
abort();
}
diff --git a/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c b/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c
index 6afa46b3a2..e6a3edcd74 100644
--- a/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c
@@ -40,8 +40,9 @@ static void io_ready_exit_ready_input(ErlDrvData, ErlDrvEvent);
static void io_ready_exit_ready_output(ErlDrvData, ErlDrvEvent);
static void io_ready_exit_drv_output(ErlDrvData, char *, int);
static void io_ready_exit_drv_finish(void);
-static int io_ready_exit_drv_control(ErlDrvData, unsigned int,
- char *, int, char **, int);
+static ErlDrvSSizeT io_ready_exit_drv_control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT,
+ char **, ErlDrvSizeT);
static ErlDrvEntry io_ready_exit_drv_entry = {
NULL, /* init */
@@ -56,7 +57,17 @@ static ErlDrvEntry io_ready_exit_drv_entry = {
io_ready_exit_drv_control,
NULL, /* timeout */
NULL, /* outputv */
- NULL /* ready_async */
+ NULL, /* ready_async */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL, /* event */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0, /* ERL_DRV_FLAGs */
+ NULL, /* handle2 */
+ NULL, /* process_exit */
+ NULL /* stop_select */
};
/* -------------------------------------------------------------------------
@@ -83,7 +94,7 @@ io_ready_exit_drv_stop(ErlDrvData drv_data) {
#ifdef UNIX
if (oeddp->fds[0] >= 0) {
driver_select(oeddp->port,
- (ErlDrvEvent) oeddp->fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) oeddp->fds[0],
DO_READ|DO_WRITE,
0);
close(oeddp->fds[0]);
@@ -109,15 +120,15 @@ io_ready_exit_ready_input(ErlDrvData drv_data, ErlDrvEvent event)
driver_failure_atom(oeddp->port, "ready_input_driver_failure");
}
-static int
+static ErlDrvSSizeT
io_ready_exit_drv_control(ErlDrvData drv_data,
unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
char *abuf;
char *res_str;
- int res_len;
+ ErlDrvSSizeT res_len;
IOReadyExitDrvData *oeddp = (IOReadyExitDrvData *) drv_data;
#ifndef UNIX
res_str = "nyiftos";
@@ -127,9 +138,9 @@ io_ready_exit_drv_control(ErlDrvData drv_data,
}
else {
res_str = "ok";
- write(oeddp->fds[1], "!", 1);
+ (void) write(oeddp->fds[1], "!", 1);
driver_select(oeddp->port,
- (ErlDrvEvent) oeddp->fds[0],
+ (ErlDrvEvent) (ErlDrvSInt) oeddp->fds[0],
DO_READ|DO_WRITE,
1);
}
diff --git a/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c b/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c
index e49de388b4..b2cc1e785a 100644
--- a/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2007-2010. All Rights Reserved.
+ * Copyright Ericsson AB 2007-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -91,7 +91,8 @@ static ErlDrvData start(ErlDrvPort port, char *command);
static void stop(ErlDrvData drv_data);
static void ready_input(ErlDrvData drv_data, ErlDrvEvent event);
static void ready_output(ErlDrvData drv_data, ErlDrvEvent event);
-static int control(ErlDrvData, unsigned int, char *, int, char **, int);
+static ErlDrvSSizeT control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
static void timeout(ErlDrvData drv_data);
static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data);
static void flush(ErlDrvData drv_data);
@@ -155,10 +156,10 @@ start(ErlDrvPort port, char *command)
return (ErlDrvData) ddp;
}
-static int control(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+static ErlDrvSSizeT control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
IOQExitDrvData *ddp = (IOQExitDrvData *) drv_data;
char *res_str = "nyiftos";
@@ -227,7 +228,7 @@ static int control(ErlDrvData drv_data,
res_str = "ok";
done: {
- int res_len = strlen(res_str);
+ ErlDrvSSizeT res_len = strlen(res_str);
if (res_len > rlen) {
char *abuf = driver_alloc(sizeof(char)*res_len);
if (!abuf)
diff --git a/erts/emulator/test/driver_SUITE_data/many_events_drv.c b/erts/emulator/test/driver_SUITE_data/many_events_drv.c
index 7417dbf7f8..a34432a8fe 100644
--- a/erts/emulator/test/driver_SUITE_data/many_events_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/many_events_drv.c
@@ -3,14 +3,17 @@
#endif
#include <stdio.h>
+#include <string.h>
#include "erl_driver.h"
static ErlDrvPort erlang_port;
static ErlDrvData many_events_start(ErlDrvPort, char *);
-static void from_erlang(ErlDrvData, char*, int);
+static void from_erlang(ErlDrvData, char*, ErlDrvSizeT);
static void from_port(ErlDrvData drv_data, ErlDrvEvent event);
-static int many_events_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags);
+static ErlDrvSSizeT many_events_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
+ unsigned *ret_flags);
static ErlDrvEntry many_events_driver_entry = {
NULL, /* Init */
many_events_start,
@@ -26,7 +29,15 @@ static ErlDrvEntry many_events_driver_entry = {
NULL,
NULL,
NULL,
- many_events_call
+ many_events_call,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
};
DRIVER_INIT(many_events_drv)
@@ -41,7 +52,7 @@ many_events_start(ErlDrvPort port, char *buf)
}
static void
-from_erlang(ErlDrvData data, char *buf, int count)
+from_erlang(ErlDrvData data, char *buf, ErlDrvSizeT count)
{
int i;
int num;
@@ -87,9 +98,10 @@ static void from_port(ErlDrvData data, ErlDrvEvent ev)
return;
}
-static int
-many_events_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags)
+static ErlDrvSSizeT
+many_events_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen,
+ unsigned *ret_flags)
{
*rbuf = buf;
*ret_flags |= DRIVER_CALL_KEEP_BUFFER;
diff --git a/erts/emulator/test/driver_SUITE_data/monitor_drv.c b/erts/emulator/test/driver_SUITE_data/monitor_drv.c
index ffb6ae9085..3da067fd09 100644
--- a/erts/emulator/test/driver_SUITE_data/monitor_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/monitor_drv.c
@@ -22,8 +22,8 @@
static ErlDrvData monitor_drv_start(ErlDrvPort, char *);
static void monitor_drv_stop(ErlDrvData data);
-static int monitor_drv_control(ErlDrvData, unsigned int,
- char *, int, char **, int);
+static ErlDrvSSizeT monitor_drv_control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
static void handle_monitor(ErlDrvData drv_data, ErlDrvMonitor *monitor);
#define OP_I_AM_IPID 1
@@ -123,16 +123,16 @@ static void handle_monitor(ErlDrvData drv_data, ErlDrvMonitor *monitor)
return;
}
-static int
+static ErlDrvSSizeT
monitor_drv_control(ErlDrvData drv_data,
unsigned int command,
- char *ibuf, int ilen,
- char **rbuf, int rlen)
+ char *ibuf, ErlDrvSizeT ilen,
+ char **rbuf, ErlDrvSizeT rlen)
{
MyDrvData *data = (MyDrvData *) drv_data;
char *answer = NULL;
char buff[64];
- int alen;
+ ErlDrvSSizeT alen;
switch (command) {
case OP_I_AM_IPID:
diff --git a/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c b/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c
index 8c0a9aadfd..ff44145ca7 100644
--- a/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c
@@ -20,11 +20,11 @@
#include <string.h>
#include "erl_driver.h"
-static int call(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen,
- unsigned int *flags);
+static ErlDrvSSizeT call(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
+ unsigned int *flags);
static ErlDrvEntry otp_6879_drv_entry = {
NULL /* init */,
@@ -57,11 +57,11 @@ DRIVER_INIT(otp_6879_drv)
}
-static int call(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen,
- unsigned int *flags)
+static ErlDrvSSizeT call(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
+ unsigned int *flags)
{
/* echo call */
if (len > rlen)
diff --git a/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c b/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c
index beee1b735f..221fd0ce51 100644
--- a/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c
@@ -28,7 +28,7 @@ static void stop(ErlDrvData drv_data);
static ErlDrvData start(ErlDrvPort port,
char *command);
static void output(ErlDrvData drv_data,
- char *buf, int len);
+ char *buf, ErlDrvSizeT len);
static void ready_async(ErlDrvData drv_data,
ErlDrvThreadData thread_data);
@@ -196,13 +196,13 @@ static void ready_async(ErlDrvData drv_data,
}
static void output(ErlDrvData drv_data,
- char *buf, int len)
+ char *buf, ErlDrvSizeT len)
{
Otp9302Data *data = (Otp9302Data *) drv_data;
ErlDrvTermData td_port = driver_mk_port(data->port);
ErlDrvTermData td_receiver = driver_caller(data->port);
ErlDrvTermData td_job = driver_mk_atom("job");
- unsigned int key = (unsigned int) data->port;
+ unsigned int key = (unsigned int) (ErlDrvSInt) data->port;
long id[5];
Otp9302AsyncData *ad[5];
int i;
diff --git a/erts/emulator/test/driver_SUITE_data/outputv_drv.c b/erts/emulator/test/driver_SUITE_data/outputv_drv.c
index 87f66ae413..3e3d4a3a03 100644
--- a/erts/emulator/test/driver_SUITE_data/outputv_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/outputv_drv.c
@@ -3,7 +3,9 @@
static ErlDrvPort erlang_port;
static ErlDrvData outputv_start(ErlDrvPort, char*);
-static void outputv_stop(ErlDrvData), outputv_read(ErlDrvData, char*, int), outputv(ErlDrvData, ErlIOVec*);
+static void outputv_stop(ErlDrvData),
+ outputv_read(ErlDrvData, char*, ErlDrvSizeT),
+ outputv(ErlDrvData, ErlIOVec*);
static ErlDrvEntry outputv_driver_entry =
{
@@ -19,6 +21,16 @@ static ErlDrvEntry outputv_driver_entry =
NULL,
NULL,
outputv,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -38,7 +50,7 @@ static ErlDrvData outputv_start(ErlDrvPort port, char *buf)
return (ErlDrvData)port;
}
-static void outputv_read(ErlDrvData port, char *buf, int count)
+static void outputv_read(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
erlang_port = (ErlDrvPort)-1;
}
diff --git a/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c b/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c
index 3a5b5af13a..8e203f74ec 100644
--- a/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c
@@ -66,7 +66,8 @@ typedef struct {
static ErlDrvData start(ErlDrvPort, char *);
static void stop(ErlDrvData);
-static int control(ErlDrvData, unsigned int, char *, int, char **, int);
+static ErlDrvSSizeT control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
static void ready_async(ErlDrvData, ErlDrvThreadData);
static void async_test(void *);
static void async_wait(void *);
@@ -121,10 +122,10 @@ static void stop(ErlDrvData drv_data)
driver_free(drv_data);
}
-static int control(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+static ErlDrvSSizeT control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
PeekNonXQDrvData *dp = (PeekNonXQDrvData *) drv_data;
unsigned int key = 0;
@@ -158,7 +159,7 @@ static int control(ErlDrvData drv_data,
}
done: {
- int res_len = strlen(res_str);
+ ErlDrvSSizeT res_len = strlen(res_str);
if (res_len > rlen) {
char *abuf = driver_alloc(sizeof(char)*res_len);
if (!abuf)
diff --git a/erts/emulator/test/driver_SUITE_data/queue_drv.c b/erts/emulator/test/driver_SUITE_data/queue_drv.c
index ded69f89f9..a02b57dc9a 100644
--- a/erts/emulator/test/driver_SUITE_data/queue_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/queue_drv.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <string.h>
#include "erl_driver.h"
#define put_int32(i, s) {((char*)(s))[0] = (char)((i) >> 24) & 0xff; \
@@ -33,9 +34,10 @@
static ErlDrvPort erlang_port;
static unsigned opcode; /* Opcode for next operation. */
static ErlDrvData queue_start(ErlDrvPort, char*);
-static void queue_stop(ErlDrvData), queue_read(ErlDrvData, char*, int);
+static void queue_stop(ErlDrvData), queue_read(ErlDrvData, char*, ErlDrvSizeT);
static void queue_outputv(ErlDrvData, ErlIOVec*);
-static int control(ErlDrvData, unsigned int, char*, int, char**, int);
+static ErlDrvSSizeT control(ErlDrvData, unsigned int,
+ char*, ErlDrvSizeT, char**, ErlDrvSizeT);
static ErlDrvBinary* read_head(ErlDrvPort, int bytes);
static ErlDrvEntry queue_driver_entry =
@@ -52,6 +54,16 @@ static ErlDrvEntry queue_driver_entry =
control,
NULL,
queue_outputv,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -73,7 +85,7 @@ static ErlDrvData queue_start(ErlDrvPort port, char *buf)
}
/* messages from Erlang */
-static void queue_read(ErlDrvData port, char *buf, int len)
+static void queue_read(ErlDrvData port, char *buf, ErlDrvSizeT len)
{
}
@@ -82,8 +94,9 @@ static void queue_stop(ErlDrvData port)
erlang_port = (ErlDrvPort) -1;
}
-static int
-control(ErlDrvData drv_data, unsigned command, char* buf, int len, char** rbuf, int rlen)
+static ErlDrvSSizeT
+control(ErlDrvData drv_data, unsigned command,
+ char* buf, ErlDrvSizeT len, char** rbuf, ErlDrvSizeT rlen)
{
ErlDrvBinary* b;
diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c b/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c
index 0504778086..c22a415c59 100644
--- a/erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c
@@ -3,34 +3,35 @@
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved via the world wide web at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* The Initial Developer of the Original Code is Ericsson Utvecklings AB.
* Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
* AB. All Rights Reserved.''
- *
+ *
* $Id$
*/
/*
* Author: Rickard Green
*
- * Description: Driver that fakes driver version 1.0 and tests
+ * Description: Driver that fakes driver version 2.0 and tests
* driver_system_info().
*
*/
#include "sys_info_drv_impl.h"
-#define SYS_INFO_DRV_MAJOR_VSN 1
+#define SYS_INFO_DRV_MAJOR_VSN 2
#define SYS_INFO_DRV_MINOR_VSN 0
-#define SYS_INFO_DRV_NAME_STR "sys_info_1_0_drv"
-#define SYS_INFO_DRV_NAME sys_info_1_0_drv
+#define SYS_INFO_DRV_NAME_STR "sys_info_base_drv"
+#define SYS_INFO_DRV_NAME sys_info_base_drv
#define SYS_INFO_DRV_LAST_FIELD smp_support
+#define ERL_DRV_SYS_INFO_SIZE sizeof(ErlDrvSysInfo)
#define SYS_INFO_DRV_RES_FORMAT "ok: " \
"drv_drv_vsn=%d.%d " \
@@ -38,8 +39,9 @@
"erts_vsn=%s " \
"otp_vsn=%s " \
"thread=%s " \
- "smp=%s"
-
+ "smp=%s " \
+ "async_thrs=%d " \
+ "sched_thrs=%d"
static size_t
sys_info_drv_max_res_len(ErlDrvSysInfo *sip)
@@ -51,6 +53,8 @@ sys_info_drv_max_res_len(ErlDrvSysInfo *sip)
slen += strlen(sip->otp_release) + 1;
slen += 5; /* threads */
slen += 5; /* smp */
+ slen += 20; /* async_thrs */
+ slen += 20; /* sched_thrs */
return slen;
}
@@ -66,7 +70,9 @@ sys_info_drv_sprintf_sys_info(ErlDrvSysInfo *sip, char *str)
sip->erts_version,
sip->otp_release,
sip->thread_support ? "true" : "false",
- sip->smp_support ? "true" : "false");
+ sip->smp_support ? "true" : "false",
+ sip->async_threads,
+ sip->scheduler_threads);
}
#include "sys_info_drv_impl.c"
diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c b/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c
index 2d3203ae5d..c6c70a2075 100644
--- a/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c
+++ b/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c
@@ -46,7 +46,8 @@
#endif
static ErlDrvData start(ErlDrvPort, char *);
-static int control(ErlDrvData, unsigned int, char *, int, char **, int);
+static ErlDrvSSizeT control(ErlDrvData, unsigned int,
+ char *, ErlDrvSizeT, char **, ErlDrvSizeT);
static ErlDrvEntry drv_entry = {
NULL /* init */,
@@ -84,13 +85,13 @@ start(ErlDrvPort port, char *command)
return (ErlDrvData) port;
}
-static int
+static ErlDrvSSizeT
control(ErlDrvData drv_data,
unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
- int res;
+ ErlDrvSSizeT res;
char *str;
size_t slen, slen2;
ErlDrvPort port = (ErlDrvPort) drv_data;
diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c b/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c
index fa21828284..815d96cc97 100644
--- a/erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c
@@ -3,34 +3,35 @@
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved via the world wide web at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* The Initial Developer of the Original Code is Ericsson Utvecklings AB.
* Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
* AB. All Rights Reserved.''
- *
+ *
* $Id$
*/
/*
* Author: Rickard Green
*
- * Description: Driver that fakes driver version 1.1 and tests
+ * Description: Driver that fakes driver version 2.0 and tests
* driver_system_info().
*
*/
#include "sys_info_drv_impl.h"
-#define SYS_INFO_DRV_MAJOR_VSN 1
-#define SYS_INFO_DRV_MINOR_VSN 1
-#define SYS_INFO_DRV_NAME_STR "sys_info_1_1_drv"
-#define SYS_INFO_DRV_NAME sys_info_1_1_drv
+#define SYS_INFO_DRV_MAJOR_VSN 2
+#define SYS_INFO_DRV_MINOR_VSN 0
+#define SYS_INFO_DRV_NAME_STR "sys_info_prev_drv"
+#define SYS_INFO_DRV_NAME sys_info_prev_drv
#define SYS_INFO_DRV_LAST_FIELD scheduler_threads
+#define ERL_DRV_SYS_INFO_SIZE sizeof(ErlDrvSysInfo)
#define SYS_INFO_DRV_RES_FORMAT "ok: " \
"drv_drv_vsn=%d.%d " \
@@ -42,7 +43,6 @@
"async_thrs=%d " \
"sched_thrs=%d"
-
static size_t
sys_info_drv_max_res_len(ErlDrvSysInfo *sip)
{
@@ -76,5 +76,3 @@ sys_info_drv_sprintf_sys_info(ErlDrvSysInfo *sip, char *str)
}
#include "sys_info_drv_impl.c"
-
-
diff --git a/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c b/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c
index c7edbba7f6..95a6ae9bdf 100644
--- a/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c
@@ -21,14 +21,8 @@
#include "erl_driver.h"
ErlDrvData start(ErlDrvPort port, char *command);
-int control(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen);
-
-static int call(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen,
- unsigned int *flags);
+ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen);
static ErlDrvEntry thr_alloc_drv_entry = {
NULL /* init */,
@@ -76,12 +70,12 @@ ErlDrvData start(ErlDrvPort port, char *command)
return (ErlDrvData) port;
}
-int control(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen)
+ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen)
{
ErlDrvPort port = (ErlDrvPort) drv_data;
char *result = "failure";
- int result_len;
+ ErlDrvSSizeT result_len;
if (len <= 20) {
int res;
ErlDrvTid tid;
diff --git a/erts/emulator/test/driver_SUITE_data/thr_free_drv.c b/erts/emulator/test/driver_SUITE_data/thr_free_drv.c
index 40637c946c..439fe6a184 100644
--- a/erts/emulator/test/driver_SUITE_data/thr_free_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/thr_free_drv.c
@@ -45,8 +45,8 @@ typedef struct {
static ErlDrvData start(ErlDrvPort port, char *command);
static void stop(ErlDrvData data);
-static int control(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen);
+static ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen);
static ErlDrvEntry thr_free_drv_entry = {
NULL /* init */,
@@ -194,14 +194,14 @@ static void stop(ErlDrvData drv_data)
driver_free(td);
}
-static int control(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen)
+static ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf,
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen)
{
test_data *td = (test_data *) drv_data;
char *result = "failure";
int i, b;
int res;
- int result_len;
+ ErlDrvSSizeT result_len;
if (td->b == -1) {
erl_drv_mutex_lock(td->ttd[0].mtx);
diff --git a/erts/emulator/test/driver_SUITE_data/timer_drv.c b/erts/emulator/test/driver_SUITE_data/timer_drv.c
index 3ea37fa079..8c3f203a64 100644
--- a/erts/emulator/test/driver_SUITE_data/timer_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/timer_drv.c
@@ -23,7 +23,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData timer_start(ErlDrvPort, char*);
static void timer_stop(ErlDrvData);
-static void timer_read(ErlDrvData, char*, int);
+static void timer_read(ErlDrvData, char*, ErlDrvSizeT);
static void timer(ErlDrvData);
static ErlDrvEntry timer_driver_entry =
@@ -40,6 +40,16 @@ static ErlDrvEntry timer_driver_entry =
NULL,
timer,
NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
NULL
};
@@ -59,8 +69,9 @@ static ErlDrvData timer_start(ErlDrvPort port, char *buf)
}
/* set the timer, this is monitored from erlang measuring the time */
-static void timer_read(ErlDrvData port, char *buf, int len)
+static void timer_read(ErlDrvData p, char *buf, ErlDrvSizeT len)
{
+ ErlDrvPort port = (ErlDrvPort) p;
char reply[1];
if (buf[0] == START_TIMER) {
diff --git a/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c b/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c
index 1e98844838..b4542f3e36 100644
--- a/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c
+++ b/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c
@@ -50,13 +50,33 @@ typedef struct {
ErlDrvData testcase_drv_start(ErlDrvPort port, char *command);
void testcase_drv_stop(ErlDrvData drv_data);
-void testcase_drv_run(ErlDrvData drv_data, char *buf, int len);
+void testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len);
static ErlDrvEntry testcase_drv_entry = {
NULL,
testcase_drv_start,
testcase_drv_stop,
- testcase_drv_run
+ testcase_drv_run,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+
};
@@ -92,7 +112,7 @@ testcase_drv_stop(ErlDrvData drv_data)
}
void
-testcase_drv_run(ErlDrvData drv_data, char *buf, int len)
+testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len)
{
InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) drv_data;
ErlDrvTermData result_atom;
diff --git a/erts/emulator/test/float_SUITE_data/fp_drv.c b/erts/emulator/test/float_SUITE_data/fp_drv.c
index eb453f6cd6..b80385c3f9 100644
--- a/erts/emulator/test/float_SUITE_data/fp_drv.c
+++ b/erts/emulator/test/float_SUITE_data/fp_drv.c
@@ -22,6 +22,7 @@
# define PRINTF(X)
#endif
+#include <string.h>
#include <math.h>
#ifdef __WIN32__
#include <float.h>
@@ -37,7 +38,8 @@ int _finite(double x);
#define ERTS_FP_CONTROL_TEST 0
#define ERTS_FP_THREAD_TEST 1
-static int control(ErlDrvData, unsigned int, char *, int, char **, int);
+static ErlDrvSSizeT control(ErlDrvData, unsigned int, char *,
+ ErlDrvSizeT, char **, ErlDrvSizeT);
static ErlDrvEntry fp_drv_entry = {
NULL /* init */,
@@ -97,10 +99,10 @@ do_test(void *unused)
return "ok";
}
-static int control(ErlDrvData drv_data,
- unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen)
+static ErlDrvSSizeT control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen)
{
char *res_str;
PRINTF(("control(%p, %d, ...) called\r\n", drv_data, command));
diff --git a/erts/emulator/test/port_SUITE_data/echo_drv.c b/erts/emulator/test/port_SUITE_data/echo_drv.c
index 25eda116fe..1d39c6a00c 100644
--- a/erts/emulator/test/port_SUITE_data/echo_drv.c
+++ b/erts/emulator/test/port_SUITE_data/echo_drv.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <string.h>
#include "erl_driver.h"
@@ -17,11 +18,9 @@ typedef struct _erl_drv_data EchoDrvData;
static EchoDrvData *echo_drv_start(ErlDrvPort port, char *command);
static void echo_drv_stop(EchoDrvData *data_p);
-static void echo_drv_output(EchoDrvData *data_p, char *buf, int len);
+static void echo_drv_output(ErlDrvData drv_data, char *buf,
+ ErlDrvSizeT len);
static void echo_drv_finish(void);
-static int echo_drv_control(EchoDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen);
static ErlDrvEntry echo_drv_entry = {
NULL, /* init */
@@ -33,10 +32,20 @@ static ErlDrvEntry echo_drv_entry = {
"echo_drv",
echo_drv_finish,
NULL, /* handle */
- echo_drv_control,
+ NULL, /* control */
NULL, /* timeout */
NULL, /* outputv */
- NULL /* ready_async */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
@@ -68,7 +77,8 @@ static EchoDrvData *echo_drv_start(ErlDrvPort port, char *command) {
static void echo_drv_stop(EchoDrvData *data_p) {
}
-static void echo_drv_output(EchoDrvData *data_p, char *buf, int len) {
+static void echo_drv_output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) {
+ EchoDrvData *data_p = (EchoDrvData *) drv_data;
void *void_ptr;
ErlDrvPort port = void_ptr = data_p;
@@ -77,9 +87,3 @@ static void echo_drv_output(EchoDrvData *data_p, char *buf, int len) {
static void echo_drv_finish() {
}
-
-static int echo_drv_control(EchoDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen) {
- return 0;
-}
diff --git a/erts/emulator/test/port_SUITE_data/exit_drv.c b/erts/emulator/test/port_SUITE_data/exit_drv.c
index 60f1b321bd..5f366b3545 100644
--- a/erts/emulator/test/port_SUITE_data/exit_drv.c
+++ b/erts/emulator/test/port_SUITE_data/exit_drv.c
@@ -5,11 +5,9 @@ typedef struct _erl_drv_data ExitDrvData;
static ExitDrvData *exit_drv_start(ErlDrvPort port, char *command);
static void exit_drv_stop(ExitDrvData *data_p);
-static void exit_drv_output(ExitDrvData *data_p, char *buf, int len);
+static void exit_drv_output(ExitDrvData *data_p, char *buf,
+ ErlDrvSizeT len);
static void exit_drv_finish(void);
-static int exit_drv_control(ExitDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen);
static ErlDrvEntry exit_drv_entry = {
NULL, /* init */
@@ -21,10 +19,20 @@ static ErlDrvEntry exit_drv_entry = {
"exit_drv",
exit_drv_finish,
NULL, /* handle */
- exit_drv_control,
+ NULL, /* control */
NULL, /* timeout */
NULL, /* outputv */
- NULL /* ready_async */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
DRIVER_INIT(exit_drv)
@@ -45,7 +53,7 @@ exit_drv_stop(ExitDrvData *datap)
}
static void
-exit_drv_output(ExitDrvData *datap, char *buf, int len)
+exit_drv_output(ExitDrvData *datap, char *buf, ErlDrvSizeT len)
{
driver_exit((ErlDrvPort) datap, 0);
}
@@ -55,14 +63,3 @@ exit_drv_finish(void)
{
}
-
-static int
-exit_drv_control(ExitDrvData *datap,
- unsigned int command,
- char *buf,
- int len,
- char **rbuf,
- int rlen)
-{
- return 0;
-}
diff --git a/erts/emulator/test/port_SUITE_data/failure_drv.c b/erts/emulator/test/port_SUITE_data/failure_drv.c
index 34d48e00f8..5826e6d5a9 100644
--- a/erts/emulator/test/port_SUITE_data/failure_drv.c
+++ b/erts/emulator/test/port_SUITE_data/failure_drv.c
@@ -5,10 +5,8 @@ typedef struct _erl_drv_data FailureDrvData;
static FailureDrvData *failure_drv_start(ErlDrvPort, char *);
static void failure_drv_stop(FailureDrvData *);
-static void failure_drv_output(FailureDrvData *, char *, int);
+static void failure_drv_output(ErlDrvData, char *, ErlDrvSizeT);
static void failure_drv_finish(void);
-static int failure_drv_control(FailureDrvData *, unsigned int,
- char *, int, char **, int);
static ErlDrvEntry failure_drv_entry = {
NULL, /* init */
@@ -18,12 +16,22 @@ static ErlDrvEntry failure_drv_entry = {
NULL, /* ready_input */
NULL, /* ready_output */
"failure_drv",
- failure_drv_finish,
+ NULL, /* finish */
NULL, /* handle */
- failure_drv_control,
+ NULL, /* control */
NULL, /* timeout */
NULL, /* outputv */
- NULL /* ready_async */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
@@ -46,7 +54,8 @@ static FailureDrvData *failure_drv_start(ErlDrvPort port, char *command) {
static void failure_drv_stop(FailureDrvData *data_p) {
}
-static void failure_drv_output(FailureDrvData *data_p, char *buf, int len) {
+static void failure_drv_output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) {
+ FailureDrvData *data_p = (FailureDrvData *) drv_data;
void *void_ptr;
ErlDrvPort port = void_ptr = data_p;
@@ -55,9 +64,3 @@ static void failure_drv_output(FailureDrvData *data_p, char *buf, int len) {
static void failure_drv_finish() {
}
-
-static int failure_drv_control(FailureDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen) {
- return 0;
-}
diff --git a/erts/emulator/test/port_bif_SUITE_data/control_drv.c b/erts/emulator/test/port_bif_SUITE_data/control_drv.c
index e9f57a887a..b937a8bb15 100644
--- a/erts/emulator/test/port_bif_SUITE_data/control_drv.c
+++ b/erts/emulator/test/port_bif_SUITE_data/control_drv.c
@@ -1,13 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "erl_driver.h"
static ErlDrvPort erlang_port;
static ErlDrvData control_start(ErlDrvPort, char*);
static void control_stop(ErlDrvData);
-static void control_read(ErlDrvData, char*, int);
-static int control_control(ErlDrvData, unsigned int, char*, int, char**, int);
+static void control_read(ErlDrvData, char*, ErlDrvSizeT);
+static ErlDrvSSizeT control_control(ErlDrvData, unsigned int, char*,
+ ErlDrvSizeT, char**, ErlDrvSizeT);
static ErlDrvEntry control_driver_entry =
{
@@ -21,9 +23,19 @@ static ErlDrvEntry control_driver_entry =
NULL,
NULL,
control_control,
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
NULL,
NULL,
- NULL
};
DRIVER_INIT(control_drv)
@@ -41,7 +53,7 @@ static ErlDrvData control_start(ErlDrvPort port,char *buf)
return (ErlDrvData)port;
}
-static void control_read(ErlDrvData port, char *buf, int count)
+static void control_read(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
driver_output(erlang_port, buf, count);
}
@@ -51,8 +63,9 @@ static void control_stop(ErlDrvData port)
erlang_port = (ErlDrvPort)-1;
}
-static int control_control(ErlDrvData port, unsigned command, char* buf, int count,
- char** res, int res_size)
+static ErlDrvSSizeT control_control(ErlDrvData port, unsigned command,
+ char* buf, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size)
{
switch (command) {
case 'e':
diff --git a/erts/emulator/test/send_term_SUITE_data/send_term_drv.c b/erts/emulator/test/send_term_SUITE_data/send_term_drv.c
index 165cce2e9d..b3feca79f0 100644
--- a/erts/emulator/test/send_term_SUITE_data/send_term_drv.c
+++ b/erts/emulator/test/send_term_SUITE_data/send_term_drv.c
@@ -24,7 +24,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData send_term_drv_start(ErlDrvPort port, char *command);
static void send_term_drv_stop(ErlDrvData drv_data);
-static void send_term_drv_run(ErlDrvData drv_data, char *buf, int len);
+static void send_term_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len);
static int make_ext_term_list(ErlDrvTermData *td, int bad);
@@ -39,6 +39,22 @@ static ErlDrvEntry send_term_drv_entry = {
NULL,
NULL,
"send_term_drv",
+ NULL,
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
DRIVER_INIT(send_term_drv)
@@ -64,7 +80,7 @@ static void send_term_drv_stop(ErlDrvData drv_data)
static void output_term(ErlDrvTermData* msg, int len);
static void fail_term(ErlDrvTermData* msg, int len, int line);
-static void send_term_drv_run(ErlDrvData port, char *buf, int count)
+static void send_term_drv_run(ErlDrvData port, char *buf, ErlDrvSizeT count)
{
char buf7[1024];
ErlDrvTermData spec[1024];
diff --git a/erts/emulator/test/system_profile_SUITE_data/echo_drv.c b/erts/emulator/test/system_profile_SUITE_data/echo_drv.c
index d968ff06f9..e0b6ff804c 100644
--- a/erts/emulator/test/system_profile_SUITE_data/echo_drv.c
+++ b/erts/emulator/test/system_profile_SUITE_data/echo_drv.c
@@ -9,11 +9,9 @@ static EchoDrvData echo_drv_data, *echo_drv_data_p;
static EchoDrvData *echo_drv_start(ErlDrvPort port, char *command);
static void echo_drv_stop(EchoDrvData *data_p);
-static void echo_drv_output(EchoDrvData *data_p, char *buf, int len);
+static void echo_drv_output(ErlDrvData drv_data, char *buf,
+ ErlDrvSizeT len);
static void echo_drv_finish(void);
-static int echo_drv_control(EchoDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen);
static ErlDrvEntry echo_drv_entry = {
NULL, /* init */
@@ -25,10 +23,21 @@ static ErlDrvEntry echo_drv_entry = {
"echo_drv",
echo_drv_finish,
NULL, /* handle */
- echo_drv_control,
+ NULL, /* control */
NULL, /* timeout */
NULL, /* outputv */
- NULL /* ready_async */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
+
};
DRIVER_INIT(echo_drv)
@@ -51,16 +60,11 @@ static void echo_drv_stop(EchoDrvData *data_p) {
echo_drv_data_p = NULL;
}
-static void echo_drv_output(EchoDrvData *data_p, char *buf, int len) {
+static void echo_drv_output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) {
+ EchoDrvData* data_p = (EchoDrvData *) drv_data;
driver_output(data_p->erlang_port, buf, len);
}
static void echo_drv_finish() {
echo_drv_data_p = NULL;
}
-
-static int echo_drv_control(EchoDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen) {
- return 0;
-}
diff --git a/erts/emulator/test/trace_port_SUITE_data/echo_drv.c b/erts/emulator/test/trace_port_SUITE_data/echo_drv.c
index 15c4ca11fe..a8d4ede4fe 100644
--- a/erts/emulator/test/trace_port_SUITE_data/echo_drv.c
+++ b/erts/emulator/test/trace_port_SUITE_data/echo_drv.c
@@ -25,12 +25,14 @@ static EchoDrvData echo_drv_data, *echo_drv_data_p;
**/
static EchoDrvData *echo_drv_start(ErlDrvPort port, char *command);
-static void echo_drv_stop(EchoDrvData *data_p);
-static void echo_drv_output(EchoDrvData *data_p, char *buf, int len);
+static void echo_drv_stop(ErlDrvData drv_data);
+static void echo_drv_output(ErlDrvData drv_data, char *buf,
+ ErlDrvSizeT len);
static void echo_drv_finish(void);
-static int echo_drv_control(EchoDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen);
+static ErlDrvSSizeT echo_drv_control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen);
static ErlDrvEntry echo_drv_entry = {
NULL, /* init */
@@ -45,11 +47,19 @@ static ErlDrvEntry echo_drv_entry = {
echo_drv_control,
NULL, /* timeout */
NULL, /* outputv */
- NULL /* ready_async */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL
};
-
-
/* -------------------------------------------------------------------------
** Entry functions
**/
@@ -75,7 +85,8 @@ static void echo_drv_stop(EchoDrvData *data_p) {
echo_drv_data_p = NULL;
}
-static void echo_drv_output(EchoDrvData *data_p, char *buf, int len) {
+static void echo_drv_output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) {
+ EchoDrvData* data_p = (EchoDrvData *) drv_data;
driver_output(data_p->erlang_port, buf, len);
switch (data_p->heavy) {
case heavy_off:
@@ -95,9 +106,11 @@ static void echo_drv_finish() {
echo_drv_data_p = NULL;
}
-static int echo_drv_control(EchoDrvData *data_p, unsigned int command,
- char *buf, int len,
- char **rbuf, int rlen) {
+static ErlDrvSSizeT echo_drv_control(ErlDrvData drv_data,
+ unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen) {
+ EchoDrvData* data_p = (EchoDrvData *) drv_data;
switch (command) {
case 'h':
data_p->heavy = heavy_set;
diff --git a/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c b/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c
index 80811fb973..1c71ea8567 100644
--- a/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c
+++ b/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c
@@ -18,14 +18,17 @@
*/
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
#include "erl_interface.h"
#include "erl_driver.h"
static ErlDrvPort my_erlang_port;
static ErlDrvData echo_start(ErlDrvPort, char *);
-static void from_erlang(ErlDrvData, char*, int);
-static int do_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags);
+static void from_erlang(ErlDrvData, char*, ErlDrvSizeT);
+static ErlDrvSSizeT do_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len, char **rbuf,
+ ErlDrvSizeT rlen, unsigned *ret_flags);
static ErlDrvEntry echo_driver_entry = {
NULL, /* Init */
echo_start,
@@ -41,7 +44,15 @@ static ErlDrvEntry echo_driver_entry = {
NULL,
NULL,
NULL,
- do_call
+ do_call,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
DRIVER_INIT(echo_drv)
@@ -56,14 +67,14 @@ echo_start(ErlDrvPort port, char *buf)
}
static void
-from_erlang(ErlDrvData data, char *buf, int count)
+from_erlang(ErlDrvData data, char *buf, ErlDrvSizeT count)
{
driver_output((ErlDrvPort) data, buf, count);
}
-static int
+static ErlDrvSSizeT
do_call(ErlDrvData drv_data, unsigned int command, char *buf,
- int len, char **rbuf, int rlen, unsigned *ret_flags)
+ ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen, unsigned *ret_flags)
{
int nlen;
ei_x_buff x;
diff --git a/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c b/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c
index dcbb3348d8..aa182b0877 100644
--- a/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c
+++ b/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c
@@ -3,7 +3,7 @@
static ErlDrvPort erlang_port;
static ErlDrvData echo_start(ErlDrvPort, char *);
-static void echo_stop(ErlDrvData), echo_read(ErlDrvData, char*, int);
+static void echo_stop(ErlDrvData), echo_read(ErlDrvData, char*, ErlDrvSizeT);
static ErlDrvEntry echo_driver_entry = {
NULL,
@@ -13,7 +13,22 @@ static ErlDrvEntry echo_driver_entry = {
NULL,
NULL,
"echo_drv",
- NULL
+ NULL,
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
+ NULL, /* ready_async */
+ NULL,
+ NULL,
+ NULL,
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
DRIVER_INIT(echo_drv)
@@ -31,7 +46,7 @@ static ErlDrvData echo_start(ErlDrvPort port,char *buf)
return (ErlDrvData)port;
}
-static void echo_read(ErlDrvData data, char *buf, int count)
+static void echo_read(ErlDrvData data, char *buf, ErlDrvSizeT count)
{
driver_output(erlang_port, buf, count);
}
diff --git a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src
index 9b4f717201..26991d3412 100644
--- a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src
+++ b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src
@@ -60,18 +60,11 @@
#define NUL 0x0
#if defined(MEGACO_REENTRANT_FLEX_SCANNER)
- #define MEGACO_EXTENDED_MARKER ERL_DRV_EXTENDED_MARKER
- #define MEGACO_DRIVER_FLAGS ERL_DRV_FLAG_USE_PORT_LOCKING
- #define MEGACO_EXTENDED_MAJOR_VERSION ERL_DRV_EXTENDED_MAJOR_VERSION
- #define MEGACO_EXTENDED_MINOR_VERSION ERL_DRV_EXTENDED_MINOR_VERSION
-#else
- #define MEGACO_EXTENDED_MARKER 0
- #define MEGACO_DRIVER_FLAGS 0
- #define MEGACO_EXTENDED_MAJOR_VERSION 0
- #define MEGACO_EXTENDED_MINOR_VERSION 0
+# define MEGACO_DRIVER_FLAGS ERL_DRV_FLAG_USE_PORT_LOCKING
+#else
+# define MEGACO_DRIVER_FLAGS 0
#endif
-
#define FREE(bufP) driver_free(bufP)
#define ALLOC(sz) driver_alloc(sz)
#define REALLOC(bufP, sz) driver_realloc(bufP, sz)
@@ -320,11 +313,11 @@ static void mfs_load_map_token();
static ErlDrvData mfs_start(ErlDrvPort port, char *buf);
static void mfs_stop(ErlDrvData handle);
static void mfs_command(ErlDrvData handle,
- char *buf, int buf_len);
-static int mfs_control(ErlDrvData handle,
+ char *buf, ErlDrvSizeT buf_len);
+static ErlDrvSSizeT mfs_control(ErlDrvData handle,
unsigned int command,
- char *buf, int buf_len,
- char **res_buf, int res_buf_len);
+ char *buf, ErlDrvSizeT buf_len,
+ char **res_buf, ErlDrvSizeT res_buf_len);
static void mfs_finish(void);
/*
@@ -348,10 +341,10 @@ static ErlDrvEntry mfs_entry = {
NULL, /* flush, port is about to be closed */
NULL, /* call, a syncronous call into the driver */
NULL, /* event, event selected by driver_event() has occurred */
- MEGACO_EXTENDED_MARKER, /* extended_marker, which we use if reentrant */
- MEGACO_EXTENDED_MAJOR_VERSION, /* major_version, ... */
- MEGACO_EXTENDED_MINOR_VERSION, /* minor_version, ... */
- MEGACO_DRIVER_FLAGS, /* driver_flags, used for port lock indication */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ MEGACO_DRIVER_FLAGS, /* driver_flags, used for port lock indication */
NULL, /* handle2, emulator internal use */
NULL /* process_exit, Called when a process monitor fires */
};
@@ -1685,17 +1678,17 @@ static void mfs_stop(ErlDrvData handle)
}
static void mfs_command(ErlDrvData handle,
- char *buf, int buf_len)
+ char *buf, ErlDrvSizeT buf_len)
{
driver_failure_atom(((MfsErlDrvData*) handle)->port, "bad_usage");
return;
}
-static int mfs_control(ErlDrvData handle,
+static ErlDrvSSizeT mfs_control(ErlDrvData handle,
unsigned int command,
- char *buf, int buf_len,
- char **res_buf, int res_buf_len)
+ char *buf, ErlDrvSizeT buf_len,
+ char **res_buf, ErlDrvSizeT res_buf_len)
{
MfsErlDrvData* dataP = (MfsErlDrvData*) handle;
char* tmp;
diff --git a/lib/runtime_tools/c_src/trace_file_drv.c b/lib/runtime_tools/c_src/trace_file_drv.c
index 5de2a65917..08bace80ef 100644
--- a/lib/runtime_tools/c_src/trace_file_drv.c
+++ b/lib/runtime_tools/c_src/trace_file_drv.c
@@ -173,11 +173,13 @@ static TraceFileData *first_data;
*/
static ErlDrvData trace_file_start(ErlDrvPort port, char *buff);
static void trace_file_stop(ErlDrvData handle);
-static void trace_file_output(ErlDrvData handle, char *buff, int bufflen);
+static void trace_file_output(ErlDrvData handle, char *buff,
+ ErlDrvSizeT bufflen);
static void trace_file_finish(void);
-static int trace_file_control(ErlDrvData handle, unsigned int command,
- char* buff, int count,
- char** res, int res_size);
+static ErlDrvSSizeT trace_file_control(ErlDrvData handle,
+ unsigned int command,
+ char* buff, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size);
static void trace_file_timeout(ErlDrvData handle);
/*
@@ -215,7 +217,18 @@ ErlDrvEntry trace_file_driver_entry = {
NULL, /* void * that is not used (BC) */
trace_file_control, /* F_PTR control, port_control callback */
trace_file_timeout, /* F_PTR timeout, driver_set_timer callback */
- NULL /* F_PTR outputv, reserved */
+ NULL, /* F_PTR outputv, reserved */
+ NULL, /* ready_async */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL, /* event */
+ ERL_DRV_EXTENDED_MARKER,
+ ERL_DRV_EXTENDED_MAJOR_VERSION,
+ ERL_DRV_EXTENDED_MINOR_VERSION,
+ 0,
+ NULL,
+ NULL,
+ NULL,
};
/*
@@ -351,7 +364,8 @@ static void trace_file_stop(ErlDrvData handle)
/*
** Data sent from erlang to port.
*/
-static void trace_file_output(ErlDrvData handle, char *buff, int bufflen)
+static void trace_file_output(ErlDrvData handle, char *buff,
+ ErlDrvSizeT bufflen)
{
int heavy = 0;
TraceFileData *data = (TraceFileData *) handle;
@@ -395,9 +409,10 @@ static void trace_file_output(ErlDrvData handle, char *buff, int bufflen)
/*
** Control message from erlang, we handle $f, which is flush.
*/
-static int trace_file_control(ErlDrvData handle, unsigned int command,
- char* buff, int count,
- char** res, int res_size)
+static ErlDrvSSizeT trace_file_control(ErlDrvData handle,
+ unsigned int command,
+ char* buff, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size)
{
if (command == 'f') {
TraceFileData *data = (TraceFileData *) handle;
diff --git a/lib/runtime_tools/c_src/trace_ip_drv.c b/lib/runtime_tools/c_src/trace_ip_drv.c
index d2ed1a294b..713ae924f6 100644
--- a/lib/runtime_tools/c_src/trace_ip_drv.c
+++ b/lib/runtime_tools/c_src/trace_ip_drv.c
@@ -185,7 +185,8 @@ static TraceIpData *first_data;
*/
static ErlDrvData trace_ip_start(ErlDrvPort port, char *buff);
static void trace_ip_stop(ErlDrvData handle);
-static void trace_ip_output(ErlDrvData handle, char *buff, int bufflen);
+static void trace_ip_output(ErlDrvData handle, char *buff,
+ ErlDrvSizeT bufflen);
#ifdef __WIN32__
static void trace_ip_event(ErlDrvData handle, ErlDrvEvent event);
#endif
@@ -193,9 +194,10 @@ static void trace_ip_ready_input(ErlDrvData handle, ErlDrvEvent fd);
static void trace_ip_ready_output(ErlDrvData handle, ErlDrvEvent fd);
static void trace_ip_finish(void); /* No arguments, despite what might be stated
in any documentation */
-static int trace_ip_control(ErlDrvData handle, unsigned int command,
- char* buff, int count,
- char** res, int res_size);
+static ErlDrvSSizeT trace_ip_control(ErlDrvData handle,
+ unsigned int command,
+ char* buff, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size);
/*
** Internal routines
@@ -382,7 +384,7 @@ static void trace_ip_stop(ErlDrvData handle)
/*
** Data sent from erlang to port.
*/
-static void trace_ip_output(ErlDrvData handle, char *buff, int bufflen)
+static void trace_ip_output(ErlDrvData handle, char *buff, ErlDrvSizeT bufflen)
{
TraceIpData *data = (TraceIpData *) handle;
if (data->flags & FLAG_LISTEN_PORT) {
@@ -548,9 +550,10 @@ static void trace_ip_ready_output(ErlDrvData handle, ErlDrvEvent fd)
/*
** Control message from erlang, we handle $p, which is get_listen_port.
*/
-static int trace_ip_control(ErlDrvData handle, unsigned int command,
- char* buff, int count,
- char** res, int res_size)
+static ErlDrvSSizeT trace_ip_control(ErlDrvData handle,
+ unsigned int command,
+ char* buff, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size)
{
register void *void_ptr; /* Soft type cast */
diff --git a/lib/wx/c_src/wxe_driver.c b/lib/wx/c_src/wxe_driver.c
index 2404b13cc3..d1ed252ec0 100644
--- a/lib/wx/c_src/wxe_driver.c
+++ b/lib/wx/c_src/wxe_driver.c
@@ -40,9 +40,14 @@ static ErlDrvData wxe_driver_start(ErlDrvPort port, char *buff);
static int wxe_driver_load(void);
static void wxe_driver_stop(ErlDrvData handle);
static void wxe_driver_unload(void);
-static int wxe_driver_control(ErlDrvData handle, unsigned int command,
- char* buf, int count, char** res, int res_size);
-static int wxe_driver_call(ErlDrvData drv_data, unsigned int command, char *buf, int len, char **rbuf, int rlen, unsigned int *flags);
+static ErlDrvSSizeT wxe_driver_control(ErlDrvData handle,
+ unsigned int command,
+ char* buf, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size);
+static ErlDrvSSizeT wxe_driver_call(ErlDrvData drv_data, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **rbuf, ErlDrvSizeT rlen,
+ unsigned int *flags);
static void standard_outputv(ErlDrvData drv_data, ErlIOVec *ev);
static void wxe_process_died(ErlDrvData drv_data, ErlDrvMonitor *monitor);
@@ -151,17 +156,20 @@ wxe_driver_unload(void)
wxe_master = NULL;
}
-static int
+static ErlDrvSSizeT
wxe_driver_control(ErlDrvData handle, unsigned op,
- char* buf, int count, char** res, int res_size)
+ char* buf, ErlDrvSizeT count,
+ char** res, ErlDrvSizeT res_size)
{
wxe_data *sd = ((wxe_data *)handle);
push_command(op,buf,count,sd);
return 0;
}
-static int wxe_driver_call(ErlDrvData handle, unsigned int command,
- char *buf, int len, char **res, int rlen, unsigned int *flags)
+static ErlDrvSSizeT
+wxe_driver_call(ErlDrvData handle, unsigned int command,
+ char *buf, ErlDrvSizeT len,
+ char **res, ErlDrvSizeT rlen, unsigned int *flags)
{
wxe_data *sd = ((wxe_data *)handle);
if(command == WXE_DEBUG_DRIVER) {