#include <lunaix/status.h>
#include <lunaix/syslog.h>
-#include <usr/lunaix/ioctl_defs.h>
+#include <usr/lunaix/ioctl.h>
LOG_MODULE("term");
#include <lunaix/device.h>
#include <lunaix/ds/rbuffer.h>
#include <lunaix/ds/waitq.h>
-#include <lunaix/signal_defs.h>
+#include <usr/lunaix/signal.h>
#include <usr/lunaix/term.h>
struct term;
#ifndef __LUNAIX_FOPTIONS_H
#define __LUNAIX_FOPTIONS_H
-#include <usr/lunaix/fcntl_defs.h>
+#include <usr/lunaix/fcntl.h>
#endif /* __LUNAIX_FOPTIONS_H */
#define __LUNAIX_FSAPI_H
#include <lunaix/fs.h>
-#include <lunaix/fcntl_defs.h>
#include <lunaix/blkbuf.h>
#include <klibc/string.h>
-#include <usr/lunaix/dirent_defs.h>
+#include <usr/lunaix/fcntl.h>
+#include <usr/lunaix/dirent.h>
struct fsapi_vsb_ops
{
#ifndef __LUNAIX_IOCTL_H
#define __LUNAIX_IOCTL_H
-#include <usr/lunaix/ioctl_defs.h>
+#include <usr/lunaix/ioctl.h>
#endif /* __LUNAIX_IOCTL_H */
#include <asm/pagetable.h>
-#include <usr/lunaix/mann_flags.h>
+#include <usr/lunaix/mman.h>
/**
* @brief 私有区域,该区域中的页无法进行任何形式的共享。
#include <lunaix/hart_state.h>
#include <lunaix/usrscope.h>
+#include <usr/lunaix/wait.h>
+
#include <stdint.h>
#define __LUNAIX_SIGNAL_H
#include <lunaix/types.h>
-#include <usr/lunaix/signal_defs.h>
+#include <usr/lunaix/signal.h>
#define _SIG_NUM 16
#ifndef __LUNAIX_TYPES_H
#define __LUNAIX_TYPES_H
+#include <stdarg.h>
#include <lunaix/compiler.h>
#include <lunaix/limits.h>
-#include <stdarg.h>
#include <usr/lunaix/types.h>
-// TODO: WTERMSIG
-
-// TODO: replace the integer type with these. To make thing more portable.
+#undef NULL
+#define NULL (void*)0
-typedef unsigned char u8_t;
-typedef unsigned short u16_t;
-typedef unsigned int u32_t;
-typedef unsigned long ptr_t;
-typedef unsigned long reg_t;
+typedef unsigned char u8_t;
+typedef unsigned short u16_t;
+typedef unsigned int u32_t;
#ifndef CONFIG_ARCH_BITS_64
-typedef unsigned long long u64_t;
+typedef unsigned long long u64_t;
#else
-typedef unsigned long u64_t;
+typedef unsigned long u64_t;
#endif
-typedef int pid_t;
-typedef signed long ssize_t;
+typedef __lunaix_pid_t pid_t;
+typedef __lunaix_tid_t tid_t;
+typedef __lunaix_uid_t uid_t;
+typedef __lunaix_gid_t gid_t;
+typedef __lunaix_size_t size_t;
+typedef __lunaix_ssize_t ssize_t;
+typedef __lunaix_size_t off_t;
+typedef __lunaix_ino_t ino_t;
-typedef unsigned int cpu_t;
+typedef unsigned long ptr_t;
+typedef unsigned long reg_t;
+typedef unsigned int cpu_t;
+typedef u64_t lba_t;
-typedef u64_t lba_t;
+typedef __lunaix_dev_t dev_t;
#define true 1
#define false 0
lunaix/fstypes.h
lunaix/status.h
-lunaix/fcntl_defs.h
-lunaix/signal_defs.h
+lunaix/fcntl.h
+lunaix/signal.h
lunaix/term.h
-lunaix/mann_flags.h
-lunaix/dirent_defs.h
+lunaix/mman.h
+lunaix/dirent.h
lunaix/poll.h
lunaix/types.h
lunaix/serial.h
lunaix/device.h
-lunaix/ioctl_defs.h
+lunaix/ioctl.h
lunaix/threads.h
lunaix/gfx.h
+lunaix/wait.h
-#ifndef __LUNAIX_UDEVICE_H
-#define __LUNAIX_UDEVICE_H
+#ifndef _LUNAIX_UHDR_UDEVICE_H
+#define _LUNAIX_UHDR_UDEVICE_H
-#include "ioctl_defs.h"
+#include "ioctl.h"
struct dev_info
{
} dev_name;
};
-#endif /* __LUNAIX_UDEVICE_H */
+#endif /* _LUNAIX_UHDR_UDEVICE_H */
-#ifndef __LUNAIX_SYS_DIRENT_DEFS_H
-#define __LUNAIX_SYS_DIRENT_DEFS_H
+#ifndef _LUNAIX_UHDR_SYS_DIRENT_DEFS_H
+#define _LUNAIX_UHDR_SYS_DIRENT_DEFS_H
#define DIRENT_NAME_MAX_LEN 256
char d_name[DIRENT_NAME_MAX_LEN];
};
-#endif /* __LUNAIX_DIRENT_DEFS_H */
+#endif /* _LUNAIX_UHDR_DIRENT_DEFS_H */
--- /dev/null
+#ifndef _LUNAIX_UHDR_SYS_FCNTL_DEFS_H
+#define _LUNAIX_UHDR_SYS_FCNTL_DEFS_H
+
+#include "fstypes.h"
+#include "types.h"
+
+#define FO_CREATE 0x1
+#define FO_APPEND 0x2
+#define FO_DIRECT 0x4
+#define FO_WRONLY 0x8
+#define FO_RDONLY 0x10
+#define FO_RDWR 0x20
+#define FO_TRUNC 0x40
+
+#define FO_NOFOLLOW 0x10000
+
+#define FSEEK_SET 0x1
+#define FSEEK_CUR 0x2
+#define FSEEK_END 0x3
+
+#define O_CREAT FO_CREATE
+#define O_APPEND FO_APPEND
+#define O_DIRECT FO_DIRECT
+#define O_WRONLY FO_WRONLY
+#define O_RDONLY FO_RDONLY
+#define O_RDWR FO_RDWR
+#define O_TRUNC FO_TRUNC
+
+#define AT_SYMLINK_FOLLOW 0b0000
+#define AT_SYMLINK_NOFOLLOW 0b0001
+#define AT_FDCWD 0b0010
+#define AT_EACCESS 0b0100
+
+#define R_OK 0b100100100
+#define W_OK 0b010010010
+#define X_OK 0b001001001
+#define F_OK 0b111111111
+
+/* Mount with read-only flag */
+#define MNT_RO (1 << 0)
+
+/* Mount with block-cache-disabled flag */
+#define MNT_NC (1 << 1)
+
+typedef unsigned int mode_t;
+typedef unsigned int nlink_t;
+
+struct file_stat
+{
+ __lunaix_dev_t st_dev;
+ __lunaix_ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ __lunaix_uid_t st_uid;
+ __lunaix_gid_t st_gid;
+ __lunaix_dev_t st_rdev;
+ __lunaix_size_t st_size;
+ __lunaix_size_t st_blksize;
+ __lunaix_size_t st_blocks;
+
+ unsigned long st_atim;
+ unsigned long st_ctim;
+ unsigned long st_mtim;
+
+ __lunaix_size_t st_ioblksize;
+};
+
+#endif /* _LUNAIX_UHDR_FNCTL_DEFS_H */
+++ /dev/null
-#ifndef __LUNAIX_SYS_FCNTL_DEFS_H
-#define __LUNAIX_SYS_FCNTL_DEFS_H
-
-#include "fstypes.h"
-#include "types.h"
-
-#define FO_CREATE 0x1
-#define FO_APPEND 0x2
-#define FO_DIRECT 0x4
-#define FO_WRONLY 0x8
-#define FO_RDONLY 0x10
-#define FO_RDWR 0x20
-#define FO_TRUNC 0x40
-
-#define FO_NOFOLLOW 0x10000
-
-#define FSEEK_SET 0x1
-#define FSEEK_CUR 0x2
-#define FSEEK_END 0x3
-
-#define O_CREAT FO_CREATE
-#define O_APPEND FO_APPEND
-#define O_DIRECT FO_DIRECT
-#define O_WRONLY FO_WRONLY
-#define O_RDONLY FO_RDONLY
-#define O_RDWR FO_RDWR
-#define O_TRUNC FO_TRUNC
-
-#define AT_SYMLINK_FOLLOW 0b0000
-#define AT_SYMLINK_NOFOLLOW 0b0001
-#define AT_FDCWD 0b0010
-#define AT_EACCESS 0b0100
-
-#define R_OK 0b100100100
-#define W_OK 0b010010010
-#define X_OK 0b001001001
-#define F_OK 0b111111111
-
-/* Mount with read-only flag */
-#define MNT_RO (1 << 0)
-
-/* Mount with block-cache-disabled flag */
-#define MNT_NC (1 << 1)
-
-typedef unsigned int mode_t;
-typedef unsigned int nlink_t;
-
-struct file_stat
-{
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
- off_t st_size;
- size_t st_blksize;
- size_t st_blocks;
-
- unsigned long st_atim;
- unsigned long st_ctim;
- unsigned long st_mtim;
-
- size_t st_ioblksize;
-};
-
-#endif /* __LUNAIX_FNCTL_DEFS_H */
-#ifndef __LUNAIX_FSTYPES_H
-#define __LUNAIX_FSTYPES_H
+#ifndef _LUNAIX_UHDR_FSTYPES_H
+#define _LUNAIX_UHDR_FSTYPES_H
/*
7 6 5 4 3 2 1 0
#define F_PIPE 0b00010000
#define F_SYMLINK 0b00100000
-#endif /* __LUNAIX_FSTYPES_H */
+#endif /* _LUNAIX_UHDR_FSTYPES_H */
-#ifndef __LUNAIX_UGFX_H
-#define __LUNAIX_UGFX_H
+#ifndef _LUNAIX_UHDR_UGFX_H
+#define _LUNAIX_UHDR_UGFX_H
#define GFX_CMDA(type, cmd_id) (((type) << 8) | ((cmd_id) & 0xf))
size_t len;
};
-#endif /* __LUNAIX_UGFX_H */
+#endif /* _LUNAIX_UHDR_UGFX_H */
-#ifndef __LUNAIX_SYS_IOCTL_DEFS_H
-#define __LUNAIX_SYS_IOCTL_DEFS_H
+#ifndef _LUNAIX_UHDR_SYS_IOCTL_H
+#define _LUNAIX_UHDR_SYS_IOCTL_H
#define IOREQ(cmd, arg_num) ((((cmd) & 0xffff) << 8) | ((arg_num) & 0xff))
#define TIMERIO_GETINFO IOREQ(1, 0)
-#endif /* __LUNAIX_IOCTL_DEFS_H */
+#endif /* _LUNAIX_UHDR_IOCTL_H */
-#ifndef __LUNAIX_SYS_MANN_FLAGS_H
-#define __LUNAIX_SYS_MANN_FLAGS_H
+#ifndef _LUNAIX_UHDR_SYS_MMAN_H
+#define _LUNAIX_UHDR_SYS_MMAN_H
// POSIX compliant.
unsigned long offset;
};
-#endif /* __LUNAIX_MANN_FLAGS_H */
+#endif /* _LUNAIX_UHDR_MMAN_H */
-#ifndef __LUNAIX_UPOLL_H
-#define __LUNAIX_UPOLL_H
+#ifndef _LUNAIX_UHDR_UPOLL_H
+#define _LUNAIX_UHDR_UPOLL_H
struct poll_info
{
#define _POLLEE_ALWAYS 1
#define _POLLEE_RM_ON_ERR (1 << 1)
-#endif /* __LUNAIX_UPOLL_H */
+#endif /* _LUNAIX_UHDR_UPOLL_H */
-#ifndef __LUNAIX_USERIAL_H
-#define __LUNAIX_USERIAL_H
+#ifndef _LUNAIX_UHDR_USERIAL_H
+#define _LUNAIX_UHDR_USERIAL_H
-#include "ioctl_defs.h"
+#include "ioctl.h"
#define SERIO_RXEN IOREQ(1, 0)
#define SERIO_RXDA IOREQ(2, 0)
#define SERIO_SETCNTRLMODE IOREQ(6, 0)
#define SERIO_SETBRDBASE IOREQ(7, 0)
-#endif /* __LUNAIX_USERIAL_H */
+#endif /* _LUNAIX_UHDR_USERIAL_H */
-#ifndef __LUNAIX_SYS_SIGNAL_DEFS_H
-#define __LUNAIX_SYS_SIGNAL_DEFS_H
+#ifndef _LUNAIX_UHDR_SYS_SIGNAL_DEFS_H
+#define _LUNAIX_UHDR_SYS_SIGNAL_DEFS_H
#define SIGALRM 1
#define SIGCHLD 2
// TODO
};
-#endif /* __LUNAIX_SIGNAL_DEFS_H */
+#endif /* _LUNAIX_UHDR_SIGNAL_DEFS_H */
-#ifndef __LUNAIX_STATUS_H
-#define __LUNAIX_STATUS_H
+#ifndef _LUNAIX_UHDR_STATUS_H
+#define _LUNAIX_UHDR_STATUS_H
#define ENOMEM -3
#define EINVAL -6
#define EPERM -33
#define EACCESS -34
-#endif /* __LUNAIX_STATUS_H */
+#endif /* _LUNAIX_UHDR_STATUS_H */
-#ifndef __LUNAIX_UTERM_H
-#define __LUNAIX_UTERM_H
+#ifndef _LUNAIX_UHDR_UTERM_H
+#define _LUNAIX_UHDR_UTERM_H
#define _BRKINT (1)
#define _ICRNL (1 << 1)
speed_t c_baud;
};
-#endif /* __LUNAIX_UTERM_H */
+#endif /* _LUNAIX_UHDR_UTERM_H */
-#ifndef __LUNAIX_USR_THREADS_H
-#define __LUNAIX_USR_THREADS_H
+#ifndef _LUNAIX_UHDR_USR_THREADS_H
+#define _LUNAIX_UHDR_USR_THREADS_H
#include "types.h"
-struct uthread_param {
+struct uthread_param
+{
void* th_handler;
void* arg1;
};
-#endif /* __LUNAIX_USR_THREADS_H */
+#endif /* _LUNAIX_UHDR_USR_THREADS_H */
-#ifndef __LUNAIX_SYS_TYPES_H
-#define __LUNAIX_SYS_TYPES_H
-
-#undef NULL
-#define NULL (void*)0
-#define NULLPTR 0
-
-#define PEXITTERM 0x100
-#define PEXITSTOP 0x200
-#define PEXITSIG 0x400
-
-#define PEXITNUM(flag, code) (flag | (code & 0xff))
-
-#define WNOHANG 1
-#define WUNTRACED 2
-#define WEXITSTATUS(wstatus) ((wstatus & 0xff))
-#define WIFSTOPPED(wstatus) ((wstatus & PEXITSTOP))
-#define WIFEXITED(wstatus) \
- ((wstatus & PEXITTERM) && ((char)WEXITSTATUS(wstatus) >= 0))
-
-#define WIFSIGNALED(wstatus) ((wstatus & PEXITSIG))
-
-typedef signed long ssize_t;
-
-typedef int pid_t;
-typedef int tid_t;
-typedef int uid_t;
-typedef int gid_t;
-
-typedef __SIZE_TYPE__ size_t;
-
-typedef __SIZE_TYPE__ off_t;
-
-typedef unsigned int ino_t;
-
-typedef struct dev_t
+#ifndef _LUNAIX_UHDR_SYS_TYPES_H
+#define _LUNAIX_UHDR_SYS_TYPES_H
+
+typedef int __lunaix_pid_t;
+typedef int __lunaix_tid_t;
+typedef int __lunaix_uid_t;
+typedef int __lunaix_gid_t;
+typedef unsigned long __lunaix_size_t;
+typedef signed long __lunaix_ssize_t;
+typedef unsigned int __lunaix_ino_t;
+
+typedef struct
{
unsigned int meta;
unsigned int unique;
unsigned int index;
-} dev_t;
+} __lunaix_dev_t;
-#endif /* __LUNAIX_TYPES_H */
+#endif /* _LUNAIX_UHDR_TYPES_H */
--- /dev/null
+#ifndef _LUNAIX_UHDR_WAIT_H
+#define _LUNAIX_UHDR_WAIT_H
+
+#define PEXITTERM 0x100
+#define PEXITSTOP 0x200
+#define PEXITSIG 0x400
+
+#define WNOHANG 1
+#define WUNTRACED 2
+
+#define PEXITNUM(flag, code) (flag | (code & 0xff))
+#define WEXITSTATUS(wstatus) ((wstatus & 0xff))
+#define WIFSTOPPED(wstatus) ((wstatus & PEXITSTOP))
+#define WIFSIGNALED(wstatus) ((wstatus & PEXITSIG))
+
+#define WIFEXITED(wstatus) \
+ ((wstatus & PEXITTERM) && ((char)WEXITSTATUS(wstatus) >= 0))
+
+#endif /* _LUNAIX_UHDR_WAIT_H */
#include <lunaix/fs/devfs.h>
#include <lunaix/spike.h>
-#include <usr/lunaix/dirent_defs.h>
+#include <usr/lunaix/dirent.h>
extern struct v_inode_ops devfs_inode_ops;
extern struct v_file_ops devfs_file_ops;
#include <klibc/string.h>
-#include <usr/lunaix/dirent_defs.h>
+#include <usr/lunaix/dirent.h>
extern struct cake_pile* drec_cache_pile;
#include <lunaix/process.h>
#include <lunaix/spike.h>
-#include <usr/lunaix/fcntl_defs.h>
+#include <usr/lunaix/fcntl.h>
#include <klibc/string.h>
#include <lunaix/fs/twifs.h>
-#include <usr/lunaix/dirent_defs.h>
+#include <usr/lunaix/dirent.h>
#define INODE_ACCESSED 0
#define INODE_MODIFY 1
#include <asm/mm_defs.h>
-#include <usr/lunaix/mann_flags.h>
+#include <usr/lunaix/mman.h>
// any size beyond this is bullshit
#define BS_SIZE (KERNEL_RESIDENT - USR_MMAP)
#include <klibc/strfmt.h>
#include <klibc/string.h>
-#include <usr/lunaix/dirent_defs.h>
+#include <usr/lunaix/dirent.h>
#define COUNTER_MASK ((1 << 16) - 1)
#include <errno.h>
#include <fcntl.h>
-#include <lunaix/lunaix.h>
-#include <lunaix/mount.h>
+#include <sys/wait.h>
+#include <sys/mount.h>
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
+#include <sys/lunaix.h>
+
#define must_mount(src, target, fs, opts) \
do { \
int err = 0; \
#ifndef __LUNALIBC_SYS_DIRENT_H
#define __LUNALIBC_SYS_DIRENT_H
-#include <lunaix/dirent_defs.h>
+#include <lunaix/dirent.h>
typedef struct
{
#ifndef __LUNALIBC_SYS_FCNTL_H
#define __LUNALIBC_SYS_FCNTL_H
-#include <lunaix/fcntl_defs.h>
-#include <lunaix/types.h>
+#include <lunaix/fcntl.h>
+#include <sys/types.h>
extern int
open(const char* path, int flags);
+++ /dev/null
-#ifndef __LUNALIBC_OSDEPS_SYSCALL_H
-#define __LUNALIBC_OSDEPS_SYSCALL_H
-
-#include <lunaix/syscallid.h>
-
-extern unsigned long
-do_lunaix_syscall(unsigned long call_id, ...);
-
-#endif /* __LUNALIBC_OSDEPS_SYSCALL_H */
#ifndef __LUNALIBC_SYS_SIGNAL_H
#define __LUNALIBC_SYS_SIGNAL_H
-#include <lunaix/signal_defs.h>
-#include <lunaix/types.h>
+#include <lunaix/signal.h>
+#include <sys/types.h>
extern sighandler_t
signal(int signum, sighandler_t handler);
#ifndef __LUNALIBC_SYS_IOCTL_H
#define __LUNALIBC_SYS_IOCTL_H
-#include <lunaix/ioctl_defs.h>
+#include <lunaix/ioctl.h>
int ioctl(int fd, int req, ...);
#ifndef __LUNALIBC_SYS_LUNAIX_H
#define __LUNALIBC_SYS_LUNAIX_H
-#include <lunaix/types.h>
+#include <sys/types.h>
#include <stddef.h>
void
yield();
-pid_t
-wait(int* status);
-
-pid_t
-waitpid(pid_t pid, int* status, int flags);
-
void
syslog(int level, const char* fmt, ...);
#define __LUNALIBC_SYS_MANN_H
#include <stddef.h>
-#include <lunaix/mann_flags.h>
-#include <lunaix/types.h>
+#include <lunaix/mman.h>
+#include <sys/types.h>
void* mmap(void* addr, size_t length, int proct, int flags, int fd, off_t offset);
#ifndef __LUNALIBC_SYS_MOUNT_H
#define __LUNALIBC_SYS_MOUNT_H
-#include <lunaix/types.h>
+#include <sys/types.h>
extern int mount(const char* source, const char* target, const char* fstype, int flags);
--- /dev/null
+#ifndef __LUNAIX_TYPES_H
+#define __LUNAIX_TYPES_H
+
+#include <lunaix/types.h>
+
+typedef __lunaix_pid_t pid_t;
+typedef __lunaix_tid_t tid_t;
+typedef __lunaix_uid_t uid_t;
+typedef __lunaix_gid_t gid_t;
+typedef __lunaix_size_t size_t;
+typedef __lunaix_ssize_t ssize_t;
+typedef __lunaix_size_t off_t;
+typedef __lunaix_ino_t ino_t;
+
+typedef __lunaix_dev_t dev_t;
+
+#endif /* __LUNAIX_TYPES_H */
--- /dev/null
+#ifndef __LUNAIX_WAIT_H
+#define __LUNAIX_WAIT_H
+
+#include <lunaix/wait.h>
+#include <sys/types.h>
+
+pid_t
+wait(int* status);
+
+pid_t
+waitpid(pid_t pid, int* status, int flags);
+
+#endif /* __LUNAIX_WAIT_H */
#ifndef __LUNALIBC_SYS_UNISTD_H
#define __LUNALIBC_SYS_UNISTD_H
-#include <lunaix/types.h>
+#include <sys/types.h>
#include <stddef.h>
extern const char** environ;
#include <syscall.h>
-#include <lunaix/dirent_defs.h>
+#include <lunaix/dirent.h>
int
sys_readdir(int fd, struct lx_dirent* dirent)
#include <syscall.h>
-#include <lunaix/ioctl.h>
+#include <sys/ioctl.h>
#include <stdarg.h>
int __attribute__((noinline))
#include <syscall.h>
-#include <lunaix/types.h>
+#include <sys/types.h>
#include <stdio.h>
void
#include <syscall.h>
-#include <lunaix/mann.h>
-#include <lunaix/types.h>
+#include <sys/mman.h>
+#include <sys/types.h>
void*
mmap(void* addr, size_t length, int proct, int flags, int fd, off_t offset)
#include <syscall.h>
-#include <lunaix/signal_defs.h>
-#include <lunaix/types.h>
+#include <lunaix/signal.h>
+#include <sys/types.h>
int
sigpending(sigset_t *set)
#include <syscall.h>
-#include <lunaix/types.h>
+#include <sys/types.h>
pid_t
fork()
#include <termios.h>
-#include <lunaix/ioctl.h>
+#include <sys/ioctl.h>
int
tcgetattr(int fd, struct termios* termios_p)
#include <errno.h>
#include <fcntl.h>
-#include <lunaix/lunaix.h>
+#include <sys/lunaix.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
-#include <lunaix/ioctl.h>
-#include <lunaix/lunaix.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
-#include <lunaix/lunaix.h>
+#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
+#include <sys/types.h>
static char buf[256];
#include <errno.h>
#include <fcntl.h>
-#include <lunaix/lunaix.h>
+#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>