Store inodes in unsigned long long

In 32 bit ABIs, ino_t is a 32 bit type, while the st_ino field
in struct stat is 64 bits wide in both 32 and 64 bit processes.
This means that struct stat can expose inode numbers that are
truncated when stored in an ino_t.

The SDCard fuse daemon (/system/bin/sdcard) uses raw pointer
values as inode numbers, so on 64 bit devices, we're very likely
to observe inodes that need > 32 bits to represent.

The fileHasMoved function in sqlite compares the stored
inode value with a new one from stat, and when the stored
value is truncated, this check will falsely indicate that
the file has been moved. When the fileHasMoved function
triggers, other functions start returning errors indicating
that the database is in read-only mode.

NOTE: Bionic differs from glibc in that struct stat's st_ino
is *always* 64 bits wide, and not the same width as ino_t.

bug: https://code.google.com/p/android/issues/detail?id=79994
bug: 18434265

(cherry picked from commit eef2c43133524ac629db4b083681c2bcc7542122)

Change-Id: I832e0084e86c9a31519764d87df499ece05b488d
2 files changed
tree: fcf6dcd841adc8342c418675cd2307b5acb1b902
  1. android/
  2. dist/
  3. CleanSpec.mk