diff options
author | Michael Frysinger <vapier@gentoo.org> | 2011-07-02 01:47:36 +0400 |
---|---|---|
committer | Michael Frysinger <vapier@gentoo.org> | 2011-07-02 01:47:36 +0400 |
commit | 1df99a60b380da06b0168b5a0484b83e64173fcb (patch) | |
tree | e834235ea938160d99667c1da8ff183127e220ab | |
parent | ecd3577e1df0eb8a0a98666c63741c9cf64e869c (diff) |
libgloss: bfin: implement getpid/fstat/stat/link/unlink syscalls
The current syscalls.c implements getpid/fstat/stat/link/unlink as mere
stubs. So replace them with useful calls to do_syscall now that our sim
can support them.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | libgloss/ChangeLog | 13 | ||||
-rw-r--r-- | libgloss/bfin/syscalls.c | 41 |
2 files changed, 34 insertions, 20 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 2d7346ce4..f37af8b2e 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,5 +1,18 @@ 2011-07-01 Mike Frysinger <vapier@gentoo.org> + * bfin/syscalls.c (_getpid): Call do_syscall with func argument n and + return the result. + (_fstat): Delete stub body. Add block array and assign file/st to it. + Call do_syscall with result. + (_stat): Delete stub body. Add block array and assign fname/st to + it. Call do_syscall with result. + (_link): Change func arguments to accept two strings. Add block array + and assign existing/new to it. Call do_syscall with result. + (_unlink): Change func arguments to accept a string. Call do_syscall + with new argument. + +2011-07-01 Mike Frysinger <vapier@gentoo.org> + * bfin/syscalls.c (_lseek): Change 3rd arg name to whence. Increase block array to 3 elements. Set 3rd element to whence. diff --git a/libgloss/bfin/syscalls.c b/libgloss/bfin/syscalls.c index 5b1df8dd0..2dea8c598 100644 --- a/libgloss/bfin/syscalls.c +++ b/libgloss/bfin/syscalls.c @@ -117,7 +117,7 @@ _kill (int n, int m) int _getpid (int n) { - return 1; + return do_syscall (SYS_getpid, &n); } caddr_t @@ -156,40 +156,41 @@ _sbrk (int incr) extern void memset (struct stat *, int, unsigned int); int -_fstat (int file, struct stat * st) +_fstat (int file, struct stat *st) { - memset (st, 0, sizeof (* st)); - st->st_mode = S_IFCHR; - st->st_blksize = 1024; - return 0; + int block[2]; + + block[0] = file; + block[1] = (int) st; + + return do_syscall (SYS_fstat, block); } int _stat (const char *fname, struct stat *st) { - int file; + int block[2]; - /* The best we can do is try to open the file readonly. If it exists, - then we can guess a few things about it. */ - if ((file = _open (fname, O_RDONLY)) < 0) - return -1; + block[0] = (int) fname; + block[1] = (int) st; - memset (st, 0, sizeof (* st)); - st->st_mode = S_IFREG | S_IREAD; - st->st_blksize = 1024; - _close (file); /* Not interested in the error. */ - return 0; + return do_syscall (SYS_stat, block); } int -_link (void) +_link (const char *existing, const char *new) { - return -1; + int block[2]; + + block[0] = (int) existing; + block[1] = (int) new; + + return do_syscall (SYS_link, block); } int -_unlink (void) +_unlink (const char *path) { - return -1; + return do_syscall (SYS_unlink, path); } void |