From e6aed438fc47f16f44154457a50883373e14ad5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 7 Dec 2011 14:08:12 +0100 Subject: runtime_tools's drivers: Conform to updated driver API --- lib/runtime_tools/c_src/trace_file_drv.c | 33 +++++++++++++++++++++++--------- lib/runtime_tools/c_src/trace_ip_drv.c | 19 ++++++++++-------- 2 files changed, 35 insertions(+), 17 deletions(-) (limited to 'lib/runtime_tools/c_src') diff --git a/lib/runtime_tools/c_src/trace_file_drv.c b/lib/runtime_tools/c_src/trace_file_drv.c index 668f6f4af3..f02bccdf9e 100644 --- a/lib/runtime_tools/c_src/trace_file_drv.c +++ b/lib/runtime_tools/c_src/trace_file_drv.c @@ -176,11 +176,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); /* @@ -212,7 +214,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, }; /* @@ -347,7 +360,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; @@ -391,9 +405,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 */ -- cgit v1.2.3