diff options
| author | [email protected] <[email protected]> | 2012-07-06 11:19:16 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-07-06 11:19:16 +0000 |
| commit | c1ad7c8f69303d7eda14bad2dd1851e8b323e368 (patch) | |
| tree | 542211a615fb00a52d9b137457324b1d260f804a /components/libc | |
| parent | 83ad1ad01df1fa57df19f82fd05e49eff7d71c1d (diff) | |
Add more type definitions for POSIX thread.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2203 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/minilibc/errno.h | 59 | ||||
| -rw-r--r-- | components/libc/minilibc/inttypes.h | 6 | ||||
| -rw-r--r-- | components/libc/minilibc/stddef.h | 3 | ||||
| -rw-r--r-- | components/libc/minilibc/stdio.h | 3 | ||||
| -rw-r--r-- | components/libc/minilibc/stdlib.h | 1 | ||||
| -rw-r--r-- | components/libc/minilibc/sys/stat.h | 36 | ||||
| -rw-r--r-- | components/libc/minilibc/sys/types.h | 3 |
7 files changed, 111 insertions, 0 deletions
diff --git a/components/libc/minilibc/errno.h b/components/libc/minilibc/errno.h new file mode 100644 index 0000000000..305b48871d --- /dev/null +++ b/components/libc/minilibc/errno.h @@ -0,0 +1,59 @@ +#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
diff --git a/components/libc/minilibc/inttypes.h b/components/libc/minilibc/inttypes.h new file mode 100644 index 0000000000..e734f7a8e7 --- /dev/null +++ b/components/libc/minilibc/inttypes.h @@ -0,0 +1,6 @@ +#ifndef __INTTYPES_H__
+#define __INTTYPES_H__
+
+#include "stdint.h"
+
+#endif
diff --git a/components/libc/minilibc/stddef.h b/components/libc/minilibc/stddef.h index b260acf79e..4991b0b19f 100644 --- a/components/libc/minilibc/stddef.h +++ b/components/libc/minilibc/stddef.h @@ -1,4 +1,7 @@ #ifndef __STDDEF_H__
#define __STDDEF_H__
+#include <sys/types.h>
+typedef signed long ptrdiff_t;
+
#endif
diff --git a/components/libc/minilibc/stdio.h b/components/libc/minilibc/stdio.h index cf115c499a..45d98dbc9b 100644 --- a/components/libc/minilibc/stdio.h +++ b/components/libc/minilibc/stdio.h @@ -1,5 +1,8 @@ #ifndef __STDIO_H__
#define __STDIO_H__
+#define BUFSIZ 128
+#define EOF (-1)
+
#endif
diff --git a/components/libc/minilibc/stdlib.h b/components/libc/minilibc/stdlib.h index 9b87743242..9ff5cdd86c 100644 --- a/components/libc/minilibc/stdlib.h +++ b/components/libc/minilibc/stdlib.h @@ -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
diff --git a/components/libc/minilibc/sys/stat.h b/components/libc/minilibc/sys/stat.h new file mode 100644 index 0000000000..7826cba945 --- /dev/null +++ b/components/libc/minilibc/sys/stat.h @@ -0,0 +1,36 @@ +#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 diff --git a/components/libc/minilibc/sys/types.h b/components/libc/minilibc/sys/types.h index a2dbee5256..27967cd6af 100644 --- a/components/libc/minilibc/sys/types.h +++ b/components/libc/minilibc/sys/types.h @@ -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 |
