00001 /* 00002 * Copyright (C) 2004-2005 by egnite Software GmbH. All rights reserved. 00003 * 00004 * Copyright (c) 1991 The Regents of the University of California. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 3. Neither the name of the University nor the names of its contributors 00016 * may be used to endorse or promote products derived from this software 00017 * without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00020 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00023 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00024 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00025 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00026 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00027 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00028 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00029 * SUCH DAMAGE. 00030 * 00031 * For additional information see http://www.ethernut.de/ 00032 * 00033 */ 00034 00071 #ifndef _UNISTD_H_ 00072 00073 #include <compiler.h> // required e.g. for CONST 00074 00075 #ifndef _UNISTD_VIRTUAL_H_ 00076 #define _UNISTD_VIRTUAL_H_ 00077 00078 /* use native version on unix emulation */ 00079 #if defined(__linux__) || defined(__APPLE__) 00080 00081 #include "unistd_orig.h" 00082 00083 // prefix all unistd calls with NUT_ 00084 #define access(...) NUT_access(__VA_ARGS__) 00085 #define lseek(...) NUT_lseek(__VA_ARGS__) 00086 #define rmdir(...) NUT_rmdir(__VA_ARGS__) 00087 #define unlink(...) NUT_unlink(__VA_ARGS__) 00088 00089 #define sleep(...) NUT_sleep(__VA_ARGS__) 00090 00091 /* assure _UNISTD_H_ is set */ 00092 #undef _UNISTD_H_ 00093 #define _UNISTD_H_ 00094 00095 #define _UNISTD_H_ 00096 00097 #else /* unix emulation */ 00098 00103 #define F_OK 0 00104 #define X_OK 0x01 00105 #define W_OK 0x02 00106 #define R_OK 0x04 00108 00109 #endif /* unix emulation */ 00110 00111 __BEGIN_DECLS 00112 /* */ 00113 extern int access(CONST char *path, int what); 00114 extern long lseek(int fh, long pos, int whence); 00115 extern int rmdir(CONST char *path); 00116 extern int unlink(CONST char *path); 00117 00118 extern unsigned int sleep(unsigned int); 00119 __END_DECLS 00120 /* */ 00121 00122 00123 #endif /* _UNISTD_VIRTUAL_H_ */ 00124 00125 #endif /* _UNISTD_H */