WSL2-Linux-Kernel/arch/tile/include/asm
Chris Metcalf 2c7387ef99 asm-generic/stat.h: support 64-bit file time_t for stat()
The existing asm-generic/stat.h specifies st_mtime, etc., as a 32-value,
and works well for 32-bit architectures (currently microblaze, score,
and 32-bit tile).  However, for 64-bit architectures it isn't sufficient
to return 32 bits of time_t; this isn't good insurance against the 2037
rollover.  (It also makes glibc support less convenient, since we can't
use glibc's handy STAT_IS_KERNEL_STAT mode.)

This change extends the two "timespec" fields for each of the three atime,
mtime, and ctime fields from "int" to "long".  As a result, on 32-bit
platforms nothing changes, and 64-bit platforms will now work as expected.

The only wrinkle is 32-bit userspace under 64-bit kernels taking advantage
of COMPAT mode.  For these, we leave the "struct stat64" definitions with
the "int" versions of the time_t and nsec fields, so that architectures
can implement compat_sys_stat64() and friends with sys_stat64(), etc.,
and get the expected 32-bit structure layout.  This requires a
field-by-field copy in the kernel, implemented by the code guarded
under __ARCH_WANT_STAT64.

This does mean that the shape of the "struct stat" and "struct stat64"
structures is different on a 64-bit kernel, but only one of the two
structures should ever be used by any given process: "struct stat"
is meant for 64-bit userspace only, and "struct stat64" for 32-bit
userspace only.  (On a 32-bit kernel the two structures continue to have
the same shape, since "long" is 32 bits.)

The alternative is keeping the two structures the same shape on 64-bit
kernels, which means a 64-bit time_t in "struct stat64" for 32-bit
processes.  This is a little unnatural since 32-bit userspace can't
do anything with 64 bits of time_t information, since time_t is just
"long", not "int64_t"; and in any case 32-bit userspace might expect
to be running under a 32-bit kernel, which can't provide the high 32
bits anyway.  In the case of a 32-bit kernel we'd then be extending the
kernel's 32-bit time_t to 64 bits, then truncating it back to 32 bits
again in userspace, for no particular reason.  And, as mentioned above,
if we have 64-bit time_t for 32-bit processes we can't easily use glibc's
STAT_IS_KERNEL_STAT, since glibc's stat structure requires an embedded
"struct timespec", which is a pair of "long" (32-bit) values in a 32-bit
userspace.  "Inventive" solutions are possible, but are pretty hacky.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2010-11-01 15:31:29 -04:00
..
Kbuild arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
asm-offsets.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
atomic.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
atomic_32.h arch/tile: Various cleanups. 2010-08-13 08:52:19 -04:00
auxvec.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
backtrace.h arch/tile: support new info op generated by compiler 2010-10-15 15:39:25 -04:00
bitops.h bitops: make asm-generic/bitops/find.h more generic 2010-10-09 21:51:44 +02:00
bitops_32.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
bitsperlong.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
bug.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
bugs.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
byteorder.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
cache.h arch/tile: rename ARCH_KMALLOC_MINALIGN to ARCH_DMA_MINALIGN 2010-08-15 11:05:33 -04:00
cacheflush.h arch/tile: Split the icache flush code off to a generic <arch> header. 2010-07-06 13:41:46 -04:00
checksum.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
compat.h arch/tile: Use <asm-generic/syscalls.h> 2010-10-14 14:34:33 -04:00
cputime.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
current.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
delay.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
device.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
div64.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
dma-mapping.h dma-mapping: remove dma_is_consistent API 2010-08-11 08:59:21 -07:00
dma.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
elf.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
emergency-restart.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
errno.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
fcntl.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
fixmap.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
ftrace.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
futex.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
hardirq.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
hardwall.h arch/tile: Add driver to enable access to the user dynamic network. 2010-07-06 13:34:15 -04:00
highmem.h arch/tile: complete migration to new kmap_atomic scheme 2010-11-01 15:30:36 -04:00
homecache.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
hugetlb.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
hv_driver.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
hw_irq.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
ide.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
io.h arch/tile: fix memcpy_fromio()/memcpy_toio() signatures 2010-09-15 11:17:04 -04:00
ioctl.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
ioctls.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
ipc.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
ipcbuf.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
irq.h arch/tile: Enable more sophisticated IRQ model for 32-bit chips. 2010-07-06 13:34:01 -04:00
irq_regs.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
irqflags.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2010-10-26 17:25:38 -07:00
kdebug.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
kexec.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
kmap_types.h arch/tile: complete migration to new kmap_atomic scheme 2010-11-01 15:30:36 -04:00
linkage.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
local.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
memprof.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
mman.h arch/tile: provide a definition of MAP_STACK 2010-10-14 15:09:02 -04:00
mmu.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
mmu_context.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
mmzone.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
module.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
msgbuf.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
mutex.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
opcode-tile.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
opcode-tile_32.h arch/tile: Shrink the tile-opcode files considerably. 2010-07-06 13:40:56 -04:00
opcode-tile_64.h arch/tile: Shrink the tile-opcode files considerably. 2010-07-06 13:40:56 -04:00
opcode_constants.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
opcode_constants_32.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
opcode_constants_64.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
page.h arch/tile: parameterize system PLs to support KVM port 2010-10-15 15:38:09 -04:00
param.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
pci-bridge.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
pci.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
percpu.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
pgalloc.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
pgtable.h arch/tile: complete migration to new kmap_atomic scheme 2010-11-01 15:30:36 -04:00
pgtable_32.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
poll.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
posix_types.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
processor.h arch/tile: parameterize system PLs to support KVM port 2010-10-15 15:38:09 -04:00
ptrace.h arch/tile: parameterize system PLs to support KVM port 2010-10-15 15:38:09 -04:00
resource.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
scatterlist.h tile: remove unused ISA_DMA_THRESHOLD define 2010-08-11 10:38:06 -04:00
sections.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
sembuf.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
setup.h arch/tile: export only COMMAND_LINE_SIZE to userspace. 2010-08-15 12:14:41 -04:00
shmbuf.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
shmparam.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
sigcontext.h arch/tile: Change struct sigcontext to be more useful 2010-09-15 11:16:08 -04:00
sigframe.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
siginfo.h arch/tile: Fix a couple of issues with the COMPAT code for TILE-Gx. 2010-08-13 08:32:21 -04:00
signal.h arch/tile: Change struct sigcontext to be more useful 2010-09-15 11:16:08 -04:00
smp.h arch/tile: Enable more sophisticated IRQ model for 32-bit chips. 2010-07-06 13:34:01 -04:00
socket.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
sockios.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
spinlock.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
spinlock_32.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
spinlock_types.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
stack.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
stat.h asm-generic/stat.h: support 64-bit file time_t for stat() 2010-11-01 15:31:29 -04:00
statfs.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
string.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
swab.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
syscall.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
syscalls.h arch/tile: Use <asm-generic/syscalls.h> 2010-10-14 14:34:33 -04:00
system.h arch/tile: parameterize system PLs to support KVM port 2010-10-15 15:38:09 -04:00
termbits.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
termios.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
thread_info.h arch/tile: catch up on various minor cleanups. 2010-07-06 13:42:15 -04:00
timex.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
tlb.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
tlbflush.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
topology.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
traps.h arch/tile: enable single-step support for TILE-Gx 2010-10-15 15:38:26 -04:00
types.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
uaccess.h arch/tile: Various cleanups. 2010-08-13 08:52:19 -04:00
ucontext.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
unaligned.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
unistd.h asm-generic/stat.h: support 64-bit file time_t for stat() 2010-11-01 15:31:29 -04:00
user.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
xor.h arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00