1 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 * 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 3 of
7 * the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #define _LARGEFILE64_SOURCE /* ask for stat64 etc */
23 #define _GNU_SOURCE /* ask for LONG_LONG_MAX/LONG_LONG_MIN */
41 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
48 #include <sys/types.h>
50 #include <sys/select.h>
52 #include <full-write.h>
54 #include "libguile/_scm.h"
55 #include "libguile/strings.h"
56 #include "libguile/validate.h"
57 #include "libguile/gc.h"
58 #include "libguile/posix.h"
59 #include "libguile/dynwind.h"
60 #include "libguile/hashtab.h"
62 #include "libguile/fports.h"
64 #if SIZEOF_OFF_T == SIZEOF_INT
65 #define OFF_T_MAX INT_MAX
66 #define OFF_T_MIN INT_MIN
67 #elif SIZEOF_OFF_T == SIZEOF_LONG
68 #define OFF_T_MAX LONG_MAX
69 #define OFF_T_MIN LONG_MIN
70 #elif SIZEOF_OFF_T == SIZEOF_LONG_LONG
71 #define OFF_T_MAX LONG_LONG_MAX
72 #define OFF_T_MIN LONG_LONG_MIN
74 #error Oops, unknown OFF_T size
77 scm_t_bits scm_tc16_fport
;
80 /* default buffer size, used if the O/S won't supply a value. */
81 static const size_t default_buffer_size
= 1024;
83 /* create FPORT buffer with specified sizes (or -1 to use default size or
86 scm_fport_buffer_add (SCM port
, long read_size
, int write_size
)
87 #define FUNC_NAME "scm_fport_buffer_add"
89 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
91 if (read_size
== -1 || write_size
== -1)
94 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
96 scm_t_fport
*fp
= SCM_FSTREAM (port
);
98 default_size
= (fstat (fp
->fdes
, &st
) == -1) ? default_buffer_size
101 default_size
= default_buffer_size
;
104 read_size
= default_size
;
105 if (write_size
== -1)
106 write_size
= default_size
;
109 if (SCM_INPUT_PORT_P (port
) && read_size
> 0)
111 pt
->read_buf
= scm_gc_malloc_pointerless (read_size
, "port buffer");
112 pt
->read_pos
= pt
->read_end
= pt
->read_buf
;
113 pt
->read_buf_size
= read_size
;
117 pt
->read_pos
= pt
->read_buf
= pt
->read_end
= &pt
->shortbuf
;
118 pt
->read_buf_size
= 1;
121 if (SCM_OUTPUT_PORT_P (port
) && write_size
> 0)
123 pt
->write_buf
= scm_gc_malloc_pointerless (write_size
, "port buffer");
124 pt
->write_pos
= pt
->write_buf
;
125 pt
->write_buf_size
= write_size
;
129 pt
->write_buf
= pt
->write_pos
= &pt
->shortbuf
;
130 pt
->write_buf_size
= 1;
133 pt
->write_end
= pt
->write_buf
+ pt
->write_buf_size
;
134 if (read_size
> 0 || write_size
> 0)
135 SCM_SET_CELL_WORD_0 (port
, SCM_CELL_WORD_0 (port
) & ~SCM_BUF0
);
137 SCM_SET_CELL_WORD_0 (port
, SCM_CELL_WORD_0 (port
) | SCM_BUF0
);
141 SCM_DEFINE (scm_setvbuf
, "setvbuf", 2, 1, 0,
142 (SCM port
, SCM mode
, SCM size
),
143 "Set the buffering mode for @var{port}. @var{mode} can be:\n"
150 "block buffered, using a newly allocated buffer of @var{size} bytes.\n"
151 "If @var{size} is omitted, a default size will be used.\n"
153 #define FUNC_NAME s_scm_setvbuf
161 port
= SCM_COERCE_OUTPORT (port
);
163 SCM_VALIDATE_OPFPORT (1,port
);
164 cmode
= scm_to_int (mode
);
165 if (cmode
!= _IONBF
&& cmode
!= _IOFBF
&& cmode
!= _IOLBF
)
166 scm_out_of_range (FUNC_NAME
, mode
);
170 SCM_SET_CELL_WORD_0 (port
, SCM_CELL_WORD_0 (port
) | SCM_BUFLINE
);
175 SCM_SET_CELL_WORD_0 (port
, SCM_CELL_WORD_0 (port
) & ~(scm_t_bits
)SCM_BUFLINE
);
178 if (SCM_UNBNDP (size
))
187 csize
= scm_to_int (size
);
188 if (csize
< 0 || (cmode
== _IONBF
&& csize
> 0))
189 scm_out_of_range (FUNC_NAME
, size
);
192 pt
= SCM_PTAB_ENTRY (port
);
194 if (SCM_INPUT_PORT_P (port
))
196 /* Drain pending input from PORT. Don't use `scm_drain_input' since
197 it returns a string, whereas we want binary input here. */
198 ndrained
= pt
->read_end
- pt
->read_pos
;
199 if (pt
->read_buf
== pt
->putback_buf
)
200 ndrained
+= pt
->saved_read_end
- pt
->saved_read_pos
;
204 drained
= scm_gc_malloc_pointerless (ndrained
, "file port");
205 scm_take_from_input_buffers (port
, drained
, ndrained
);
211 if (SCM_OUTPUT_PORT_P (port
))
214 if (pt
->read_buf
== pt
->putback_buf
)
216 pt
->read_buf
= pt
->saved_read_buf
;
217 pt
->read_pos
= pt
->saved_read_pos
;
218 pt
->read_end
= pt
->saved_read_end
;
219 pt
->read_buf_size
= pt
->saved_read_buf_size
;
221 if (pt
->read_buf
!= &pt
->shortbuf
)
222 scm_gc_free (pt
->read_buf
, pt
->read_buf_size
, "port buffer");
223 if (pt
->write_buf
!= &pt
->shortbuf
)
224 scm_gc_free (pt
->write_buf
, pt
->write_buf_size
, "port buffer");
226 scm_fport_buffer_add (port
, csize
, csize
);
229 /* Put DRAINED back to PORT. */
230 while (ndrained
-- > 0)
231 scm_unget_byte (drained
[ndrained
], port
);
233 return SCM_UNSPECIFIED
;
237 /* Move ports with the specified file descriptor to new descriptors,
238 * resetting the revealed count to 0.
241 scm_i_evict_port (void *closure
, SCM port
)
243 int fd
= * (int*) closure
;
245 if (SCM_FPORTP (port
))
250 /* XXX: In some cases, we can encounter a port with no associated ptab
252 p
= SCM_PTAB_ENTRY (port
);
253 fp
= (p
!= NULL
) ? (scm_t_fport
*) p
->stream
: NULL
;
255 if ((fp
!= NULL
) && (fp
->fdes
== fd
))
259 scm_syserror ("scm_evict_ports");
260 scm_set_port_revealed_x (port
, scm_from_int (0));
266 scm_evict_ports (int fd
)
268 scm_c_port_for_each (scm_i_evict_port
, (void *) &fd
);
272 SCM_DEFINE (scm_file_port_p
, "file-port?", 1, 0, 0,
274 "Determine whether @var{obj} is a port that is related to a file.")
275 #define FUNC_NAME s_scm_file_port_p
277 return scm_from_bool (SCM_FPORTP (obj
));
282 static SCM sys_file_port_name_canonicalization
;
283 SCM_SYMBOL (sym_relative
, "relative");
284 SCM_SYMBOL (sym_absolute
, "absolute");
287 fport_canonicalize_filename (SCM filename
)
289 SCM mode
= scm_fluid_ref (sys_file_port_name_canonicalization
);
291 if (!scm_is_string (filename
))
295 else if (scm_is_eq (mode
, sym_relative
))
299 path
= scm_variable_ref (scm_c_module_lookup (scm_the_root_module (),
301 rel
= scm_i_relativize_path (filename
, path
);
303 return scm_is_true (rel
) ? rel
: filename
;
305 else if (scm_is_eq (mode
, sym_absolute
))
309 str
= scm_to_locale_string (filename
);
310 canon
= canonicalize_file_name (str
);
313 return canon
? scm_take_locale_string (canon
) : filename
;
323 * Return a new port open on a given file.
325 * The mode string must match the pattern: [rwa+]** which
326 * is interpreted in the usual unix way.
328 * Return the new port.
330 SCM_DEFINE (scm_open_file
, "open-file", 2, 0, 0,
331 (SCM filename
, SCM mode
),
332 "Open the file whose name is @var{filename}, and return a port\n"
333 "representing that file. The attributes of the port are\n"
334 "determined by the @var{mode} string. The way in which this is\n"
335 "interpreted is similar to C stdio. The first character must be\n"
336 "one of the following:\n"
339 "Open an existing file for input.\n"
341 "Open a file for output, creating it if it doesn't already exist\n"
342 "or removing its contents if it does.\n"
344 "Open a file for output, creating it if it doesn't already\n"
345 "exist. All writes to the port will go to the end of the file.\n"
346 "The \"append mode\" can be turned off while the port is in use\n"
347 "@pxref{Ports and File Descriptors, fcntl}\n"
349 "The following additional characters can be appended:\n"
352 "Open the underlying file in binary mode, if supported by the system.\n"
353 "Also, open the file using the binary-compatible character encoding\n"
354 "\"ISO-8859-1\", ignoring the port's encoding and the coding declaration\n"
355 "at the top of the input file, if any.\n"
357 "Open the port for both input and output. E.g., @code{r+}: open\n"
358 "an existing file for both input and output.\n"
360 "Create an \"unbuffered\" port. In this case input and output\n"
361 "operations are passed directly to the underlying port\n"
362 "implementation without additional buffering. This is likely to\n"
363 "slow down I/O operations. The buffering mode can be changed\n"
364 "while a port is in use @pxref{Ports and File Descriptors,\n"
367 "Add line-buffering to the port. The port output buffer will be\n"
368 "automatically flushed whenever a newline character is written.\n"
370 "When the file is opened, this procedure will scan for a coding\n"
371 "declaration@pxref{Character Encoding of Source Files}. If present\n"
372 "will use that encoding for interpreting the file. Otherwise, the\n"
373 "port's encoding will be used.\n"
375 "In theory we could create read/write ports which were buffered\n"
376 "in one direction only. However this isn't included in the\n"
377 "current interfaces. If a file cannot be opened with the access\n"
378 "requested, @code{open-file} throws an exception.")
379 #define FUNC_NAME s_scm_open_file
382 int fdes
, flags
= 0, use_encoding
= 1;
383 unsigned int retries
;
384 char *file
, *md
, *ptr
;
386 scm_dynwind_begin (0);
388 file
= scm_to_locale_string (filename
);
389 scm_dynwind_free (file
);
391 md
= scm_to_locale_string (mode
);
392 scm_dynwind_free (md
);
400 flags
|= O_WRONLY
| O_CREAT
| O_TRUNC
;
403 flags
|= O_WRONLY
| O_CREAT
| O_APPEND
;
406 scm_out_of_range (FUNC_NAME
, mode
);
414 flags
= (flags
& ~(O_RDONLY
| O_WRONLY
)) | O_RDWR
;
418 #if defined (O_BINARY)
422 case '0': /* unbuffered: handled later. */
423 case 'l': /* line buffered: handled during output. */
426 scm_out_of_range (FUNC_NAME
, mode
);
431 for (retries
= 0, fdes
= -1;
432 fdes
< 0 && retries
< 2;
435 SCM_SYSCALL (fdes
= open_or_open64 (file
, flags
, 0666));
440 if (en
== EMFILE
&& retries
== 0)
441 /* Run the GC in case it collects open file ports that are no
442 longer referenced. */
443 scm_i_gc (FUNC_NAME
);
445 SCM_SYSERROR_MSG ("~A: ~S",
446 scm_cons (scm_strerror (scm_from_int (en
)),
447 scm_cons (filename
, SCM_EOL
)), en
);
451 /* Create a port from this file descriptor. The port's encoding is initially
452 %default-port-encoding. */
453 port
= scm_i_fdes_to_port (fdes
, scm_i_mode_bits (mode
),
454 fport_canonicalize_filename (filename
));
458 /* If this file has a coding declaration, use that as the port
460 if (SCM_INPUT_PORT_P (port
))
462 char *enc
= scm_i_scan_for_encoding (port
);
464 scm_i_set_port_encoding_x (port
, enc
);
468 /* If this is a binary file, use the binary-friendly ISO-8859-1
470 scm_i_set_port_encoding_x (port
, NULL
);
479 /* Building Guile ports from a file descriptor. */
481 /* Build a Scheme port from an open file descriptor `fdes'.
482 MODE indicates whether FILE is open for reading or writing; it uses
483 the same notation as open-file's second argument.
484 NAME is a string to be used as the port's filename.
487 scm_i_fdes_to_port (int fdes
, long mode_bits
, SCM name
)
488 #define FUNC_NAME "scm_fdes_to_port"
493 /* Test that fdes is valid. */
495 int flags
= fcntl (fdes
, F_GETFL
, 0);
500 && ((flags
!= O_WRONLY
&& (mode_bits
& SCM_WRTNG
))
501 || (flags
!= O_RDONLY
&& (mode_bits
& SCM_RDNG
))))
503 SCM_MISC_ERROR ("requested file mode not available on fdes", SCM_EOL
);
506 /* If we don't have F_GETFL, as on mingw, at least we can test that
507 it is a valid file descriptor. */
509 if (fstat (fdes
, &st
) != 0)
513 scm_i_scm_pthread_mutex_lock (&scm_i_port_table_mutex
);
515 port
= scm_new_port_table_entry (scm_tc16_fport
);
516 SCM_SET_CELL_TYPE(port
, scm_tc16_fport
| mode_bits
);
517 pt
= SCM_PTAB_ENTRY(port
);
520 = (scm_t_fport
*) scm_gc_malloc_pointerless (sizeof (scm_t_fport
),
524 pt
->rw_random
= SCM_FDES_RANDOM_P (fdes
);
525 SCM_SETSTREAM (port
, fp
);
526 if (mode_bits
& SCM_BUF0
)
527 scm_fport_buffer_add (port
, 0, 0);
529 scm_fport_buffer_add (port
, -1, -1);
531 SCM_SET_FILENAME (port
, name
);
532 scm_i_pthread_mutex_unlock (&scm_i_port_table_mutex
);
538 scm_fdes_to_port (int fdes
, char *mode
, SCM name
)
540 return scm_i_fdes_to_port (fdes
, scm_mode_bits (mode
), name
);
543 /* Return a lower bound on the number of bytes available for input. */
545 fport_input_waiting (SCM port
)
547 int fdes
= SCM_FSTREAM (port
)->fdes
;
549 /* `FD_SETSIZE', which is 1024 on GNU systems, effectively limits the
550 highest numerical value of file descriptors that can be monitored.
551 Thus, use poll(2) whenever that is possible. */
553 #if defined(HAVE_POLL) && defined(HAVE_STRUCT_POLLFD)
554 struct pollfd pollfd
= { fdes
, POLLIN
, 0 };
556 if (poll (&pollfd
, 1, 0) < 0)
557 scm_syserror ("fport_input_waiting");
559 return pollfd
.revents
& POLLIN
? 1 : 0;
562 struct timeval timeout
;
568 FD_ZERO (&write_set
);
569 FD_ZERO (&except_set
);
571 if (fdes
< FD_SETSIZE
)
572 FD_SET (fdes
, &read_set
);
574 scm_out_of_range ("fport_input_waiting", scm_from_int (fdes
));
579 if (select (fdes
+ 1,
580 &read_set
, &write_set
, &except_set
, &timeout
)
582 scm_syserror ("fport_input_waiting");
583 return FD_ISSET (fdes
, &read_set
) ? 1 : 0;
589 fport_print (SCM exp
, SCM port
, scm_print_state
*pstate SCM_UNUSED
)
591 scm_puts ("#<", port
);
592 scm_print_port_mode (exp
, port
);
593 if (SCM_OPFPORTP (exp
))
596 SCM name
= SCM_FILENAME (exp
);
597 if (scm_is_string (name
) || scm_is_symbol (name
))
598 scm_display (name
, port
);
600 scm_puts (SCM_PTOBNAME (SCM_PTOBNUM (exp
)), port
);
601 scm_putc (' ', port
);
602 fdes
= (SCM_FSTREAM (exp
))->fdes
;
604 #if (defined HAVE_TTYNAME) && (defined HAVE_POSIX)
606 scm_display (scm_ttyname (exp
), port
);
608 #endif /* HAVE_TTYNAME */
609 scm_intprint (fdes
, 10, port
);
613 scm_puts (SCM_PTOBNAME (SCM_PTOBNUM (exp
)), port
);
614 scm_putc (' ', port
);
615 scm_uintprint ((scm_t_bits
) SCM_PTAB_ENTRY (exp
), 16, port
);
617 scm_putc ('>', port
);
621 static void fport_flush (SCM port
);
623 /* fill a port's read-buffer with a single read. returns the first
624 char or EOF if end of file. */
626 fport_fill_input (SCM port
)
629 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
630 scm_t_fport
*fp
= SCM_FSTREAM (port
);
632 SCM_SYSCALL (count
= read (fp
->fdes
, pt
->read_buf
, pt
->read_buf_size
));
634 scm_syserror ("fport_fill_input");
636 return (scm_t_wchar
) EOF
;
639 pt
->read_pos
= pt
->read_buf
;
640 pt
->read_end
= pt
->read_buf
+ count
;
641 return *pt
->read_buf
;
646 fport_seek (SCM port
, scm_t_off offset
, int whence
)
648 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
649 scm_t_fport
*fp
= SCM_FSTREAM (port
);
651 off_t_or_off64_t result
;
653 if (pt
->rw_active
== SCM_PORT_WRITE
)
655 if (offset
!= 0 || whence
!= SEEK_CUR
)
658 result
= rv
= lseek_or_lseek64 (fp
->fdes
, offset
, whence
);
662 /* read current position without disturbing the buffer. */
663 rv
= lseek_or_lseek64 (fp
->fdes
, offset
, whence
);
664 result
= rv
+ (pt
->write_pos
- pt
->write_buf
);
667 else if (pt
->rw_active
== SCM_PORT_READ
)
669 if (offset
!= 0 || whence
!= SEEK_CUR
)
671 /* could expand to avoid a second seek. */
672 scm_end_input (port
);
673 result
= rv
= lseek_or_lseek64 (fp
->fdes
, offset
, whence
);
677 /* read current position without disturbing the buffer
678 (particularly the unread-char buffer). */
679 rv
= lseek_or_lseek64 (fp
->fdes
, offset
, whence
);
680 result
= rv
- (pt
->read_end
- pt
->read_pos
);
682 if (pt
->read_buf
== pt
->putback_buf
)
683 result
-= pt
->saved_read_end
- pt
->saved_read_pos
;
686 else /* SCM_PORT_NEITHER */
688 result
= rv
= lseek_or_lseek64 (fp
->fdes
, offset
, whence
);
692 scm_syserror ("fport_seek");
698 fport_truncate (SCM port
, scm_t_off length
)
700 scm_t_fport
*fp
= SCM_FSTREAM (port
);
702 if (ftruncate (fp
->fdes
, length
) == -1)
703 scm_syserror ("ftruncate");
707 fport_write (SCM port
, const void *data
, size_t size
)
708 #define FUNC_NAME "fport_write"
710 /* this procedure tries to minimize the number of writes/flushes. */
711 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
713 if (pt
->write_buf
== &pt
->shortbuf
714 || (pt
->write_pos
== pt
->write_buf
&& size
>= pt
->write_buf_size
))
716 /* Unbuffered port, or port with empty buffer and data won't fit in
718 if (full_write (SCM_FPORT_FDES (port
), data
, size
) < size
)
725 scm_t_off space
= pt
->write_end
- pt
->write_pos
;
729 /* data fits in buffer. */
730 memcpy (pt
->write_pos
, data
, size
);
731 pt
->write_pos
+= size
;
732 if (pt
->write_pos
== pt
->write_end
)
735 /* we can skip the line-buffering check if nothing's buffered. */
741 memcpy (pt
->write_pos
, data
, space
);
742 pt
->write_pos
= pt
->write_end
;
745 const void *ptr
= ((const char *) data
) + space
;
746 size_t remaining
= size
- space
;
748 if (size
>= pt
->write_buf_size
)
750 if (full_write (SCM_FPORT_FDES (port
), ptr
, remaining
)
757 memcpy (pt
->write_pos
, ptr
, remaining
);
758 pt
->write_pos
+= remaining
;
763 /* handle line buffering. */
764 if ((SCM_CELL_WORD_0 (port
) & SCM_BUFLINE
) && memchr (data
, '\n', size
))
771 fport_flush (SCM port
)
774 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
775 scm_t_fport
*fp
= SCM_FSTREAM (port
);
776 size_t count
= pt
->write_pos
- pt
->write_buf
;
778 written
= full_write (fp
->fdes
, pt
->write_buf
, count
);
780 scm_syserror ("scm_flush");
782 pt
->write_pos
= pt
->write_buf
;
783 pt
->rw_active
= SCM_PORT_NEITHER
;
786 /* clear the read buffer and adjust the file position for unread bytes. */
788 fport_end_input (SCM port
, int offset
)
790 scm_t_fport
*fp
= SCM_FSTREAM (port
);
791 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
793 offset
+= pt
->read_end
- pt
->read_pos
;
797 pt
->read_pos
= pt
->read_end
;
798 /* will throw error if unread-char used at beginning of file
799 then attempting to write. seems correct. */
800 if (lseek (fp
->fdes
, -offset
, SEEK_CUR
) == -1)
801 scm_syserror ("fport_end_input");
803 pt
->rw_active
= SCM_PORT_NEITHER
;
807 fport_close (SCM port
)
809 scm_t_fport
*fp
= SCM_FSTREAM (port
);
810 scm_t_port
*pt
= SCM_PTAB_ENTRY (port
);
814 SCM_SYSCALL (rv
= close (fp
->fdes
));
815 if (rv
== -1 && errno
!= EBADF
)
817 if (scm_gc_running_p
)
818 /* silently ignore the error. scm_error would abort if we
822 scm_syserror ("fport_close");
824 if (pt
->read_buf
== pt
->putback_buf
)
825 pt
->read_buf
= pt
->saved_read_buf
;
826 if (pt
->read_buf
!= &pt
->shortbuf
)
827 scm_gc_free (pt
->read_buf
, pt
->read_buf_size
, "port buffer");
828 if (pt
->write_buf
!= &pt
->shortbuf
)
829 scm_gc_free (pt
->write_buf
, pt
->write_buf_size
, "port buffer");
830 scm_gc_free (fp
, sizeof (*fp
), "file port");
835 fport_free (SCM port
)
844 scm_t_bits tc
= scm_make_port_type ("file", fport_fill_input
, fport_write
);
846 scm_set_port_free (tc
, fport_free
);
847 scm_set_port_print (tc
, fport_print
);
848 scm_set_port_flush (tc
, fport_flush
);
849 scm_set_port_end_input (tc
, fport_end_input
);
850 scm_set_port_close (tc
, fport_close
);
851 scm_set_port_seek (tc
, fport_seek
);
852 scm_set_port_truncate (tc
, fport_truncate
);
853 scm_set_port_input_waiting (tc
, fport_input_waiting
);
861 scm_tc16_fport
= scm_make_fptob ();
863 scm_c_define ("_IOFBF", scm_from_int (_IOFBF
));
864 scm_c_define ("_IOLBF", scm_from_int (_IOLBF
));
865 scm_c_define ("_IONBF", scm_from_int (_IONBF
));
867 sys_file_port_name_canonicalization
= scm_make_fluid ();
868 scm_c_define ("%file-port-name-canonicalization",
869 sys_file_port_name_canonicalization
);
871 #include "libguile/fports.x"