Random bits and pieces

This commit is contained in:
Kevin Lange 2013-03-22 15:11:19 -07:00
parent ce4c6bea52
commit bc2e4741c7
6 changed files with 67 additions and 7 deletions

View File

@ -98,7 +98,7 @@ void mouse_handler(struct regs *r) {
mouse_cycle = 0;
mouse_device_packet_t bitbucket;
while (pipe_size(mouse_pipe) > (DISCARD_POINT * sizeof(packet))) {
while (pipe_size(mouse_pipe) > (int)(DISCARD_POINT * sizeof(packet))) {
read_fs(mouse_pipe, 0, sizeof(packet), (uint8_t *)&bitbucket);
}
write_fs(mouse_pipe, 0, sizeof(packet), (uint8_t *)&packet);

View File

@ -25,7 +25,7 @@ static inline size_t pipe_unread(pipe_device_t * pipe) {
}
}
size_t pipe_size(fs_node_t * node) {
int pipe_size(fs_node_t * node) {
pipe_device_t * pipe = (pipe_device_t *)node->inode;
return pipe_unread(pipe);
}

View File

@ -19,6 +19,6 @@ typedef struct _pipe_device {
} pipe_device_t;
fs_node_t * make_pipe(size_t size);
size_t pipe_size(fs_node_t * node);
int pipe_size(fs_node_t * node);
#endif

View File

@ -355,8 +355,8 @@ process_t * process_get_first_child_rec(tree_node_t * node, process_t * target)
process_t * proc = (process_t *)node->value;
if (proc == target) {
foreach(child, node->children) {
debug_print(WARNING, "Found a child: %d", ((process_t *)child->value)->id);
return child->value;
process_t * cproc = (process_t *)((tree_node_t *)child->value)->value;
return cproc;
}
return NULL;
}

View File

@ -13,6 +13,7 @@
#include <sys/termios.h>
#include <stdio.h>
#include <utime.h>
#include <signal.h>
#include <_ansi.h>
#include <errno.h>
@ -480,6 +481,16 @@ int tcsetattr(int fd, int actions, struct termios * tio) {
return 0;
}
int tcsetpgrp(int fd, pid_t pgrp) {
DEBUG_STUB("tcsetpgrp(%d,%d);\n", fd, pgrp);
return 0;
}
pid_t tcgetpgrp(int fd) {
DEBUG_STUB("tcgetpgrp(%d);\n", fd);
return -1;
}
int fpathconf(int file, int name) {
DEBUG_STUB("fpathconf(%d,%d)\n", file, name);
return 0;
@ -502,11 +513,52 @@ int geteuid() {
return getuid();
}
int getegid() {
return getgid();
}
int getgroups(int size, gid_t list[]) {
DEBUG_STUB("getgroups(...);\n");
return 0;
}
pid_t wait3(int *status, int options, struct rusage *rusage) {
return wait(status);
}
int dup(int oldfd) {
return dup2(oldfd, 0);
}
void sync() {
/* LOOOL NOPE */
int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
DEBUG_STUB("sigprocmask(%d, 0x%x, 0x%x);\n", how, set, oldset);
return -1;
}
int sigsuspend(const sigset_t * mask) {
DEBUG_STUB("sigsuspend(0x%x);\n", mask);
syscall_yield();
return -1;
}
int setpgid(pid_t pid, pid_t pgid) {
DEBUG_STUB("setpgid(%d,%d);\n", pid, pgid);
return -1;
}
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
DEBUG_STUB("sigaction(%d,...);\n", signum);
return 0;
}
pid_t getppid() {
DEBUG_STUB("getppid()\n");
return 0;
}
void sync() {
DEBUG_STUB("sync();\n");
}

View File

@ -0,0 +1,8 @@
#include <stdlib.h>
#include <stdio.h>
int main(int arch, char * argv[]) {
fprintf(stderr, "Calling system(\"echo hello world\")\n");
int ret = system("echo hello world");
fprintf(stderr, "Done. Returned %d.\n", ret);
}