/* Get curernt position in the file. */ static MVMint64 mvm_tell(MVMThreadContext *tc, MVMOSHandle *h) { MVMIOFileData *data = (MVMIOFileData *)h->body.data; MVMint64 r; if (data->ds) return MVM_string_decodestream_tell_bytes(tc, data->ds); if ((r = MVM_platform_lseek(data->fd, 0, SEEK_CUR)) == -1) MVM_exception_throw_adhoc(tc, "Failed to tell in filehandle: %d", errno); return r; }
/* Get curernt position in the file. */ static MVMint64 mvm_tell(MVMThreadContext *tc, MVMOSHandle *h) { MVMIOFileData *data = (MVMIOFileData *)h->body.data; return data->ds ? MVM_string_decodestream_tell_bytes(tc, data->ds) : 0; }
/* If we've been reading, the total number of bytes read. Otherwise, the total * number of bytes we've written. */ MVMint64 MVM_io_syncstream_tell(MVMThreadContext *tc, MVMOSHandle *h) { MVMIOSyncStreamData *data = (MVMIOSyncStreamData *)h->body.data; return data->ds ? MVM_string_decodestream_tell_bytes(tc, data->ds) : data->total_bytes_written; }