summaryrefslogtreecommitdiff
path: root/scalls
diff options
context:
space:
mode:
Diffstat (limited to 'scalls')
-rw-r--r--scalls/accept.c5
-rw-r--r--scalls/accept.h9
-rw-r--r--scalls/bind.c5
-rw-r--r--scalls/bind.h9
-rw-r--r--scalls/clock_gettime.c10
-rw-r--r--scalls/clock_gettime.h8
-rw-r--r--scalls/ftruncate.c6
-rw-r--r--scalls/ftruncate.h2
-rw-r--r--scalls/mkdir.c5
-rw-r--r--scalls/mkdir.h2
-rw-r--r--scalls/mmap.c7
-rw-r--r--scalls/mmap.h13
-rw-r--r--scalls/msleep.c9
-rw-r--r--scalls/msleep.h5
-rw-r--r--scalls/ppoll.c11
-rw-r--r--scalls/ppoll.h9
-rw-r--r--scalls/recvfrom.c59
-rw-r--r--scalls/recvfrom.h11
-rw-r--r--scalls/sendto.c23
-rw-r--r--scalls/sendto.h11
-rw-r--r--scalls/shm.c6
-rw-r--r--scalls/shm.h14
-rw-r--r--scalls/socket.c5
-rw-r--r--scalls/socket.h9
-rw-r--r--scalls/stat.c13
-rw-r--r--scalls/stat.h33
-rw-r--r--scalls/uptime.c4
-rw-r--r--scalls/uptime.h2
28 files changed, 0 insertions, 305 deletions
diff --git a/scalls/accept.c b/scalls/accept.c
deleted file mode 100644
index 3c3f5ad..0000000
--- a/scalls/accept.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "accept.h"
-
-int syscall_accept(SYS_ACCEPT_PARAMS *args) {
- return accept(args->socket, args->address, args->address_len);
-}
diff --git a/scalls/accept.h b/scalls/accept.h
deleted file mode 100644
index d022999..0000000
--- a/scalls/accept.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "../socket.h"
-
-typedef struct SYS_ACCEPT_PARAMS {
- int socket;
- struct sockaddr *address;
- socklen_t *address_len;
-} __attribute__((packed)) SYS_ACCEPT_PARAMS;
-
-int syscall_accept(SYS_ACCEPT_PARAMS *args);
diff --git a/scalls/bind.c b/scalls/bind.c
deleted file mode 100644
index 76e36ab..0000000
--- a/scalls/bind.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "bind.h"
-
-int syscall_bind(SYS_BIND_PARAMS *args) {
- return bind(args->sockfd, args->addr, args->addrlen);
-}
diff --git a/scalls/bind.h b/scalls/bind.h
deleted file mode 100644
index 5661ad0..0000000
--- a/scalls/bind.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "../socket.h"
-
-typedef struct SYS_BIND_PARAMS {
- int sockfd;
- const struct sockaddr *addr;
- socklen_t addrlen;
-} __attribute__((packed)) SYS_BIND_PARAMS;
-
-int syscall_bind(SYS_BIND_PARAMS *args);
diff --git a/scalls/clock_gettime.c b/scalls/clock_gettime.c
deleted file mode 100644
index 632ea08..0000000
--- a/scalls/clock_gettime.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <scalls/clock_gettime.h>
-
-int syscall_clock_gettime(SYS_CLOCK_GETTIME_PARAMS *args) {
- // FIXME: Actually implement this
- if (args->ts) {
- args->ts->tv_sec = 0;
- args->ts->tv_nsec = 0;
- }
- return 0;
-}
diff --git a/scalls/clock_gettime.h b/scalls/clock_gettime.h
deleted file mode 100644
index 145aa24..0000000
--- a/scalls/clock_gettime.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <time.h>
-
-typedef struct SYS_CLOCK_GETTIME_PARAMS {
- clockid_t clk;
- struct timespec *ts;
-} __attribute__((packed)) SYS_CLOCK_GETTIME_PARAMS;
-
-int syscall_clock_gettime(SYS_CLOCK_GETTIME_PARAMS *args);
diff --git a/scalls/ftruncate.c b/scalls/ftruncate.c
deleted file mode 100644
index 6bc1170..0000000
--- a/scalls/ftruncate.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <fs/vfs.h>
-#include <scalls/ftruncate.h>
-
-int syscall_ftruncate(int fd, size_t length) {
- return vfs_ftruncate(fd, length);
-}
diff --git a/scalls/ftruncate.h b/scalls/ftruncate.h
deleted file mode 100644
index 9213e85..0000000
--- a/scalls/ftruncate.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <stddef.h>
-int syscall_ftruncate(int fd, size_t length);
diff --git a/scalls/mkdir.c b/scalls/mkdir.c
deleted file mode 100644
index 43f2424..0000000
--- a/scalls/mkdir.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <scalls/mkdir.h>
-
-int syscall_mkdir(const char *path, int mode) {
- return vfs_mkdir(path, mode);
-}
diff --git a/scalls/mkdir.h b/scalls/mkdir.h
deleted file mode 100644
index 0bf0043..0000000
--- a/scalls/mkdir.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <fs/vfs.h>
-int syscall_mkdir(const char *path, int mode);
diff --git a/scalls/mmap.c b/scalls/mmap.c
deleted file mode 100644
index 83fff6a..0000000
--- a/scalls/mmap.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <scalls/mmap.h>
-#include <sched/scheduler.h>
-
-void *syscall_mmap(SYS_MMAP_PARAMS *args) {
- return mmap(args->addr, args->length, args->prot, args->flags, args->fd,
- args->offset);
-}
diff --git a/scalls/mmap.h b/scalls/mmap.h
deleted file mode 100644
index f5e121e..0000000
--- a/scalls/mmap.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct SYS_MMAP_PARAMS {
- void *addr;
- size_t length;
- int prot;
- int flags;
- int fd;
- size_t offset;
-} __attribute__((packed)) SYS_MMAP_PARAMS;
-
-void *syscall_mmap(SYS_MMAP_PARAMS *args);
diff --git a/scalls/msleep.c b/scalls/msleep.c
deleted file mode 100644
index 0120f08..0000000
--- a/scalls/msleep.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <drivers/pit.h>
-#include <scalls/msleep.h>
-#include <sched/scheduler.h>
-#include <stdio.h>
-
-void syscall_msleep(uint32_t ms) {
- get_current_task()->sleep_until = pit_num_ms() + ms;
- switch_task();
-}
diff --git a/scalls/msleep.h b/scalls/msleep.h
deleted file mode 100644
index 71bf269..0000000
--- a/scalls/msleep.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef MSLEEP_H
-#define MSLEEP_H
-#include <stdint.h>
-void syscall_msleep(uint32_t ms);
-#endif
diff --git a/scalls/ppoll.c b/scalls/ppoll.c
deleted file mode 100644
index 8feb35c..0000000
--- a/scalls/ppoll.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <scalls/ppoll.h>
-#include <fs/vfs.h>
-#include <poll.h>
-#include <sched/scheduler.h>
-
-int syscall_poll(SYS_POLL_PARAMS *args) {
- struct pollfd *fds = args->fds;
- size_t nfds = args->nfds;
- int timeout = args->timeout;
- return poll(fds, nfds, timeout);
-}
diff --git a/scalls/ppoll.h b/scalls/ppoll.h
deleted file mode 100644
index 13700b5..0000000
--- a/scalls/ppoll.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stddef.h>
-
-typedef struct SYS_POLL_PARAMS {
- struct pollfd *fds;
- size_t nfds;
- int timeout;
-} __attribute__((packed)) SYS_POLL_PARAMS;
-
-int syscall_poll(SYS_POLL_PARAMS *args);
diff --git a/scalls/recvfrom.c b/scalls/recvfrom.c
deleted file mode 100644
index 1770fa1..0000000
--- a/scalls/recvfrom.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <assert.h>
-#include <fs/vfs.h>
-#include <math.h>
-#include <poll.h>
-#include <scalls/recvfrom.h>
-
-size_t syscall_recvfrom(
- int socket, void *buffer, size_t length, int flags,
- struct two_args
- *extra_args /*struct sockaddr *address, socklen_t *address_len*/) {
-
- struct sockaddr *address = (struct sockaddr *)extra_args->a;
- socklen_t *address_len = (socklen_t *)extra_args->b;
- kprintf("address: %x\n", address);
- kprintf("address_len: %x\n", address_len);
-
- if (flags & MSG_WAITALL) {
- struct pollfd fds[1];
- fds[0].fd = socket;
- fds[0].events = POLLIN;
- poll(fds, 1, 0);
- }
-
- uint16_t data_length;
- socklen_t tmp_socklen;
- vfs_pread(socket, &tmp_socklen, sizeof(socklen_t), 0);
- if (address_len)
- *address_len = tmp_socklen;
- if (address) {
- vfs_pread(socket, address, tmp_socklen, 0);
- } else {
- // We still have to throwaway the data.
- char devnull[100];
- for (; tmp_socklen;) {
- int rc = vfs_pread(socket, devnull, min(tmp_socklen, 100), 0);
- assert(rc >= 0);
- tmp_socklen -= rc;
- }
- }
-
- vfs_pread(socket, &data_length, sizeof(data_length), 0);
- // If it is reading less than the packet length that could cause
- // problems as the next read will not be put at a new header. Luckily
- // it seems as if other UNIX systems can discard the rest of the
- // packet if not read.
-
- // Read in the data requested
- int read_len = min(length, data_length);
- int rc = vfs_pread(socket, buffer, read_len, 0);
- // Discard the rest of the packet
- int rest = data_length - read_len;
- char devnull[100];
- for (; rest;) {
- int rc = vfs_pread(socket, devnull, 100, 0);
- assert(rc >= 0);
- rest -= rc;
- }
- return rc;
-}
diff --git a/scalls/recvfrom.h b/scalls/recvfrom.h
deleted file mode 100644
index d81a1e0..0000000
--- a/scalls/recvfrom.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <socket.h>
-
-struct two_args {
- uint32_t a;
- uint32_t b;
-};
-
-size_t syscall_recvfrom(
- int socket, void *buffer, size_t length, int flags,
- struct two_args
- *extra_args /*struct sockaddr *address, socklen_t *address_len*/);
diff --git a/scalls/sendto.c b/scalls/sendto.c
deleted file mode 100644
index 48c4020..0000000
--- a/scalls/sendto.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <assert.h>
-#include <network/bytes.h>
-#include <network/udp.h>
-#include <scalls/sendto.h>
-
-size_t syscall_sendto(int socket, const void *message, size_t length,
- int flags, struct t_two_args *extra_args /*
- const struct sockaddr *dest_addr,
- socklen_t dest_len*/) {
- const struct sockaddr *dest_addr = (const struct sockaddr *)extra_args->a;
- socklen_t dest_len = (socklen_t)extra_args->b;
- (void)dest_len;
- vfs_fd_t *fd = get_vfs_fd(socket);
- assert(fd);
- SOCKET *s = (SOCKET *)fd->inode->internal_object;
- OPEN_INET_SOCKET *inet = s->child;
- assert(inet);
- struct sockaddr_in in;
- in.sin_addr.s_addr = inet->address;
- in.sin_port = inet->port;
- send_udp_packet(&in, (const struct sockaddr_in *)dest_addr, message, length);
- return length; // FIXME: This is probably not true.
-}
diff --git a/scalls/sendto.h b/scalls/sendto.h
deleted file mode 100644
index 0f852de..0000000
--- a/scalls/sendto.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <socket.h>
-#include <stdint.h>
-
-struct t_two_args {
- uint32_t a;
- uint32_t b;
-};
-size_t syscall_sendto(int socket, const void *message, size_t length,
- int flags, struct t_two_args *extra_args /*
- const struct sockaddr *dest_addr,
- socklen_t dest_len*/);
diff --git a/scalls/shm.c b/scalls/shm.c
deleted file mode 100644
index 979084a..0000000
--- a/scalls/shm.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "shm.h"
-#include "../fs/shm.h"
-
-int syscall_shm_open(SYS_SHM_OPEN_PARAMS *args) {
- return shm_open(args->name, args->oflag, args->mode);
-}
diff --git a/scalls/shm.h b/scalls/shm.h
deleted file mode 100644
index 80e4366..0000000
--- a/scalls/shm.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SYS_SHM_H
-#define SYS_SHM_H
-#include <stddef.h>
-#include <stdint.h>
-typedef int mode_t;
-
-typedef struct SYS_SHM_OPEN_PARAMS {
- const char *name;
- int oflag;
- mode_t mode;
-} __attribute__((packed)) SYS_SHM_OPEN_PARAMS;
-
-int syscall_shm_open(SYS_SHM_OPEN_PARAMS *args);
-#endif
diff --git a/scalls/socket.c b/scalls/socket.c
deleted file mode 100644
index 594c745..0000000
--- a/scalls/socket.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "socket.h"
-
-int syscall_socket(SYS_SOCKET_PARAMS *args) {
- return socket(args->domain, args->type, args->protocol);
-}
diff --git a/scalls/socket.h b/scalls/socket.h
deleted file mode 100644
index 6540b0f..0000000
--- a/scalls/socket.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "../socket.h"
-
-typedef struct SYS_SOCKET_PARAMS {
- int domain;
- int type;
- int protocol;
-} __attribute__((packed)) SYS_SOCKET_PARAMS;
-
-int syscall_socket(SYS_SOCKET_PARAMS *args);
diff --git a/scalls/stat.c b/scalls/stat.c
deleted file mode 100644
index 0850151..0000000
--- a/scalls/stat.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <errno.h>
-#include <fs/vfs.h>
-#include <scalls/stat.h>
-
-int syscall_stat(SYS_STAT_PARAMS *args) {
- const char *pathname = copy_and_allocate_user_string(args->pathname);
- struct stat *statbuf = args->statbuf;
- vfs_inode_t *i = vfs_internal_open(pathname);
- if (!i)
- return -ENOENT;
- statbuf->st_size = i->file_size;
- return 0;
-}
diff --git a/scalls/stat.h b/scalls/stat.h
deleted file mode 100644
index 78e8c45..0000000
--- a/scalls/stat.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <types.h>
-#include <time.h>
-
-typedef struct SYS_STAT_PARAMS {
- const char *pathname;
- struct stat *statbuf;
-} __attribute__((packed)) SYS_STAT_PARAMS;
-
-struct stat {
- dev_t st_dev; // Device ID of device containing file.
- ino_t st_ino; // File serial number.
- mode_t st_mode; // Mode of file (see below).
- nlink_t st_nlink; // Number of hard links to the file.
- uid_t st_uid; // User ID of file.
- gid_t st_gid; // Group ID of file.
- dev_t st_rdev; // Device ID (if file is character or block special).
- off_t st_size; // For regular files, the file size in bytes.
- // For symbolic links, the length in bytes of the
- // pathname contained in the symbolic link.
- // For a shared memory object, the length in bytes.
- // For a typed memory object, the length in bytes.
- // For other file types, the use of this field is
- // unspecified.
- struct timespec st_atim; // Last data access timestamp.
- struct timespec st_mtim; // Last data modification timestamp.
- struct timespec st_ctim; // Last file status change timestamp.
- blksize_t st_blksize; // A file system-specific preferred I/O block size
- // for this object. In some file system types, this
- // may vary from file to file.
- blkcnt_t st_blocks; // Number of blocks allocated for this object.
-};
-
-int syscall_stat(SYS_STAT_PARAMS *args);
diff --git a/scalls/uptime.c b/scalls/uptime.c
deleted file mode 100644
index 866c7e5..0000000
--- a/scalls/uptime.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <scalls/uptime.h>
-#include <drivers/pit.h>
-
-uint32_t syscall_uptime(void) { return (uint32_t)pit_num_ms(); }
diff --git a/scalls/uptime.h b/scalls/uptime.h
deleted file mode 100644
index 2b5b0c9..0000000
--- a/scalls/uptime.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <stdint.h>
-uint32_t syscall_uptime(void);