Added copyright header to all C++ source files.
[oota-llvm.git] / tools / llee / OSInterface.h
1 /*===- OSInterface.h - Interface to query OS for functionality ---*- C -*--===*\
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  *                                                                            *
14 \*===----------------------------------------------------------------------===*/
15
16 #ifndef OS_INTERFACE_H
17 #define OS_INTERFACE_H
18
19 #include "Config/sys/types.h"
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