diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-12-04 06:01:22 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-12-04 06:01:22 -0800 |
commit | a4d8692c9d23fed82f6f594ead826af83608f1c2 (patch) | |
tree | 610d817c1a8d830d769de209295858345fb389ec /sysif.h | |
parent | c790707d517dbf4fa6a8b2695a35b3bc3b784556 (diff) | |
download | txr-a4d8692c9d23fed82f6f594ead826af83608f1c2.tar.gz txr-a4d8692c9d23fed82f6f594ead826af83608f1c2.tar.bz2 txr-a4d8692c9d23fed82f6f594ead826af83608f1c2.zip |
Large file support.
* stream.h (struct strm_ops): seek operation's second argument
is now just a val.
* stream.c (unimpl_seek, null_seek): Second argument is a val,
not cnum, to conform with function pointer in stream
structure.
(stdio_seek): Accept offset as val, which could be a fixnum
or bignum. Use new stdio_ftell and stdio_fseek functions
so large values work.
(seek_stream): No need to convert offset argument to cnum;
pass the val directly to seek virtual function.
* sysif.c (off_t_num, num_off_t, stdio_ftell,
stdio_fseek): New functions.
* sysif.h (OFF_T_MAX, OFF_T_MIN): New preprocessor symbols.
(off_t_num, num_off_t, stdio_ftell, stdio_fseek): Declared.
Diffstat (limited to 'sysif.h')
-rw-r--r-- | sysif.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -32,7 +32,21 @@ extern val dev_s, ino_s, mode_s, nlink_s, uid_s; extern val gid_s, rdev_s, size_s, blksize_s, blocks_s; extern val atime_s, mtime_s, ctime_s; +#if !HAVE_FTRUNCATE +typedef long off_t; +#define OFF_T_MAX LONG_MAX +#define OFF_T_MIN LONG_MIN +#else +#define OFF_T_MAX ((((convert(off_t, 1) << \ + ((sizeof(off_t) * CHAR_BIT) - 2)) - 1) << 1) + 1) +#define OFF_T_MIN (-OFF_T_MAX) +#endif + val getenv_wrap(val name); val statp(val path); val statf(val path); +off_t off_t_num(val num); +val num_off_t(off_t offnum); +val stdio_ftell(FILE *); +val stdio_fseek(FILE *, val, int whence); void sysif_init(void); |