2018-10-14 19:28:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2020-12-16 15:25:08 +08:00
|
|
|
* 2020-12-16 Meco Man add usleep
|
2018-10-14 19:28:18 +08:00
|
|
|
*/
|
2015-05-04 20:35:28 +08:00
|
|
|
#ifndef _SYS_UNISTD_H
|
|
|
|
#define _SYS_UNISTD_H
|
|
|
|
|
2020-12-16 15:25:08 +08:00
|
|
|
#include <rtconfig.h>
|
|
|
|
#include "types.h"
|
2016-04-18 13:54:07 +08:00
|
|
|
|
2015-05-04 20:35:28 +08:00
|
|
|
#ifdef RT_USING_DFS
|
2018-03-22 12:09:39 +08:00
|
|
|
|
|
|
|
#define STDIN_FILENO 0 /* standard input file descriptor */
|
|
|
|
#define STDOUT_FILENO 1 /* standard output file descriptor */
|
|
|
|
#define STDERR_FILENO 2 /* standard error file descriptor */
|
|
|
|
|
2015-05-04 20:35:28 +08:00
|
|
|
#include <dfs_posix.h>
|
|
|
|
#else
|
2017-10-15 22:41:59 +08:00
|
|
|
#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 */
|
2015-05-04 20:35:28 +08:00
|
|
|
|
2020-10-02 11:22:17 +08:00
|
|
|
|
|
|
|
#ifndef O_RDONLY
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_RDONLY 0 /* +1 == FREAD */
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_WRONLY
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_WRONLY 1 /* +1 == FWRITE */
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_RDWR
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_RDWR 2 /* +1 == FREAD|FWRITE */
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_APPEND
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_APPEND _FAPPEND
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_CREAT
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_CREAT _FCREAT
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_TRUNC
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_TRUNC _FTRUNC
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_EXCL
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_EXCL _FEXCL
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
#ifndef O_SYNC
|
2017-10-15 22:41:59 +08:00
|
|
|
#define O_SYNC _FSYNC
|
2015-05-04 20:35:28 +08:00
|
|
|
#endif
|
|
|
|
|
2020-10-02 11:22:17 +08:00
|
|
|
#endif
|
|
|
|
|
2020-09-02 10:25:52 +08:00
|
|
|
|
|
|
|
int isatty (int fd);
|
|
|
|
char * ttyname (int desc);
|
|
|
|
|
2020-12-04 20:16:56 +08:00
|
|
|
unsigned int sleep(unsigned int seconds);
|
2020-12-16 15:25:08 +08:00
|
|
|
int usleep(useconds_t usec);
|
2020-12-04 20:16:56 +08:00
|
|
|
|
2015-05-04 20:35:28 +08:00
|
|
|
#endif /* _SYS_UNISTD_H */
|