forked from VOID001/neu-os
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement signal handling framework
- Loading branch information
Showing
12 changed files
with
318 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef _ERRNO_H | ||
#define _ERRNO_H | ||
|
||
// 错误号定义 | ||
|
||
extern int errno; | ||
|
||
#define ERROR 99 | ||
#define EPERM 1 | ||
#define ENOENT 2 | ||
#define ESRCH 3 | ||
#define EINTR 4 | ||
#define EIO 5 | ||
#define ENXIO 6 | ||
#define E2BIG 7 | ||
#define ENOEXEC 8 | ||
#define EBADF 9 | ||
#define ECHILD 10 | ||
#define EAGAIN 11 | ||
#define ENOMEM 12 | ||
#define EACCES 13 | ||
#define EFAULT 14 | ||
#define ENOTBLK 15 | ||
#define EBUSY 16 | ||
#define EEXIST 17 | ||
#define EXDEV 18 | ||
#define ENODEV 19 | ||
#define ENOTDIR 20 | ||
#define EISDIR 21 | ||
#define EINVAL 22 | ||
#define ENFILE 23 | ||
#define EMFILE 24 | ||
#define ENOTTY 25 | ||
#define ETXTBSY 26 | ||
#define EFBIG 27 | ||
#define ENOSPC 28 | ||
#define ESPIPE 29 | ||
#define EROFS 30 | ||
#define EMLINK 31 | ||
#define EPIPE 32 | ||
#define EDOM 33 | ||
#define ERANGE 34 | ||
#define EDEADLK 35 | ||
#define ENAMETOOLONG 36 | ||
#define ENOLCK 37 | ||
#define ENOSYS 38 | ||
#define ENOTEMPTY 39 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef _SYS_TYPES_H | ||
#define _SYS_TYPES_H | ||
|
||
#ifndef _SIZE_T | ||
#define _SIZE_T | ||
typedef unsigned int size_t; | ||
#endif | ||
|
||
#ifndef _TIME_T | ||
#define _TIME_T | ||
typedef long time_t; | ||
#endif | ||
|
||
#ifndef _PTRDIFF_T | ||
#define _PTRDIFF_T | ||
typedef long ptrdiff_t; | ||
#endif | ||
|
||
#ifndef NULL | ||
#define NULL ((void *) 0) | ||
#endif | ||
|
||
typedef int pid_t; | ||
typedef unsigned short uid_t; | ||
typedef unsigned char gid_t; | ||
typedef unsigned short dev_t; | ||
typedef unsigned short ino_t; | ||
typedef unsigned short mode_t; | ||
typedef unsigned short umode_t; | ||
typedef unsigned char nlink_t; | ||
typedef int daddr_t; | ||
typedef long off_t; | ||
typedef unsigned char u_char; | ||
typedef unsigned short ushort; | ||
|
||
typedef struct { int quot,rem; } div_t; | ||
typedef struct { long quot,rem; } ldiv_t; | ||
|
||
struct ustat { | ||
daddr_t f_tfree; | ||
ino_t f_tinode; | ||
char f_fname[6]; | ||
char f_fpack[6]; | ||
}; | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#ifndef _UNISTD_H | ||
#define _UNISTD_H | ||
|
||
#ifdef __LIBRARY__ | ||
|
||
#define __NR_fork 2 | ||
#define __NR_pause 29 | ||
#define __NR_kill 37 | ||
#define __NR_sys_debug 72 | ||
|
||
#define _syscall0(type, name) \ | ||
type name(void) \ | ||
{ \ | ||
long __res; \ | ||
__asm__ volatile("int $0x80\n\t" \ | ||
: "=a" (__res) \ | ||
: "0" (__NR_##name)); \ | ||
if (__res >= 0) \ | ||
return (type) __res; \ | ||
/*errno = -__res;*/ \ | ||
return -1;\ | ||
} | ||
|
||
#define _syscall1(type, name, atype, a) \ | ||
type name(atype a) \ | ||
{ \ | ||
long __res; \ | ||
__asm__ volatile("int $0x80\n\t" \ | ||
: "=a" (__res) \ | ||
: "0" (__NR_##name), "b" ((long) a)); \ | ||
if (__res >= 0) \ | ||
return (type) __res; \ | ||
/*errno = -__res;*/ \ | ||
return -1; \ | ||
} | ||
|
||
#define _syscall2(type, name, atype, a, btype, b) \ | ||
type name(atype a, btype b) \ | ||
{ \ | ||
long __res; \ | ||
__asm__ volatile("int $0x80\n\t" \ | ||
: "=a" (__res) \ | ||
: "0" (__NR_##name), "b" ((long) a), "c" ((long) b)); \ | ||
if (__res >= 0) \ | ||
return (type) __res; \ | ||
/*errno = -__res;*/ \ | ||
return -1; \ | ||
} | ||
|
||
#define _syscall3(type, name, atype, a, btype, b, ctype, c) \ | ||
type name(atype a, btype b, ctype c) \ | ||
{ \ | ||
long __res; \ | ||
__asm__ volatile("int $0x80\n\t" \ | ||
: "=a" (res) \ | ||
: "0" (__NR_##name), "b" ((long) a), "c" ((long) c), "d" ((long) c)); \ | ||
if (__res >= 0) \ | ||
return (type) __res; \ | ||
/* errno = -__res;*/ \ | ||
return -1; \ | ||
} | ||
|
||
#endif | ||
|
||
static int pause(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.