From d2a246ad722cc6df6005b8a1c42489bc839eb0d0 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 12 Mar 2002 21:25:12 +0000 Subject: 2002-03-12 Richard Earnshaw * libc/sys/arm/access.c: New file. * libc/sys/arm/Makefile.am (lib_a_SOURCES): Add access.c. * libc/sys/arm/Makefile.in: Regenerate. * libc/sys/arm/syscalls.c (_stat): New function. --- newlib/libc/sys/arm/syscalls.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'newlib/libc/sys/arm/syscalls.c') diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c index 0483d4893..3662a4687 100644 --- a/newlib/libc/sys/arm/syscalls.c +++ b/newlib/libc/sys/arm/syscalls.c @@ -21,6 +21,7 @@ int _gettimeofday _PARAMS ((struct timeval *, struct timezone *)); void _raise _PARAMS ((void)); int _unlink _PARAMS ((void)); int _link _PARAMS ((void)); +int _stat _PARAMS ((const char *, struct stat *)); int _fstat _PARAMS ((int, struct stat *)); caddr_t _sbrk _PARAMS ((int)); int _getpid _PARAMS ((int)); @@ -515,6 +516,22 @@ _fstat (int file, struct stat * st) file = file; } +int _stat (const char *fname, struct stat *st) +{ + int file; + + /* 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; + + memset (st, 0, sizeof (* st)); + st->st_mode = S_IFREG | S_IREAD; + st->st_blksize = 1024; + _swiclose (file); /* Not interested in the error. */ + return 0; +} + int _link (void) { -- cgit v1.2.3