Skip to content

Commit

Permalink
Rename sys directory to kernel
Browse files Browse the repository at this point in the history
A number of the headers in it were conflicting with macOS system
headers.
  • Loading branch information
tbodt committed Oct 13, 2017
1 parent 84bc907 commit f1e63c4
Show file tree
Hide file tree
Showing 47 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "emu/cpu.h"
#include "emu/modrm.h"
#include "emu/interrupt.h"
#include "sys/calls.h"
#include "kernel/calls.h"

#undef DEFAULT_CHANNEL
#define DEFAULT_CHANNEL instr
Expand Down
2 changes: 1 addition & 1 deletion emu/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdio.h>
#include <errno.h>

#include "sys/errno.h"
#include "kernel/errno.h"
#include "emu/memory.h"

static void tlb_flush(struct mem *mem);
Expand Down
2 changes: 1 addition & 1 deletion fs/adhoc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sys/stat.h>
#include "sys/fs.h"
#include "kernel/fs.h"

static struct mount adhoc_mount;

Expand Down
2 changes: 1 addition & 1 deletion fs/dev.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "sys/errno.h"
#include "kernel/errno.h"
#include "fs/dev.h"
#include "fs/tty.h"

Expand Down
2 changes: 1 addition & 1 deletion fs/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <sys/types.h>
#include <sys/sysmacros.h>
#include "sys/fs.h"
#include "kernel/fs.h"

// a dev_t is encoded like this in hex, where M is major and m is minor:
// mmmMMMmm
Expand Down
6 changes: 3 additions & 3 deletions fs/dir.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <string.h>

#include "sys/calls.h"
#include "sys/errno.h"
#include "sys/fs.h"
#include "kernel/calls.h"
#include "kernel/errno.h"
#include "kernel/fs.h"

