diff options
Diffstat (limited to 'jim-aio.c')
-rw-r--r-- | jim-aio.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -693,6 +693,23 @@ static int aio_cmd_filename(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } +static int aio_cmd_listen(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + AioFile *af = Jim_CmdPrivData(interp); + long backlog; + + if (Jim_GetLong(interp, argv[0], &backlog) != JIM_OK) { + return JIM_ERR; + } + + if (listen(af->fd, backlog)) { + JimAioSetError(interp, NULL); + return JIM_ERR; + } + + return JIM_OK; +} + #ifdef O_NDELAY static int aio_cmd_ndelay(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { @@ -905,6 +922,13 @@ static const jim_subcmd_type aio_command_table[] = { .function = aio_cmd_filename, .description = "Returns the original filename" }, + { .cmd = "listen", + .args = "backlog", + .function = aio_cmd_listen, + .minargs = 1, + .maxargs = 1, + .description = "Set the listen backlog for server socket" + }, #ifdef O_NDELAY { .cmd = "ndelay", .args = "?0|1?", |