aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc/tutorial/port_driver.c
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2012-11-16 09:39:31 +0100
committerPatrik Nyblom <[email protected]>2012-11-16 09:39:31 +0100
commit662f39df616113351b4083ff3f4e5b27eb1de8a2 (patch)
tree3a0ae4e0fefb1bf2aec9c50bdd61a448c46aa080 /system/doc/tutorial/port_driver.c
parentcb11b4d6ec812813d0df07facc02ac5bd47e6851 (diff)
parentd51f75af306975ba59e5eee1d86bf10ea00135ff (diff)
downloadotp-662f39df616113351b4083ff3f4e5b27eb1de8a2.tar.gz
otp-662f39df616113351b4083ff3f4e5b27eb1de8a2.tar.bz2
otp-662f39df616113351b4083ff3f4e5b27eb1de8a2.zip
Merge branch 'maint'
Diffstat (limited to 'system/doc/tutorial/port_driver.c')
-rw-r--r--system/doc/tutorial/port_driver.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/system/doc/tutorial/port_driver.c b/system/doc/tutorial/port_driver.c
index d428d08ff3..37de67310f 100644
--- a/system/doc/tutorial/port_driver.c
+++ b/system/doc/tutorial/port_driver.c
@@ -19,7 +19,8 @@ static void example_drv_stop(ErlDrvData handle)
driver_free((char*)handle);
}
-static void example_drv_output(ErlDrvData handle, char *buff, int bufflen)
+static void example_drv_output(ErlDrvData handle, char *buff,
+ ErlDrvSizeT bufflen)
{
example_data* d = (example_data*)handle;
char fn = buff[0], arg = buff[1], res;
@@ -32,7 +33,7 @@ static void example_drv_output(ErlDrvData handle, char *buff, int bufflen)
}
ErlDrvEntry example_driver_entry = {
- NULL, /* F_PTR init, N/A */
+ NULL, /* F_PTR init, called when driver is loaded */
example_drv_start, /* L_PTR start, called when port is opened */
example_drv_stop, /* F_PTR stop, called when port is closed */
example_drv_output, /* F_PTR output, called when erlang has sent */
@@ -40,9 +41,30 @@ ErlDrvEntry example_driver_entry = {
NULL, /* F_PTR ready_output, called when output descriptor ready */
"example_drv", /* char *driver_name, the argument to open_port */
NULL, /* F_PTR finish, called when unloaded */
+ NULL, /* void *handle, Reserved by VM */
NULL, /* F_PTR control, port_command callback */
NULL, /* F_PTR timeout, reserved */
- NULL /* F_PTR outputv, reserved */
+ NULL, /* F_PTR outputv, reserved */
+ NULL, /* F_PTR ready_async, only for async drivers */
+ NULL, /* F_PTR flush, called when port is about
+ to be closed, but there is data in driver
+ queue */
+ NULL, /* F_PTR call, much like control, sync call
+ to driver */
+ NULL, /* F_PTR event, called when an event selected
+ by driver_event() occurs. */
+ ERL_DRV_EXTENDED_MARKER, /* int extended marker, Should always be
+ set to indicate driver versioning */
+ ERL_DRV_EXTENDED_MAJOR_VERSION, /* int major_version, should always be
+ set to this value */
+ ERL_DRV_EXTENDED_MINOR_VERSION, /* int minor_version, should always be
+ set to this value */
+ 0, /* int driver_flags, see documentation */
+ NULL, /* void *handle2, reserved for VM use */
+ NULL, /* F_PTR process_exit, called when a
+ monitored process dies */
+ NULL /* F_PTR stop_select, called to close an
+ event object */
};
DRIVER_INIT(example_drv) /* must match name in driver_entry */