From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92050 invoked by alias); 22 May 2017 12:04:36 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 91944 invoked by uid 89); 22 May 2017 12:04:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=sebastian, Sebastian, U*sebastian.huber, sebastian.huber@embedded-brains.de X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 May 2017 12:04:33 +0000 Received: from [88.198.220.132] (helo=sslproxy03.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1dCm4g-0002uX-GO for newlib@sourceware.org; Mon, 22 May 2017 14:04:34 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy03.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dCm4f-0006yq-W9 for newlib@sourceware.org; Mon, 22 May 2017 14:04:34 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id F36302A167C for ; Mon, 22 May 2017 14:05:13 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id B1m3HdefBQTS for ; Mon, 22 May 2017 14:05:13 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 21D1F2A160A for ; Mon, 22 May 2017 14:05:13 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qx-3pSL2J7lW for ; Mon, 22 May 2017 14:05:13 +0200 (CEST) Received: from huber-linux.eb.localhost (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTP id 0ACA02A1678 for ; Mon, 22 May 2017 14:05:13 +0200 (CEST) From: Sebastian Huber To: newlib@sourceware.org Subject: [PATCH 4/8] Move ARM access.c from machine to sys Date: Mon, 22 May 2017 12:04:00 -0000 Message-Id: <1495454672-9131-4-git-send-email-sebastian.huber@embedded-brains.de> In-Reply-To: <1495454672-9131-1-git-send-email-sebastian.huber@embedded-brains.de> References: <1495454672-9131-1-git-send-email-sebastian.huber@embedded-brains.de> X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00342.txt.bz2 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 --- newlib/libc/machine/arm/Makefile.am | 2 +- newlib/libc/machine/arm/Makefile.in | 13 +++---------- newlib/libc/machine/arm/access.c | 33 --------------------------------- newlib/libc/sys/arm/Makefile.am | 2 +- newlib/libc/sys/arm/Makefile.in | 10 ++++++++-- newlib/libc/sys/arm/access.c | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 47 deletions(-) delete mode 100644 newlib/libc/machine/arm/access.c create mode 100644 newlib/libc/sys/arm/access.c diff --git a/newlib/libc/machine/arm/Makefile.am b/newlib/libc/machine/arm/Makefile.am index 6b67050..9bd35e7 100644 --- a/newlib/libc/machine/arm/Makefile.am +++ b/newlib/libc/machine/arm/Makefile.am @@ -8,7 +8,7 @@ AM_CCASFLAGS = $(INCLUDES) noinst_LIBRARIES = lib.a -lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \ +lib_a_SOURCES = setjmp.S strcmp.S strcpy.c \ aeabi_memcpy.c aeabi_memcpy-armv7a.S \ aeabi_memmove.c aeabi_memmove-soft.S \ aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c diff --git a/newlib/libc/machine/arm/Makefile.in b/newlib/libc/machine/arm/Makefile.in index a0e4cc2..d9dbcd5 100644 --- a/newlib/libc/machine/arm/Makefile.in +++ b/newlib/libc/machine/arm/Makefile.in @@ -69,9 +69,8 @@ LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru lib_a_AR = $(AR) $(ARFLAGS) lib_a_LIBADD = -am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \ - lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) \ - lib_a-aeabi_memcpy.$(OBJEXT) \ +am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-strcmp.$(OBJEXT) \ + lib_a-strcpy.$(OBJEXT) lib_a-aeabi_memcpy.$(OBJEXT) \ lib_a-aeabi_memcpy-armv7a.$(OBJEXT) \ lib_a-aeabi_memmove.$(OBJEXT) \ lib_a-aeabi_memmove-soft.$(OBJEXT) \ @@ -206,7 +205,7 @@ AUTOMAKE_OPTIONS = cygnus INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) AM_CCASFLAGS = $(INCLUDES) noinst_LIBRARIES = lib.a -lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c aeabi_memcpy.c \ +lib_a_SOURCES = setjmp.S strcmp.S strcpy.c aeabi_memcpy.c \ aeabi_memcpy-armv7a.S aeabi_memmove.c aeabi_memmove-soft.S \ aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c \ memchr-stub.c memchr.S memcpy-stub.c memcpy.S strlen-stub.c \ @@ -338,12 +337,6 @@ lib_a-strlen.obj: strlen.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-strcpy.o: strcpy.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy.o `test -f 'strcpy.c' || echo '$(srcdir)/'`strcpy.c diff --git a/newlib/libc/machine/arm/access.c b/newlib/libc/machine/arm/access.c deleted file mode 100644 index 980682e..0000000 --- a/newlib/libc/machine/arm/access.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -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; -} - diff --git a/newlib/libc/sys/arm/Makefile.am b/newlib/libc/sys/arm/Makefile.am index 3d8aa9d..711872d 100644 --- a/newlib/libc/sys/arm/Makefile.am +++ b/newlib/libc/sys/arm/Makefile.am @@ -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) diff --git a/newlib/libc/sys/arm/Makefile.in b/newlib/libc/sys/arm/Makefile.in index ba0f92b..c01e4e2 100644 --- a/newlib/libc/sys/arm/Makefile.in +++ b/newlib/libc/sys/arm/Makefile.in @@ -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 diff --git a/newlib/libc/sys/arm/access.c b/newlib/libc/sys/arm/access.c new file mode 100644 index 0000000..980682e --- /dev/null +++ b/newlib/libc/sys/arm/access.c @@ -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 +#include +#include + +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; +} + -- 1.8.4.5