blob: 18fe0da13a586a76c2a5511ca4121acf262477b8 [file] [log] [blame]
Misha Brukman2e1fbdd2003-09-29 22:37:00 +00001/*===- OSInterface.h - Interface to query OS for functionality ---*- C -*--===*\
2 * *
3 * This file defines the prototype interface that we will expect operating *
4 * systems to implement if they wish to support offline cachine. *
5 * *
6\*===----------------------------------------------------------------------===*/
7
8#ifndef OS_INTERFACE_H
9#define OS_INTERFACE_H
10
11#include "Config/sys/types.h"
12
13struct stat;
14
15/*
16 * llvmStat - equivalent to stat(3), except the key may not necessarily
17 * correspond to a file by that name, implementation is up to the OS.
18 * Values returned in buf are similar as they are in Unix.
19 */
20void llvmStat(const char *key, struct stat *buf);
21
22/*
23 * llvmWriteFile - implements a 'save' of a file in the OS. 'key' may not
24 * necessarily map to a file of the same name.
25 * Returns:
26 * 0 - success
27 * non-zero - error
28 */
29int llvmWriteFile(const char *key, const void *data, size_t len);
30
31/*
32 * llvmLoadFile - tells the OS to load data corresponding to a particular key
33 * somewhere into memory.
34 * Returns:
35 * 0 - failure
36 * non-zero - address of loaded file
37 *
38 * Value of size is the length of data loaded into memory.
39 */
40void* llvmReadFile(const char *key, size_t *size);
41
42/*
43 * llvmExecve - execute a file from cache. This is a temporary proof-of-concept
44 * because we do not relocate what we can read from disk.
45 */
46int llvmExecve(const char *filename, char *const argv[], char *const envp[]);
47
48#endif