Move ARM access.c from machine to sys
The implementation of the POSIX access() function is nothing machine specific like memcpy(), etc. Move it back to the system domain. This avoids problems due to the include search order of the Newlib/GCC build which picks up machine includes before system includes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
committed by
Jeff Johnston
parent
0008601042
commit
2693c1db69
@ -14,7 +14,7 @@ else
|
||||
extra_objs =
|
||||
endif
|
||||
|
||||
lib_a_SOURCES = aeabi_atexit.c
|
||||
lib_a_SOURCES = access.c aeabi_atexit.c
|
||||
lib_a_LIBADD = $(extra_objs)
|
||||
EXTRA_lib_a_SOURCES = trap.S syscalls.c libcfunc.c
|
||||
lib_a_DEPENDENCIES = $(extra_objs)
|
||||
|
@ -70,7 +70,7 @@ ARFLAGS = cru
|
||||
lib_a_AR = $(AR) $(ARFLAGS)
|
||||
@MAY_SUPPLY_SYSCALLS_TRUE@am__DEPENDENCIES_1 = $(lpfx)libcfunc.o \
|
||||
@MAY_SUPPLY_SYSCALLS_TRUE@ $(lpfx)trap.o $(lpfx)syscalls.o
|
||||
am_lib_a_OBJECTS = lib_a-aeabi_atexit.$(OBJEXT)
|
||||
am_lib_a_OBJECTS = lib_a-access.$(OBJEXT) lib_a-aeabi_atexit.$(OBJEXT)
|
||||
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp =
|
||||
@ -198,7 +198,7 @@ AM_CCASFLAGS = $(INCLUDES)
|
||||
noinst_LIBRARIES = lib.a
|
||||
@MAY_SUPPLY_SYSCALLS_FALSE@extra_objs =
|
||||
@MAY_SUPPLY_SYSCALLS_TRUE@extra_objs = $(lpfx)libcfunc.o $(lpfx)trap.o $(lpfx)syscalls.o
|
||||
lib_a_SOURCES = aeabi_atexit.c
|
||||
lib_a_SOURCES = access.c aeabi_atexit.c
|
||||
lib_a_LIBADD = $(extra_objs)
|
||||
EXTRA_lib_a_SOURCES = trap.S syscalls.c libcfunc.c
|
||||
lib_a_DEPENDENCIES = $(extra_objs)
|
||||
@ -276,6 +276,12 @@ lib_a-trap.obj: trap.S
|
||||
.c.obj:
|
||||
$(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
lib_a-access.o: access.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-access.o `test -f 'access.c' || echo '$(srcdir)/'`access.c
|
||||
|
||||
lib_a-access.obj: access.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-access.obj `if test -f 'access.c'; then $(CYGPATH_W) 'access.c'; else $(CYGPATH_W) '$(srcdir)/access.c'; fi`
|
||||
|
||||
lib_a-aeabi_atexit.o: aeabi_atexit.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_atexit.o `test -f 'aeabi_atexit.c' || echo '$(srcdir)/'`aeabi_atexit.c
|
||||
|
||||
|
33
newlib/libc/sys/arm/access.c
Normal file
33
newlib/libc/sys/arm/access.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* This is file ACCESS.C */
|
||||
/*
|
||||
* Copyright (C) 1993 DJ Delorie
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution, modification, and use in source and binary forms is permitted
|
||||
* provided that the above copyright notice and following paragraph are
|
||||
* duplicated in all such forms.
|
||||
*
|
||||
* This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int access(const char *fn, int flags)
|
||||
{
|
||||
struct stat s;
|
||||
if (stat(fn, &s))
|
||||
return -1;
|
||||
if (s.st_mode & S_IFDIR)
|
||||
return 0;
|
||||
if (flags & W_OK)
|
||||
{
|
||||
if (s.st_mode & S_IWRITE)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user