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 00068 #ifndef _UNISTD_H_ 00069 00070 #include <compiler.h> // required e.g. for CONST 00071 00072 #ifndef _UNISTD_VIRTUAL_H_ 00073 #define _UNISTD_VIRTUAL_H_ 00074 00075 /* use native version on unix emulation */ 00076 #if defined(__linux__) || defined(__APPLE__) 00077 00078 #include "unistd_orig.h" 00079 00080 // prefix all unistd calls with NUT_ 00081 #define access(...) NUT_access(__VA_ARGS__) 00082 #define lseek(...) NUT_lseek(__VA_ARGS__) 00083 #define rmdir(...) NUT_rmdir(__VA_ARGS__) 00084 #define unlink(...) NUT_unlink(__VA_ARGS__) 00085 00086 #define sleep(...) NUT_sleep(__VA_ARGS__) 00087 00088 /* assure _UNISTD_H_ is set */ 00089 #undef _UNISTD_H_ 00090 #define _UNISTD_H_ 00091 00092 #define _UNISTD_H_ 00093 00094 #endif /* unix emulation */ 00095 00096 __BEGIN_DECLS 00097 /* */ 00098 extern int access(CONST char *path, int what); 00099 extern long lseek(int fh, long pos, int whence); 00100 extern int rmdir(CONST char *path); 00101 extern int unlink(CONST char *path); 00102 00103 extern unsigned int sleep(unsigned int); 00104 __END_DECLS 00105 /* */ 00106 00107 00108 #endif /* _UNISTD_VIRTUAL_H_ */ 00109 00110 #endif /* _UNISTD_H */