File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,8 +190,10 @@ impl MappedShard {
190190 if ptr == libc:: MAP_FAILED {
191191 anyhow:: bail!( "mmap failed: {}" , std:: io:: Error :: last_os_error( ) ) ;
192192 }
193- // Hint: sequential access pattern — triggers aggressive readahead on NVMe
194- unsafe { libc:: posix_madvise ( ptr, len, libc:: POSIX_MADV_SEQUENTIAL ) ; }
193+ // Hint: sequential access pattern — triggers aggressive readahead on NVMe.
194+ // Use madvise (POSIX.1-2003 base) which is available on all Unix platforms
195+ // including Android. posix_madvise is not defined in Android's libc.
196+ unsafe { libc:: madvise ( ptr, len, libc:: MADV_SEQUENTIAL ) ; }
195197 Ok ( Self { mmap_ptr : ptr as * const u8 , mmap_len : len } )
196198 }
197199
@@ -238,9 +240,6 @@ pub struct SafetensorsStorage {
238240 index : HashMap < String , TensorMeta > ,
239241 /// Memory-mapped shard files (indexed by shard_idx in TensorMeta).
240242 shards : Vec < MappedShard > ,
241- /// File handles for non-mmap fallback.
242- #[ cfg( not( unix) ) ]
243- files : Vec < File > ,
244243}
245244
246245impl SafetensorsStorage {
You can’t perform that action at this time.
0 commit comments