Commit MetaInfo
Log Message
(libgloss) : Support more POSIX functions.
Change Summary
Diff
| | @@ -7157,11 +7157,11 @@ | | 7157 | 7157 | config_testsuite=true | | 7158 | 7158 | diff -bcrN newlib-1.15.0.org/libgloss/i386-es/Makefile.in newlib-1.15.0/libgloss/i386-es/Makefile.in | | 7159 | 7159 | *** newlib-1.15.0.org/libgloss/i386-es/Makefile.in 1970-01-01 09:00:00.000000000 +0900 | | 7160 | | ---- newlib-1.15.0/libgloss/i386-es/Makefile.in 2007-08-07 18:20:42.000000000 +0900 | | 7160 | +--- newlib-1.15.0/libgloss/i386-es/Makefile.in 2007-11-09 17:12:43.000000000 +0900 | | 7161 | 7161 | *************** | | 7162 | 7162 | *** 0 **** | | 7163 | | ---- 1,133 ---- | | 7164 | | -+ # Copyright (c) 1997, 2000 Cygnus Support | | 7163 | +--- 1,144 ---- | | 7164 | ++ # Copyright (c) 1998, 2000 Cygnus Support | | 7165 | 7165 | + # | | 7166 | 7166 | + # The authors hereby grant permission to use, copy, modify, distribute, | | 7167 | 7167 | + # and license this software and its documentation for any purpose, provided |
| | @@ -7228,8 +7228,31 @@ | | 7228 | 7228 | + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` | | 7229 | 7229 | + | | 7230 | 7230 | + CRT0 = crt0.o | | 7231 | | -+ ES_OBJS = es-salib.o es-pthread.o libcfunc.o | | 7231 | ++ ES_OBJS = es.o \ | | 7232 | ++ access.o \ | | 7233 | ++ close.o \ | | 7234 | ++ exit.o \ | | 7235 | ++ fstat.o \ | | 7236 | ++ getcwd.o \ | | 7237 | ++ getdents.o \ | | 7238 | ++ getpid.o \ | | 7239 | ++ gettimeofday.o \ | | 7240 | ++ kill.o \ | | 7241 | ++ lseek.o \ | | 7242 | ++ mkdir.o \ | | 7243 | ++ nanosleep.o \ | | 7244 | ++ open.o \ | | 7245 | ++ pthread.o \ | | 7246 | ++ read.o \ | | 7247 | ++ rename.o \ | | 7248 | ++ rmdir.o \ | | 7249 | ++ sbrk.o \ | | 7250 | ++ stat.o \ | | 7251 | ++ times.o \ | | 7252 | ++ unlink.o \ | | 7253 | ++ write.o \ | | 7232 | 7254 | + | | 7255 | ++ | | 7233 | 7256 | + CFLAGS = -g | | 7234 | 7257 | + | | 7235 | 7258 | + GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ |
| | @@ -7246,22 +7269,12 @@ | | 7246 | 7269 | + # | | 7247 | 7270 | + # here's where we build the board support packages for each target | | 7248 | 7271 | + # | | 7272 | ++ | | 7249 | 7273 | + libes.a: $(ES_OBJS) | | 7250 | 7274 | + ${AR} ${ARFLAGS} $@ $(ES_OBJS) | | 7251 | 7275 | + ${RANLIB} $@ | | 7252 | 7276 | + | | 7253 | | -+ es-salib.o: ${srcdir}/es-salib.c | | 7254 | | -+ $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ @IS_AOUT@ $(<) -o $@ | | 7255 | 7277 | + | | 7256 | | -+ es-pthread.o: ${srcdir}/es-pthread.c | | 7257 | | -+ $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ @IS_AOUT@ $(<) -o $@ | | 7258 | | -+ | | 7259 | | -+ libcfunc.o: ${srcdir}/libcfunc.c | | 7260 | | -+ $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ @IS_AOUT@ $(<) -o $@ | | 7261 | | -+ | | 7262 | | -+ crt0.o: ${srcdir}/crt0.S | | 7263 | | -+ $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ @IS_AOUT@ $(<) -o $@ | | 7264 | | -+ | | 7265 | 7278 | + doc: | | 7266 | 7279 | + | | 7267 | 7280 | + clean mostlyclean: |
| | @@ -7284,8 +7297,6 @@ | | 7284 | 7297 | + install-info: | | 7285 | 7298 | + clean-info: | | 7286 | 7299 | + | | 7287 | | -+ test.o: ${srcdir}/test.c | | 7288 | | -+ | | 7289 | 7300 | + # these are for the BSPs | | 7290 | 7301 | + ${CRT0}: crt0.S | | 7291 | 7302 | + |
| | @@ -7294,6 +7305,44 @@ | | 7294 | 7305 | + | | 7295 | 7306 | + config.status: configure | | 7296 | 7307 | + $(SHELL) config.status --recheck | | 7308 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/access.c newlib-1.15.0/libgloss/i386-es/access.c | | 7309 | +*** newlib-1.15.0.org/libgloss/i386-es/access.c 1970-01-01 09:00:00.000000000 +0900 | | 7310 | +--- newlib-1.15.0/libgloss/i386-es/access.c 2007-08-07 17:32:24.000000000 +0900 | | 7311 | +*************** | | 7312 | +*** 0 **** | | 7313 | +--- 1,32 ---- | | 7314 | ++ /* This is file ACCESS.C */ | | 7315 | ++ /* | | 7316 | ++ * Copyright (C) 1993 DJ Delorie | | 7317 | ++ * All rights reserved. | | 7318 | ++ * | | 7319 | ++ * Redistribution and use in source and binary forms is permitted | | 7320 | ++ * provided that the above copyright notice and following paragraph are | | 7321 | ++ * duplicated in all such forms. | | 7322 | ++ * | | 7323 | ++ * This file is distributed WITHOUT ANY WARRANTY; without even the implied | | 7324 | ++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | 7325 | ++ */ | | 7326 | ++ | | 7327 | ++ #include <fcntl.h> | | 7328 | ++ #include <sys/stat.h> | | 7329 | ++ #include <unistd.h> | | 7330 | ++ | | 7331 | ++ int access(const char *fn, int flags) | | 7332 | ++ { | | 7333 | ++ struct stat s; | | 7334 | ++ if (stat(fn, &s)) | | 7335 | ++ return -1; | | 7336 | ++ if (s.st_mode & S_IFDIR) | | 7337 | ++ return 0; | | 7338 | ++ if (flags & W_OK) | | 7339 | ++ { | | 7340 | ++ if (s.st_mode & S_IWRITE) | | 7341 | ++ return 0; | | 7342 | ++ return -1; | | 7343 | ++ } | | 7344 | ++ return 0; | | 7345 | ++ } | | 7297 | 7346 | diff -bcrN newlib-1.15.0.org/libgloss/i386-es/aclocal.m4 newlib-1.15.0/libgloss/i386-es/aclocal.m4 | | 7298 | 7347 | *** newlib-1.15.0.org/libgloss/i386-es/aclocal.m4 1970-01-01 09:00:00.000000000 +0900 | | 7299 | 7348 | --- newlib-1.15.0/libgloss/i386-es/aclocal.m4 2006-04-20 04:44:04.000000000 +0900 |
| | @@ -7644,12 +7693,71 @@ | | 7644 | 7693 | + ]) | | 7645 | 7694 | + | | 7646 | 7695 | + m4_include([../acinclude.m4]) | | 7696 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/close.c newlib-1.15.0/libgloss/i386-es/close.c | | 7697 | +*** newlib-1.15.0.org/libgloss/i386-es/close.c 1970-01-01 09:00:00.000000000 +0900 | | 7698 | +--- newlib-1.15.0/libgloss/i386-es/close.c 2007-11-08 11:14:00.000000000 +0900 | | 7699 | +*************** | | 7700 | +*** 0 **** | | 7701 | +--- 1,53 ---- | | 7702 | ++ /* | | 7703 | ++ * Copyright (c) 2007 | | 7704 | ++ * Nintendo Co., Ltd. | | 7705 | ++ * | | 7706 | ++ * Permission to use, copy, modify, distribute and sell this software | | 7707 | ++ * and its documentation for any purpose is hereby granted without fee, | | 7708 | ++ * provided that the above copyright notice appear in all copies and | | 7709 | ++ * that both that copyright notice and this permission notice appear | | 7710 | ++ * in supporting documentation. Nintendo makes no | | 7711 | ++ * representations about the suitability of this software for any | | 7712 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 7713 | ++ */ | | 7714 | ++ | | 7715 | ++ #include <errno.h> | | 7716 | ++ #include <fcntl.h> | | 7717 | ++ #include <stdarg.h> | | 7718 | ++ #include <string.h> | | 7719 | ++ #include <stdlib.h> | | 7720 | ++ #include <sys/times.h> | | 7721 | ++ #include "es-syscall.h" | | 7722 | ++ | | 7723 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 7724 | ++ #pragma weak _close | | 7725 | ++ | | 7726 | ++ int _close(int file) | | 7727 | ++ { | | 7728 | ++ void* object = 0; | | 7729 | ++ switch (file) | | 7730 | ++ { | | 7731 | ++ case 0: // stdin | | 7732 | ++ object = _es_streamStdin; | | 7733 | ++ _es_streamStdin = 0; | | 7734 | ++ break; | | 7735 | ++ case 1: // stdout | | 7736 | ++ object = _es_streamStdout; | | 7737 | ++ _es_streamStdout = 0; | | 7738 | ++ break; | | 7739 | ++ case 2: // stderr | | 7740 | ++ object = _es_streamStderr; | | 7741 | ++ _es_streamStderr = 0; | | 7742 | ++ break; | | 7743 | ++ default: | | 7744 | ++ object = (void*) file; | | 7745 | ++ break; | | 7746 | ++ } | | 7747 | ++ if (!object) | | 7748 | ++ { | | 7749 | ++ errno = EBADF; | | 7750 | ++ return -1; | | 7751 | ++ } | | 7752 | ++ _es_syscall(object, 0, RELEASE, 0); | | 7753 | ++ return 0; | | 7754 | ++ } | | 7647 | 7755 | diff -bcrN newlib-1.15.0.org/libgloss/i386-es/configure newlib-1.15.0/libgloss/i386-es/configure | | 7648 | 7756 | *** newlib-1.15.0.org/libgloss/i386-es/configure 1970-01-01 09:00:00.000000000 +0900 | | 7649 | | ---- newlib-1.15.0/libgloss/i386-es/configure 2007-08-01 16:42:30.000000000 +0900 | | 7757 | +--- newlib-1.15.0/libgloss/i386-es/configure 2007-11-07 17:20:02.000000000 +0900 | | 7650 | 7758 | *************** | | 7651 | 7759 | *** 0 **** | | 7652 | | ---- 1,3749 ---- | | 7760 | +--- 1,3737 ---- | | 7653 | 7761 | + #! /bin/sh | | 7654 | 7762 | + # Guess values for system-dependent variables and create Makefiles. | | 7655 | 7763 | + # Generated by GNU Autoconf 2.61. |
| | @@ -8228,7 +8336,7 @@ | | 8228 | 8336 | + PACKAGE_STRING= | | 8229 | 8337 | + PACKAGE_BUGREPORT= | | 8230 | 8338 | + | | 8231 | | -+ ac_unique_file="es-salib.c" | | 8339 | ++ ac_unique_file="crt0.S" | | 8232 | 8340 | + ac_subst_vars='SHELL | | 8233 | 8341 | + PATH_SEPARATOR | | 8234 | 8342 | + PACKAGE_NAME |
| | @@ -8295,8 +8403,6 @@ | | 8295 | 8403 | + AS | | 8296 | 8404 | + AR | | 8297 | 8405 | + LD | | 8298 | | -+ IS_COFF | | 8299 | | -+ IS_AOUT | | 8300 | 8406 | + NEED_UNDERSCORE | | 8301 | 8407 | + RANLIB | | 8302 | 8408 | + CCAS |
| | @@ -9584,15 +9690,6 @@ | | 9584 | 9690 | + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' | | 9585 | 9691 | + | | 9586 | 9692 | + | | 9587 | | -+ case "$target" in | | 9588 | | -+ *coff) | | 9589 | | -+ IS_COFF="-DCOFF" | | 9590 | | -+ ;; | | 9591 | | -+ *aout) | | 9592 | | -+ IS_AOUT="-DAOUT" | | 9593 | | -+ ;; | | 9594 | | -+ esac | | 9595 | | -+ | | 9596 | 9693 | + rm -rf .tst 2>/dev/null | | 9597 | 9694 | + mkdir .tst 2>/dev/null | | 9598 | 9695 | + if test -d .tst; then |
| | @@ -10076,8 +10173,6 @@ | | 10076 | 10173 | + LD=${LD-ld} | | 10077 | 10174 | + | | 10078 | 10175 | + | | 10079 | | -+ | | 10080 | | -+ | | 10081 | 10176 | + if test -n "$ac_tool_prefix"; then | | 10082 | 10177 | + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. | | 10083 | 10178 | + set dummy ${ac_tool_prefix}ranlib; ac_word=$2 |
| | @@ -10922,8 +11017,6 @@ | | 10922 | 11017 | + AS!$AS$ac_delim | | 10923 | 11018 | + AR!$AR$ac_delim | | 10924 | 11019 | + LD!$LD$ac_delim | | 10925 | | -+ IS_COFF!$IS_COFF$ac_delim | | 10926 | | -+ IS_AOUT!$IS_AOUT$ac_delim | | 10927 | 11020 | + NEED_UNDERSCORE!$NEED_UNDERSCORE$ac_delim | | 10928 | 11021 | + RANLIB!$RANLIB$ac_delim | | 10929 | 11022 | + CCAS!$CCAS$ac_delim |
| | @@ -10933,7 +11026,7 @@ | | 10933 | 11026 | + LTLIBOBJS!$LTLIBOBJS$ac_delim | | 10934 | 11027 | + _ACEOF | | 10935 | 11028 | + | | 10936 | | -+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then | | 11029 | ++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then | | 10937 | 11030 | + break | | 10938 | 11031 | + elif $ac_last_try; then | | 10939 | 11032 | + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 |
| | @@ -11366,7 +11459,10 @@ | | 11366 | 11459 | + done | | 11367 | 11460 | + done | | 11368 | 11461 | + ;; | | 11369 | | -+ "Makefile":F) . ${libgloss_topdir}/config-ml.in ;; | | 11462 | ++ "Makefile":F) if test -n "$CONFIG_FILES"; then | | 11463 | ++ unset ac_file | | 11464 | ++ . ${libgloss_topdir}/config-ml.in | | 11465 | ++ fi ;; | | 11370 | 11466 | + | | 11371 | 11467 | + esac | | 11372 | 11468 | + done # for ac_tag |
| | @@ -11401,11 +11497,11 @@ | | 11401 | 11497 | + | | 11402 | 11498 | diff -bcrN newlib-1.15.0.org/libgloss/i386-es/configure.in newlib-1.15.0/libgloss/i386-es/configure.in | | 11403 | 11499 | *** newlib-1.15.0.org/libgloss/i386-es/configure.in 1970-01-01 09:00:00.000000000 +0900 | | 11404 | | ---- newlib-1.15.0/libgloss/i386-es/configure.in 2007-08-01 16:42:25.000000000 +0900 | | 11500 | +--- newlib-1.15.0/libgloss/i386-es/configure.in 2007-11-07 17:06:07.000000000 +0900 | | 11405 | 11501 | *************** | | 11406 | 11502 | *** 0 **** | | 11407 | | ---- 1,79 ---- | | 11408 | | -+ # Copyright (c) 1995, 1996 Cygnus Support | | 11503 | +--- 1,71 ---- | | 11504 | ++ # Copyright (c) 1995, 1996, 2000 Cygnus Support | | 11409 | 11505 | + # | | 11410 | 11506 | + # The authors hereby grant permission to use, copy, modify, distribute, | | 11411 | 11507 | + # and license this software and its documentation for any purpose, provided |
| | @@ -11420,7 +11516,7 @@ | | 11420 | 11516 | + # Process this file with autoconf to produce a configure script. | | 11421 | 11517 | + # | | 11422 | 11518 | + AC_PREREQ(2.59) | | 11423 | | -+ AC_INIT(es-salib.c) | | 11519 | ++ AC_INIT(crt0.S) | | 11424 | 11520 | + | | 11425 | 11521 | + if test "${enable_shared}" = "yes" ; then | | 11426 | 11522 | + echo "Shared libraries not supported for cross compiling, ignored" |
| | @@ -11442,15 +11538,6 @@ | | 11442 | 11538 | + | | 11443 | 11539 | + AC_PROG_INSTALL | | 11444 | 11540 | + | | 11445 | | -+ case "$target" in | | 11446 | | -+ *coff) | | 11447 | | -+ IS_COFF="-DCOFF" | | 11448 | | -+ ;; | | 11449 | | -+ *aout) | | 11450 | | -+ IS_AOUT="-DAOUT" | | 11451 | | -+ ;; | | 11452 | | -+ esac | | 11453 | | -+ | | 11454 | 11541 | + LIB_AC_PROG_CC | | 11455 | 11542 | + AS=${AS-as} | | 11456 | 11543 | + AC_SUBST(AS) |
| | @@ -11458,8 +11545,6 @@ | | 11458 | 11545 | + AC_SUBST(AR) | | 11459 | 11546 | + LD=${LD-ld} | | 11460 | 11547 | + AC_SUBST(LD) | | 11461 | | -+ AC_SUBST(IS_COFF) | | 11462 | | -+ AC_SUBST(IS_AOUT) | | 11463 | 11548 | + AC_SUBST(NEED_UNDERSCORE) | | 11464 | 11549 | + AC_PROG_RANLIB | | 11465 | 11550 | + LIB_AM_PROG_AS |
| | @@ -11474,8 +11559,11 @@ | | 11474 | 11559 | + AC_SUBST(host_makefile_frag_path) | | 11475 | 11560 | + AC_SUBST_FILE(host_makefile_frag) | | 11476 | 11561 | + | | 11477 | | -+ AC_CONFIG_FILES(Makefile, | | 11478 | | -+ . ${libgloss_topdir}/config-ml.in, | | 11562 | ++ AC_CONFIG_FILES([Makefile], | | 11563 | ++ [if test -n "$CONFIG_FILES"; then | | 11564 | ++ unset ac_file | | 11565 | ++ . ${libgloss_topdir}/config-ml.in | | 11566 | ++ fi], | | 11479 | 11567 | + srcdir=${srcdir} | | 11480 | 11568 | + target=${target} | | 11481 | 11569 | + with_multisubdir=${with_multisubdir} |
| | @@ -11541,13 +11629,174 @@ | | 11541 | 11629 | + 3: | | 11542 | 11630 | + hlt | | 11543 | 11631 | + jmp 3b | | 11544 | | -diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es-pthread.c newlib-1.15.0/libgloss/i386-es/es-pthread.c | | 11545 | | -*** newlib-1.15.0.org/libgloss/i386-es/es-pthread.c 1970-01-01 09:00:00.000000000 +0900 | | 11546 | | ---- newlib-1.15.0/libgloss/i386-es/es-pthread.c 2007-08-07 13:27:28.000000000 +0900 | | 11632 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es-syscall.h newlib-1.15.0/libgloss/i386-es/es-syscall.h | | 11633 | +*** newlib-1.15.0.org/libgloss/i386-es/es-syscall.h 1970-01-01 09:00:00.000000000 +0900 | | 11634 | +--- newlib-1.15.0/libgloss/i386-es/es-syscall.h 2007-11-16 13:39:46.000000000 +0900 | | 11547 | 11635 | *************** | | 11548 | 11636 | *** 0 **** | | 11549 | | ---- 1,287 ---- | | 11637 | +--- 1,155 ---- | | 11550 | 11638 | + /* | | 11639 | ++ * Copyright (c) 2006, 2007 | | 11640 | ++ * Nintendo Co., Ltd. | | 11641 | ++ * | | 11642 | ++ * Permission to use, copy, modify, distribute and sell this software | | 11643 | ++ * and its documentation for any purpose is hereby granted without fee, | | 11644 | ++ * provided that the above copyright notice appear in all copies and | | 11645 | ++ * that both that copyright notice and this permission notice appear | | 11646 | ++ * in supporting documentation. Nintendo makes no | | 11647 | ++ * representations about the suitability of this software for any | | 11648 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 11649 | ++ */ | | 11650 | ++ | | 11651 | ++ #ifndef ES_SYSCALL_H | | 11652 | ++ #define ES_SYSCALL_H | | 11653 | ++ | | 11654 | ++ #include <stdarg.h> | | 11655 | ++ | | 11656 | ++ enum | | 11657 | ++ { | | 11658 | ++ // IInterface method number | | 11659 | ++ QUERY_INTERFACE = 0, | | 11660 | ++ ADD_REF, | | 11661 | ++ RELEASE, | | 11662 | ++ | | 11663 | ++ // ICurrentProcess method number | | 11664 | ++ EXIT = 3, | | 11665 | ++ MAP, | | 11666 | ++ UNMAP, | | 11667 | ++ CURRENT_THREAD, | | 11668 | ++ CREATE_THREAD, | | 11669 | ++ YIELD, | | 11670 | ++ CREATE_MONITOR, | | 11671 | ++ GET_ROOT, | | 11672 | ++ GET_IN, | | 11673 | ++ GET_OUT, | | 11674 | ++ GET_ERROR, | | 11675 | ++ SET_BREAK, | | 11676 | ++ TRACE, | | 11677 | ++ GET_NOW, | | 11678 | ++ GET_CURRENT, | | 11679 | ++ SET_CURRENT, | | 11680 | ++ | | 11681 | ++ // IMonitor method number | | 11682 | ++ LOCK = 3, | | 11683 | ++ TRY_LOCK, | | 11684 | ++ UNLOCK, | | 11685 | ++ WAIT, | | 11686 | ++ WAIT_TIMEOUT, | | 11687 | ++ NOTIFY, | | 11688 | ++ NOTIFY_ALL, | | 11689 | ++ | | 11690 | ++ // IStream method number | | 11691 | ++ GET_POSITION = 3, | | 11692 | ++ SET_POSITION, | | 11693 | ++ GET_SIZE, | | 11694 | ++ SET_SIZE, | | 11695 | ++ READ, | | 11696 | ++ READ_OFFSET, | | 11697 | ++ WRITE, | | 11698 | ++ WRITE_OFFSET, | | 11699 | ++ FLUSH, | | 11700 | ++ | | 11701 | ++ // IBinding method number | | 11702 | ++ GET_OBJECT = 3, | | 11703 | ++ SET_OBJECT, | | 11704 | ++ GET_NAME, | | 11705 | ++ | | 11706 | ++ // IContext method number | | 11707 | ++ BIND = 3, | | 11708 | ++ CREATE_SUBCONTEXT, | | 11709 | ++ DESTROY_SUBCONTEXT, | | 11710 | ++ LOOKUP, | | 11711 | ++ RENAME, | | 11712 | ++ UNBIND, | | 11713 | ++ LIST, | | 11714 | ++ | | 11715 | ++ // IFile method number | | 11716 | ++ GET_ATTRIBUTES = 3, | | 11717 | ++ SET_ATTRIBUTES, | | 11718 | ++ GET_CREATIONTIME, | | 11719 | ++ SET_CREATIONTIME, | | 11720 | ++ GET_LASTACCESSTIME, | | 11721 | ++ SET_LASTACCESSTIME, | | 11722 | ++ GET_LASTWRITETIME, | | 11723 | ++ SET_LASTWRITETIME, | | 11724 | ++ CAN_READ, | | 11725 | ++ CAN_WRITE, | | 11726 | ++ IS_DIRECTORY, | | 11727 | ++ IS_FILE, | | 11728 | ++ IS_HIDDEN, | | 11729 | ++ GET_FILENAME, | | 11730 | ++ GET_PAGEABLE, | | 11731 | ++ GET_FILESIZE, | | 11732 | ++ GET_STREAM, | | 11733 | ++ | | 11734 | ++ // IIterator method number | | 11735 | ++ HAS_NEXT = 3, | | 11736 | ++ NEXT, | | 11737 | ++ REMOVE, | | 11738 | ++ | | 11739 | ++ // ICurrentThread method number | | 11740 | ++ THREAD_EXIT = 3, | | 11741 | ++ THREAD_SLEEP, | | 11742 | ++ SET_CANCEL_STATE, | | 11743 | ++ SET_CANCEL_TYPE, | | 11744 | ++ TEST_CANCEL, | | 11745 | ++ }; | | 11746 | ++ | | 11747 | ++ // file attributes | | 11748 | ++ enum | | 11749 | ++ { | | 11750 | ++ IFILE_READONLY = 0x01, | | 11751 | ++ IFILE_HIDDEN = 0x02, | | 11752 | ++ IFILE_SYSTEM = 0x04, | | 11753 | ++ IFILE_DIRECTORY = 0x10, | | 11754 | ++ IFILE_ARCHIVE = 0x20 | | 11755 | ++ }; | | 11756 | ++ | | 11757 | ++ struct _GUID | | 11758 | ++ { | | 11759 | ++ unsigned long Data1; | | 11760 | ++ unsigned short Data2; | | 11761 | ++ unsigned short Data3; | | 11762 | ++ unsigned char Data4[8]; | | 11763 | ++ }; | | 11764 | ++ typedef struct _GUID GUID; | | 11765 | ++ typedef struct _GUID Guid; | | 11766 | ++ | | 11767 | ++ const Guid _es_bindingIid; | | 11768 | ++ const Guid _es_contextIid; | | 11769 | ++ const Guid _es_fileIid; | | 11770 | ++ const Guid _es_iteratorIid; | | 11771 | ++ const Guid _es_socketIid; | | 11772 | ++ const Guid _es_streamIid; | | 11773 | ++ | | 11774 | ++ void* _es_streamStdin; | | 11775 | ++ void* _es_streamStdout; | | 11776 | ++ void* _es_streamStderr; | | 11777 | ++ | | 11778 | ++ long long _es_syscall(void* self, void* base, int m, va_list ap); | | 11779 | ++ void* _es_getInterfacePointer(int file); | | 11780 | ++ | | 11781 | ++ void* _es_addRef(void* interface); | | 11782 | ++ void* _es_release(void* interface); | | 11783 | ++ void* _es_queryInterface(void* interface, const Guid* uuid); | | 11784 | ++ int _es_getBindingName(void* binding, char* name, int len); | | 11785 | ++ void* _es_getRoot(void); | | 11786 | ++ void* _es_getCurrent(void); | | 11787 | ++ int _es_trace(int on); | | 11788 | ++ void* _es_bind(void* context, const char* name, void* object); | | 11789 | ++ void* _es_lookup(void* context, const char* name); | | 11790 | ++ int _es_rename(void* context, const char* oldName, const char* newName); | | 11791 | ++ | | 11792 | ++ #endif /* ES_SYSCALL_H */ | | 11793 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es.c newlib-1.15.0/libgloss/i386-es/es.c | | 11794 | +*** newlib-1.15.0.org/libgloss/i386-es/es.c 1970-01-01 09:00:00.000000000 +0900 | | 11795 | +--- newlib-1.15.0/libgloss/i386-es/es.c 2007-11-16 13:39:56.000000000 +0900 | | 11796 | +*************** | | 11797 | +*** 0 **** | | 11798 | +--- 1,167 ---- | | 11799 | ++ /* | | 11551 | 11800 | + * Copyright (c) 2007 | | 11552 | 11801 | + * Nintendo Co., Ltd. | | 11553 | 11802 | + * |
| | @@ -11560,9 +11809,980 @@ | | 11560 | 11809 | + * purpose. It is provided "as is" without express or implied warranty. | | 11561 | 11810 | + */ | | 11562 | 11811 | + | | 11812 | ++ #include <errno.h> | | 11813 | ++ #include <dirent.h> | | 11814 | ++ #include <fcntl.h> | | 11815 | ++ #include <stdarg.h> | | 11816 | ++ #include <stdlib.h> | | 11817 | ++ #include <string.h> | | 11818 | ++ #include <unistd.h> | | 11819 | ++ #include <sys/lock.h> | | 11820 | ++ #include <sys/times.h> | | 11563 | 11821 | + #include "es-syscall.h" | | 11564 | 11822 | + | | 11823 | ++ const Guid _es_bindingIid = | | 11824 | ++ { | | 11825 | ++ 0x33f5e13e, 0x25dc, 0x11db, { 0x9c, 0x02, 0x00, 0x09, 0xbf, 0x00, 0x00, 0x01 } | | 11826 | ++ }; | | 11827 | ++ | | 11828 | ++ const Guid _es_contextIid = | | 11829 | ++ { | | 11830 | ++ 0x33f8180a, 0x25dc, 0x11db, { 0x9c, 0x02, 0x00, 0x09, 0xbf, 0x00, 0x00, 0x01 } | | 11831 | ++ }; | | 11832 | ++ | | 11833 | ++ const Guid _es_fileIid = | | 11834 | ++ { | | 11835 | ++ 0x0325f4e6, 0x25db, 0x11db, { 0x9c, 0x02, 0x00, 0x09, 0xbf, 0x00, 0x00, 0x01 } | | 11836 | ++ }; | | 11837 | ++ | | 11838 | ++ const Guid _es_iteratorIid = | | 11839 | ++ { | | 11840 | ++ 0x640f7718, 0x25dc, 0x11db, { 0x9c, 0x02, 0x00, 0x09, 0xbf, 0x00, 0x00, 0x01 } | | 11841 | ++ }; | | 11842 | ++ | | 11843 | ++ const Guid _es_socketIid = | | 11844 | ++ { | | 11845 | ++ 0x2f2ea026, 0xd137, 0x11db, { 0x9c, 0x02, 0x00, 0x09, 0xbf, 0x00, 0x00, 0x01 } | | 11846 | ++ }; | | 11847 | ++ | | 11848 | ++ const Guid _es_streamIid = | | 11849 | ++ { | | 11850 | ++ 0x032c16c8, 0x25db, 0x11db, { 0x9c, 0x02, 0x00, 0x09, 0xbf, 0x00, 0x00, 0x01 } | | 11851 | ++ }; | | 11852 | ++ | | 11853 | ++ void* _es_streamStdin; | | 11854 | ++ void* _es_streamStdout; | | 11855 | ++ void* _es_streamStderr; | | 11856 | ++ | | 11857 | ++ long long _es_syscall(void* self, void* base, int m, va_list ap) | | 11858 | ++ { | | 11859 | ++ long long result; | | 11860 | ++ int error = 0; | | 11861 | ++ | | 11862 | ++ __asm__ __volatile__ ( | | 11863 | ++ "int $65" | | 11864 | ++ : "=A"(result), "=c" (error) : "a"(self), "d"(m), "c"(ap), "S"(base)); | | 11865 | ++ | | 11866 | ++ if (error) | | 11867 | ++ { | | 11868 | ++ errno = error; | | 11869 | ++ return -1; | | 11870 | ++ } | | 11871 | ++ return result; | | 11872 | ++ } | | 11873 | ++ | | 11874 | ++ void* _es_getInterfacePointer(int file) | | 11875 | ++ { | | 11876 | ++ void* object = 0; | | 11877 | ++ | | 11878 | ++ switch (file) | | 11879 | ++ { | | 11880 | ++ case 0: // stdin | | 11881 | ++ if (!_es_streamStdin) | | 11882 | ++ { | | 11883 | ++ _es_streamStdin = (void*) _es_syscall(0, 0, GET_IN, 0); | | 11884 | ++ } | | 11885 | ++ object = _es_streamStdin; | | 11886 | ++ break; | | 11887 | ++ case 1: // stdout | | 11888 | ++ if (!_es_streamStdout) | | 11889 | ++ { | | 11890 | ++ _es_streamStdout = (void*) _es_syscall(0, 0, GET_OUT, 0); | | 11891 | ++ } | | 11892 | ++ object = _es_streamStdout; | | 11893 | ++ break; | | 11894 | ++ case 2: // stderr | | 11895 | ++ if (!_es_streamStderr) | | 11896 | ++ { | | 11897 | ++ _es_streamStderr = (void*) _es_syscall(0, 0, GET_ERROR, 0); | | 11898 | ++ } | | 11899 | ++ object = _es_streamStderr; | | 11900 | ++ break; | | 11901 | ++ default: | | 11902 | ++ object = (void*) file; | | 11903 | ++ break; | | 11904 | ++ } | | 11905 | ++ return object; | | 11906 | ++ } | | 11907 | ++ | | 11908 | ++ void* _es_addRef(void* interface) | | 11909 | ++ { | | 11910 | ++ return (void*) _es_syscall(interface, 0, ADD_REF, 0); | | 11911 | ++ } | | 11912 | ++ | | 11913 | ++ void* _es_release(void* interface) | | 11914 | ++ { | | 11915 | ++ return (void*) _es_syscall(interface, 0, RELEASE, 0); | | 11916 | ++ } | | 11917 | ++ | | 11918 | ++ void* _es_queryInterface(void* interface, const Guid* uuid) | | 11919 | ++ { | | 11920 | ++ return (void*) _es_syscall(interface, 0, QUERY_INTERFACE, (va_list) &uuid); | | 11921 | ++ } | | 11922 | ++ | | 11923 | ++ // | | 11924 | ++ // IBinding | | 11925 | ++ // | | 11926 | ++ int _es_getBindingName(void* binding, char* name, int len) | | 11927 | ++ { | | 11928 | ++ return _es_syscall(binding, 0, GET_NAME, (va_list) &name); | | 11929 | ++ } | | 11930 | ++ | | 11931 | ++ // | | 11932 | ++ // ICurrentProcess | | 11933 | ++ // | | 11934 | ++ void* _es_getRoot(void) | | 11935 | ++ { | | 11936 | ++ return (void*) _es_syscall(0, 0, GET_ROOT, 0); | | 11937 | ++ } | | 11938 | ++ | | 11939 | ++ void* _es_getCurrent(void) | | 11940 | ++ { | | 11941 | ++ return (void*) _es_syscall(0, 0, GET_CURRENT, 0); | | 11942 | ++ } | | 11943 | ++ | | 11944 | ++ int _es_trace(int on) | | 11945 | ++ { | | 11946 | ++ return (int) _es_syscall(0, 0, TRACE, (va_list) &on); | | 11947 | ++ } | | 11948 | ++ | | 11949 | ++ // | | 11950 | ++ // IContext | | 11951 | ++ // | | 11952 | ++ void* _es_lookup(void* context, const char* name) | | 11953 | ++ { | | 11954 | ++ return (void*) _es_syscall(context, 0, LOOKUP, (va_list) &name); | | 11955 | ++ } | | 11956 | ++ | | 11957 | ++ void* _es_bind(void* context, const char* name, void* object) | | 11958 | ++ { | | 11959 | ++ return (void*) _es_syscall(context, 0, BIND, (va_list) &name); | | 11960 | ++ } | | 11961 | ++ | | 11962 | ++ int _es_rename(void* context, const char* oldName, const char* newName) | | 11963 | ++ { | | 11964 | ++ return (int) _es_syscall(context, 0, RENAME, (va_list) &oldName); | | 11965 | ++ } | | 11966 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es.ld newlib-1.15.0/libgloss/i386-es/es.ld | | 11967 | +*** newlib-1.15.0.org/libgloss/i386-es/es.ld 1970-01-01 09:00:00.000000000 +0900 | | 11968 | +--- newlib-1.15.0/libgloss/i386-es/es.ld 2006-08-17 09:16:53.000000000 +0900 | | 11969 | +*************** | | 11970 | +*** 0 **** | | 11971 | +--- 1,99 ---- | | 11972 | ++ STARTUP(es-crt0.o) | | 11973 | ++ ENTRY(__start) | | 11974 | ++ GROUP(-les -lc -les -lgcc) | | 11975 | ++ SEARCH_DIR(.) | | 11976 | ++ __DYNAMIC = 0; | | 11977 | ++ | | 11978 | ++ /* | | 11979 | ++ * Allocate the stack to be at the top of memory, since the stack | | 11980 | ++ * grows down | | 11981 | ++ */ | | 11982 | ++ PROVIDE (__stack = 0x500000); | | 11983 | ++ | | 11984 | ++ /* | | 11985 | ++ * Initalize some symbols to be zero so we can reference them in the | | 11986 | ++ * crt0 without core dumping. These functions are all optional, but | | 11987 | ++ * we do this so we can have our crt0 always use them if they exist. | | 11988 | ++ * This is so BSPs work better when using the crt0 installed with gcc. | | 11989 | ++ * We have to initalize them twice, so we multiple object file | | 11990 | ++ * formats, as some prepend an underscore. | | 11991 | ++ */ | | 11992 | ++ PROVIDE (hardware_init_hook = 0); | | 11993 | ++ PROVIDE (software_init_hook = 0); | | 11994 | ++ PROVIDE (__mem_start = 0x100000); | | 11995 | ++ PROVIDE (___mem_start = 0x100000); | | 11996 | ++ SECTIONS | | 11997 | ++ { | | 11998 | ++ . = 0x100000; | | 11999 | ++ .text : { | | 12000 | ++ _ftext = . ; | | 12001 | ++ *(.init) | | 12002 | ++ eprol = .; | | 12003 | ++ *(.text) | | 12004 | ++ PROVIDE (__runtime_reloc_start = .); | | 12005 | ++ *(.rel.sdata) | | 12006 | ++ PROVIDE (__runtime_reloc_stop = .); | | 12007 | ++ *(.fini) | | 12008 | ++ __CTOR_LIST__ = .; | | 12009 | ++ CONSTRUCTORS | | 12010 | ++ LONG(-1) | | 12011 | ++ *(.ctors) | | 12012 | ++ LONG(0) | | 12013 | ++ __CTOR_END__ = .; | | 12014 | ++ __DTOR_LIST__ = .; | | 12015 | ++ LONG(-1) | | 12016 | ++ *(.dtors) | | 12017 | ++ LONG(0) | | 12018 | ++ __DTOR_END__ = .; | | 12019 | ++ PROVIDE(_etext = .); | | 12020 | ++ PROVIDE(__etext = .); | | 12021 | ++ } | | 12022 | ++ . = .; | | 12023 | ++ .rdata : { | | 12024 | ++ *(.rdata) | | 12025 | ++ } | | 12026 | ++ .rodata : { | | 12027 | ++ *(.rodata) | | 12028 | ++ } | | 12029 | ++ .eh_frame : | | 12030 | ++ { | | 12031 | ++ PROVIDE (__EH_FRAME_BEGIN__ = .); | | 12032 | ++ *(.eh_frame) | | 12033 | ++ PROVIDE (__EH_FRAME_END__ = .); | | 12034 | ++ } | | 12035 | ++ _fdata = ALIGN(16); | | 12036 | ++ .data : { | | 12037 | ++ *(.data) | | 12038 | ++ *(.gcc_except_table) | | 12039 | ++ *(.gcc_exc) | | 12040 | ++ } | | 12041 | ++ . = ALIGN(8); | | 12042 | ++ _gp = . + 0x8000; | | 12043 | ++ __global = . + 0x8000; | | 12044 | ++ .lit8 : { | | 12045 | ++ *(.lit8) | | 12046 | ++ } | | 12047 | ++ .lit4 : { | | 12048 | ++ *(.lit4) | | 12049 | ++ } | | 12050 | ++ .sdata : { | | 12051 | ++ *(.sdata) | | 12052 | ++ } | | 12053 | ++ . = ALIGN(4); | | 12054 | ++ PROVIDE(_edata = .); | | 12055 | ++ PROVIDE(__edata = .); | | 12056 | ++ fbss = .; | | 12057 | ++ _fbss = .; | | 12058 | ++ .sbss : { | | 12059 | ++ PROVIDE(__bss_start = .); | | 12060 | ++ *(.sbss) | | 12061 | ++ *(.scommon) | | 12062 | ++ } | | 12063 | ++ .bss : { | | 12064 | ++ *(.bss) | | 12065 | ++ *(COMMON) | | 12066 | ++ PROVIDE(__bss_end = .); | | 12067 | ++ } | | 12068 | ++ PROVIDE(_end = .); | | 12069 | ++ PROVIDE(__end = .); | | 12070 | ++ } | | 12071 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/exit.c newlib-1.15.0/libgloss/i386-es/exit.c | | 12072 | +*** newlib-1.15.0.org/libgloss/i386-es/exit.c 1970-01-01 09:00:00.000000000 +0900 | | 12073 | +--- newlib-1.15.0/libgloss/i386-es/exit.c 2007-11-08 11:13:59.000000000 +0900 | | 12074 | +*************** | | 12075 | +*** 0 **** | | 12076 | +--- 1,28 ---- | | 12077 | ++ /* | | 12078 | ++ * Copyright (c) 2007 | | 12079 | ++ * Nintendo Co., Ltd. | | 12080 | ++ * | | 12081 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12082 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12083 | ++ * provided that the above copyright notice appear in all copies and | | 12084 | ++ * that both that copyright notice and this permission notice appear | | 12085 | ++ * in supporting documentation. Nintendo makes no | | 12086 | ++ * representations about the suitability of this software for any | | 12087 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12088 | ++ */ | | 12089 | ++ | | 11565 | 12090 | + #include <errno.h> | | 12091 | ++ #include <fcntl.h> | | 12092 | ++ #include <stdarg.h> | | 12093 | ++ #include <string.h> | | 12094 | ++ #include <stdlib.h> | | 12095 | ++ #include <sys/times.h> | | 12096 | ++ #include "es-syscall.h" | | 12097 | ++ | | 12098 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 12099 | ++ #pragma weak _exit | | 12100 | ++ | | 12101 | ++ void _exit(int i) | | 12102 | ++ { | | 12103 | ++ _es_syscall(0, 0, EXIT, (va_list) &i); | | 12104 | ++ } | | 12105 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/fstat.c newlib-1.15.0/libgloss/i386-es/fstat.c | | 12106 | +*** newlib-1.15.0.org/libgloss/i386-es/fstat.c 1970-01-01 09:00:00.000000000 +0900 | | 12107 | +--- newlib-1.15.0/libgloss/i386-es/fstat.c 2007-11-16 15:08:52.000000000 +0900 | | 12108 | +*************** | | 12109 | +*** 0 **** | | 12110 | +--- 1,81 ---- | | 12111 | ++ /* | | 12112 | ++ * Copyright (c) 2007 | | 12113 | ++ * Nintendo Co., Ltd. | | 12114 | ++ * | | 12115 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12116 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12117 | ++ * provided that the above copyright notice appear in all copies and | | 12118 | ++ * that both that copyright notice and this permission notice appear | | 12119 | ++ * in supporting documentation. Nintendo makes no | | 12120 | ++ * representations about the suitability of this software for any | | 12121 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12122 | ++ */ | | 12123 | ++ | | 12124 | ++ #include <sys/stat.h> | | 12125 | ++ | | 12126 | ++ #include <errno.h> | | 12127 | ++ #include <stdarg.h> | | 12128 | ++ #include <string.h> | | 12129 | ++ #include "es-syscall.h" | | 12130 | ++ | | 12131 | ++ int __attribute__((weak)) | | 12132 | ++ _fstat(int fd, struct stat *statbuf) | | 12133 | ++ { | | 12134 | ++ void* unknown = _es_getInterfacePointer(fd); | | 12135 | ++ void* iter; | | 12136 | ++ void* file; | | 12137 | ++ void* stream; | | 12138 | ++ void* socket; | | 12139 | ++ | | 12140 | ++ memset(statbuf, 0, sizeof(struct stat)); | | 12141 | ++ if ((iter = _es_queryInterface(unknown, &_es_iteratorIid)) != 0) | | 12142 | ++ { | | 12143 | ++ statbuf->st_mode |= S_IFDIR; | | 12144 | ++ _es_release(iter); | | 12145 | ++ } | | 12146 | ++ else if ((file = _es_queryInterface(unknown, &_es_fileIid)) != 0) | | 12147 | ++ { | | 12148 | ++ unsigned int attr = _es_syscall(file, 0, GET_ATTRIBUTES, 0); | | 12149 | ++ if (attr & IFILE_READONLY) | | 12150 | ++ { | | 12151 | ++ statbuf->st_mode |= (S_IRUSR | S_IXUSR); | | 12152 | ++ } | | 12153 | ++ else | | 12154 | ++ { | | 12155 | ++ statbuf->st_mode |= S_IRWXU; | | 12156 | ++ } | | 12157 | ++ if (attr & IFILE_DIRECTORY) | | 12158 | ++ { | | 12159 | ++ statbuf->st_mode |= S_IFDIR; | | 12160 | ++ } | | 12161 | ++ else | | 12162 | ++ { | | 12163 | ++ statbuf->st_mode |= S_IFREG; | | 12164 | ++ } | | 12165 | ++ statbuf->st_atime = _es_syscall(file, 0, GET_LASTACCESSTIME, 0); | | 12166 | ++ statbuf->st_size = _es_syscall(file, 0, GET_FILESIZE, 0); | | 12167 | ++ statbuf->st_mtime = _es_syscall(file, 0, GET_LASTWRITETIME, 0); | | 12168 | ++ statbuf->st_ctime = _es_syscall(file, 0, GET_CREATIONTIME, 0); | | 12169 | ++ _es_release(file); | | 12170 | ++ } | | 12171 | ++ else if ((socket = _es_queryInterface(unknown, &_es_socketIid)) != 0) | | 12172 | ++ { | | 12173 | ++ statbuf->st_mode |= S_IFSOCK; | | 12174 | ++ _es_release(socket); | | 12175 | ++ } | | 12176 | ++ else if ((stream = _es_queryInterface(unknown, &_es_streamIid)) != 0) | | 12177 | ++ { | | 12178 | ++ if (_es_syscall(stream, 0, GET_POSITION, 0) == -1) | | 12179 | ++ { | | 12180 | ++ statbuf->st_mode |= S_IFCHR; | | 12181 | ++ } | | 12182 | ++ else | | 12183 | ++ { | | 12184 | ++ statbuf->st_mode |= S_IFREG; | | 12185 | ++ } | | 12186 | ++ statbuf->st_size = _es_syscall(stream, 0, GET_SIZE, 0); | | 12187 | ++ _es_release(stream); | | 12188 | ++ } | | 12189 | ++ | | 12190 | ++ return 0; | | 12191 | ++ } | | 12192 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/getcwd.c newlib-1.15.0/libgloss/i386-es/getcwd.c | | 12193 | +*** newlib-1.15.0.org/libgloss/i386-es/getcwd.c 1970-01-01 09:00:00.000000000 +0900 | | 12194 | +--- newlib-1.15.0/libgloss/i386-es/getcwd.c 2007-11-08 11:16:54.000000000 +0900 | | 12195 | +*************** | | 12196 | +*** 0 **** | | 12197 | +--- 1,21 ---- | | 12198 | ++ /* | | 12199 | ++ * Copyright (c) 2007 | | 12200 | ++ * Nintendo Co., Ltd. | | 12201 | ++ * | | 12202 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12203 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12204 | ++ * provided that the above copyright notice appear in all copies and | | 12205 | ++ * that both that copyright notice and this permission notice appear | | 12206 | ++ * in supporting documentation. Nintendo makes no | | 12207 | ++ * representations about the suitability of this software for any | | 12208 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12209 | ++ */ | | 12210 | ++ | | 12211 | ++ #include <dirent.h> | | 12212 | ++ #include <time.h> | | 12213 | ++ | | 12214 | ++ char* __attribute__((weak)) | | 12215 | ++ getcwd(char *buf, size_t size) | | 12216 | ++ { | | 12217 | ++ return 0; | | 12218 | ++ } | | 12219 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/getdents.c newlib-1.15.0/libgloss/i386-es/getdents.c | | 12220 | +*** newlib-1.15.0.org/libgloss/i386-es/getdents.c 1970-01-01 09:00:00.000000000 +0900 | | 12221 | +--- newlib-1.15.0/libgloss/i386-es/getdents.c 2007-11-09 12:16:16.000000000 +0900 | | 12222 | +*************** | | 12223 | +*** 0 **** | | 12224 | +--- 1,69 ---- | | 12225 | ++ /* | | 12226 | ++ * Copyright (c) 2007 | | 12227 | ++ * Nintendo Co., Ltd. | | 12228 | ++ * | | 12229 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12230 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12231 | ++ * provided that the above copyright notice appear in all copies and | | 12232 | ++ * that both that copyright notice and this permission notice appear | | 12233 | ++ * in supporting documentation. Nintendo makes no | | 12234 | ++ * representations about the suitability of this software for any | | 12235 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12236 | ++ */ | | 12237 | ++ | | 12238 | ++ #include <errno.h> | | 12239 | ++ #include <unistd.h> | | 12240 | ++ #include <sys/types.h> | | 12241 | ++ #include <sys/dirent.h> | | 12242 | ++ | | 12243 | ++ #include "es-syscall.h" | | 12244 | ++ | | 12245 | ++ int __attribute__((weak)) | | 12246 | ++ getdents(unsigned int fd, struct dirent* dirp, unsigned int count) | | 12247 | ++ { | | 12248 | ++ void* iter = _es_getInterfacePointer(fd); // IIterator | | 12249 | ++ void* unknown; | | 12250 | ++ void* binding; | | 12251 | ++ int len; | | 12252 | ++ | | 12253 | ++ if (!dirp) | | 12254 | ++ { | | 12255 | ++ errno = EFAULT; | | 12256 | ++ return -1; | | 12257 | ++ } | | 12258 | ++ | | 12259 | ++ if (count < sizeof(sizeof(struct dirent))) | | 12260 | ++ { | | 12261 | ++ errno = EINVAL; | | 12262 | ++ return -1; | | 12263 | ++ } | | 12264 | ++ | | 12265 | ++ unknown = (void*) _es_syscall(iter, 0, NEXT, 0); | | 12266 | ++ if (!unknown) | | 12267 | ++ { | | 12268 | ++ return 0; | | 12269 | ++ } | | 12270 | ++ | | 12271 | ++ binding = _es_queryInterface(unknown, &_es_bindingIid); | | 12272 | ++ _es_release(unknown); | | 12273 | ++ if (!binding) | | 12274 | ++ { | | 12275 | ++ errno = ENOTDIR; | | 12276 | ++ return -1; | | 12277 | ++ } | | 12278 | ++ len = _es_getBindingName(binding, dirp->d_name, MAXNAMLEN); | | 12279 | ++ _es_release(binding); | | 12280 | ++ | | 12281 | ++ if (len < 0) | | 12282 | ++ { | | 12283 | ++ errno = ENOTDIR; | | 12284 | ++ return -1; | | 12285 | ++ } | | 12286 | ++ dirp->d_off = 0; | | 12287 | ++ dirp->d_fileno = len; // Note: just as a non-zero value for readdir() | | 12288 | ++ dirp->d_reclen = sizeof(struct dirent); | | 12289 | ++ dirp->d_name[MAXNAMLEN] = '\0'; | | 12290 | ++ dirp->d_namlen = len; | | 12291 | ++ | | 12292 | ++ return sizeof(struct dirent); | | 12293 | ++ } | | 12294 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/getpid.c newlib-1.15.0/libgloss/i386-es/getpid.c | | 12295 | +*** newlib-1.15.0.org/libgloss/i386-es/getpid.c 1970-01-01 09:00:00.000000000 +0900 | | 12296 | +--- newlib-1.15.0/libgloss/i386-es/getpid.c 2007-11-08 11:13:59.000000000 +0900 | | 12297 | +*************** | | 12298 | +*** 0 **** | | 12299 | +--- 1,28 ---- | | 12300 | ++ /* | | 12301 | ++ * Copyright (c) 2007 | | 12302 | ++ * Nintendo Co., Ltd. | | 12303 | ++ * | | 12304 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12305 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12306 | ++ * provided that the above copyright notice appear in all copies and | | 12307 | ++ * that both that copyright notice and this permission notice appear | | 12308 | ++ * in supporting documentation. Nintendo makes no | | 12309 | ++ * representations about the suitability of this software for any | | 12310 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12311 | ++ */ | | 12312 | ++ | | 12313 | ++ #include <errno.h> | | 12314 | ++ #include <fcntl.h> | | 12315 | ++ #include <stdarg.h> | | 12316 | ++ #include <string.h> | | 12317 | ++ #include <stdlib.h> | | 12318 | ++ #include <sys/times.h> | | 12319 | ++ #include "es-syscall.h" | | 12320 | ++ | | 12321 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 12322 | ++ #pragma weak _getpid | | 12323 | ++ | | 12324 | ++ _getpid(int n) | | 12325 | ++ { | | 12326 | ++ return -1; | | 12327 | ++ } | | 12328 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/gettimeofday.c newlib-1.15.0/libgloss/i386-es/gettimeofday.c | | 12329 | +*** newlib-1.15.0.org/libgloss/i386-es/gettimeofday.c 1970-01-01 09:00:00.000000000 +0900 | | 12330 | +--- newlib-1.15.0/libgloss/i386-es/gettimeofday.c 2007-11-09 14:11:42.000000000 +0900 | | 12331 | +*************** | | 12332 | +*** 0 **** | | 12333 | +--- 1,35 ---- | | 12334 | ++ /* | | 12335 | ++ * Copyright (c) 2007 | | 12336 | ++ * Nintendo Co., Ltd. | | 12337 | ++ * | | 12338 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12339 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12340 | ++ * provided that the above copyright notice appear in all copies and | | 12341 | ++ * that both that copyright notice and this permission notice appear | | 12342 | ++ * in supporting documentation. Nintendo makes no | | 12343 | ++ * representations about the suitability of this software for any | | 12344 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12345 | ++ */ | | 12346 | ++ | | 12347 | ++ #include <sys/time.h> | | 12348 | ++ #include "es-syscall.h" | | 12349 | ++ | | 12350 | ++ int __attribute__((weak)) | | 12351 | ++ _gettimeofday(struct timeval* tv, struct timezone* tz) | | 12352 | ++ { | | 12353 | ++ if (tv) | | 12354 | ++ { | | 12355 | ++ long long now = _es_syscall(0, 0, GET_NOW, 0); | | 12356 | ++ | | 12357 | ++ now -= 621355968000000000LL; // 1970-01-01 00:00:00 | | 12358 | ++ tv->tv_sec = now / 10000000; | | 12359 | ++ now %= 10000000; | | 12360 | ++ tv->tv_usec = now * 100; | | 12361 | ++ } | | 12362 | ++ | | 12363 | ++ if (tz) | | 12364 | ++ { | | 12365 | ++ tz->tz_minuteswest = 0; | | 12366 | ++ tz->tz_dsttime = 0; | | 12367 | ++ } | | 12368 | ++ } | | 12369 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/kill.c newlib-1.15.0/libgloss/i386-es/kill.c | | 12370 | +*** newlib-1.15.0.org/libgloss/i386-es/kill.c 1970-01-01 09:00:00.000000000 +0900 | | 12371 | +--- newlib-1.15.0/libgloss/i386-es/kill.c 2007-11-08 11:17:57.000000000 +0900 | | 12372 | +*************** | | 12373 | +*** 0 **** | | 12374 | +--- 1,28 ---- | | 12375 | ++ /* | | 12376 | ++ * Copyright (c) 2007 | | 12377 | ++ * Nintendo Co., Ltd. | | 12378 | ++ * | | 12379 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12380 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12381 | ++ * provided that the above copyright notice appear in all copies and | | 12382 | ++ * that both that copyright notice and this permission notice appear | | 12383 | ++ * in supporting documentation. Nintendo makes no | | 12384 | ++ * representations about the suitability of this software for any | | 12385 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12386 | ++ */ | | 12387 | ++ | | 12388 | ++ #include <errno.h> | | 12389 | ++ #include <fcntl.h> | | 12390 | ++ #include <stdarg.h> | | 12391 | ++ #include <string.h> | | 12392 | ++ #include <stdlib.h> | | 12393 | ++ #include <sys/times.h> | | 12394 | ++ #include "es-syscall.h" | | 12395 | ++ | | 12396 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 12397 | ++ #pragma weak _kill | | 12398 | ++ | | 12399 | ++ int _kill(int n, int m) | | 12400 | ++ { | | 12401 | ++ return -1; | | 12402 | ++ } | | 12403 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/link.c newlib-1.15.0/libgloss/i386-es/link.c | | 12404 | +*** newlib-1.15.0.org/libgloss/i386-es/link.c 1970-01-01 09:00:00.000000000 +0900 | | 12405 | +--- newlib-1.15.0/libgloss/i386-es/link.c 2007-11-09 17:12:19.000000000 +0900 | | 12406 | +*************** | | 12407 | +*** 0 **** | | 12408 | +--- 1,28 ---- | | 12409 | ++ /* | | 12410 | ++ * Copyright (c) 2007 | | 12411 | ++ * Nintendo Co., Ltd. | | 12412 | ++ * | | 12413 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12414 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12415 | ++ * provided that the above copyright notice appear in all copies and | | 12416 | ++ * that both that copyright notice and this permission notice appear | | 12417 | ++ * in supporting documentation. Nintendo makes no | | 12418 | ++ * representations about the suitability of this software for any | | 12419 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12420 | ++ */ | | 12421 | ++ | | 12422 | ++ #include <errno.h> | | 12423 | ++ #include <fcntl.h> | | 12424 | ++ #include <stdarg.h> | | 12425 | ++ #include <string.h> | | 12426 | ++ #include <stdlib.h> | | 12427 | ++ #include <sys/times.h> | | 12428 | ++ #include "es-syscall.h" | | 12429 | ++ | | 12430 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 12431 | ++ #pragma weak _link | | 12432 | ++ | | 12433 | ++ int _link(const char *oldpath, const char *newpath) | | 12434 | ++ { | | 12435 | ++ return -1; | | 12436 | ++ } | | 12437 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/lseek.c newlib-1.15.0/libgloss/i386-es/lseek.c | | 12438 | +*** newlib-1.15.0.org/libgloss/i386-es/lseek.c 1970-01-01 09:00:00.000000000 +0900 | | 12439 | +--- newlib-1.15.0/libgloss/i386-es/lseek.c 2007-11-15 11:33:20.000000000 +0900 | | 12440 | +*************** | | 12441 | +*** 0 **** | | 12442 | +--- 1,53 ---- | | 12443 | ++ /* | | 12444 | ++ * Copyright (c) 2007 | | 12445 | ++ * Nintendo Co., Ltd. | | 12446 | ++ * | | 12447 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12448 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12449 | ++ * provided that the above copyright notice appear in all copies and | | 12450 | ++ * that both that copyright notice and this permission notice appear | | 12451 | ++ * in supporting documentation. Nintendo makes no | | 12452 | ++ * representations about the suitability of this software for any | | 12453 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12454 | ++ */ | | 12455 | ++ | | 12456 | ++ #include <sys/types.h> | | 12457 | ++ #include <unistd.h> | | 12458 | ++ | | 12459 | ++ #include <errno.h> | | 12460 | ++ #include "es-syscall.h" | | 12461 | ++ | | 12462 | ++ off_t __attribute__((weak)) | | 12463 | ++ _lseek(int fd, off_t ptr, int whence) | | 12464 | ++ { | | 12465 | ++ void* stream = _es_getInterfacePointer(fd); | | 12466 | ++ long long pos; | | 12467 | ++ | | 12468 | ++ switch (whence) | | 12469 | ++ { | | 12470 | ++ case SEEK_SET: | | 12471 | ++ pos = ptr; | | 12472 | ++ break; | | 12473 | ++ case SEEK_CUR: | | 12474 | ++ pos = _es_syscall(stream, 0, GET_POSITION, 0); | | 12475 | ++ if (pos < 0) | | 12476 | ++ { | | 12477 | ++ errno = ESPIPE; | | 12478 | ++ return (off_t) -1; | | 12479 | ++ } | | 12480 | ++ pos += ptr; | | 12481 | ++ break; | | 12482 | ++ case SEEK_END: | | 12483 | ++ pos = _es_syscall(stream, 0, GET_SIZE, 0); | | 12484 | ++ if (pos < 0) | | 12485 | ++ { | | 12486 | ++ errno = ESPIPE; | | 12487 | ++ return (off_t) -1; | | 12488 | ++ } | | 12489 | ++ pos += ptr; | | 12490 | ++ break; | | 12491 | ++ } | | 12492 | ++ | | 12493 | ++ _es_syscall(stream, 0, SET_POSITION, (va_list) &pos); | | 12494 | ++ return _es_syscall(stream, 0, GET_POSITION, 0); | | 12495 | ++ } | | 12496 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/mkdir.c newlib-1.15.0/libgloss/i386-es/mkdir.c | | 12497 | +*** newlib-1.15.0.org/libgloss/i386-es/mkdir.c 1970-01-01 09:00:00.000000000 +0900 | | 12498 | +--- newlib-1.15.0/libgloss/i386-es/mkdir.c 2007-11-12 09:48:08.000000000 +0900 | | 12499 | +*************** | | 12500 | +*** 0 **** | | 12501 | +--- 1,54 ---- | | 12502 | ++ /* | | 12503 | ++ * Copyright (c) 2007 | | 12504 | ++ * Nintendo Co., Ltd. | | 12505 | ++ * | | 12506 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12507 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12508 | ++ * provided that the above copyright notice appear in all copies and | | 12509 | ++ * that both that copyright notice and this permission notice appear | | 12510 | ++ * in supporting documentation. Nintendo makes no | | 12511 | ++ * representations about the suitability of this software for any | | 12512 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12513 | ++ */ | | 12514 | ++ | | 12515 | ++ #include <sys/stat.h> | | 12516 | ++ #include <sys/types.h> | | 12517 | ++ | | 12518 | ++ #include <errno.h> | | 12519 | ++ #include "es-syscall.h" | | 12520 | ++ | | 12521 | ++ int __attribute__((weak)) | | 12522 | ++ mkdir(const char* path, mode_t mode) | | 12523 | ++ { | | 12524 | ++ void* context; | | 12525 | ++ void* subcontext; | | 12526 | ++ | | 12527 | ++ if (!path) | | 12528 | ++ { | | 12529 | ++ errno = EFAULT; | | 12530 | ++ return -1; | | 12531 | ++ } | | 12532 | ++ if (*path == '/') | | 12533 | ++ { | | 12534 | ++ context = _es_getRoot(); | | 12535 | ++ ++path; | | 12536 | ++ } | | 12537 | ++ else | | 12538 | ++ { | | 12539 | ++ context = _es_getCurrent(); | | 12540 | ++ } | | 12541 | ++ if (!context) | | 12542 | ++ { | | 12543 | ++ errno = EACCES; | | 12544 | ++ return -1; | | 12545 | ++ } | | 12546 | ++ | | 12547 | ++ subcontext = (void*) _es_syscall(context, 0, CREATE_SUBCONTEXT, (va_list) &path); | | 12548 | ++ _es_release(context); | | 12549 | ++ if (subcontext) | | 12550 | ++ { | | 12551 | ++ _es_release(subcontext); | | 12552 | ++ return 0; | | 12553 | ++ } | | 12554 | ++ return -1; | | 12555 | ++ } | | 12556 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/nanosleep.c newlib-1.15.0/libgloss/i386-es/nanosleep.c | | 12557 | +*** newlib-1.15.0.org/libgloss/i386-es/nanosleep.c 1970-01-01 09:00:00.000000000 +0900 | | 12558 | +--- newlib-1.15.0/libgloss/i386-es/nanosleep.c 2007-11-09 13:22:24.000000000 +0900 | | 12559 | +*************** | | 12560 | +*** 0 **** | | 12561 | +--- 1,42 ---- | | 12562 | ++ /* | | 12563 | ++ * Copyright (c) 2007 | | 12564 | ++ * Nintendo Co., Ltd. | | 12565 | ++ * | | 12566 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12567 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12568 | ++ * provided that the above copyright notice appear in all copies and | | 12569 | ++ * that both that copyright notice and this permission notice appear | | 12570 | ++ * in supporting documentation. Nintendo makes no | | 12571 | ++ * representations about the suitability of this software for any | | 12572 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12573 | ++ */ | | 12574 | ++ | | 12575 | ++ #include <errno.h> | | 12576 | ++ #include <time.h> | | 12577 | ++ #include "es-syscall.h" | | 12578 | ++ | | 12579 | ++ int __attribute__((weak)) | | 12580 | ++ nanosleep(const struct timespec* req, struct timespec* rem) | | 12581 | ++ { | | 12582 | ++ long long time; | | 12583 | ++ | | 12584 | ++ if (!req) | | 12585 | ++ { | | 12586 | ++ errno = EFAULT; | | 12587 | ++ return -1; | | 12588 | ++ } | | 12589 | ++ | | 12590 | ++ time = (req->tv_sec * 10000000LL) + (req->tv_nsec / 100); | | 12591 | ++ | | 12592 | ++ void* current = (void*) _es_syscall(0, 0, CURRENT_THREAD, 0); | | 12593 | ++ _es_syscall(current, 0, THREAD_SLEEP, (va_list) &time); | | 12594 | ++ _es_release(current); | | 12595 | ++ | | 12596 | ++ if (rem) | | 12597 | ++ { | | 12598 | ++ rem->tv_sec = 0; | | 12599 | ++ rem->tv_nsec = 0; | | 12600 | ++ } | | 12601 | ++ | | 12602 | ++ return 0; | | 12603 | ++ } | | 12604 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/open.c newlib-1.15.0/libgloss/i386-es/open.c | | 12605 | +*** newlib-1.15.0.org/libgloss/i386-es/open.c 1970-01-01 09:00:00.000000000 +0900 | | 12606 | +--- newlib-1.15.0/libgloss/i386-es/open.c 2007-11-15 14:21:57.000000000 +0900 | | 12607 | +*************** | | 12608 | +*** 0 **** | | 12609 | +--- 1,154 ---- | | 12610 | ++ /* | | 12611 | ++ * Copyright (c) 2007 | | 12612 | ++ * Nintendo Co., Ltd. | | 12613 | ++ * | | 12614 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12615 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12616 | ++ * provided that the above copyright notice appear in all copies and | | 12617 | ++ * that both that copyright notice and this permission notice appear | | 12618 | ++ * in supporting documentation. Nintendo makes no | | 12619 | ++ * representations about the suitability of this software for any | | 12620 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12621 | ++ */ | | 12622 | ++ | | 12623 | ++ #include <fcntl.h> | | 12624 | ++ | | 12625 | ++ #include <errno.h> | | 12626 | ++ #include <stdarg.h> | | 12627 | ++ #include "es-syscall.h" | | 12628 | ++ | | 12629 | ++ int __attribute__((weak)) | | 12630 | ++ _open(const char* path, int flags, ...) | | 12631 | ++ { | | 12632 | ++ void* context; | | 12633 | ++ void* unknown; | | 12634 | ++ void* file; | | 12635 | ++ void* stream; | | 12636 | ++ unsigned int attr; | | 12637 | ++ long long size; | | 12638 | ++ | | 12639 | ++ if (!path) | | 12640 | ++ { | | 12641 | ++ errno = EFAULT; | | 12642 | ++ return -1; | | 12643 | ++ } | | 12644 | ++ if (*path == '/') | | 12645 | ++ { | | 12646 | ++ context = _es_getRoot(); | | 12647 | ++ ++path; | | 12648 | ++ } | | 12649 | ++ else | | 12650 | ++ { | | 12651 | ++ context = _es_getCurrent(); | | 12652 | ++ } | | 12653 | ++ if (!context) | | 12654 | ++ { | | 12655 | ++ errno = EACCES; | | 12656 | ++ return -1; | | 12657 | ++ } | | 12658 | ++ | | 12659 | ++ if (flags & O_CREAT) | | 12660 | ++ { | | 12661 | ++ // Create a file | | 12662 | ++ unknown = _es_bind(context, path, 0); | | 12663 | ++ if (!unknown) | | 12664 | ++ { | | 12665 | ++ if (flags & O_EXCL) | | 12666 | ++ { | | 12667 | ++ _es_release(context); | | 12668 | ++ errno = EEXIST; | | 12669 | ++ return -1; | | 12670 | ++ } | | 12671 | ++ flags &= ~O_CREAT; // O_CREAT has no meaning. | | 12672 | ++ } | | 12673 | ++ } | | 12674 | ++ if (!(flags & O_CREAT)) | | 12675 | ++ { | | 12676 | ++ unknown = _es_lookup(context, path); | | 12677 | ++ } | | 12678 | ++ if (!unknown) | | 12679 | ++ { | | 12680 | ++ _es_release(context); | | 12681 | ++ errno = ENOENT; | | 12682 | ++ return -1; | | 12683 | ++ } | | 12684 | ++ _es_release(context); | | 12685 | ++ | | 12686 | ++ context = _es_queryInterface(unknown, &_es_contextIid); | | 12687 | ++ if (context) | | 12688 | ++ { | | 12689 | ++ static const char* arg = ""; | | 12690 | ++ void* iter; | | 12691 | ++ | | 12692 | ++ iter = (void*) _es_syscall(context, 0, LIST, (va_list) &arg); | | 12693 | ++ _es_release(context); | | 12694 | ++ if (!iter) | | 12695 | ++ { | | 12696 | ++ errno = EACCES; | | 12697 | ++ return -1; | | 12698 | ++ } | | 12699 | ++ return (int) iter; // for getdents() | | 12700 | ++ } | | 12701 | ++ | | 12702 | ++ file = _es_queryInterface(unknown, &_es_fileIid); | | 12703 | ++ if (file) | | 12704 | ++ { | | 12705 | ++ if (flags & O_CREAT) | | 12706 | ++ { | | 12707 | ++ va_list ap; | | 12708 | ++ mode_t mode; | | 12709 | ++ | | 12710 | ++ va_start(ap, flags); | | 12711 | ++ mode = va_arg(ap, mode_t); | | 12712 | ++ va_end(ap); | | 12713 | ++ if (mode & S_IWUSR) | | 12714 | ++ { | | 12715 | ++ attr = 0; | | 12716 | ++ } | | 12717 | ++ else | | 12718 | ++ { | | 12719 | ++ attr = IFILE_READONLY; | | 12720 | ++ } | | 12721 | ++ _es_syscall(file, 0, SET_ATTRIBUTES, (va_list) &attr); | | 12722 | ++ } | | 12723 | ++ else | | 12724 | ++ { | | 12725 | ++ attr = _es_syscall(file, 0, GET_ATTRIBUTES, 0); | | 12726 | ++ } | | 12727 | ++ if ((attr & IFILE_READONLY) && (flags & (O_WRONLY | O_RDWR)) || | | 12728 | ++ (attr & IFILE_DIRECTORY)) | | 12729 | ++ { | | 12730 | ++ _es_release(file); | | 12731 | ++ errno = EACCES; | | 12732 | ++ return -1; | | 12733 | ++ } | | 12734 | ++ | | 12735 | ++ stream = (void*) _es_syscall(file, 0, GET_STREAM, 0); | | 12736 | ++ _es_release(file); | | 12737 | ++ } | | 12738 | ++ else | | 12739 | ++ { | | 12740 | ++ stream = _es_queryInterface(unknown, &_es_streamIid); | | 12741 | ++ } | | 12742 | ++ _es_release(unknown); | | 12743 | ++ | | 12744 | ++ if (!stream) | | 12745 | ++ { | | 12746 | ++ errno = EACCES; | | 12747 | ++ return -1; | | 12748 | ++ } | | 12749 | ++ | | 12750 | ++ if (flags & O_TRUNC) | | 12751 | ++ { | | 12752 | ++ size = 0; | | 12753 | ++ _es_syscall(stream, 0, SET_SIZE, (va_list) &size); | | 12754 | ++ } | | 12755 | ++ | | 12756 | ++ if (flags & O_APPEND) | | 12757 | ++ { | | 12758 | ++ size = _es_syscall(stream, 0, GET_SIZE, 0); | | 12759 | ++ _es_syscall(stream, 0, SET_POSITION, (va_list) &size); | | 12760 | ++ } | | 12761 | ++ | | 12762 | ++ return (int) stream; | | 12763 | ++ } | | 12764 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/pthread.c newlib-1.15.0/libgloss/i386-es/pthread.c | | 12765 | +*** newlib-1.15.0.org/libgloss/i386-es/pthread.c 1970-01-01 09:00:00.000000000 +0900 | | 12766 | +--- newlib-1.15.0/libgloss/i386-es/pthread.c 2007-11-08 11:31:36.000000000 +0900 | | 12767 | +*************** | | 12768 | +*** 0 **** | | 12769 | +--- 1,277 ---- | | 12770 | ++ /* | | 12771 | ++ * Copyright (c) 2007 | | 12772 | ++ * Nintendo Co., Ltd. | | 12773 | ++ * | | 12774 | ++ * Permission to use, copy, modify, distribute and sell this software | | 12775 | ++ * and its documentation for any purpose is hereby granted without fee, | | 12776 | ++ * provided that the above copyright notice appear in all copies and | | 12777 | ++ * that both that copyright notice and this permission notice appear | | 12778 | ++ * in supporting documentation. Nintendo makes no | | 12779 | ++ * representations about the suitability of this software for any | | 12780 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12781 | ++ */ | | 12782 | ++ | | 12783 | ++ #include "es-syscall.h" | | 12784 | ++ | | 12785 | ++ #include <errno.h> | | 11566 | 12786 | + #include <pthread.h> | | 11567 | 12787 | + #include <stdarg.h> | | 11568 | 12788 | + #include <unistd.h> |
| | @@ -11585,16 +12805,6 @@ | | 11585 | 12805 | + #pragma weak pthread_mutex_init | | 11586 | 12806 | + #pragma weak pthread_mutex_destroy | | 11587 | 12807 | + | | 11588 | | -+ static long long syscall(void* self, void* base, int m, va_list ap) | | 11589 | | -+ { | | 11590 | | -+ long long result; | | 11591 | | -+ | | 11592 | | -+ __asm__ __volatile__ ( | | 11593 | | -+ "int $65" | | 11594 | | -+ : "=A"(result) : "a"(self), "d"(m), "c"(ap), "S"(base)); | | 11595 | | -+ return result; | | 11596 | | -+ } | | 11597 | | -+ | | 11598 | 12808 | + #ifndef PTHREAD_KEYS_MAX | | 11599 | 12809 | + #define PTHREAD_KEYS_MAX 64 | | 11600 | 12810 | + #endif |
| | @@ -11640,7 +12850,7 @@ | | 11640 | 12850 | + { | | 11641 | 12851 | + while (!once->init_executed) | | 11642 | 12852 | + { | | 11643 | | -+ syscall(0, 0, YIELD, 0); // XXX should sleep for a while | | 12853 | ++ _es_syscall(0, 0, YIELD, 0); // XXX should sleep for a while | | 11644 | 12854 | + } | | 11645 | 12855 | + } | | 11646 | 12856 | + } |
| | @@ -11771,7 +12981,7 @@ | | 11771 | 12981 | + void* monitor = getMonitor(mutex); | | 11772 | 12982 | + if (monitor) | | 11773 | 12983 | + { | | 11774 | | -+ syscall(monitor, 0, LOCK, 0); | | 12984 | ++ _es_syscall(monitor, 0, LOCK, 0); | | 11775 | 12985 | + } | | 11776 | 12986 | + return 0; | | 11777 | 12987 | + } |
| | @@ -11784,7 +12994,7 @@ | | 11784 | 12994 | + return 0; | | 11785 | 12995 | + } | | 11786 | 12996 | + | | 11787 | | -+ if ((int) syscall(monitor, 0, TRY_LOCK, 0)) | | 12997 | ++ if ((int) _es_syscall(monitor, 0, TRY_LOCK, 0)) | | 11788 | 12998 | + { | | 11789 | 12999 | + return 0; | | 11790 | 13000 | + } |
| | @@ -11799,7 +13009,7 @@ | | 11799 | 13009 | + void* monitor = getMonitor(mutex); | | 11800 | 13010 | + if (monitor) | | 11801 | 13011 | + { | | 11802 | | -+ syscall(monitor, 0, UNLOCK, 0); | | 13012 | ++ _es_syscall(monitor, 0, UNLOCK, 0); | | 11803 | 13013 | + } | | 11804 | 13014 | + return 0; | | 11805 | 13015 | + } |
| | @@ -11821,7 +13031,7 @@ | | 11821 | 13031 | + | | 11822 | 13032 | + int pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr) | | 11823 | 13033 | + { | | 11824 | | -+ *mutex = (pthread_mutex_t*) syscall(0, 0, CREATE_MONITOR, 0); | | 13034 | ++ *mutex = (pthread_mutex_t*) _es_syscall(0, 0, CREATE_MONITOR, 0); | | 11825 | 13035 | + return 0; | | 11826 | 13036 | + } | | 11827 | 13037 | + |
| | @@ -11830,16 +13040,16 @@ | | 11830 | 13040 | + void* monitor = getMonitor(mutex); | | 11831 | 13041 | + if (monitor) | | 11832 | 13042 | + { | | 11833 | | -+ syscall(monitor, 0, RELEASE, 0); | | 13043 | ++ _es_syscall(monitor, 0, RELEASE, 0); | | 11834 | 13044 | + } | | 11835 | 13045 | + return 0; | | 11836 | 13046 | + } | | 11837 | | -diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es-salib.c newlib-1.15.0/libgloss/i386-es/es-salib.c | | 11838 | | -*** newlib-1.15.0.org/libgloss/i386-es/es-salib.c 1970-01-01 09:00:00.000000000 +0900 | | 11839 | | ---- newlib-1.15.0/libgloss/i386-es/es-salib.c 2007-08-09 11:23:18.000000000 +0900 | | 13047 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/read.c newlib-1.15.0/libgloss/i386-es/read.c | | 13048 | +*** newlib-1.15.0.org/libgloss/i386-es/read.c 1970-01-01 09:00:00.000000000 +0900 | | 13049 | +--- newlib-1.15.0/libgloss/i386-es/read.c 2007-11-08 11:14:00.000000000 +0900 | | 11840 | 13050 | *************** | | 11841 | 13051 | *** 0 **** | | 11842 | | ---- 1,220 ---- | | 13052 | +--- 1,28 ---- | | 11843 | 13053 | + /* | | 11844 | 13054 | + * Copyright (c) 2007 | | 11845 | 13055 | + * Nintendo Co., Ltd. |
| | @@ -11853,22 +13063,6 @@ | | 11853 | 13063 | + * purpose. It is provided "as is" without express or implied warranty. | | 11854 | 13064 | + */ | | 11855 | 13065 | + | | 11856 | | -+ /* | | 11857 | | -+ * Standard x86 syscalls for user programs running under Cygmon | | 11858 | | -+ * | | 11859 | | -+ * Copyright (c) 1998, 2000 Cygnus Support | | 11860 | | -+ * | | 11861 | | -+ * The authors hereby grant permission to use, copy, modify, distribute, | | 11862 | | -+ * and license this software and its documentation for any purpose, provided | | 11863 | | -+ * that existing copyright notices are retained in all copies and that this | | 11864 | | -+ * notice is included verbatim in any distributions. No written agreement, | | 11865 | | -+ * license, or royalty fee is required for any of the authorized uses. | | 11866 | | -+ * Modifications to this software may be copyrighted by their authors | | 11867 | | -+ * and need not follow the licensing terms described here, provided that | | 11868 | | -+ * the new terms are clearly indicated on the first page of each file where | | 11869 | | -+ * they apply. | | 11870 | | -+ */ | | 11871 | | -+ | | 11872 | 13066 | + #include <errno.h> | | 11873 | 13067 | + #include <fcntl.h> | | 11874 | 13068 | + #include <stdarg.h> |
| | @@ -11878,196 +13072,333 @@ | | 11878 | 13072 | + #include "es-syscall.h" | | 11879 | 13073 | + | | 11880 | 13074 | + // Functions that are also defined inside the kernel are declared to be weak. | | 11881 | | -+ #pragma weak _close | | 11882 | | -+ #pragma weak _exit | | 11883 | | -+ #pragma weak _write | | 11884 | 13075 | + #pragma weak _read | | 11885 | 13076 | + | | 11886 | | -+ static long long syscall(void* self, void* base, int m, va_list ap) | | 13077 | ++ int _read(int file, char *ptr, size_t len) | | 11887 | 13078 | + { | | 11888 | | -+ long long result; | | 11889 | | -+ | | 11890 | | -+ __asm__ __volatile__ ( | | 11891 | | -+ "int $65" | | 11892 | | -+ : "=A"(result) : "a"(self), "d"(m), "c"(ap), "S"(base)); | | 11893 | | -+ return result; | | 13079 | ++ return (int) _es_syscall(_es_getInterfacePointer(file), 0, READ, (va_list) &ptr); | | 11894 | 13080 | + } | | 13081 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/rename.c newlib-1.15.0/libgloss/i386-es/rename.c | | 13082 | +*** newlib-1.15.0.org/libgloss/i386-es/rename.c 1970-01-01 09:00:00.000000000 +0900 | | 13083 | +--- newlib-1.15.0/libgloss/i386-es/rename.c 2007-11-15 14:22:08.000000000 +0900 | | 13084 | +*************** | | 13085 | +*** 0 **** | | 13086 | +--- 1,107 ---- | | 13087 | ++ /* | | 13088 | ++ * Copyright (c) 2007 | | 13089 | ++ * Nintendo Co., Ltd. | | 13090 | ++ * | | 13091 | ++ * Permission to use, copy, modify, distribute and sell this software | | 13092 | ++ * and its documentation for any purpose is hereby granted without fee, | | 13093 | ++ * provided that the above copyright notice appear in all copies and | | 13094 | ++ * that both that copyright notice and this permission notice appear | | 13095 | ++ * in supporting documentation. Nintendo makes no | | 13096 | ++ * representations about the suitability of this software for any | | 13097 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 13098 | ++ */ | | 11895 | 13099 | + | | 11896 | | -+ static void* streamStdin; | | 11897 | | -+ static void* streamStdout; | | 11898 | | -+ static void* streamStderr; | | 13100 | ++ #include <stdio.h> | | 11899 | 13101 | + | | 11900 | | -+ static void* getInterfacePointer(int file) | | 13102 | ++ #include <errno.h> | | 13103 | ++ #include "es-syscall.h" | | 13104 | ++ | | 13105 | ++ int __attribute__((weak)) | | 13106 | ++ _rename(const char* oldpath, const char* newpath) | | 11901 | 13107 | + { | | 11902 | | -+ void* object = 0; | | 13108 | ++ void* context; | | 13109 | ++ int rc; | | 13110 | ++ int i; | | 13111 | ++ char path[2048]; | | 11903 | 13112 | + | | 11904 | | -+ switch (file) | | 13113 | ++ if (!oldpath || !newpath) | | 11905 | 13114 | + { | | 11906 | | -+ case 0: // stdin | | 11907 | | -+ if (!streamStdin) | | 13115 | ++ errno = EFAULT; | | 13116 | ++ return -1; | | 13117 | ++ } | | 13118 | ++ | | 13119 | ++ for (i = 0; oldpath[i] && newpath[i]; ++i) | | 13120 | ++ { | | 13121 | ++ if (oldpath[i] != newpath[i]) | | 11908 | 13122 | + { | | 11909 | | -+ streamStdin = (void*) syscall(0, 0, GET_IN, 0); | | 13123 | ++ break; | | 11910 | 13124 | + } | | 11911 | | -+ object = streamStdin; | | 11912 | | -+ break; | | 11913 | | -+ case 1: // stdout | | 11914 | | -+ if (!streamStdout) | | 13125 | ++ } | | 13126 | ++ while (0 < i) | | 13127 | ++ { | | 13128 | ++ --i; | | 13129 | ++ if (oldpath[i] == '/') | | 11915 | 13130 | + { | | 11916 | | -+ streamStdout = (void*) syscall(0, 0, GET_OUT, 0); | | 13131 | ++ ++i; | | 13132 | ++ break; | | 11917 | 13133 | + } | | 11918 | | -+ object = streamStdout; | | 11919 | | -+ break; | | 11920 | | -+ case 2: // stderr | | 11921 | | -+ if (!streamStderr) | | 11922 | | -+ { | | 11923 | | -+ streamStderr = (void*) syscall(0, 0, GET_ERROR, 0); | | 11924 | | -+ } | | 11925 | | -+ object = streamStderr; | | 11926 | | -+ break; | | 11927 | | -+ default: | | 11928 | | -+ object = (void*) file; | | 11929 | | -+ break; | | 11930 | 13134 | + } | | 11931 | | -+ return object; | | 11932 | | -+ } | | 13135 | ++ if (oldpath[i] == '\0') | | 13136 | ++ { | | 13137 | ++ errno = ENOENT; | | 13138 | ++ return -1; | | 13139 | ++ } | | 11933 | 13140 | + | | 11934 | | -+ extern int errno; | | 13141 | ++ if (sizeof path <= i) | | 13142 | ++ { | | 13143 | ++ errno = ENAMETOOLONG; | | 13144 | ++ return -1; | | 13145 | ++ } | | 13146 | ++ if (0 < i) | | 13147 | ++ { | | 13148 | ++ memmove(path, oldpath, i); | | 13149 | ++ path[i - 1] = '\0'; | | 13150 | ++ } | | 13151 | ++ else | | 13152 | ++ { | | 13153 | ++ path[0] = '\0'; | | 13154 | ++ } | | 11935 | 13155 | + | | 11936 | | -+ int _fstat(int file, struct stat *st) | | 11937 | | -+ { | | 11938 | | -+ return -1; | | 11939 | | -+ } | | 13156 | ++ if (*oldpath == '/') | | 13157 | ++ { | | 13158 | ++ context = _es_getRoot(); | | 13159 | ++ } | | 13160 | ++ else | | 13161 | ++ { | | 13162 | ++ context = _es_getCurrent(); | | 13163 | ++ } | | 13164 | ++ if (!context) | | 13165 | ++ { | | 13166 | ++ errno = EACCES; | | 13167 | ++ return -1; | | 13168 | ++ } | | 11940 | 13169 | + | | 11941 | | -+ int _open(const char *path, int flags) | | 11942 | | -+ { | | 11943 | | -+ return -1; | | 11944 | | -+ } | | 13170 | ++ if (*path) | | 13171 | ++ { | | 13172 | ++ void* unknown = _es_lookup(context, (*path == '/') ? (path + 1) : path); | | 13173 | ++ _es_release(context); | | 13174 | ++ if (!unknown) | | 13175 | ++ { | | 13176 | ++ errno = ENOENT; | | 13177 | ++ return -1; | | 13178 | ++ } | | 11945 | 13179 | + | | 11946 | | -+ caddr_t _sbrk(size_t amt) | | 11947 | | -+ { | | 11948 | | -+ long long increment = amt; | | 13180 | ++ context = _es_queryInterface(unknown, &_es_contextIid); | | 13181 | ++ _es_release(unknown); | | 13182 | ++ if (!context) | | 13183 | ++ { | | 13184 | ++ errno = ENOTDIR; | | 13185 | ++ return -1; | | 13186 | ++ } | | 13187 | ++ } | | 11949 | 13188 | + | | 11950 | | -+ return (caddr_t) syscall(0, 0, SET_BREAK, (va_list) &increment); | | 11951 | | -+ } | | 13189 | ++ rc = _es_rename(context, oldpath + i, newpath + i); | | 13190 | ++ _es_release(context); | | 11952 | 13191 | + | | 11953 | | -+ int _kill(int n, int m) | | 11954 | | -+ { | | 11955 | | -+ return -1; | | 13192 | ++ return rc; | | 11956 | 13193 | + } | | 13194 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/rmdir.c newlib-1.15.0/libgloss/i386-es/rmdir.c | | 13195 | +*** newlib-1.15.0.org/libgloss/i386-es/rmdir.c 1970-01-01 09:00:00.000000000 +0900 | | 13196 | +--- newlib-1.15.0/libgloss/i386-es/rmdir.c 2007-11-12 09:49:38.000000000 +0900 | | 13197 | +*************** | | 13198 | +*** 0 **** | | 13199 | +--- 1,47 ---- | | 13200 | ++ /* | | 13201 | ++ * Copyright (c) 2007 | | 13202 | ++ * Nintendo Co., Ltd. | | 13203 | ++ * | | 13204 | ++ * Permission to use, copy, modify, distribute and sell this software | | 13205 | ++ * and its documentation for any purpose is hereby granted without fee, | | 13206 | ++ * provided that the above copyright notice appear in all copies and | | 13207 | ++ * that both that copyright notice and this permission notice appear | | 13208 | ++ * in supporting documentation. Nintendo makes no | | 13209 | ++ * representations about the suitability of this software for any | | 13210 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 13211 | ++ */ | | 11957 | 13212 | + | | 11958 | | -+ _getpid(int n) | | 11959 | | -+ { | | 11960 | | -+ return -1; | | 11961 | | -+ } | | 13213 | ++ #include <unistd.h> | | 11962 | 13214 | + | | 11963 | | -+ int _write(int file, const char *ptr, size_t len) | | 13215 | ++ #include <errno.h> | | 13216 | ++ #include "es-syscall.h" | | 13217 | ++ | | 13218 | ++ int __attribute__((weak)) | | 13219 | ++ rmdir(const char *path) | | 11964 | 13220 | + { | | 11965 | | -+ return (int) syscall(getInterfacePointer(file), 0, WRITE, (va_list) &ptr); | | 11966 | | -+ } | | 13221 | ++ void* context; | | 11967 | 13222 | + | | 11968 | | -+ int _close(int file) | | 11969 | | -+ { | | 11970 | | -+ void* object = 0; | | 11971 | | -+ switch (file) | | 13223 | ++ if (!path) | | 11972 | 13224 | + { | | 11973 | | -+ case 0: // stdin | | 11974 | | -+ object = streamStdin; | | 11975 | | -+ streamStdin = 0; | | 11976 | | -+ break; | | 11977 | | -+ case 1: // stdout | | 11978 | | -+ object = streamStdout; | | 11979 | | -+ streamStdout = 0; | | 11980 | | -+ break; | | 11981 | | -+ case 2: // stderr | | 11982 | | -+ object = streamStderr; | | 11983 | | -+ streamStderr = 0; | | 11984 | | -+ break; | | 11985 | | -+ default: | | 11986 | | -+ object = (void*) file; | | 11987 | | -+ break; | | 13225 | ++ errno = EFAULT; | | 13226 | ++ return -1; | | 11988 | 13227 | + } | | 11989 | | -+ if (!object) | | 13228 | ++ if (*path == '/') | | 11990 | 13229 | + { | | 11991 | | -+ errno = EBADF; | | 13230 | ++ context = _es_getRoot(); | | 13231 | ++ ++path; | | 13232 | ++ } | | 13233 | ++ else | | 13234 | ++ { | | 13235 | ++ context = _es_getCurrent(); | | 13236 | ++ } | | 13237 | ++ if (!context) | | 13238 | ++ { | | 13239 | ++ errno = EACCES; | | 11992 | 13240 | + return -1; | | 11993 | 13241 | + } | | 11994 | | -+ syscall(object, 0, RELEASE, 0); | | 11995 | | -+ return 0; | | 11996 | | -+ } | | 11997 | 13242 | + | | 11998 | | -+ off_t _lseek(int file, off_t ptr, int dir) | | 11999 | | -+ { | | 12000 | | -+ return -1; | | 13243 | ++ int rc = (int) _es_syscall(context, 0, DESTROY_SUBCONTEXT, (va_list) &path); | | 13244 | ++ _es_release(context); | | 13245 | ++ return rc; | | 12001 | 13246 | + } | | 13247 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/sbrk.c newlib-1.15.0/libgloss/i386-es/sbrk.c | | 13248 | +*** newlib-1.15.0.org/libgloss/i386-es/sbrk.c 1970-01-01 09:00:00.000000000 +0900 | | 13249 | +--- newlib-1.15.0/libgloss/i386-es/sbrk.c 2007-11-08 11:13:59.000000000 +0900 | | 13250 | +*************** | | 13251 | +*** 0 **** | | 13252 | +--- 1,30 ---- | | 13253 | ++ /* | | 13254 | ++ * Copyright (c) 2007 | | 13255 | ++ * Nintendo Co., Ltd. | | 13256 | ++ * | | 13257 | ++ * Permission to use, copy, modify, distribute and sell this software | | 13258 | ++ * and its documentation for any purpose is hereby granted without fee, | | 13259 | ++ * provided that the above copyright notice appear in all copies and | | 13260 | ++ * that both that copyright notice and this permission notice appear | | 13261 | ++ * in supporting documentation. Nintendo makes no | | 13262 | ++ * representations about the suitability of this software for any | | 13263 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 13264 | ++ */ | | 12002 | 13265 | + | | 12003 | | -+ int _read(int file, char *ptr, size_t len) | | 12004 | | -+ { | | 12005 | | -+ return (int) syscall(getInterfacePointer(file), 0, READ, (va_list) &ptr); | | 12006 | | -+ } | | 13266 | ++ #include <errno.h> | | 13267 | ++ #include <fcntl.h> | | 13268 | ++ #include <stdarg.h> | | 13269 | ++ #include <string.h> | | 13270 | ++ #include <stdlib.h> | | 13271 | ++ #include <sys/times.h> | | 13272 | ++ #include "es-syscall.h" | | 12007 | 13273 | + | | 12008 | | -+ void _exit(int i) | | 12009 | | -+ { | | 12010 | | -+ syscall(0, 0, EXIT, (va_list) &i); | | 12011 | | -+ } | | 13274 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 13275 | ++ #pragma weak _sbrk | | 12012 | 13276 | + | | 12013 | | -+ int _isatty(int i) | | 13277 | ++ caddr_t _sbrk(size_t amt) | | 12014 | 13278 | + { | | 12015 | | -+ return i < 3; // Ultra-super cheezy. | | 12016 | | -+ } | | 13279 | ++ long long increment = amt; | | 12017 | 13280 | + | | 12018 | | -+ int _link(const char *oldpath, const char *newpath) | | 12019 | | -+ { | | 12020 | | -+ return -1; | | 13281 | ++ return (caddr_t) _es_syscall(0, 0, SET_BREAK, (va_list) &increment); | | 12021 | 13282 | + } | | 13283 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/stat.c newlib-1.15.0/libgloss/i386-es/stat.c | | 13284 | +*** newlib-1.15.0.org/libgloss/i386-es/stat.c 1970-01-01 09:00:00.000000000 +0900 | | 13285 | +--- newlib-1.15.0/libgloss/i386-es/stat.c 2007-11-08 17:27:31.000000000 +0900 | | 13286 | +*************** | | 13287 | +*** 0 **** | | 13288 | +--- 1,105 ---- | | 13289 | ++ /* | | 13290 | ++ * Copyright (c) 2007 | | 13291 | ++ * Nintendo Co., Ltd. | | 13292 | ++ * | | 13293 | ++ * Permission to use, copy, modify, distribute and sell this software | | 13294 | ++ * and its documentation for any purpose is hereby granted without fee, | | 13295 | ++ * provided that the above copyright notice appear in all copies and | | 13296 | ++ * that both that copyright notice and this permission notice appear | | 13297 | ++ * in supporting documentation. Nintendo makes no | | 13298 | ++ * representations about the suitability of this software for any | | 13299 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 13300 | ++ */ | | 12022 | 13301 | + | | 12023 | | -+ int _unlink(const char *p) | | 12024 | | -+ { | | 12025 | | -+ return -1; | | 12026 | | -+ } | | 13302 | ++ #include <sys/stat.h> | | 12027 | 13303 | + | | 12028 | | -+ int _stat(const char *file, struct stat *st) | | 12029 | | -+ { | | 12030 | | -+ errno = ENOSYS; | | 12031 | | -+ return -1; | | 12032 | | -+ } | | 13304 | ++ #include <errno.h> | | 13305 | ++ #include <stdarg.h> | | 13306 | ++ #include <string.h> | | 13307 | ++ #include "es-syscall.h" | | 12033 | 13308 | + | | 12034 | | -+ clock_t _times(struct tms *buf) | | 13309 | ++ int __attribute__((weak)) | | 13310 | ++ _stat(const char* path, struct stat* statbuf) | | 12035 | 13311 | + { | | 12036 | | -+ errno = ENOSYS; | | 12037 | | -+ return -1; | | 12038 | | -+ } | | 13312 | ++ void* context; | | 13313 | ++ void* unknown; | | 13314 | ++ void* file; | | 13315 | ++ void* stream; | | 13316 | ++ void* socket; | | 12039 | 13317 | + | | 12040 | | -+ int _gettimeofday(struct timeval *tv, struct timezone *tz) | | 12041 | | -+ { | | 12042 | | -+ return -1; | | 12043 | | -+ } | | 13318 | ++ if (!path) | | 13319 | ++ { | | 13320 | ++ errno = EFAULT; | | 13321 | ++ return -1; | | 13322 | ++ } | | 13323 | ++ if (*path == '/') | | 13324 | ++ { | | 13325 | ++ context = _es_getRoot(); | | 13326 | ++ ++path; | | 13327 | ++ } | | 13328 | ++ else | | 13329 | ++ { | | 13330 | ++ context = _es_getCurrent(); | | 13331 | ++ } | | 13332 | ++ if (!context) | | 13333 | ++ { | | 13334 | ++ errno = EACCES; | | 13335 | ++ return -1; | | 13336 | ++ } | | 12044 | 13337 | + | | 12045 | | -+ void | | 12046 | | -+ profil_write(int type, char *buffer, int len) | | 12047 | | -+ { | | 12048 | | -+ static int des = -1; | | 13338 | ++ unknown = _es_lookup(context, path); | | 13339 | ++ _es_release(context); | | 13340 | ++ if (!unknown) | | 13341 | ++ { | | 13342 | ++ errno = ENOENT; | | 13343 | ++ return -1; | | 13344 | ++ } | | 12049 | 13345 | + | | 12050 | | -+ if (des < 0) | | 13346 | ++ memset(statbuf, 0, sizeof(struct stat)); | | 13347 | ++ if ((file = _es_queryInterface(unknown, &_es_fileIid)) != 0) | | 12051 | 13348 | + { | | 12052 | | -+ des = open("gmon.out", O_WRONLY | O_CREAT | O_TRUNC, 0644); | | 13349 | ++ unsigned int attr = _es_syscall(file, 0, GET_ATTRIBUTES, 0); | | 13350 | ++ if (attr & IFILE_READONLY) | | 13351 | ++ { | | 13352 | ++ statbuf->st_mode |= (S_IRUSR | S_IXUSR); | | 13353 | ++ } | | 13354 | ++ else | | 13355 | ++ { | | 13356 | ++ statbuf->st_mode |= S_IRWXU; | | 13357 | ++ } | | 13358 | ++ if (attr & IFILE_DIRECTORY) | | 13359 | ++ { | | 13360 | ++ statbuf->st_mode |= S_IFDIR; | | 13361 | ++ } | | 13362 | ++ else | | 13363 | ++ { | | 13364 | ++ statbuf->st_mode |= S_IFREG; | | 13365 | ++ } | | 13366 | ++ statbuf->st_size = _es_syscall(file, 0, GET_FILESIZE, 0); | | 13367 | ++ statbuf->st_atime = _es_syscall(file, 0, GET_LASTACCESSTIME, 0); | | 13368 | ++ statbuf->st_mtime = _es_syscall(file, 0, GET_LASTWRITETIME, 0); | | 13369 | ++ statbuf->st_ctime = _es_syscall(file, 0, GET_CREATIONTIME, 0); | | 13370 | ++ _es_release(file); | | 12053 | 13371 | + } | | 12054 | | -+ if (len == 0) | | 13372 | ++ else if ((socket = _es_queryInterface(unknown, &_es_socketIid)) != 0) | | 12055 | 13373 | + { | | 12056 | | -+ close (des); | | 13374 | ++ statbuf->st_mode |= S_IFSOCK; | | 13375 | ++ _es_release(socket); | | 12057 | 13376 | + } | | 12058 | | -+ else | | 13377 | ++ else if ((stream = _es_queryInterface(unknown, &_es_streamIid)) != 0) | | 12059 | 13378 | + { | | 12060 | | -+ write(des, buffer, len); | | 13379 | ++ if (_es_syscall(stream, 0, GET_POSITION, 0) == -1) | | 13380 | ++ { | | 13381 | ++ statbuf->st_mode |= S_IFCHR; | | 13382 | ++ } | | 13383 | ++ else | | 13384 | ++ { | | 13385 | ++ statbuf->st_mode |= S_IFREG; | | 13386 | ++ } | | 13387 | ++ statbuf->st_size = _es_syscall(stream, 0, GET_SIZE, 0); | | 13388 | ++ _es_release(stream); | | 12061 | 13389 | + } | | 13390 | ++ | | 13391 | ++ _es_release(unknown); | | 13392 | ++ return 0; | | 12062 | 13393 | + } | | 12063 | | -diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es-syscall.h newlib-1.15.0/libgloss/i386-es/es-syscall.h | | 12064 | | -*** newlib-1.15.0.org/libgloss/i386-es/es-syscall.h 1970-01-01 09:00:00.000000000 +0900 | | 12065 | | ---- newlib-1.15.0/libgloss/i386-es/es-syscall.h 2007-08-07 17:54:29.000000000 +0900 | | 13394 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/times.c newlib-1.15.0/libgloss/i386-es/times.c | | 13395 | +*** newlib-1.15.0.org/libgloss/i386-es/times.c 1970-01-01 09:00:00.000000000 +0900 | | 13396 | +--- newlib-1.15.0/libgloss/i386-es/times.c 2007-11-08 11:13:59.000000000 +0900 | | 12066 | 13397 | *************** | | 12067 | 13398 | *** 0 **** | | 12068 | | ---- 1,63 ---- | | 13399 | +--- 1,29 ---- | | 12069 | 13400 | + /* | | 12070 | | -+ * Copyright (c) 2006, 2007 | | 13401 | ++ * Copyright (c) 2007 | | 12071 | 13402 | + * Nintendo Co., Ltd. | | 12072 | 13403 | + * | | 12073 | 13404 | + * Permission to use, copy, modify, distribute and sell this software |
| | @@ -12079,200 +13410,108 @@ | | 12079 | 13410 | + * purpose. It is provided "as is" without express or implied warranty. | | 12080 | 13411 | + */ | | 12081 | 13412 | + | | 12082 | | -+ #ifndef ES_SYSCALL_H | | 12083 | | -+ #define ES_SYSCALL_H | | 13413 | ++ #include <errno.h> | | 13414 | ++ #include <fcntl.h> | | 13415 | ++ #include <stdarg.h> | | 13416 | ++ #include <string.h> | | 13417 | ++ #include <stdlib.h> | | 13418 | ++ #include <sys/times.h> | | 13419 | ++ #include "es-syscall.h" | | 12084 | 13420 | + | | 12085 | | -+ enum | | 13421 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 13422 | ++ #pragma weak _times | | 13423 | ++ | | 13424 | ++ clock_t _times(struct tms *buf) | | 12086 | 13425 | + { | | 12087 | | -+ // IInterface method number | | 12088 | | -+ QUERY_INTERFACE = 0, | | 12089 | | -+ ADD_REF, | | 12090 | | -+ RELEASE, | | 12091 | | -+ | | 12092 | | -+ // ICurrentProcess method number | | 12093 | | -+ EXIT = 3, | | 12094 | | -+ MAP, | | 12095 | | -+ UNMAP, | | 12096 | | -+ CURRENT_THREAD, | | 12097 | | -+ CREATE_THREAD, | | 12098 | | -+ YIELD, | | 12099 | | -+ CREATE_MONITOR, | | 12100 | | -+ GET_ROOT, | | 12101 | | -+ GET_IN, | | 12102 | | -+ GET_OUT, | | 12103 | | -+ GET_ERROR, | | 12104 | | -+ SET_BREAK, | | 12105 | | -+ GET_NOW, | | 12106 | | -+ TRACE, | | 12107 | | -+ SET_CURRENT, | | 12108 | | -+ GET_CURRENT, | | 12109 | | -+ | | 12110 | | -+ // IMonitor method number | | 12111 | | -+ LOCK = 3, | | 12112 | | -+ TRY_LOCK, | | 12113 | | -+ UNLOCK, | | 12114 | | -+ WAIT, | | 12115 | | -+ WAIT_TIMEOUT, | | 12116 | | -+ NOTIFY, | | 12117 | | -+ NOTIFY_ALL, | | 12118 | | -+ | | 12119 | | -+ // IStream method number | | 12120 | | -+ GET_POSITION = 3, | | 12121 | | -+ SET_POSITION, | | 12122 | | -+ GET_SIZE, | | 12123 | | -+ SET_SIZE, | | 12124 | | -+ READ, | | 12125 | | -+ READ_OFFSET, | | 12126 | | -+ WRITE, | | 12127 | | -+ WRITE_OFFSET, | | 12128 | | -+ FLUSH, | | 12129 | | -+ }; | | 12130 | | -+ | | 12131 | | -+ #endif /* SYSCALL_H */ | | 12132 | | -diff -bcrN newlib-1.15.0.org/libgloss/i386-es/es.ld newlib-1.15.0/libgloss/i386-es/es.ld | | 12133 | | -*** newlib-1.15.0.org/libgloss/i386-es/es.ld 1970-01-01 09:00:00.000000000 +0900 | | 12134 | | ---- newlib-1.15.0/libgloss/i386-es/es.ld 2006-08-17 09:16:53.000000000 +0900 | | 13426 | ++ errno = ENOSYS; | | 13427 | ++ return -1; | | 13428 | ++ } | | 13429 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/unlink.c newlib-1.15.0/libgloss/i386-es/unlink.c | | 13430 | +*** newlib-1.15.0.org/libgloss/i386-es/unlink.c 1970-01-01 09:00:00.000000000 +0900 | | 13431 | +--- newlib-1.15.0/libgloss/i386-es/unlink.c 2007-11-12 09:52:12.000000000 +0900 | | 12135 | 13432 | *************** | | 12136 | 13433 | *** 0 **** | | 12137 | | ---- 1,99 ---- | | 12138 | | -+ STARTUP(es-crt0.o) | | 12139 | | -+ ENTRY(__start) | | 12140 | | -+ GROUP(-les -lc -les -lgcc) | | 12141 | | -+ SEARCH_DIR(.) | | 12142 | | -+ __DYNAMIC = 0; | | 12143 | | -+ | | 13434 | +--- 1,47 ---- | | 12144 | 13435 | + /* | | 12145 | | -+ * Allocate the stack to be at the top of memory, since the stack | | 12146 | | -+ * grows down | | 13436 | ++ * Copyright (c) 2007 | | 13437 | ++ * Nintendo Co., Ltd. | | 13438 | ++ * | | 13439 | ++ * Permission to use, copy, modify, distribute and sell this software | | 13440 | ++ * and its documentation for any purpose is hereby granted without fee, | | 13441 | ++ * provided that the above copyright notice appear in all copies and | | 13442 | ++ * that both that copyright notice and this permission notice appear | | 13443 | ++ * in supporting documentation. Nintendo makes no | | 13444 | ++ * representations about the suitability of this software for any | | 13445 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 12147 | 13446 | + */ | | 12148 | | -+ PROVIDE (__stack = 0x500000); | | 12149 | 13447 | + | | 12150 | | -+ /* | | 12151 | | -+ * Initalize some symbols to be zero so we can reference them in the | | 12152 | | -+ * crt0 without core dumping. These functions are all optional, but | | 12153 | | -+ * we do this so we can have our crt0 always use them if they exist. | | 12154 | | -+ * This is so BSPs work better when using the crt0 installed with gcc. | | 12155 | | -+ * We have to initalize them twice, so we multiple object file | | 12156 | | -+ * formats, as some prepend an underscore. | | 12157 | | -+ */ | | 12158 | | -+ PROVIDE (hardware_init_hook = 0); | | 12159 | | -+ PROVIDE (software_init_hook = 0); | | 12160 | | -+ PROVIDE (__mem_start = 0x100000); | | 12161 | | -+ PROVIDE (___mem_start = 0x100000); | | 12162 | | -+ SECTIONS | | 12163 | | -+ { | | 12164 | | -+ . = 0x100000; | | 12165 | | -+ .text : { | | 12166 | | -+ _ftext = . ; | | 12167 | | -+ *(.init) | | 12168 | | -+ eprol = .; | | 12169 | | -+ *(.text) | | 12170 | | -+ PROVIDE (__runtime_reloc_start = .); | | 12171 | | -+ *(.rel.sdata) | | 12172 | | -+ PROVIDE (__runtime_reloc_stop = .); | | 12173 | | -+ *(.fini) | | 12174 | | -+ __CTOR_LIST__ = .; | | 12175 | | -+ CONSTRUCTORS | | 12176 | | -+ LONG(-1) | | 12177 | | -+ *(.ctors) | | 12178 | | -+ LONG(0) | | 12179 | | -+ __CTOR_END__ = .; | | 12180 | | -+ __DTOR_LIST__ = .; | | 12181 | | -+ LONG(-1) | | 12182 | | -+ *(.dtors) | | 12183 | | -+ LONG(0) | | 12184 | | -+ __DTOR_END__ = .; | | 12185 | | -+ PROVIDE(_etext = .); | | 12186 | | -+ PROVIDE(__etext = .); | | 12187 | | -+ } | | 12188 | | -+ . = .; | | 12189 | | -+ .rdata : { | | 12190 | | -+ *(.rdata) | | 12191 | | -+ } | | 12192 | | -+ .rodata : { | | 12193 | | -+ *(.rodata) | | 12194 | | -+ } | | 12195 | | -+ .eh_frame : | | 12196 | | -+ { | | 12197 | | -+ PROVIDE (__EH_FRAME_BEGIN__ = .); | | 12198 | | -+ *(.eh_frame) | | 12199 | | -+ PROVIDE (__EH_FRAME_END__ = .); | | 12200 | | -+ } | | 12201 | | -+ _fdata = ALIGN(16); | | 12202 | | -+ .data : { | | 12203 | | -+ *(.data) | | 12204 | | -+ *(.gcc_except_table) | | 12205 | | -+ *(.gcc_exc) | | 12206 | | -+ } | | 12207 | | -+ . = ALIGN(8); | | 12208 | | -+ _gp = . + 0x8000; | | 12209 | | -+ __global = . + 0x8000; | | 12210 | | -+ .lit8 : { | | 12211 | | -+ *(.lit8) | | 12212 | | -+ } | | 12213 | | -+ .lit4 : { | | 12214 | | -+ *(.lit4) | | 12215 | | -+ } | | 12216 | | -+ .sdata : { | | 12217 | | -+ *(.sdata) | | 12218 | | -+ } | | 12219 | | -+ . = ALIGN(4); | | 12220 | | -+ PROVIDE(_edata = .); | | 12221 | | -+ PROVIDE(__edata = .); | | 12222 | | -+ fbss = .; | | 12223 | | -+ _fbss = .; | | 12224 | | -+ .sbss : { | | 12225 | | -+ PROVIDE(__bss_start = .); | | 12226 | | -+ *(.sbss) | | 12227 | | -+ *(.scommon) | | 12228 | | -+ } | | 12229 | | -+ .bss : { | | 12230 | | -+ *(.bss) | | 12231 | | -+ *(COMMON) | | 12232 | | -+ PROVIDE(__bss_end = .); | | 12233 | | -+ } | | 12234 | | -+ PROVIDE(_end = .); | | 12235 | | -+ PROVIDE(__end = .); | | 12236 | | -+ } | | 12237 | | -diff -bcrN newlib-1.15.0.org/libgloss/i386-es/libcfunc.c newlib-1.15.0/libgloss/i386-es/libcfunc.c | | 12238 | | -*** newlib-1.15.0.org/libgloss/i386-es/libcfunc.c 1970-01-01 09:00:00.000000000 +0900 | | 12239 | | ---- newlib-1.15.0/libgloss/i386-es/libcfunc.c 2007-08-09 11:22:23.000000000 +0900 | | 12240 | | -*************** | | 12241 | | -*** 0 **** | | 12242 | | ---- 1,34 ---- | | 12243 | | -+ /* Support files for GNU libc. Files in the C namespace go here. | | 12244 | | -+ Files in the system namespace (ie those that start with an underscore) | | 12245 | | -+ go in syscalls.c. | | 13448 | ++ #include <unistd.h> | | 12246 | 13449 | + | | 12247 | | -+ Note: These functions are in a seperate file so that OS providers can | | 12248 | | -+ overrride the system call stubs (defined in syscalls.c) without having | | 12249 | | -+ to provide libc funcitons as well. */ | | 13450 | ++ #include <errno.h> | | 13451 | ++ #include "es-syscall.h" | | 12250 | 13452 | + | | 12251 | | -+ #include <dirent.h> | | 12252 | | -+ #include <time.h> | | 12253 | | -+ | | 12254 | 13453 | + int __attribute__((weak)) | | 12255 | | -+ nanosleep(const struct timespec *req, struct timespec *rem) | | 13454 | ++ _unlink(const char* path) | | 12256 | 13455 | + { | | 12257 | | -+ return -1; | | 12258 | | -+ } | | 13456 | ++ void* context; | | 12259 | 13457 | + | | 12260 | | -+ int __attribute__((weak)) | | 12261 | | -+ mkdir(const char *pathname, mode_t mode) | | 12262 | | -+ { | | 12263 | | -+ return -1; | | 12264 | | -+ } | | 13458 | ++ if (!path) | | 13459 | ++ { | | 13460 | ++ errno = EFAULT; | | 13461 | ++ return -1; | | 13462 | ++ } | | 13463 | ++ if (*path == '/') | | 13464 | ++ { | | 13465 | ++ context = _es_getRoot(); | | 13466 | ++ ++path; | | 13467 | ++ } | | 13468 | ++ else | | 13469 | ++ { | | 13470 | ++ context = _es_getCurrent(); | | 13471 | ++ } | | 13472 | ++ if (!context) | | 13473 | ++ { | | 13474 | ++ errno = EACCES; | | 13475 | ++ return -1; | | 13476 | ++ } | | 12265 | 13477 | + | | 12266 | | -+ char* __attribute__((weak)) | | 12267 | | -+ getcwd(char *buf, size_t size) | | 12268 | | -+ { | | 12269 | | -+ return 0; | | 13478 | ++ int rc = (int) _es_syscall(context, 0, UNBIND, (va_list) &path); | | 13479 | ++ _es_release(context); | | 13480 | ++ return rc; | | 12270 | 13481 | + } | | 13482 | +diff -bcrN newlib-1.15.0.org/libgloss/i386-es/write.c newlib-1.15.0/libgloss/i386-es/write.c | | 13483 | +*** newlib-1.15.0.org/libgloss/i386-es/write.c 1970-01-01 09:00:00.000000000 +0900 | | 13484 | +--- newlib-1.15.0/libgloss/i386-es/write.c 2007-11-08 11:13:59.000000000 +0900 | | 13485 | +*************** | | 13486 | +*** 0 **** | | 13487 | +--- 1,28 ---- | | 13488 | ++ /* | | 13489 | ++ * Copyright (c) 2007 | | 13490 | ++ * Nintendo Co., Ltd. | | 13491 | ++ * | | 13492 | ++ * Permission to use, copy, modify, distribute and sell this software | | 13493 | ++ * and its documentation for any purpose is hereby granted without fee, | | 13494 | ++ * provided that the above copyright notice appear in all copies and | | 13495 | ++ * that both that copyright notice and this permission notice appear | | 13496 | ++ * in supporting documentation. Nintendo makes no | | 13497 | ++ * representations about the suitability of this software for any | | 13498 | ++ * purpose. It is provided "as is" without express or implied warranty. | | 13499 | ++ */ | | 12271 | 13500 | + | | 12272 | | -+ int __attribute__((weak)) | | 12273 | | -+ getdents(unsigned int fd, struct dirent *dirp, unsigned int count) | | 13501 | ++ #include <errno.h> | | 13502 | ++ #include <fcntl.h> | | 13503 | ++ #include <stdarg.h> | | 13504 | ++ #include <string.h> | | 13505 | ++ #include <stdlib.h> | | 13506 | ++ #include <sys/times.h> | | 13507 | ++ #include "es-syscall.h" | | 13508 | ++ | | 13509 | ++ // Functions that are also defined inside the kernel are declared to be weak. | | 13510 | ++ #pragma weak _write | | 13511 | ++ | | 13512 | ++ int _write(int file, const char *ptr, size_t len) | | 12274 | 13513 | + { | | 12275 | | -+ return -1; | | 13514 | ++ return (int) _es_syscall(_es_getInterfacePointer(file), 0, WRITE, (va_list) &ptr); | | 12276 | 13515 | + } | | 12277 | 13516 | diff -bcrN newlib-1.15.0.org/newlib/configure newlib-1.15.0/newlib/configure | | 12278 | 13517 | *** newlib-1.15.0.org/newlib/configure 2006-12-19 07:21:47.000000000 +0900 |
| | @@ -22529,7 +23768,7 @@ | | 22529 | 23768 | | | 22530 | 23769 | diff -bcrN newlib-1.15.0.org/newlib/configure.host newlib-1.15.0/newlib/configure.host | | 22531 | 23770 | *** newlib-1.15.0.org/newlib/configure.host 2006-12-19 06:49:14.000000000 +0900 | | 22532 | | ---- newlib-1.15.0/newlib/configure.host 2007-08-09 10:47:48.000000000 +0900 | | 23771 | +--- newlib-1.15.0/newlib/configure.host 2007-11-09 17:16:06.000000000 +0900 | | 22533 | 23772 | *************** | | 22534 | 23773 | *** 388,393 **** | | 22535 | 23774 | --- 388,400 ---- |
| | @@ -22541,7 +23780,7 @@ | | 22541 | 23780 | + posix_dir=posix | | 22542 | 23781 | + have_crt0="no" | | 22543 | 23782 | + newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS" | | 22544 | | -+ newlib_cflags="${newlib_cflags} -DHAVE_NANOSLEEP" | | 23783 | ++ newlib_cflags="${newlib_cflags} -DHAVE_NANOSLEEP -DHAVE_RENAME" | | 22545 | 23784 | + ;; | | 22546 | 23785 | i[34567]86-pc-linux-*) | | 22547 | 23786 | sys_dir=linux |
| | @@ -22653,40 +23892,21 @@ | | 22653 | 23892 | #define __DYNAMIC_REENT__ | | 22654 | 23893 | diff -bcrN newlib-1.15.0.org/newlib/libc/include/sys/features.h newlib-1.15.0/newlib/libc/include/sys/features.h | | 22655 | 23894 | *** newlib-1.15.0.org/newlib/libc/include/sys/features.h 2006-09-14 07:09:27.000000000 +0900 | | 22656 | | ---- newlib-1.15.0/newlib/libc/include/sys/features.h 2007-08-01 14:32:09.000000000 +0900 | | 23895 | +--- newlib-1.15.0/newlib/libc/include/sys/features.h 2007-11-09 13:36:10.000000000 +0900 | | 22657 | 23896 | *************** | | 22658 | 23897 | *** 94,99 **** | | 22659 | | ---- 94,103 ---- | | 22660 | | - # define _POSIX_MEMLOCK_RANGE 1 | | 23898 | +--- 94,104 ---- | | 23899 | + # define _POSIX_MEMLOCK_RANGE 1 | | 22661 | 23900 | #endif | | 22662 | 23901 | | | 22663 | 23902 | + #ifdef __es__ | | 22664 | 23903 | + # define _POSIX_THREADS 1 | | 23904 | ++ # define _POSIX_TIMERS 1 // for nanosleep() | | 22665 | 23905 | + #endif | | 22666 | 23906 | + | | 22667 | 23907 | #ifdef __cplusplus | | 22668 | 23908 | } | | 22669 | 23909 | #endif | | 22670 | | -diff -bcrN newlib-1.15.0.org/newlib/libc/machine/arm/access.c newlib-1.15.0/newlib/libc/machine/arm/access.c | | 22671 | | -*** newlib-1.15.0.org/newlib/libc/machine/arm/access.c 2004-06-10 04:05:09.000000000 +0900 | | 22672 | | ---- newlib-1.15.0/newlib/libc/machine/arm/access.c 2007-08-07 17:19:30.000000000 +0900 | | 22673 | | -*************** | | 22674 | | -*** 15,21 **** | | 22675 | | - #include <sys/stat.h> | | 22676 | | - #include <unistd.h> | | 22677 | | - | | 22678 | | -! int access(const char *fn, int flags) | | 22679 | | - { | | 22680 | | - struct stat s; | | 22681 | | - if (stat(fn, &s)) | | 22682 | | ---- 15,21 ---- | | 22683 | | - #include <sys/stat.h> | | 22684 | | - #include <unistd.h> | | 22685 | | - | | 22686 | | -! iint access(const char *fn, int flags) | | 22687 | | - { | | 22688 | | - struct stat s; | | 22689 | | - if (stat(fn, &s)) | | 22690 | 23910 | diff -bcrN newlib-1.15.0.org/newlib/libc/stdlib/__atexit.c newlib-1.15.0/newlib/libc/stdlib/__atexit.c | | 22691 | 23911 | *** newlib-1.15.0.org/newlib/libc/stdlib/__atexit.c 2006-03-21 09:57:34.000000000 +0900 | | 22692 | 23912 | --- newlib-1.15.0/newlib/libc/stdlib/__atexit.c 2007-07-30 17:22:19.000000000 +0900 |
| | @@ -32397,7 +33617,7 @@ | | 32397 | 33617 | linux) AC_CONFIG_SUBDIRS(linux) ;; | | 32398 | 33618 | diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/Makefile.am newlib-1.15.0/newlib/libc/sys/es/Makefile.am | | 32399 | 33619 | *** newlib-1.15.0.org/newlib/libc/sys/es/Makefile.am 1970-01-01 09:00:00.000000000 +0900 | | 32400 | | ---- newlib-1.15.0/newlib/libc/sys/es/Makefile.am 2007-08-07 17:17:15.000000000 +0900 | | 33620 | +--- newlib-1.15.0/newlib/libc/sys/es/Makefile.am 2007-11-09 17:01:49.000000000 +0900 | | 32401 | 33621 | *************** | | 32402 | 33622 | *** 0 **** | | 32403 | 33623 | --- 1,16 ---- |
| | @@ -32411,7 +33631,7 @@ | | 32411 | 33631 | + | | 32412 | 33632 | + noinst_LIBRARIES = lib.a | | 32413 | 33633 | + | | 32414 | | -+ lib_a_SOURCES = getreent.c access.c | | 33634 | ++ lib_a_SOURCES = getreent.c syslink.c linkr.c | | 32415 | 33635 | + lib_a_CCASFLAGS = $(AM_CCASFLAGS) | | 32416 | 33636 | + lib_a_CFLAGS = $(AM_CFLAGS) | | 32417 | 33637 | + |
| | @@ -32419,10 +33639,10 @@ | | 32419 | 33639 | + CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host | | 32420 | 33640 | diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/Makefile.in newlib-1.15.0/newlib/libc/sys/es/Makefile.in | | 32421 | 33641 | *** newlib-1.15.0.org/newlib/libc/sys/es/Makefile.in 1970-01-01 09:00:00.000000000 +0900 | | 32422 | | ---- newlib-1.15.0/newlib/libc/sys/es/Makefile.in 2007-08-09 10:17:39.000000000 +0900 | | 33642 | +--- newlib-1.15.0/newlib/libc/sys/es/Makefile.in 2007-11-16 15:25:43.000000000 +0900 | | 32423 | 33643 | *************** | | 32424 | 33644 | *** 0 **** | | 32425 | | ---- 1,392 ---- | | 33645 | +--- 1,399 ---- | | 32426 | 33646 | + # Makefile.in generated by automake 1.10 from Makefile.am. | | 32427 | 33647 | + # @configure_input@ | | 32428 | 33648 | + |
| | @@ -32474,7 +33694,8 @@ | | 32474 | 33694 | + ARFLAGS = cru | | 32475 | 33695 | + lib_a_AR = $(AR) $(ARFLAGS) | | 32476 | 33696 | + lib_a_LIBADD = | | 32477 | | -+ am_lib_a_OBJECTS = lib_a-getreent.$(OBJEXT) lib_a-access.$(OBJEXT) | | 33697 | ++ am_lib_a_OBJECTS = lib_a-getreent.$(OBJEXT) lib_a-syslink.$(OBJEXT) \ | | 33698 | ++ lib_a-linkr.$(OBJEXT) | | 32478 | 33699 | + lib_a_OBJECTS = $(am_lib_a_OBJECTS) | | 32479 | 33700 | + DEFAULT_INCLUDES = -I.@am__isrc@ | | 32480 | 33701 | + depcomp = |
| | @@ -32590,7 +33811,7 @@ | | 32590 | 33811 | + INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) | | 32591 | 33812 | + AM_CCASFLAGS = $(INCLUDES) | | 32592 | 33813 | + noinst_LIBRARIES = lib.a | | 32593 | | -+ lib_a_SOURCES = getreent.c access.c | | 33814 | ++ lib_a_SOURCES = getreent.c syslink.c linkr.c | | 32594 | 33815 | + lib_a_CCASFLAGS = $(AM_CCASFLAGS) | | 32595 | 33816 | + lib_a_CFLAGS = $(AM_CFLAGS) | | 32596 | 33817 | + ACLOCAL_AMFLAGS = -I ../../.. |
| | @@ -32658,12 +33879,18 @@ | | 32658 | 33879 | + lib_a-getreent.obj: getreent.c | | 32659 | 33880 | + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getreent.obj `if test -f 'getreent.c'; then $(CYGPATH_W) 'getreent.c'; else $(CYGPATH_W) '$(srcdir)/getreent.c'; fi` | | 32660 | 33881 | + | | 32661 | | -+ lib_a-access.o: access.c | | 32662 | | -+ $(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 | | 33882 | ++ lib_a-syslink.o: syslink.c | | 33883 | ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-syslink.o `test -f 'syslink.c' || echo '$(srcdir)/'`syslink.c | | 32663 | 33884 | + | | 32664 | | -+ lib_a-access.obj: access.c | | 32665 | | -+ $(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` | | 33885 | ++ lib_a-syslink.obj: syslink.c | | 33886 | ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-syslink.obj `if test -f 'syslink.c'; then $(CYGPATH_W) 'syslink.c'; else $(CYGPATH_W) '$(srcdir)/syslink.c'; fi` | | 32666 | 33887 | + | | 33888 | ++ lib_a-linkr.o: linkr.c | | 33889 | ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linkr.o `test -f 'linkr.c' || echo '$(srcdir)/'`linkr.c | | 33890 | ++ | | 33891 | ++ lib_a-linkr.obj: linkr.c | | 33892 | ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linkr.obj `if test -f 'linkr.c'; then $(CYGPATH_W) 'linkr.c'; else $(CYGPATH_W) '$(srcdir)/linkr.c'; fi` | | 33893 | ++ | | 32667 | 33894 | + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | | 32668 | 33895 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | | 32669 | 33896 | + unique=`for i in $$list; do \ |
| | @@ -32815,44 +34042,6 @@ | | 32815 | 34042 | + # Tell versions [3.59,3.63) of GNU make to not export all variables. | | 32816 | 34043 | + # Otherwise a system limit (for SysV at least) may be exceeded. | | 32817 | 34044 | + .NOEXPORT: | | 32818 | | -diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/access.c newlib-1.15.0/newlib/libc/sys/es/access.c | | 32819 | | -*** newlib-1.15.0.org/newlib/libc/sys/es/access.c 1970-01-01 09:00:00.000000000 +0900 | | 32820 | | ---- newlib-1.15.0/newlib/libc/sys/es/access.c 2007-08-07 17:32:24.000000000 +0900 | | 32821 | | -*************** | | 32822 | | -*** 0 **** | | 32823 | | ---- 1,32 ---- | | 32824 | | -+ /* This is file ACCESS.C */ | | 32825 | | -+ /* | | 32826 | | -+ * Copyright (C) 1993 DJ Delorie | | 32827 | | -+ * All rights reserved. | | 32828 | | -+ * | | 32829 | | -+ * Redistribution and use in source and binary forms is permitted | | 32830 | | -+ * provided that the above copyright notice and following paragraph are | | 32831 | | -+ * duplicated in all such forms. | | 32832 | | -+ * | | 32833 | | -+ * This file is distributed WITHOUT ANY WARRANTY; without even the implied | | 32834 | | -+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | 32835 | | -+ */ | | 32836 | | -+ | | 32837 | | -+ #include <fcntl.h> | | 32838 | | -+ #include <sys/stat.h> | | 32839 | | -+ #include <unistd.h> | | 32840 | | -+ | | 32841 | | -+ int access(const char *fn, int flags) | | 32842 | | -+ { | | 32843 | | -+ struct stat s; | | 32844 | | -+ if (stat(fn, &s)) | | 32845 | | -+ return -1; | | 32846 | | -+ if (s.st_mode & S_IFDIR) | | 32847 | | -+ return 0; | | 32848 | | -+ if (flags & W_OK) | | 32849 | | -+ { | | 32850 | | -+ if (s.st_mode & S_IWRITE) | | 32851 | | -+ return 0; | | 32852 | | -+ return -1; | | 32853 | | -+ } | | 32854 | | -+ return 0; | | 32855 | | -+ } | | 32856 | 34045 | diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/aclocal.m4 newlib-1.15.0/newlib/libc/sys/es/aclocal.m4 | | 32857 | 34046 | *** newlib-1.15.0.org/newlib/libc/sys/es/aclocal.m4 1970-01-01 09:00:00.000000000 +0900 | | 32858 | 34047 | --- newlib-1.15.0/newlib/libc/sys/es/aclocal.m4 2007-07-30 16:59:23.000000000 +0900 |
| | @@ -33753,7 +34942,7 @@ | | 33753 | 34942 | + m4_include([../../../acinclude.m4]) | | 33754 | 34943 | diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/configure newlib-1.15.0/newlib/libc/sys/es/configure | | 33755 | 34944 | *** newlib-1.15.0.org/newlib/libc/sys/es/configure 1970-01-01 09:00:00.000000000 +0900 | | 33756 | | ---- newlib-1.15.0/newlib/libc/sys/es/configure 2007-08-07 17:19:44.000000000 +0900 | | 34945 | +--- newlib-1.15.0/newlib/libc/sys/es/configure 2007-11-07 16:08:35.000000000 +0900 | | 33757 | 34946 | *************** | | 33758 | 34947 | *** 0 **** | | 33759 | 34948 | --- 1,4816 ---- |
| | @@ -38611,6 +39800,16 @@ | | 38611 | 39800 | + { | | 38612 | 39801 | + return &impure_data; | | 38613 | 39802 | + } | | 39803 | +diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/linkr.c newlib-1.15.0/newlib/libc/sys/es/linkr.c | | 39804 | +*** newlib-1.15.0.org/newlib/libc/sys/es/linkr.c 1970-01-01 09:00:00.000000000 +0900 | | 39805 | +--- newlib-1.15.0/newlib/libc/sys/es/linkr.c 2007-11-09 17:01:37.000000000 +0900 | | 39806 | +*************** | | 39807 | +*** 0 **** | | 39808 | +--- 1,4 ---- | | 39809 | ++ /* Reentrant versions of file system calls. These implementations | | 39810 | ++ just call the usual system calls. */ | | 39811 | ++ | | 39812 | ++ /* es does not support link() */ | | 38614 | 39813 | diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/sys/dirent.h newlib-1.15.0/newlib/libc/sys/es/sys/dirent.h | | 38615 | 39814 | *** newlib-1.15.0.org/newlib/libc/sys/es/sys/dirent.h 1970-01-01 09:00:00.000000000 +0900 | | 38616 | 39815 | --- newlib-1.15.0/newlib/libc/sys/es/sys/dirent.h 2007-08-09 09:38:42.000000000 +0900 |
| | @@ -38705,6 +39904,15 @@ | | 38705 | 39904 | + #endif | | 38706 | 39905 | + | | 38707 | 39906 | + #endif /* __SYS_LOCK_H__ */ | | 39907 | +diff -bcrN newlib-1.15.0.org/newlib/libc/sys/es/syslink.c newlib-1.15.0/newlib/libc/sys/es/syslink.c | | 39908 | +*** newlib-1.15.0.org/newlib/libc/sys/es/syslink.c 1970-01-01 09:00:00.000000000 +0900 | | 39909 | +--- newlib-1.15.0/newlib/libc/sys/es/syslink.c 2007-11-09 16:51:45.000000000 +0900 | | 39910 | +*************** | | 39911 | +*** 0 **** | | 39912 | +--- 1,3 ---- | | 39913 | ++ /* connector for link */ | | 39914 | ++ | | 39915 | ++ /* es does not support link() */ | | 38708 | 39916 | diff -bcrN newlib-1.15.0.org/newlib/libc/syscalls/syslink.c newlib-1.15.0/newlib/libc/syscalls/syslink.c | | 38709 | 39917 | *** newlib-1.15.0.org/newlib/libc/syscalls/syslink.c 2003-06-04 04:48:08.000000000 +0900 | | 38710 | 39918 | --- newlib-1.15.0/newlib/libc/syscalls/syslink.c 2007-08-01 15:42:22.000000000 +0900 |
旧リポジトリブラウザで表示
|