diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-10-24 20:48:47 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-10-24 20:48:47 +0100 |
commit | 15490398d7553605c422d8ab0e59e69e25111df4 (patch) | |
tree | 3a98fd7979403ee3b5b7c39b437eff0f8dcc0a1d /Src/utils.c | |
parent | 1f6dcf9bcdade41886e36826196e79502a9afa26 (diff) | |
download | zsh-15490398d7553605c422d8ab0e59e69e25111df4.tar.gz zsh-15490398d7553605c422d8ab0e59e69e25111df4.tar.xz zsh-15490398d7553605c422d8ab0e59e69e25111df4.zip |
36944: extend fd management to zsocket
Diffstat (limited to 'Src/utils.c')
-rw-r--r-- | Src/utils.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Src/utils.c b/Src/utils.c index 4c69d75a1..37a02c593 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1894,24 +1894,29 @@ redup(int x, int y) /* * Add an fd opened ithin a module. * - * If is_internal is FALSE, the fd can be used within the shell for - * normal I/O but it will not be closed automatically or by normal shell - * syntax; it can only be closed by the module (which should included - * zclose() as part of the sequence). + * fdt is the type of the fd; see the FDT_ definitions in zsh.h. + * The most likely falures are: + * + * FDT_EXTERNAL: the fd can be used within the shell for normal I/O but + * it will not be closed automatically or by normal shell syntax. + * + * FDT_MODULE: as FDT_EXTERNAL, but it can only be closed by the module + * (which should included zclose() as part of the sequence, not by + * the standard shell syntax for closing file descriptors. + * + * FDT_INTERNAL: fd is treated like others created by the shell for + * internall use; it can be closed and will be closed by the shell if it + * exec's or performs an exec with a fork optimised out. * - * If is_internal is TRUE the fd is treated like others created by the - * shell for internall use; it can be closed and will be closed by the - * shell if it exec's or performs an exec with a fork optimised out. - *. * Safe if fd is -1 to indicate failure. */ /**/ mod_export void -addmodulefd(int fd, bool is_internal) +addmodulefd(int fd, int fdt) { if (fd >= 0) { check_fd_table(fd); - fdtable[fd] = is_internal ? FDT_INTERNAL : FDT_MODULE; + fdtable[fd] = fdt; } } |