struct linux_dirent64 {
qword_t inode;
Expand Down
4 changes: 2 additions & 2 deletions fs/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <string.h>
#include <sys/stat.h>

#include "sys/fs.h"
#include "kernel/fs.h"
#include "fs/dev.h"
#include "sys/process.h"
#include "kernel/process.h"

struct fd *fd_create() {
struct fd *fd = malloc(sizeof(struct fd));
Expand Down
2 changes: 1 addition & 1 deletion fs/path.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <string.h>
#include "sys/calls.h"
#include "kernel/calls.h"

#define __NO_AT (struct fd *) 1

Expand Down
4 changes: 2 additions & 2 deletions fs/poll.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <poll.h>
#include "misc.h"
#include "util/list.h"
#include "sys/errno.h"
#include "sys/fs.h"
#include "kernel/errno.h"
#include "kernel/fs.h"

struct poll *poll_create() {
struct poll *poll = malloc(sizeof(struct poll));
Expand Down
6 changes: 3 additions & 3 deletions fs/real.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include <sys/xattr.h>
#include <sys/file.h>

#include "sys/errno.h"
#include "sys/calls.h"
#include "sys/fs.h"
#include "kernel/errno.h"
#include "kernel/calls.h"
#include "kernel/fs.h"
#include "fs/dev.h"
#include "fs/tty.h"

Expand Down
6 changes: 3 additions & 3 deletions fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <sys/stat.h>
#include <limits.h>

#include "sys/calls.h"
#include "sys/errno.h"
#include "sys/fs.h"
#include "kernel/calls.h"
#include "kernel/errno.h"
#include "kernel/fs.h"

struct newstat64 stat_convert_newstat64(struct statbuf stat) {
struct newstat64 newstat;
Expand Down
2 changes: 1 addition & 1 deletion fs/tty-real.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <pthread.h>
#include <signal.h>

#include "sys/calls.h"
#include "kernel/calls.h"
#include "fs/tty.h"

static void real_tty_read_thread(struct tty *tty) {
Expand Down
2 changes: 1 addition & 1 deletion fs/tty.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define DEFAULT_CHANNEL debug
#include "debug.h"
#include <string.h>
#include "sys/calls.h"
#include "kernel/calls.h"
#include "fs/tty.h"

// TODO remove magic number
Expand Down
2 changes: 1 addition & 1 deletion fs/tty.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TTY_H
#define TTY_H

#include "sys/fs.h"
#include "kernel/fs.h"
#include "fs/dev.h"

struct winsize_ {
Expand Down
2 changes: 1 addition & 1 deletion sys/calls.c → kernel/calls.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "debug.h"
#include "sys/calls.h"
#include "kernel/calls.h"
#include "emu/interrupt.h"

#define NUM_SYSCALLS 400
Expand Down
10 changes: 5 additions & 5 deletions sys/calls.h → kernel/calls.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef CALLS_H
#define CALLS_H

#include "sys/process.h"
#include "sys/errno.h"
#include "sys/fs.h"
#include "kernel/process.h"
#include "kernel/errno.h"
#include "kernel/fs.h"
#include "misc.h"

#include "sys/signal.h"
#include "sys/sock.h"
#include "kernel/signal.h"
#include "kernel/sock.h"

void handle_interrupt(struct cpu_state *cpu, int interrupt);

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions sys/exec.c → kernel/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <string.h>

#include "misc.h"
#include "sys/calls.h"
#include "sys/errno.h"
#include "sys/elf.h"
#include "kernel/calls.h"
#include "kernel/errno.h"
#include "kernel/elf.h"
#include "libvdso.so.h"

#define ERRNO_FAIL(label) { \
Expand Down
2 changes: 1 addition & 1 deletion sys/exit.c → kernel/exit.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <pthread.h>
#include "sys/calls.h"
#include "kernel/calls.h"

noreturn void do_exit(int status) {
if (current->pid == 1) {
Expand Down
4 changes: 2 additions & 2 deletions sys/fork.c → kernel/fork.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "debug.h"
#include "sys/process.h"
#include "sys/calls.h"
#include "kernel/process.h"
#include "kernel/calls.h"

#define CSIGNAL_ 0x000000ff
#define CLONE_VM_ 0x00000100
Expand Down
8 changes: 4 additions & 4 deletions sys/fs.c → kernel/fs.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "debug.h"
#include <string.h>
#include <sys/stat.h>
#include "sys/calls.h"
#include "sys/errno.h"
#include "sys/process.h"
#include "sys/fs.h"
#include "kernel/calls.h"
#include "kernel/errno.h"
#include "kernel/process.h"
#include "kernel/fs.h"

fd_t fd_next() {
for (fd_t fd = 0; fd < MAX_FD; fd++)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sys/getset.c → kernel/getset.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "sys/calls.h"
#include "kernel/calls.h"

dword_t sys_getpid() {
STRACE("getpid()");
Expand Down
4 changes: 2 additions & 2 deletions sys/group.c → kernel/group.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "util/list.h"
#include "sys/calls.h"
#include "sys/process.h"
#include "kernel/calls.h"
#include "kernel/process.h"

dword_t sys_setpgid(dword_t id, dword_t pgid) {
int err;
Expand Down
4 changes: 2 additions & 2 deletions sys/mm.c → kernel/mm.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <sys/mman.h>
#include <string.h>
#include "sys/calls.h"
#include "sys/errno.h"
#include "kernel/calls.h"
#include "kernel/errno.h"
#include "emu/memory.h"

addr_t sys_brk(addr_t new_brk) {
Expand Down
6 changes: 3 additions & 3 deletions sys/mmap.c → kernel/mmap.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "debug.h"
#include "sys/calls.h"
#include "sys/errno.h"
#include "sys/process.h"
#include "kernel/calls.h"
#include "kernel/errno.h"
#include "kernel/process.h"
#include "emu/memory.h"

addr_t sys_mmap2(addr_t addr, dword_t len, dword_t prot, dword_t flags, fd_t fd_no, dword_t offset) {
Expand Down
4 changes: 2 additions & 2 deletions sys/poll.c → kernel/poll.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "debug.h"
#include "sys/fs.h"
#include "sys/calls.h"
#include "kernel/fs.h"
#include "kernel/calls.h"

dword_t sys_poll(addr_t fds, dword_t nfds, dword_t timeout) {
if (nfds != 1)
Expand Down
4 changes: 2 additions & 2 deletions sys/process.c → kernel/process.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include "sys/calls.h"
#include "sys/process.h"
#include "kernel/calls.h"
#include "kernel/process.h"
#include "emu/memory.h"

__thread struct process *current;
Expand Down
4 changes: 2 additions & 2 deletions sys/process.h → kernel/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <stdatomic.h>
#include "util/list.h"
#include "emu/cpu.h"
#include "sys/fs.h"
#include "sys/signal.h"
#include "kernel/fs.h"
#include "kernel/signal.h"

struct process {
struct cpu_state cpu; // do not access this field except on the current process
Expand Down
6 changes: 3 additions & 3 deletions sys/signal.c → kernel/signal.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "debug.h"
#include <signal.h>
#include "sys/calls.h"
#include "sys/signal.h"
#include "sys/vdso.h"
#include "kernel/calls.h"
#include "kernel/signal.h"
#include "kernel/vdso.h"

int xsave_extra = 0;
int fxsave_extra = 0;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions sys/sock.c → kernel/sock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <sys/socket.h>
#include "sys/calls.h"
#include "sys/sock.h"
#include "kernel/calls.h"
#include "kernel/sock.h"
#include "debug.h"

static struct fd_ops socket_fdops;
Expand Down
2 changes: 1 addition & 1 deletion sys/sock.h → kernel/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define SYS_SOCK_H

#include <sys/socket.h>
#include "sys/errno.h"
#include "kernel/errno.h"
#include "misc.h"
#include "debug.h"

Expand Down
4 changes: 2 additions & 2 deletions sys/sockaddr.c → kernel/sockaddr.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include "sys/sock.h"
#include "sys/fs.h"
#include "kernel/sock.h"
#include "kernel/fs.h"

struct sockaddr_un_ {
uint16_t family;
Expand Down
4 changes: 2 additions & 2 deletions sys/time.c → kernel/time.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "debug.h"
#include <time.h>
#include <signal.h>
#include "sys/calls.h"
#include "sys/errno.h"
#include "kernel/calls.h"
#include "kernel/errno.h"

dword_t sys_time(addr_t time_out) {
dword_t now = time(NULL);
Expand Down
2 changes: 1 addition & 1 deletion sys/tls.c → kernel/tls.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "sys/calls.h"
#include "kernel/calls.h"

struct user_desc {
dword_t entry_number;
Expand Down
2 changes: 1 addition & 1 deletion sys/uname.c → kernel/uname.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <strings.h>
#include <string.h>
#include <sys/sysinfo.h>
#include "sys/calls.h"
#include "kernel/calls.h"

int sys_uname(struct uname *uts) {
bzero(uts, sizeof(struct uname));
Expand Down
2 changes: 1 addition & 1 deletion sys/user.c → kernel/user.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "sys/calls.h"
#include "kernel/calls.h"

int user_read_proc(struct process *proc, addr_t addr, void *buf, size_t count) {
char *cbuf = (char *) buf;
Expand Down
4 changes: 2 additions & 2 deletions sys/vdso.c → kernel/vdso.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string.h>
#include "sys/elf.h"
#include "sys/vdso.h"
#include "kernel/elf.h"
#include "kernel/vdso.h"

int vdso_symbol(const char *name) {
struct elf_header *header = (void *) vdso_data;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include "sys/calls.h"
#include "sys/process.h"
#include "kernel/calls.h"
#include "kernel/process.h"
#include "xX_main_Xx.h"

int main(int argc, char *const argv[]) {
Expand Down
Loading

0 comments on commit f1e63c4

Please sign in to comment.