Simon Glass | 7a9219c | 2011-10-03 19:26:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The Chromium OS Authors. |
| 3 | * See file CREDITS for list of people who contributed to this |
| 4 | * project. |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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, |
| 19 | * MA 02111-1307 USA |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * Operating System Interface |
| 24 | * |
| 25 | * This provides access to useful OS routines from the sandbox architecture |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * Access to the OS read() system call |
| 30 | * |
| 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 |
| 35 | */ |
| 36 | ssize_t os_read(int fd, void *buf, size_t count); |
| 37 | |
| 38 | /** |
| 39 | * Access to the OS write() system call |
| 40 | * |
| 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 |
| 45 | */ |
| 46 | ssize_t os_write(int fd, const void *buf, size_t count); |
| 47 | |
| 48 | /** |
| 49 | * Access to the OS open() system call |
| 50 | * |
| 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 |
| 54 | */ |
| 55 | int os_open(const char *pathname, int flags); |
| 56 | |
| 57 | /** |
| 58 | * Access to the OS close() system call |
| 59 | * |
| 60 | * \param fd File descriptor to close |
| 61 | * \return 0 on success, -1 on error |
| 62 | */ |
| 63 | int os_close(int fd); |
| 64 | |
| 65 | /** |
| 66 | * Access to the OS exit() system call |
| 67 | * |
| 68 | * This exits with the supplied return code, which should be 0 to indicate |
| 69 | * success. |
| 70 | * |
| 71 | * @param exit_code exit code for U-Boot |
| 72 | */ |
| 73 | void os_exit(int exit_code); |