提交 c1ad7c8f 编写于 作者: B bernard.xiong@gmail.com

Add more type definitions for POSIX thread.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2203 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 83ad1ad0
#ifndef __ERRNO_H__
#define __ERRNO_H__
#ifdef RT_USING_DFS
#include <dfs_def.h>
/* using device error codes */
#define ENOENT DFS_STATUS_ENOENT
#define EIO DFS_STATUS_EIO
#define ENXIO DFS_STATUS_ENXIO
#define EBADF DFS_STATUS_EBADF
#define EAGAIN DFS_STATUS_EAGAIN
#define ENOMEM DFS_STATUS_ENOMEM
#define EBUSY DFS_STATUS_EBUSY
#define EEXIST DFS_STATUS_EEXIST
#define EXDEV DFS_STATUS_EXDEV
#define ENODEV DFS_STATUS_ENODEV
#define ENOTDIR DFS_STATUS_ENOTDIR
#define EISDIR DFS_STATUS_EISDIR
#define EINVAL DFS_STATUS_EINVAL
#define ENOSPC DFS_STATUS_ENOSPC
#define EROFS DFS_STATUS_EROFS
#define ENOSYS DFS_STATUS_ENOSYS
#define ENOTEMPTY DFS_STATUS_ENOTEMPTY
#else
/* error codes */
#define ENOENT 2 /* No such file or directory */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define EBADF 9 /* Bad file number */
#define EAGAIN 11 /* Try again */
#define ENOMEM 12 /* no memory */
#define EBUSY 16 /* Device or resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENOSPC 28 /* No space left on device */
#define EROFS 30 /* Read-only file system */
#define ENOSYS 38 /* Function not implemented */
#define ENOTEMPTY 39 /* Directory not empty */
#endif
#define EPERM 1 /* Not super-user */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define ENFILE 23 /* Too many open files in system */
#define EDEADLK 45 /* Deadlock condition */
#define EBADMSG 77 /* Trying to read unreadable message */
#define ETIMEDOUT 116 /* Connection timed out */
#define ENOTSUP 134 /* Not supported */
#endif
#ifndef __INTTYPES_H__
#define __INTTYPES_H__
#include "stdint.h"
#endif
#ifndef __STDDEF_H__
#define __STDDEF_H__
#include <sys/types.h>
typedef signed long ptrdiff_t;
#endif
#ifndef __STDIO_H__
#define __STDIO_H__
#define BUFSIZ 128
#define EOF (-1)
#endif
......@@ -30,6 +30,7 @@ void *malloc(size_t size);
void free(void *ptr);
void *realloc(void *ptr, size_t size);
void *calloc(size_t nelem, size_t elsize);
void abort(void);
#endif
#endif
#ifndef __STAT_H__
#define __STAT_H__
#include <rtthread.h>
#ifdef RT_USING_DFS
#include <dfs_posix.h>
#else
#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 */
#define O_RDONLY 0 /* +1 == FREAD */
#define O_WRONLY 1 /* +1 == FWRITE */
#define O_RDWR 2 /* +1 == FREAD|FWRITE */
#define O_APPEND _FAPPEND
#define O_CREAT _FCREAT
#define O_TRUNC _FTRUNC
#define O_EXCL _FEXCL
#define O_SYNC _FSYNC
#endif
#endif
......@@ -15,6 +15,9 @@ typedef rt_uint32_t u_long;
typedef rt_time_t time_t;
typedef int mode_t;
typedef unsigned long clockid_t;
typedef int pid_t;
#ifndef NULL
#define NULL RT_NULL
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册