2 * Copyright (c) 2011 The Chromium OS Authors.
3 * See file CREDITS for list of people who contributed to this
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * Operating System Interface
25 * This provides access to useful OS routines from the sandbox architecture
29 * Access to the OS read() system call
31 * \param fd File descriptor as returned by os_open()
32 * \param buf Buffer to place data
33 * \param count Number of bytes to read
34 * \return number of bytes read, or -1 on error
36 ssize_t os_read(int fd, void *buf, size_t count);
39 * Access to the OS write() system call
41 * \param fd File descriptor as returned by os_open()
42 * \param buf Buffer containing data to write
43 * \param count Number of bytes to write
44 * \return number of bytes written, or -1 on error
46 ssize_t os_write(int fd, const void *buf, size_t count);
49 * Access to the OS open() system call
51 * \param pathname Pathname of file to open
52 * \param flags Flags, like O_RDONLY, O_RDWR
53 * \return file descriptor, or -1 on error
55 int os_open(const char *pathname, int flags);
58 * Access to the OS close() system call
60 * \param fd File descriptor to close
61 * \return 0 on success, -1 on error
66 * Access to the OS exit() system call
68 * This exits with the supplied return code, which should be 0 to indicate
71 * @param exit_code exit code for U-Boot
73 void os_exit(int exit_code);