diff options
author | Michael Frysinger <vapier@gentoo.org> | 2011-07-01 21:47:36 +0000 |
---|---|---|
committer | Michael Frysinger <vapier@gentoo.org> | 2011-07-01 21:47:36 +0000 |
commit | 1df99a60b380da06b0168b5a0484b83e64173fcb (patch) | |
tree | e834235ea938160d99667c1da8ff183127e220ab /libgloss/bfin | |
parent | ecd3577e1df0eb8a0a98666c63741c9cf64e869c (diff) | |
download | cygnal-1df99a60b380da06b0168b5a0484b83e64173fcb.tar.gz cygnal-1df99a60b380da06b0168b5a0484b83e64173fcb.tar.bz2 cygnal-1df99a60b380da06b0168b5a0484b83e64173fcb.zip |
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>
Diffstat (limited to 'libgloss/bfin')
-rw-r--r-- | libgloss/bfin/syscalls.c | 41 |
1 files changed, 21 insertions, 20 deletions
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 |