mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 17:20:29 +02:00
Add file descriptor finalizers
* doc/ref/posix.texi (Ports and File Descriptors): Document new interfaces. * libguile/filesys.c (scm_close, scm_close_fdes) * libguile/fports.c (fport_close): * libguile/ioext.c (scm_primitive_move_to_fdes): Call scm_run_fdes_finalizers. * module/ice-9/fdes-finalizers.scm: * test-suite/tests/fdes-finalizers.test: * libguile/fdes-finalizers.h: * libguile/fdes-finalizers.c: New files. * module/Makefile.am: * test-suite/Makefile.am: * libguile/Makefile.am: * libguile.h: * libguile/init.c: Wire up new files.
This commit is contained in:
parent
4256e0655f
commit
2fa2e50a0f
13 changed files with 314 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "libguile/_scm.h"
|
||||
#include "libguile/dynwind.h"
|
||||
#include "libguile/fdes-finalizers.h"
|
||||
#include "libguile/feature.h"
|
||||
#include "libguile/fports.h"
|
||||
#include "libguile/hashtab.h"
|
||||
|
@ -266,6 +267,7 @@ SCM_DEFINE (scm_primitive_move_to_fdes, "primitive-move->fdes", 2, 0, 0,
|
|||
if (rv == -1)
|
||||
SCM_SYSERROR;
|
||||
stream->fdes = new_fd;
|
||||
scm_run_fdes_finalizers (old_fd);
|
||||
SCM_SYSCALL (close (old_fd));
|
||||
return SCM_BOOL_T;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue