Renamed VFS syscalls to the new scheme.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7979 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-06-15 16:00:53 +00:00
parent fc44d00f56
commit 6f4ae5140d
6 changed files with 32 additions and 29 deletions
+3 -3
View File
@@ -9,9 +9,9 @@
int RLD_STARTUP(void *args) int RLD_STARTUP(void *args)
{ {
#if DEBUG_RLD #if DEBUG_RLD
sys_close(0); open("/dev/console", 0); /* stdin */ close(0); open("/dev/console", 0); /* stdin */
sys_close(1); open("/dev/console", 0); /* stdout */ close(1); open("/dev/console", 0); /* stdout */
sys_close(2); open("/dev/console", 0); /* stderr */ close(2); open("/dev/console", 0); /* stderr */
#endif #endif
return rldmain(args); return rldmain(args);
} }
+1 -1
View File
@@ -20,7 +20,7 @@ printf(const char *fmt, ...)
i = vsprintf(buf, fmt, args); i = vsprintf(buf, fmt, args);
va_end(args); va_end(args);
sys_write(2, 0, buf, strlen(buf)); _kern_write(2, 0, buf, strlen(buf));
return i; return i;
} }
+4 -4
View File
@@ -811,10 +811,10 @@ load_container(char const *path, char const *name, image_type type)
return found; return found;
} }
fd = sys_open(path, 0); fd = _kern_open(path, 0);
FATAL((fd < 0), "cannot open file %s\n", path); FATAL((fd < 0), "cannot open file %s\n", path);
len = sys_read(fd, 0, &eheader, sizeof(eheader)); len = _kern_read(fd, 0, &eheader, sizeof(eheader));
FATAL((len != sizeof(eheader)), "troubles reading ELF header\n"); FATAL((len != sizeof(eheader)), "troubles reading ELF header\n");
if (parse_elf_header(&eheader, &pheaderSize, &sheaderSize) < B_OK) { if (parse_elf_header(&eheader, &pheaderSize, &sheaderSize) < B_OK) {
@@ -823,7 +823,7 @@ load_container(char const *path, char const *name, image_type type)
// ToDo: what to do about this restriction?? // ToDo: what to do about this restriction??
FATAL((pheaderSize > (int)sizeof(ph_buff)), "cannot handle Program headers bigger than %lu\n", (long unsigned)sizeof(ph_buff)); FATAL((pheaderSize > (int)sizeof(ph_buff)), "cannot handle Program headers bigger than %lu\n", (long unsigned)sizeof(ph_buff));
len = sys_read(fd, eheader.e_phoff, ph_buff, pheaderSize); len = _kern_read(fd, eheader.e_phoff, ph_buff, pheaderSize);
FATAL((len != pheaderSize), "troubles reading Program headers\n"); FATAL((len != pheaderSize), "troubles reading Program headers\n");
num_regions = count_regions(ph_buff, eheader.e_phnum, eheader.e_phentsize); num_regions = count_regions(ph_buff, eheader.e_phnum, eheader.e_phentsize);
@@ -845,7 +845,7 @@ load_container(char const *path, char const *name, image_type type)
image->type = type; image->type = type;
register_image(image, path); register_image(image, path);
sys_close(fd); _kern_close(fd);
enqueue_image(&gLoadedImages, image); enqueue_image(&gLoadedImages, image);
+1 -1
View File
@@ -97,7 +97,7 @@ cmd_mkdir(int argc, char *argv[])
return 0; return 0;
} }
rc = sys_create_dir(argv[1],0755); rc = _kern_create_dir(argv[1],0755);
if (rc < 0) { if (rc < 0) {
printf("sys_mkdir() returned error: %s\n", strerror(rc)); printf("sys_mkdir() returned error: %s\n", strerror(rc));
} else { } else {
+22 -20
View File
@@ -1,8 +1,9 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <syscalls.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include "parse.h" #include "parse.h"
#include "commands.h" #include "commands.h"
@@ -485,7 +486,8 @@ void parse_vars_in_string(const char *string,char *out,int max_len)
} }
static int launch(int (*cmd)(int, char **), int argc, char **argv, char *r_in, char *r_out) static int
launch(int (*cmd)(int, char **), int argc, char **argv, char *r_in, char *r_out)
{ {
int saved_in; int saved_in;
int saved_out; int saved_out;
@@ -495,11 +497,11 @@ static int launch(int (*cmd)(int, char **), int argc, char **argv, char *r_in, c
int err; int err;
if (strcmp(r_in, "")!= 0) { if (strcmp(r_in, "")!= 0) {
new_in = sys_open(r_in, 0); new_in = open(r_in, 0);
if (new_in < 0) if (new_in < 0)
new_in = sys_create(r_in, 0, 0644); new_in = creat(r_in, 0644);
} else { } else {
new_in = sys_dup(0); new_in = dup(0);
} }
if (new_in < 0) { if (new_in < 0) {
err = new_in; err = new_in;
@@ -507,36 +509,36 @@ static int launch(int (*cmd)(int, char **), int argc, char **argv, char *r_in, c
} }
if (strcmp(r_out, "")!= 0) { if (strcmp(r_out, "")!= 0) {
new_out = sys_open(r_out, 0); new_out = open(r_out, 0);
if (new_out < 0) if (new_out < 0)
new_out = sys_create(r_out, 0, 0644); new_out = creat(r_out, 0644);
} else { } else {
new_out = sys_dup(1); new_out = dup(1);
} }
if (new_out < 0) { if (new_out < 0) {
err = new_out; err = new_out;
goto err_2; goto err_2;
} }
saved_in = sys_dup(0); saved_in = dup(0);
saved_out= sys_dup(1); saved_out= dup(1);
sys_dup2(new_in, 0); dup2(new_in, 0);
sys_dup2(new_out, 1); dup2(new_out, 1);
sys_close(new_in); close(new_in);
sys_close(new_out); close(new_out);
retval= cmd(argc, argv); retval = cmd(argc, argv);
sys_dup2(saved_in, 0); dup2(saved_in, 0);
sys_dup2(saved_out, 1); dup2(saved_out, 1);
sys_close(saved_in); close(saved_in);
sys_close(saved_out); close(saved_out);
return 0; return 0;
err_2: err_2:
sys_close(new_in); close(new_in);
err_1: err_1:
return err; return err;
} }
+1
View File
@@ -1,6 +1,7 @@
#ifndef _shell_defs_h_ #ifndef _shell_defs_h_
#define _shell_defs_h_ #define _shell_defs_h_
#include <SupportDefs.h>
#include "script.h" #include "script.h"
#define NAME_VAR_PATH "path" #define NAME_VAR_PATH "path"