Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 1 | /*===- OSInterface.h - Interface to query OS for functionality ---*- C -*--===*\ |
Misha Brukman | 3b87f21 | 2004-08-04 21:19:49 +0000 | [diff] [blame] | 2 | * |
| 3 | * The LLVM Compiler Infrastructure |
| 4 | * |
| 5 | * This file was developed by the LLVM research group and is distributed under |
| 6 | * the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | * |
| 8 | *===----------------------------------------------------------------------=== |
| 9 | * |
| 10 | * |
| 11 | * This file defines the prototype interface that we will expect operating |
| 12 | * systems to implement if they wish to support offline cachine. |
| 13 | * |
Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 14 | \*===----------------------------------------------------------------------===*/ |
| 15 | |
| 16 | #ifndef OS_INTERFACE_H |
| 17 | #define OS_INTERFACE_H |
| 18 | |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame] | 19 | #include "llvm/Config/sys/types.h" |
Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 20 | |
| 21 | struct stat; |
| 22 | |
| 23 | /* |
| 24 | * llvmStat - equivalent to stat(3), except the key may not necessarily |
| 25 | * correspond to a file by that name, implementation is up to the OS. |
| 26 | * Values returned in buf are similar as they are in Unix. |
| 27 | */ |
| 28 | void llvmStat(const char *key, struct stat *buf); |
| 29 | |
| 30 | /* |
| 31 | * llvmWriteFile - implements a 'save' of a file in the OS. 'key' may not |
| 32 | * necessarily map to a file of the same name. |
| 33 | * Returns: |
| 34 | * 0 - success |
| 35 | * non-zero - error |
| 36 | */ |
| 37 | int llvmWriteFile(const char *key, const void *data, size_t len); |
| 38 | |
| 39 | /* |
| 40 | * llvmLoadFile - tells the OS to load data corresponding to a particular key |
| 41 | * somewhere into memory. |
| 42 | * Returns: |
| 43 | * 0 - failure |
| 44 | * non-zero - address of loaded file |
| 45 | * |
| 46 | * Value of size is the length of data loaded into memory. |
| 47 | */ |
| 48 | void* llvmReadFile(const char *key, size_t *size); |
| 49 | |
| 50 | /* |
| 51 | * llvmExecve - execute a file from cache. This is a temporary proof-of-concept |
| 52 | * because we do not relocate what we can read from disk. |
| 53 | */ |
| 54 | int llvmExecve(const char *filename, char *const argv[], char *const envp[]); |
| 55 | |
| 56 | #endif |