unistd.h 2.0 KB
Newer Older
1 2 3 4 5 6 7 8
/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */
9 10 11
#ifndef _SYS_UNISTD_H
#define _SYS_UNISTD_H

12 13
#include <rtthread.h>

14
#ifdef RT_USING_DFS
15 16 17 18 19

#define STDIN_FILENO    0       /* standard input file descriptor */
#define STDOUT_FILENO   1       /* standard output file descriptor */
#define STDERR_FILENO   2       /* standard error file descriptor */

20 21
#include <dfs_posix.h>
#else
B
bernard 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#define _FREAD      0x0001  /* read enabled */
#define _FWRITE     0x0002  /* write enabled */
#define _FAPPEND    0x0008  /* append (writes guaranteed at the end) */
#define _FMARK      0x0010  /* internal; mark during gc() */
#define _FDEFER     0x0020  /* internal; defer for next gc pass */
#define _FASYNC     0x0040  /* signal pgrp when data ready */
#define _FSHLOCK    0x0080  /* BSD flock() shared lock present */
#define _FEXLOCK    0x0100  /* BSD flock() exclusive lock present */
#define _FCREAT     0x0200  /* open with file create */
#define _FTRUNC     0x0400  /* open with truncation */
#define _FEXCL      0x0800  /* error on open if file exists */
#define _FNBIO      0x1000  /* non blocking I/O (sys5 style) */
#define _FSYNC      0x2000  /* do all writes synchronously */
#define _FNONBLOCK  0x4000  /* non blocking I/O (POSIX style) */
#define _FNDELAY    _FNONBLOCK  /* non blocking I/O (4.2 style) */
#define _FNOCTTY    0x8000  /* don't assign a ctty on this open */
38

39 40

#ifndef O_RDONLY
B
bernard 已提交
41
#define O_RDONLY    0       /* +1 == FREAD */
42 43
#endif
#ifndef O_WRONLY
B
bernard 已提交
44
#define O_WRONLY    1       /* +1 == FWRITE */
45 46
#endif
#ifndef O_RDWR
B
bernard 已提交
47
#define O_RDWR      2       /* +1 == FREAD|FWRITE */
48 49
#endif
#ifndef O_APPEND
B
bernard 已提交
50
#define O_APPEND    _FAPPEND
51 52
#endif
#ifndef O_CREAT
B
bernard 已提交
53
#define O_CREAT     _FCREAT
54 55
#endif
#ifndef O_TRUNC
B
bernard 已提交
56
#define O_TRUNC     _FTRUNC
57 58
#endif
#ifndef O_EXCL
B
bernard 已提交
59
#define O_EXCL      _FEXCL
60 61
#endif
#ifndef O_SYNC
B
bernard 已提交
62
#define O_SYNC      _FSYNC
63 64
#endif

65 66
#endif

mysterywolf's avatar
mysterywolf 已提交
67 68 69 70

int     isatty      (int fd);
char *  ttyname     (int desc);

71 72
unsigned int sleep(unsigned int seconds);

73
#endif /* _SYS_UNISTD_H */