Skip to content

Commit ae4678d

Browse files
committed
implement access
1 parent 082b2bc commit ae4678d

1 file changed

Lines changed: 88 additions & 1 deletion

File tree

dkppc/patches/newlib-2.5.0.patch

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ index 0000000..48ce950
989989
+/* symbol prefix */
990990
+#undef __SYMBOL_PREFIX
991991
diff --git a/libgloss/libsysbase/configure b/libgloss/libsysbase/configure
992-
new file mode 100755
992+
new file mode 100644
993993
index 0000000..874eec1
994994
--- /dev/null
995995
+++ b/libgloss/libsysbase/configure
@@ -7622,6 +7622,93 @@ index 8572821..57dee54 100644
76227622
{
76237623
return __get_current_locale ()->ctype_ptr;
76247624
}
7625+
diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am
7626+
index e86afdf..007bd15 100644
7627+
--- a/newlib/libc/machine/powerpc/Makefile.am
7628+
+++ b/newlib/libc/machine/powerpc/Makefile.am
7629+
@@ -10,7 +10,7 @@ noinst_LIBRARIES = lib.a
7630+
7631+
AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
7632+
7633+
-lib_a_SOURCES = setjmp.S
7634+
+lib_a_SOURCES = setjmp.S access.c
7635+
lib_a_CCASFLAGS=$(AM_CCASFLAGS)
7636+
lib_a_CFLAGS=$(AM_CFLAGS)
7637+
lib_a_LIBADD = @extra_objs@
7638+
diff --git a/newlib/libc/machine/powerpc/Makefile.in b/newlib/libc/machine/powerpc/Makefile.in
7639+
index 73b0cc4..12044cb 100644
7640+
--- a/newlib/libc/machine/powerpc/Makefile.in
7641+
+++ b/newlib/libc/machine/powerpc/Makefile.in
7642+
@@ -68,7 +68,7 @@ CONFIG_CLEAN_VPATH_FILES =
7643+
LIBRARIES = $(noinst_LIBRARIES)
7644+
ARFLAGS = cru
7645+
lib_a_AR = $(AR) $(ARFLAGS)
7646+
-am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT)
7647+
+am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT)
7648+
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
7649+
DEFAULT_INCLUDES = -I.@am__isrc@
7650+
depcomp =
7651+
@@ -196,7 +196,7 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
7652+
AM_CCASFLAGS = $(INCLUDES)
7653+
noinst_LIBRARIES = lib.a
7654+
AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
7655+
-lib_a_SOURCES = setjmp.S
7656+
+lib_a_SOURCES = setjmp.S access.c
7657+
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
7658+
lib_a_CFLAGS = $(AM_CFLAGS)
7659+
lib_a_LIBADD = @extra_objs@
7660+
@@ -280,6 +280,12 @@ lib_a-setjmp.obj: setjmp.S
7661+
.c.obj:
7662+
$(COMPILE) -c `$(CYGPATH_W) '$<'`
7663+
7664+
+lib_a-access.o: access.c
7665+
+ $(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
7666+
+
7667+
+lib_a-access.obj: access.c
7668+
+ $(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`
7669+
+
7670+
lib_a-vfprintf.o: vfprintf.c
7671+
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vfprintf.o `test -f 'vfprintf.c' || echo '$(srcdir)/'`vfprintf.c
7672+
7673+
diff --git a/newlib/libc/machine/powerpc/access.c b/newlib/libc/machine/powerpc/access.c
7674+
new file mode 100644
7675+
index 0000000..980682e
7676+
--- /dev/null
7677+
+++ b/newlib/libc/machine/powerpc/access.c
7678+
@@ -0,0 +1,33 @@
7679+
+/* This is file ACCESS.C */
7680+
+/*
7681+
+ * Copyright (C) 1993 DJ Delorie
7682+
+ * All rights reserved.
7683+
+ *
7684+
+ * Redistribution, modification, and use in source and binary forms is permitted
7685+
+ * provided that the above copyright notice and following paragraph are
7686+
+ * duplicated in all such forms.
7687+
+ *
7688+
+ * This file is distributed WITHOUT ANY WARRANTY; without even the implied
7689+
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7690+
+ */
7691+
+
7692+
+#include <fcntl.h>
7693+
+#include <sys/stat.h>
7694+
+#include <unistd.h>
7695+
+
7696+
+int access(const char *fn, int flags)
7697+
+{
7698+
+ struct stat s;
7699+
+ if (stat(fn, &s))
7700+
+ return -1;
7701+
+ if (s.st_mode & S_IFDIR)
7702+
+ return 0;
7703+
+ if (flags & W_OK)
7704+
+ {
7705+
+ if (s.st_mode & S_IWRITE)
7706+
+ return 0;
7707+
+ return -1;
7708+
+ }
7709+
+ return 0;
7710+
+}
7711+
+
76257712
diff --git a/newlib/libc/machine/powerpc/machine/_types.h b/newlib/libc/machine/powerpc/machine/_types.h
76267713
new file mode 100644
76277714
index 0000000..a7d63da

0 commit comments

Comments
 (0)