diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-03-13 17:22:36 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-03-28 23:17:06 -0400 |
commit | be9c0561e7da91b2d5c589a43f9c0fea1e684f2d (patch) | |
tree | 069cb1ce6dc67bc2847e747942c0ee3867694d35 /newlib/libc | |
parent | 761ef3b434b5eb7f321e58c3fae1f578f5c34999 (diff) | |
download | newlib-be9c0561e7da91b2d5c589a43f9c0fea1e684f2d.zip newlib-be9c0561e7da91b2d5c589a43f9c0fea1e684f2d.tar.gz newlib-be9c0561e7da91b2d5c589a43f9c0fea1e684f2d.tar.bz2 |
newlib: drop phoenix support
This code has not been updated since 2016, and it looks like it has
rotted quite a bit since. It does not build against the current set
of phoenix sources -- I had to hack both the kernel headers and the
newlib headers up to get it to build, and I still have no idea if it
actually links or runs. It seems like the project itself has moved
away from newlib and to its own C library:
https://phoenix-rtos.com/documentation/libc/README.md
So since there's no interest from the phoenix folks to maintain this,
and it has a significant amount of non-standard code that we try to
keep up-to-date (without actually testing it), just punt it all.
Diffstat (limited to 'newlib/libc')
133 files changed, 0 insertions, 9950 deletions
diff --git a/newlib/libc/acinclude.m4 b/newlib/libc/acinclude.m4 index 5629f9e..7cba7db 100644 --- a/newlib/libc/acinclude.m4 +++ b/newlib/libc/acinclude.m4 @@ -19,7 +19,6 @@ m4_foreach_w([SYS_DIR], [ m88kbug mmixware netware or1k - phoenix rdos rtems sh sysmec sysnec810 sysnecv850 sysvi386 sysvnecv70 tic80 tirtos @@ -39,7 +38,6 @@ m4_include([libc/machine/nds32/acinclude.m4]) m4_include([libc/machine/powerpc/acinclude.m4]) m4_include([libc/machine/sh/acinclude.m4]) m4_include([libc/machine/spu/acinclude.m4]) -m4_include([libc/sys/phoenix/acinclude.m4]) m4_foreach_w([MACHINE], [ aarch64 amdgcn arc arm diff --git a/newlib/libc/sys/Makefile.inc b/newlib/libc/sys/Makefile.inc index 69a59d4..9f87589 100644 --- a/newlib/libc/sys/Makefile.inc +++ b/newlib/libc/sys/Makefile.inc @@ -31,9 +31,6 @@ endif if HAVE_LIBC_SYS_OR1K_DIR include %D%/or1k/Makefile.inc endif -if HAVE_LIBC_SYS_PHOENIX_DIR -include %D%/phoenix/Makefile.inc -endif if HAVE_LIBC_SYS_RDOS_DIR include %D%/rdos/Makefile.inc endif diff --git a/newlib/libc/sys/phoenix/Makefile.inc b/newlib/libc/sys/phoenix/Makefile.inc deleted file mode 100644 index 9c97751..0000000 --- a/newlib/libc/sys/phoenix/Makefile.inc +++ /dev/null @@ -1,105 +0,0 @@ -libc_a_SOURCES += \ - %D%/net/domainname.c \ - %D%/net/freeaddrinfo.c \ - %D%/net/getaddrinfo.c \ - %D%/net/gethostbyaddr.c \ - %D%/net/gethostbyname.c \ - %D%/net/getnameinfo.c \ - %D%/net/getservbyname.c \ - %D%/net/getservbyport.c \ - %D%/net/herror.c \ - %D%/net/hostname.c \ - %D%/net/inet_addr.c \ - %D%/net/inet_aton.c \ - %D%/net/inet_lnaof.c \ - %D%/net/inet_makeaddr.c \ - %D%/net/inet_net_ntop.c \ - %D%/net/inet_net_pton.c \ - %D%/net/inet_netof.c \ - %D%/net/inet_network.c \ - %D%/net/inet_ntoa.c \ - %D%/net/inet_ntop.c \ - %D%/net/inet_pton.c \ - %D%/net/nametoindex.c \ - %D%/net/network.c \ - %D%/alarm.c \ - %D%/chmod.c \ - %D%/chown.c \ - %D%/clocks.c \ - %D%/dup.c \ - %D%/endmntent.c \ - %D%/exec.c \ - %D%/fcntl.c \ - %D%/fork.c \ - %D%/fs.c \ - %D%/getentropy.c \ - %D%/getmntent.c \ - %D%/getpagesize.c \ - %D%/groups.c \ - %D%/ids.c \ - %D%/io.c \ - %D%/ioctl.c \ - %D%/mmap.c \ - %D%/mount.c \ - %D%/nanosleep.c \ - %D%/phoenix.c \ - %D%/pid.c \ - %D%/pipe.c \ - %D%/poll.c \ - %D%/realpath.c \ - %D%/reboot.c \ - %D%/resource.c \ - %D%/sbrk.c \ - %D%/sched.c \ - %D%/select.c \ - %D%/semaphore.c \ - %D%/setmntent.c \ - %D%/shm.c \ - %D%/signal.c \ - %D%/socket.c \ - %D%/sockopt.c \ - %D%/stat.c \ - %D%/statfs.c \ - %D%/symlink.c \ - %D%/sync.c \ - %D%/sysconf.c \ - %D%/syslog.c \ - %D%/time.c \ - %D%/truncate.c \ - %D%/tty.c \ - %D%/uname.c \ - %D%/utime.c \ - %D%/wait.c - -libc_a_CPPFLAGS_%C%_net = -I$(srcdir)/%D% - -%D%/crt0.o: %D%/$(PHOENIX_MACHINE_DIR)/crt0.o - $(AM_V_at)rm -f $@ - $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@ - -INSTALL_DATA_LOCAL += install-data-local-%C% -install-data-local-%C%: - $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \ - for i in $(srcdir)/%D%/include/arpa/*.h; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \ - done; \ - $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \ - for i in $(srcdir)/%D%/include/net/*.h; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \ - done; \ - $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \ - for i in $(srcdir)/%D%/include/netinet/*.h; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \ - done; \ - $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \ - for i in $(srcdir)/%D%/include/netinet6/*.h; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \ - done; \ - $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netpacket; \ - for i in $(srcdir)/%D%/include/netpacket/*.h; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netpacket/`basename $$i`; \ - done; - -if HAVE_LIBC_SYS_PHOENIX_ARM_DIR -include %D%/machine/arm/Makefile.inc -endif diff --git a/newlib/libc/sys/phoenix/acinclude.m4 b/newlib/libc/sys/phoenix/acinclude.m4 deleted file mode 100644 index 1bbc7cf..0000000 --- a/newlib/libc/sys/phoenix/acinclude.m4 +++ /dev/null @@ -1,8 +0,0 @@ -AS_IF([test "$sys_dir" = "phoenix"], [dnl - PHOENIX_MACHINE_DIR=machine/${machine_dir} -]) -AC_SUBST(PHOENIX_MACHINE_DIR) - -m4_foreach_w([MACHINE], [ - arm -], [AM_CONDITIONAL([HAVE_LIBC_SYS_PHOENIX_]m4_toupper(MACHINE)[_DIR], test "${machine_dir}" = MACHINE)]) diff --git a/newlib/libc/sys/phoenix/alarm.c b/newlib/libc/sys/phoenix/alarm.c deleted file mode 100644 index 8a5f0ac..0000000 --- a/newlib/libc/sys/phoenix/alarm.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -unsigned int alarm(unsigned int seconds) -{ - /* TODO: implement. */ - return 0; -} diff --git a/newlib/libc/sys/phoenix/bits/posix_opt.h b/newlib/libc/sys/phoenix/bits/posix_opt.h deleted file mode 100644 index da412d0..0000000 --- a/newlib/libc/sys/phoenix/bits/posix_opt.h +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _POSIX_OPT_H -#define _POSIX_OPT_H - -/* Job control is supported. */ -#define _POSIX_JOB_CONTROL 1 - -/* Processes have a saved set-user-ID and a saved set-group-ID. */ -#define _POSIX_SAVED_IDS 1 - -/* Priority scheduling is supported. */ -#define _POSIX_PRIORITY_SCHEDULING 1 - -/* Synchronizing file data is supported. */ -#define _POSIX_SYNCHRONIZED_IO 1 - -/* The fsync function is present. */ -#define _POSIX_FSYNC 1 - -/* Mapping of files to memory is supported. */ -#define _POSIX_MAPPED_FILES 1 - -/* Locking of all memory is supported. */ -#define _POSIX_MEMLOCK 1 - -/* Locking of ranges of memory is supported. */ -#define _POSIX_MEMLOCK_RANGE 1 - -/* Setting of memory protections is supported. */ -#define _POSIX_MEMORY_PROTECTION 1 - -/* Implementation supports `poll' function. */ -#define _POSIX_POLL 1 - -/* Implementation supports `select' and `pselect' functions. */ -#define _POSIX_SELECT 1 - -/* Only root can change owner of file. */ -#define _POSIX_CHOWN_RESTRICTED 1 - -/* `c_cc' member of 'struct termios' structure can be disabled by - using the value _POSIX_VDISABLE. */ -#define _POSIX_VDISABLE '\0' - -/* Filenames are not silently truncated. */ -#define _POSIX_NO_TRUNC 1 - -/* X/Open realtime support is available. */ -#define _XOPEN_REALTIME 1 - -/* X/Open realtime thread support is available. */ -#define _XOPEN_REALTIME_THREADS 1 - -/* XPG4.2 shared memory is supported. */ -#define _XOPEN_SHM 1 - -/* Tell we don't have POSIX threads. */ -#undef _POSIX_THREADS - -/* We have the reentrant functions described in POSIX. */ -#define _POSIX_REENTRANT_FUNCTIONS 1 -#define _POSIX_THREAD_SAFE_FUNCTIONS 1 - -/* We provide priority scheduling for threads. */ -#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 - -/* We support user-defined stack sizes. */ -#define _POSIX_THREAD_ATTR_STACKSIZE 1 - -/* We support user-defined stacks. */ -#define _POSIX_THREAD_ATTR_STACKADDR 1 - -/* We support POSIX.1b semaphores, but only the non-shared form for now. */ -#define _POSIX_SEMAPHORES 1 - -/* Real-time signals are supported. */ -#define _POSIX_REALTIME_SIGNALS 1 - -/* We support asynchronous I/O. */ -#define _POSIX_ASYNCHRONOUS_IO 1 -#define _POSIX_ASYNC_IO 1 -/* Alternative name for Unix98. */ -#define _LFS_ASYNCHRONOUS_IO 1 - -/* The LFS support in asynchronous I/O is also available. */ -#define _LFS64_ASYNCHRONOUS_IO 1 - -/* The rest of the LFS is also available. */ -#define _LFS_LARGEFILE 1 -#define _LFS64_LARGEFILE 1 -#define _LFS64_STDIO 1 - -/* POSIX shared memory objects are implemented. */ -#define _POSIX_SHARED_MEMORY_OBJECTS 1 - -/* GNU libc provides regular expression handling. */ -#define _POSIX_REGEXP 1 - -/* Reader/Writer locks are available. */ -#define _POSIX_READER_WRITER_LOCKS 200912L - -/* We have a POSIX shell. */ -#define _POSIX_SHELL 1 - -/* We support the Timeouts option. */ -#define _POSIX_TIMEOUTS 200912L - -/* We support spinlocks. */ -#define _POSIX_SPIN_LOCKS 200912L - -/* The `spawn' function family is supported. */ -#define _POSIX_SPAWN 200912L - -/* We don't have POSIX timers. */ -#undef _POSIX_TIMERS - -/* The barrier functions are available. */ -#define _POSIX_BARRIERS 200912L - -/* POSIX message queues are not yet supported. */ -#undef _POSIX_MESSAGE_PASSING - -#endif diff --git a/newlib/libc/sys/phoenix/chmod.c b/newlib/libc/sys/phoenix/chmod.c deleted file mode 100644 index fea2290..0000000 --- a/newlib/libc/sys/phoenix/chmod.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/types.h> - -int chmod(const char *pathname, mode_t mode) -{ - int ret = syscall2(int, SYS_CHMOD, pathname, mode); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int fchmod(int fd, mode_t mode) -{ - int ret = syscall2(int, SYS_FCHMOD, fd, mode); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/chown.c b/newlib/libc/sys/phoenix/chown.c deleted file mode 100644 index c2cea2c..0000000 --- a/newlib/libc/sys/phoenix/chown.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/types.h> - -int chown(const char *pathname, uid_t owner, gid_t group) -{ - int ret = syscall3(int, SYS_CHOWN, pathname, (unsigned int) owner, (unsigned int) group); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int fchown(int fd, uid_t owner, gid_t group) -{ - int ret = syscall3(int, SYS_FCHOWN, fd, (unsigned int) owner, (unsigned int) group); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int lchown(const char *pathname, uid_t owner, gid_t group) -{ - int ret = syscall3(int, SYS_LCHOWN, pathname, (unsigned int) owner, (unsigned int) group); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/clocks.c b/newlib/libc/sys/phoenix/clocks.c deleted file mode 100644 index 78700cf..0000000 --- a/newlib/libc/sys/phoenix/clocks.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <time.h> - -int clock_gettime(clockid_t clock_id, struct timespec *tp) -{ - int ret = syscall2(int, SYS_CLOCK_GETTIME, clock_id, tp); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int clock_settime(clockid_t clock_id, const struct timespec *tp) -{ - int ret = syscall2(int, SYS_CLOCK_SETTIME, clock_id, tp); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/dup.c b/newlib/libc/sys/phoenix/dup.c deleted file mode 100644 index f355463..0000000 --- a/newlib/libc/sys/phoenix/dup.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <fcntl.h> - -int dup(int oldfd) -{ - int ret = fcntl(oldfd, F_DUPFD, 0); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int dup2(int oldfd, int newfd) -{ - int ret = syscall2(int, SYS_DUP2, oldfd, newfd); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/endmntent.c b/newlib/libc/sys/phoenix/endmntent.c deleted file mode 100644 index ada7607..0000000 --- a/newlib/libc/sys/phoenix/endmntent.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <stdio.h> - -int endmntent(FILE *fp) -{ - fclose(fp); - return 1; -} diff --git a/newlib/libc/sys/phoenix/exec.c b/newlib/libc/sys/phoenix/exec.c deleted file mode 100644 index 341ef97..0000000 --- a/newlib/libc/sys/phoenix/exec.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <stdio.h> - -int execve(const char *filename, char *const argv[], char *const envp[]) -{ - int ret = syscall3(int, SYS_EXECVE, filename, argv, envp); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int _execve(const char *filename, char *const argv[], char *const envp[]) -{ - return execve(filename, argv, envp); -} - -void exit(int status) -{ - fflush(NULL); - syscall1(int, SYS_EXIT, status); -} - -void _exit(int status) -{ - exit(status); -} diff --git a/newlib/libc/sys/phoenix/fcntl.c b/newlib/libc/sys/phoenix/fcntl.c deleted file mode 100644 index d897065..0000000 --- a/newlib/libc/sys/phoenix/fcntl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <fcntl.h> -#include <stdarg.h> - -int fcntl( int fd , int cmd, ...) -{ - int arg = 0; - if ((cmd == F_DUPFD) || (cmd == F_SETFD) || (cmd == F_SETFL)) { - va_list args; - va_start(args, cmd); - arg = va_arg(args, int); - va_end(args); - } - - int ret = syscall3(int, SYS_FCNTL, fd, cmd, arg); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/fork.c b/newlib/libc/sys/phoenix/fork.c deleted file mode 100644 index 7e8d591..0000000 --- a/newlib/libc/sys/phoenix/fork.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <unistd.h> - -pid_t fork() -{ - int ret = syscall3(int, SYS_FORK, 0x10, 0x20, 0x30); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -pid_t vfork() -{ - return fork(); -} - -int daemon(int nochdir, int noclose) -{ - switch(fork()) { - case -1: - return -1; - case 0: - break; - default: - exit(0); - } - - if (setsid() == -1) - return -1; - - if (nochdir == 0) - chdir("/"); - - if (noclose == 0) - freopen("/dev/null", "a+", stdout); - - return 0; -} diff --git a/newlib/libc/sys/phoenix/fs.c b/newlib/libc/sys/phoenix/fs.c deleted file mode 100644 index bde35e1..0000000 --- a/newlib/libc/sys/phoenix/fs.c +++ /dev/null @@ -1,130 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <fcntl.h> -#include <malloc.h> -#include <stdio.h> -#include <sys/dirent.h> -#include <sys/stat.h> - -#define MAX_PATH 1024 - -int mkdir(const char *pathname, mode_t mode) -{ - int ret = syscall2(int, SYS_MKDIR, pathname, mode); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int rmdir(const char *pathname) -{ - int ret = syscall1(int, SYS_RMDIR, pathname); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int chdir(const char *path) -{ - int ret = syscall1(int, SYS_SETCWD, path); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -char *getcwd(char *buf, size_t size) -{ - if (buf == NULL) - buf = (char *) malloc(MAX_PATH); - - int ret = syscall2(int, SYS_GETCWD, buf, size); - if (ret < 0) { - errno = -ret; - return NULL; - } - - return buf; -} - -int unlink(const char *pathname) -{ - int ret = syscall1(int, SYS_UNLINK, pathname); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int mkfifo(const char *pathname, mode_t mode) -{ - int ret = syscall3(int, SYS_OPEN, pathname, O_CREAT, (mode | S_IFIFO)); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int mknod(const char *pathname, mode_t mode, dev_t dev) -{ - int ret = syscall3(int, SYS_MKNOD, pathname, mode, dev); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int getdents(unsigned int fd, struct dirent *dirp, unsigned int count) -{ - int ret = syscall3(int, SYS_GETDENTS, fd, dirp, count); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int chroot(const char *path) -{ - return chdir(path); -} diff --git a/newlib/libc/sys/phoenix/getentropy.c b/newlib/libc/sys/phoenix/getentropy.c deleted file mode 100644 index 097fb90..0000000 --- a/newlib/libc/sys/phoenix/getentropy.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <fcntl.h> -#include <sys/types.h> -#include <unistd.h> - -#define DEV_RANDOM "/dev/random" -#define MAX_ENTROPY 256 - -int getentropy(void *buf, size_t buflen) -{ - if (buflen > MAX_ENTROPY) { - errno = -EIO; - return -1; - } - - int ret = -1; - int fd = open(DEV_RANDOM, O_RDONLY); - if (fd >= 0) { - ret = read(fd, buf, buflen); - close(fd); - } - - return (ret > 0) ? 0 : -1; -} diff --git a/newlib/libc/sys/phoenix/getmntent.c b/newlib/libc/sys/phoenix/getmntent.c deleted file mode 100644 index e61d245..0000000 --- a/newlib/libc/sys/phoenix/getmntent.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <mntent.h> -#include <malloc.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define COLUMN_FS_NAME 0 -#define COLUMN_MOUNTPOINT 1 -#define COLUMN_FS_TYPE 2 -#define COLUMN_OPTS 3 -#define COLUMN_DUMP_FREQ 4 -#define COLUMN_PASSNO 5 - -#define BUFFER_SIZE 4096 - -struct mntent *getmntent_r(FILE *fp, struct mntent *result, char *buffer, int bufsize) -{ - char *token, *buff_ptr; - char *line = NULL; - size_t size = 0; - int i; - - buff_ptr = buffer; - - if (getline(&line, &size, fp) == -1 || feof(fp)) { - free(line); - return NULL; - } - - for (token = strtok(line, " "), i = 0; token != NULL; token = strtok(NULL, " "), ++i) { - if (((buff_ptr + strlen(token) + 1) - buffer) > bufsize) { - errno = ENOBUFS; - free(line); - return NULL; - } - - switch (i) { - case COLUMN_FS_NAME: - result->mnt_fsname = strcpy(buff_ptr, token); - break; - case COLUMN_MOUNTPOINT: - result->mnt_dir = strcpy(buff_ptr, token); - break; - case COLUMN_FS_TYPE: - result->mnt_type = strcpy(buff_ptr, token); - break; - case COLUMN_OPTS: - result->mnt_opts = strcpy(buff_ptr, token); - break; - case COLUMN_DUMP_FREQ: - result->mnt_freq = atoi(token); - break; - case COLUMN_PASSNO: - result->mnt_passno = atoi(token); - break; - default: - free(line); - return NULL; - } - - buff_ptr += strlen(token) + 1; - } - - free(line); - return result; -} - -struct mntent *getmntent(FILE *fp) -{ - static struct mntent result; - static char buffer[BUFFER_SIZE]; - memset(&result, 0, sizeof(struct mntent)); - memset(buffer, 0, sizeof(buffer)); - - return getmntent_r(fp, &result, buffer, sizeof(buffer)); -} diff --git a/newlib/libc/sys/phoenix/getpagesize.c b/newlib/libc/sys/phoenix/getpagesize.c deleted file mode 100644 index 3b39422..0000000 --- a/newlib/libc/sys/phoenix/getpagesize.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#define PHOENIX_PAGESIZE 0x1000 - -int getpagesize() -{ - /* TODO: consider making it a syscall. */ - return PHOENIX_PAGESIZE; -} diff --git a/newlib/libc/sys/phoenix/groups.c b/newlib/libc/sys/phoenix/groups.c deleted file mode 100644 index b231475..0000000 --- a/newlib/libc/sys/phoenix/groups.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - - #include "syscall.h" - - #include <errno.h> - #include <stdio.h> - #include <sys/types.h> - -int initgroups(const char *user, gid_t group) -{ - /* TODO: implement. */ - if(user == NULL) { - errno = EINVAL; - return -1; - } - - return 0; -} - -int getgroups(int size, gid_t list[]) -{ - int ret = syscall2(int, SYS_GETGROUPS, size, list); - if(ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int setgroups(size_t size, const gid_t *list) -{ - int ret = syscall2(int, SYS_SETGROUPS, size, list); - if(ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -struct group *getgrent() -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} - -void setgrent() -{ - /* TODO: implement. */ -} - -void endgrent() -{ - /* TODO: implement. */ -} - -struct group *getgrnam(const char *name) -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} - -struct group *getgrgid(gid_t gid) -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} - -int setpgrp(pid_t pid, pid_t pgid) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/phoenix/ids.c b/newlib/libc/sys/phoenix/ids.c deleted file mode 100644 index 7f88edf..0000000 --- a/newlib/libc/sys/phoenix/ids.c +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/types.h> -#include <unistd.h> - -uid_t getuid() -{ - return syscall0(int, SYS_GETUID); -} - -uid_t geteuid() -{ - return syscall0(int, SYS_GETEUID); -} - -int setuid(uid_t uid) -{ - int ret = syscall1(int, SYS_SETUID, (unsigned int) uid); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int seteuid(uid_t euid) -{ - int ret = syscall1(int, SYS_SETEUID, (unsigned int) euid); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int setreuid(uid_t ruid, uid_t euid) -{ - int ret = syscall2(int, SYS_SETREUID, (unsigned int) ruid, (unsigned int) euid); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -gid_t getgid() -{ - return syscall0(int, SYS_GETGID); -} - -gid_t getegid() -{ - return syscall0(int, SYS_GETEGID); -} - -int setgid(gid_t gid) -{ - int ret = syscall2(int, SYS_SETGID, (unsigned int) gid, 0); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int setegid(gid_t egid) -{ - int ret = syscall1(int, SYS_SETEGID, (unsigned int) egid); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int setregid(gid_t rgid, gid_t egid) -{ - int ret = syscall2(int, SYS_SETREGID, (unsigned int) rgid, (unsigned int) egid); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int setpgid(pid_t pid, pid_t pgid) -{ - int ret = syscall2(int, SYS_SETGID, pgid, pid); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -pid_t getsid(pid_t pid) -{ - errno = ENOSYS; - return -1; -} - -pid_t setsid() -{ - return getpid(); -} diff --git a/newlib/libc/sys/phoenix/include/arpa/inet.h b/newlib/libc/sys/phoenix/include/arpa/inet.h deleted file mode 100644 index 8b76fc0..0000000 --- a/newlib/libc/sys/phoenix/include/arpa/inet.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _ARPA_INET_H -#define _ARPA_INET_H - -#include <netinet/in.h> -#include <phoenix/socket.h> -#include <stdint.h> - -#define INET_ADDRSTRLEN 16 -#define INET6_ADDRSTRLEN 46 - -int inet_aton(const char *cp, struct in_addr *inp); -in_addr_t inet_addr(const char *cp); -in_addr_t inet_network(const char *cp); -char *inet_ntoa(struct in_addr in); -struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host); -in_addr_t inet_lnaof(struct in_addr in); -in_addr_t inet_netof(struct in_addr in); -const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); -int inet_pton(int af, const char *src, void *dst); -int inet_net_pton(int af, const char *pres, void *netp, size_t nsize); -char *inet_net_ntop(int af, const void *netp, int bits, char *pres, size_t psize); - -#endif diff --git a/newlib/libc/sys/phoenix/include/arpa/nameser.h b/newlib/libc/sys/phoenix/include/arpa/nameser.h deleted file mode 100644 index bf542d9..0000000 --- a/newlib/libc/sys/phoenix/include/arpa/nameser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _ARPA_NAMESER_H -#define _ARPA_NAMESER_H - -/* Define constants based on RFC 883, RFC 1034, RFC 1035 */ -#define NS_PACKETSZ 512 /* Maximum packet size */ -#define NS_MAXDNAME 1025 /* Maximum domain name */ -#define NS_MAXCDNAME 255 /* Maximum compressed domain name */ -#define NS_MAXLABEL 63 /* Maximum length of domain label */ -#define NS_HFIXEDSZ 12 /* Bytes of fixed data in header */ -#define NS_QFIXEDSZ 4 /* Bytes of fixed data in query */ -#define NS_RRFIXEDSZ 10 /* Bytes of fixed data in r record */ -#define NS_INT32SZ 4 /* Bytes of data in a u_int32_t */ -#define NS_INT16SZ 2 /* Bytes of data in a u_int16_t */ -#define NS_INT8SZ 1 /* Bytes of data in a u_int8_t */ -#define NS_INADDRSZ 4 /* IPv4 T_A */ -#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ -#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ -#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ - -#endif diff --git a/newlib/libc/sys/phoenix/include/arpa/telnet.h b/newlib/libc/sys/phoenix/include/arpa/telnet.h deleted file mode 100644 index a639686..0000000 --- a/newlib/libc/sys/phoenix/include/arpa/telnet.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)telnet.h 8.2 (Berkeley) 12/15/93 - * $FreeBSD: src/include/arpa/telnet.h,v 1.8 2001/12/03 12:41:18 markm Exp $ - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#ifndef _ARPA_TELNET_H -#define _ARPA_TELNET_H - -/* Definitions for the TELNET protocol. */ -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ -#define EOR 239 /* end of record (transparent mode) */ -#define ABORT 238 /* Abort process */ -#define SUSP 237 /* Suspend process */ -#define xEOF 236 /* End of file: EOF is already used... */ - -#define SYNCH 242 /* for telfunc calls */ - -#ifdef TELCMDS -const char *telcmds[] = { - "EOF", "SUSP", "ABORT", "EOR", - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", - 0 -}; -#else -extern char *telcmds[]; -#endif - -#define TELCMD_FIRST xEOF -#define TELCMD_LAST IAC -#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && (unsigned int)(x) >= TELCMD_FIRST) -#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] - -/* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_TUID 26 /* TACACS user identification */ -#define TELOPT_OUTMRK 27 /* output marking */ -#define TELOPT_TTYLOC 28 /* terminal location number */ -#define TELOPT_3270REGIME 29 /* 3270 regime */ -#define TELOPT_X3PAD 30 /* X.3 PAD */ -#define TELOPT_NAWS 31 /* window size */ -#define TELOPT_TSPEED 32 /* terminal speed */ -#define TELOPT_LFLOW 33 /* remote flow control */ -#define TELOPT_LINEMODE 34 /* Linemode option */ -#define TELOPT_XDISPLOC 35 /* X Display Location */ -#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ -#define TELOPT_AUTHENTICATION 37 /* Authenticate */ -#define TELOPT_ENCRYPT 38 /* Encryption option */ -#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ -#define TELOPT_EXOPL 255 /* extended-options-list */ - - -#define NTELOPTS (1+TELOPT_NEW_ENVIRON) -#ifdef TELOPTS -const char *telopts[NTELOPTS + 1] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", - "TACACS UID", "OUTPUT MARKING", "TTYLOC", - "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", - "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", - "ENCRYPT", "NEW-ENVIRON", - 0 -}; - -#define TELOPT_FIRST TELOPT_BINARY -#define TELOPT_LAST TELOPT_NEW_ENVIRON -#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) -#define TELOPT(x) telopts[(x)-TELOPT_FIRST] -#endif - -/* Sub-option qualifiers */ -#define TELQUAL_IS 0 /* Option is... */ -#define TELQUAL_SEND 1 /* Send option */ -#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ -#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ -#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ - -#define LFLOW_OFF 0 /* Disable remote flow control */ -#define LFLOW_ON 1 /* Enable remote flow control */ -#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ -#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ - -/* LINEMODE suboptions */ -#define LM_MODE 1 -#define LM_FORWARDMASK 2 -#define LM_SLC 3 - -#define MODE_EDIT 0x01 -#define MODE_TRAPSIG 0x02 -#define MODE_ACK 0x04 -#define MODE_SOFT_TAB 0x08 -#define MODE_LIT_ECHO 0x10 -#define MODE_MASK 0x1f - -/* Not part of protocol, but needed to simplify things... */ -#define MODE_FLOW 0x0100 -#define MODE_ECHO 0x0200 -#define MODE_INBIN 0x0400 -#define MODE_OUTBIN 0x0800 -#define MODE_FORCE 0x1000 - -#define SLC_SYNCH 1 -#define SLC_BRK 2 -#define SLC_IP 3 -#define SLC_AO 4 -#define SLC_AYT 5 -#define SLC_EOR 6 -#define SLC_ABORT 7 -#define SLC_EOF 8 -#define SLC_SUSP 9 -#define SLC_EC 10 -#define SLC_EL 11 -#define SLC_EW 12 -#define SLC_RP 13 -#define SLC_LNEXT 14 -#define SLC_XON 15 -#define SLC_XOFF 16 -#define SLC_FORW1 17 -#define SLC_FORW2 18 -#define SLC_MCL 19 -#define SLC_MCR 20 -#define SLC_MCWL 21 -#define SLC_MCWR 22 -#define SLC_MCBOL 23 -#define SLC_MCEOL 24 -#define SLC_INSRT 25 -#define SLC_OVER 26 -#define SLC_ECR 27 -#define SLC_EWR 28 -#define SLC_EBOL 29 -#define SLC_EEOL 30 - -#define NSLC 30 - -/* - * For backwards compatibility, we define SLC_NAMES to be the - * list of names if SLC_NAMES is not defined. - */ -#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ - "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ - "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \ - "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \ - "MCEOL", "INSRT", "OVER", "ECR", "EWR", \ - "EBOL", "EEOL", \ - 0 - -#ifdef SLC_NAMES -const char *slc_names[] = { - SLC_NAMELIST -}; -#else -extern char *slc_names[]; -#define SLC_NAMES SLC_NAMELIST -#endif - -#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) -#define SLC_NAME(x) slc_names[x] - -#define SLC_NOSUPPORT 0 -#define SLC_CANTCHANGE 1 -#define SLC_VARIABLE 2 -#define SLC_DEFAULT 3 -#define SLC_LEVELBITS 0x03 - -#define SLC_FUNC 0 -#define SLC_FLAGS 1 -#define SLC_VALUE 2 - -#define SLC_ACK 0x80 -#define SLC_FLUSHIN 0x40 -#define SLC_FLUSHOUT 0x20 - -#define OLD_ENV_VAR 1 -#define OLD_ENV_VALUE 0 -#define NEW_ENV_VAR 0 -#define NEW_ENV_VALUE 1 -#define ENV_ESC 2 -#define ENV_USERVAR 3 - -/* AUTHENTICATION suboptions */ - -/* Who is authenticating who ... */ -#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ -#define AUTH_WHO_SERVER 1 /* Server authenticating client */ -#define AUTH_WHO_MASK 1 - -/* Amount of authentication done */ -#define AUTH_HOW_ONE_WAY 0 -#define AUTH_HOW_MUTUAL 2 -#define AUTH_HOW_MASK 2 - -#define AUTHTYPE_NULL 0 -#define AUTHTYPE_KERBEROS_V4 1 -#define AUTHTYPE_KERBEROS_V5 2 -#define AUTHTYPE_SPX 3 -#define AUTHTYPE_MINK 4 -#define AUTHTYPE_SRA 6 -#define AUTHTYPE_CNT 7 - -#define AUTHTYPE_TEST 99 - -#ifdef AUTH_NAMES -const char *authtype_names[] = { - "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA", - 0 -}; -#else -extern char *authtype_names[]; -#endif - -#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) authtype_names[x] - -/* ENCRYPTion suboptions */ -#define ENCRYPT_IS 0 /* I pick encryption type ... */ -#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ -#define ENCRYPT_REPLY 2 /* Initial setup response */ -#define ENCRYPT_START 3 /* Am starting to send encrypted */ -#define ENCRYPT_END 4 /* Am ending encrypted */ -#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ -#define ENCRYPT_REQEND 6 /* Request you end encrypting */ -#define ENCRYPT_ENC_KEYID 7 -#define ENCRYPT_DEC_KEYID 8 -#define ENCRYPT_CNT 9 - -#define ENCTYPE_ANY 0 -#define ENCTYPE_DES_CFB64 1 -#define ENCTYPE_DES_OFB64 2 -#define ENCTYPE_CNT 3 - -#ifdef ENCRYPT_NAMES -const char *encrypt_names[] = { - "IS", "SUPPORT", "REPLY", "START", "END", - "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", - 0 -}; - -const char *enctype_names[] = { - "ANY", "DES_CFB64", "DES_OFB64", - 0 -}; -#else -extern char *encrypt_names[]; -extern char *enctype_names[]; -#endif - - -#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) encrypt_names[x] - -#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) enctype_names[x] - -#endif diff --git a/newlib/libc/sys/phoenix/include/features.h b/newlib/libc/sys/phoenix/include/features.h deleted file mode 100644 index 34192dd..0000000 --- a/newlib/libc/sys/phoenix/include/features.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef FEATURES_H -#define FEATURES_H - -#include <sys/features.h> - -#endif diff --git a/newlib/libc/sys/phoenix/include/mntent.h b/newlib/libc/sys/phoenix/include/mntent.h deleted file mode 100644 index 8685ab5..0000000 --- a/newlib/libc/sys/phoenix/include/mntent.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef MNTENT_H -#define MNTENT_H - -#include <features.h> -#define __need_FILE -#include <stdio.h> -#include <paths.h> - -/* File listing canonical interesting mount points. */ -#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */ - -/* File listing currently active mount points. */ -#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ - -/* General filesystem types. */ -#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ -#define MNTTYPE_NFS "nfs" /* Network file system. */ -#define MNTTYPE_SWAP "swap" /* Swap device. */ - -/* Generic mount options. */ -#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */ -#define MNTOPT_RO "ro" /* Read only. */ -#define MNTOPT_RW "rw" /* Read/write. */ -#define MNTOPT_SUID "suid" /* Set uid allowed. */ -#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */ -#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */ - -/* Structure describing a mount table entry. */ -struct mntent { - char *mnt_fsname; /* Device or server for filesystem. */ - char *mnt_dir; /* Directory mounted on. */ - char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */ - char *mnt_opts; /* Comma-separated options for fs. */ - int mnt_freq; /* Dump frequency (in days). */ - int mnt_passno; /* Pass number for `fsck'. */ -}; - -FILE *setmntent(const char *filename, const char *type); -struct mntent *getmntent(FILE *fp); -int endmntent(FILE * filep); - -#endif diff --git a/newlib/libc/sys/phoenix/include/net/if.h b/newlib/libc/sys/phoenix/include/net/if.h deleted file mode 100644 index 42987b5..0000000 --- a/newlib/libc/sys/phoenix/include/net/if.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/net/if.h,v 1.71 2002/03/19 21:54:16 alfred Exp $ - */ - -#ifndef _NET_IF_H -#define _NET_IF_H - -#include <phoenix/iface.h> -#include <sys/queue.h> -#include <sys/socket.h> -#include <sys/time.h> - -struct ifnet; - -/* - * Length of interface external name, including terminating '\0'. - * Note: this is the same size as a generic device's external name. - */ -#define IFNAMSIZ 16 -#define IF_NAMESIZE IFNAMSIZ -#define IF_MAXUNIT 0x7fff /* ifp->if_unit is only 15 bits */ - -/* Structure describing a `cloning' interface. */ -struct if_clone { - LIST_ENTRY(if_clone) ifc_list; /* On list of cloners */ - const char *ifc_name; /* Name of device, e.g. `gif' */ - size_t ifc_namelen; /* Length of name */ - int ifc_maxunit; /* Maximum unit number */ - unsigned char *ifc_units; /* Bitmap to handle units */ - int ifc_bmlen; /* Bitmap length */ - - int (*ifc_create)(struct if_clone *, int); - int (*ifc_destroy)(struct ifnet *); -}; - -#define IF_CLONE_INITIALIZER(name, create, destroy, maxunit) \ - { { 0 }, name, sizeof(name) - 1, maxunit, NULL, 0, create, destroy } - -/* Structure used to query names of interface cloners. */ -struct if_clonereq { - int ifcr_total; /* Total cloners (out) */ - int ifcr_count; /* Room for this many in user buffer */ - char *ifcr_buffer; /* Buffer for cloner names */ -}; - -/* - * Structure describing information about an interface - * which may be of interest to management entities. - */ -struct if_data { - /* Generic interface information */ - u_char ifi_type; /* Ethernet, tokenring, etc */ - u_char ifi_physical; /* E.g., AUI, Thinnet, 10base-T, etc */ - u_char ifi_addrlen; /* Media address length */ - u_char ifi_hdrlen; /* Media header length */ - u_char ifi_recvquota; /* Polling quota for receive intrs */ - u_char ifi_xmitquota; /* Polling quota for xmit intrs */ - u_long ifi_mtu; /* Maximum transmission unit */ - u_long ifi_metric; /* Routing metric (external only) */ - u_long ifi_baudrate; /* Linespeed */ - /* Volatile statistics */ - u_long ifi_ipackets; /* Packets received on interface */ - u_long ifi_ierrors; /* Input errors on interface */ - u_long ifi_opackets; /* Packets sent on interface */ - u_long ifi_oerrors; /* Output errors on interface */ - u_long ifi_collisions; /* Collisions on csma interfaces */ - u_long ifi_ibytes; /* Total number of octets received */ - u_long ifi_obytes; /* Total number of octets sent */ - u_long ifi_imcasts; /* Packets received via multicast */ - u_long ifi_omcasts; /* Packets sent via multicast */ - u_long ifi_iqdrops; /* Dropped on input, this interface */ - u_long ifi_noproto; /* Destined for unsupported protocol */ - u_long ifi_hwassist; /* HW offload capabilities */ - u_long ifi_unused; /* XXX was ifi_xmittiming */ - struct timeval ifi_lastchange; /* Time of last administrative change */ -}; - -/* - * The following flag(s) ought to go in if_flags, but we cannot change - * struct ifnet because of binary compatibility, so we store them in - * if_ipending, which is not used so far. - * If possible, make sure the value is not conflicting with other - * IFF flags, so we have an easier time when we want to merge them. - */ -#define IFF_POLLING 0x10000 /* Interface is in polling mode. */ - -/* Flags set internally only */ -#define IFF_CANTCHANGE (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING | IFF_OACTIVE | IFF_SIMPLEX | IFF_MULTICAST | IFF_ALLMULTI | IFF_NOTRAILERS) - -/* Capabilities that interfaces can advertise. */ -#define IFCAP_RXCSUM 0x0001 /* Can offload checksum on RX */ -#define IFCAP_TXCSUM 0x0002 /* Can offload checksum on TX */ -#define IFCAP_NETCONS 0x0004 /* Can be a network console */ - -#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) - -#define IFQ_MAXLEN 50 -#define IFNET_SLOWHZ 1 /* Granularity is 1 second */ - -/* Message format for use in obtaining information about interfaces from getkerninfo and the routing socket */ -struct if_msghdr { - u_short ifm_msglen; /* To skip over non-understood messages */ - u_char ifm_version; /* Future binary compatibility */ - u_char ifm_type; /* Message type */ - int ifm_addrs; /* Like rtm_addrs */ - int ifm_flags; /* Value of if_flags */ - u_short ifm_index; /* Index for associated ifp */ - struct if_data ifm_data; /* Statistics and other data about if */ -}; - -/* Message format for use in obtaining information about interface addresses from getkerninfo and the routing socket */ -struct ifa_msghdr { - u_short ifam_msglen; /* To skip over non-understood messages */ - u_char ifam_version; /* Future binary compatibility */ - u_char ifam_type; /* Message type */ - int ifam_addrs; /* Like rtm_addrs */ - int ifam_flags; /* Value of ifa_flags */ - u_short ifam_index; /* Index for associated ifp */ - int ifam_metric; /* Value of ifa_metric */ -}; - -/* Message format for use in obtaining information about multicast addresses from the routing socket */ -struct ifma_msghdr { - u_short ifmam_msglen; /* To skip over non-understood messages */ - u_char ifmam_version; /* Future binary compatibility */ - u_char ifmam_type; /* Message type */ - int ifmam_addrs; /* Like rtm_addrs */ - int ifmam_flags; /* Value of ifa_flags */ - u_short ifmam_index; /* Index for associated ifp */ -}; - -/* Message format announcing the arrival or departure of a network interface. */ -struct if_announcemsghdr { - u_short ifan_msglen; /* To skip over non-understood messages */ - u_char ifan_version; /* Future binary compatibility */ - u_char ifan_type; /* Message type */ - u_short ifan_index; /* Index for associated ifp */ - char ifan_name[IFNAMSIZ]; /* If name, e.g. "en0" */ - u_short ifan_what; /* What type of announcement */ -}; - -#define IFAN_ARRIVAL 0 /* Interface arrival */ -#define IFAN_DEPARTURE 1 /* Interface departure */ - -struct ifaliasreq { - char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - struct sockaddr ifra_addr; - struct sockaddr ifra_broadaddr; - struct sockaddr ifra_mask; -}; - -struct ifmediareq { - char ifm_name[IFNAMSIZ]; /* If name, e.g. "en0" */ - int ifm_current; /* Current media options */ - int ifm_mask; /* Don't care mask */ - int ifm_status; /* Media status */ - int ifm_active; /* Active options */ - int ifm_count; /* # entries in ifm_ulist array */ - int *ifm_ulist; /* Media words */ -}; - -/* - * Structure used to retrieve aux status data from interfaces. - * Kernel suppliers to this interface should respect the formatting - * needed by ifconfig(8): each line starts with a TAB and ends with - * a newline. The canonical example to copy and paste is in if_tun.c. - */ -#define IFSTATMAX 800 /* 10 lines of text */ -struct ifstat { - char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - char ascii[IFSTATMAX + 1]; -}; - -/* - * Structure used in SIOCGIFCONF request. - * Used to retrieve interface configuration - * for machine (useful for programs which - * must know all networks accessible). - */ -struct ifconf { - int ifc_len; /* Size of associated buffer */ - union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* Array of structures returned */ -}; - - -/* Structure for SIOC[AGD]LIFADDR */ -struct if_laddrreq { - char iflr_name[IFNAMSIZ]; - u_int flags; -#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ - u_int prefixlen; /* in/out */ - struct sockaddr_storage addr; /* in/out */ - struct sockaddr_storage dstaddr; /* out */ -}; - -struct if_nameindex { - u_int if_index; /* 1, 2, ... */ - char *if_name; /* null terminated name: "le0", ... */ -}; - -unsigned int if_nametoindex(const char *ifname); -char *if_indextoname(unsigned int ifindex, char *ifname); -struct if_nameindex *if_nameindex(); -void if_freenameindex(struct if_nameindex *ptr); - -#endif diff --git a/newlib/libc/sys/phoenix/include/net/if_arp.h b/newlib/libc/sys/phoenix/include/net/if_arp.h deleted file mode 100644 index 52f718c..0000000 --- a/newlib/libc/sys/phoenix/include/net/if_arp.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/net/if_arp.h,v 1.16 2001/10/14 20:17:52 fjoe Exp $ - */ - -#ifndef _NET_IF_ARP_H_ -#define _NET_IF_ARP_H_ - -/* - * Address Resolution Protocol. - * - * See RFC 826 for protocol description. ARP packets are variable - * in size; the arphdr structure defines the fixed-length portion. - * Protocol type values are the same as those for 10 Mb/s Ethernet. - * It is followed by the variable-sized fields ar_sha, arp_spa, - * arp_tha and arp_tpa in that order, according to the lengths - * specified. Field names used correspond to RFC 826. - */ -struct arphdr { - u_short ar_hrd; /* format of hardware address */ -#define ARPHRD_ETHER 1 /* ethernet hardware format */ -#define ARPHRD_IEEE802 6 /* token-ring hardware format */ -#define ARPHRD_ARCNET 7 /* arcnet hardware format */ -#define ARPHRD_FRELAY 15 /* frame relay hardware format */ - u_short ar_pro; /* format of protocol address */ - u_char ar_hln; /* length of hardware address */ - u_char ar_pln; /* length of protocol address */ - u_short ar_op; /* one of: */ -#define ARPOP_REQUEST 1 /* request to resolve address */ -#define ARPOP_REPLY 2 /* response to previous request */ -#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ -#define ARPOP_REVREPLY 4 /* response giving protocol address */ -#define ARPOP_INVREQUEST 8 /* request to identify peer */ -#define ARPOP_INVREPLY 9 /* response identifying peer */ -/* - * The remaining fields are variable in size, - * according to the sizes above. - */ -#ifdef COMMENT_ONLY - u_char ar_sha[]; /* sender hardware address */ - u_char ar_spa[]; /* sender protocol address */ - u_char ar_tha[]; /* target hardware address */ - u_char ar_tpa[]; /* target protocol address */ -#endif -}; - -#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0) -#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln) -#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln) -#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln) - -#define arphdr_len2(ar_hln, ar_pln) \ - (sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln)) -#define arphdr_len(ap) (arphdr_len2((ap)->ar_hln, (ap)->ar_pln)) - -/* - * ARP ioctl request - */ -struct arpreq { - struct sockaddr arp_pa; /* protocol address */ - struct sockaddr arp_ha; /* hardware address */ - int arp_flags; /* flags */ -}; -/* arp_flags and at_flags field values */ -#define ATF_INUSE 0x01 /* entry in use */ -#define ATF_COM 0x02 /* completed entry (enaddr valid) */ -#define ATF_PERM 0x04 /* permanent entry */ -#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ -#define ATF_USETRAILERS 0x10 /* has requested trailers */ - -#ifdef _KERNEL -/* - * Structure shared between the ethernet driver modules and - * the address resolution code. For example, each ec_softc or il_softc - * begins with this structure. - */ -struct arpcom { - /* - * The ifnet struct _must_ be at the head of this structure. - */ - struct ifnet ac_if; /* network-visible interface */ - u_char ac_enaddr[6]; /* ethernet hardware address */ - int ac_multicnt; /* length of ac_multiaddrs list */ - void *ac_netgraph; /* ng_ether(4) netgraph node info */ -}; - -extern u_char etherbroadcastaddr[6]; -#endif - -#endif /* !_NET_IF_ARP_H_ */ diff --git a/newlib/libc/sys/phoenix/include/netdb.h b/newlib/libc/sys/phoenix/include/netdb.h deleted file mode 100644 index 3d8b8c2..0000000 --- a/newlib/libc/sys/phoenix/include/netdb.h +++ /dev/null @@ -1,225 +0,0 @@ -/*- - * Copyright (c) 1980, 1983, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -/* - * @(#)netdb.h 8.1 (Berkeley) 6/2/93 - * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ - * $FreeBSD: src/include/netdb.h,v 1.23 2002/03/23 17:24:53 imp Exp $ - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#ifndef _NETDB_H -#define _NETDB_H - -#include <stdio.h> -#include <sys/socket.h> -#include <sys/types.h> - -#ifndef _PATH_HEQUIV -#define _PATH_HEQUIV "/etc/hosts.equiv" -#endif -#define _PATH_HOSTS "/etc/hosts" -#define _PATH_NETWORKS "/etc/networks" -#define _PATH_PROTOCOLS "/etc/protocols" -#define _PATH_SERVICES "/etc/services" -#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" - -extern int *__h_errno_location(void); - -#define h_errno (*(__h_errno_location())) - -#define MAXALIASES 35 -/* For now, only support one return address. */ -#define MAXADDRS 2 - -struct hostent { - char *h_name; /* Official name of host */ - char **h_aliases; /* Alias list */ - int h_addrtype; /* Host address type */ - int h_length; /* Length of address */ - char **h_addr_list; /* List of addresses from name server */ - char *h_addr; /* Address, for backward compatibility */ - /* Private data, for re-entrancy */ - char *__host_addrs[MAXADDRS]; - char *__host_aliases[MAXALIASES]; - unsigned int __host_addr[4]; -}; - -/* Assumption here is that a network number fits in an unsigned long -- probably a poor one. */ -struct netent { - char *n_name; /* Official name of net */ - char **n_aliases; /* Alias list */ - int n_addrtype; /* Net address type */ - unsigned long n_net; /* Network # */ -}; - -struct servent { - char *s_name; /* Official service name */ - char **s_aliases; /* Alias list */ - int s_port; /* Port # */ - char *s_proto; /* Protocol to use */ -}; - -struct protoent { - char *p_name; /* Official protocol name */ - char **p_aliases; /* Alias list */ - int p_proto; /* Protocol # */ -}; - -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* Length of ai_addr */ - char *ai_canonname; /* Canonical name for hostname */ - struct sockaddr *ai_addr; /* Binary address */ - struct addrinfo *ai_next; /* Next structure in linked list */ -}; - -/* Error return codes from gethostbyname() and gethostbyaddr() (left in extern int h_errno). */ -#define NETDB_INTERNAL -1 /* See errno */ -#define NETDB_SUCCESS 0 /* No problem */ -#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ -#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */ -#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ -#define NO_DATA 4 /* Valid name, no data record of requested type */ -#define NO_ADDRESS NO_DATA /* No address, look for MX record */ - -/* Error return codes from getaddrinfo() */ -#define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ -#define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ -#define EAI_AGAIN -3 /* Temporary failure in name resolution. */ -#define EAI_FAIL -4 /* Non-recoverable failure in name res. */ -#define EAI_NODATA -5 /* No address associated with NAME. */ -#define EAI_FAMILY -6 /* `ai_family' not supported. */ -#define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ -#define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ -#define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ -#define EAI_MEMORY -10 /* Memory allocation failure. */ -#define EAI_SYSTEM -11 /* System error returned in `errno'. */ -#define EAI_OVERFLOW -12 /* Argument buffer overflow. */ -#ifdef __USE_GNU -#define EAI_INPROGRESS -100 /* Processing request in progress. */ -#define EAI_CANCELED -101 /* Request canceled. */ -#define EAI_NOTCANCELED -102 /* Request not canceled. */ -#define EAI_ALLDONE -103 /* All requests done. */ -#define EAI_INTR -104 /* Interrupted by a signal. */ -#define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ -#endif - -/* Flag values for getaddrinfo() */ -#define AI_PASSIVE 0x00000001 /* Get address to use bind() */ -#define AI_CANONNAME 0x00000002 /* Fill ai_canonname */ -#define AI_NUMERICHOST 0x00000004 /* Prevent name resolution */ -#define AI_NUMERICSERV 0x00000008 /* Fon't use name resolution. */ - -/* Valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG) -#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ -#define AI_V4MAPPED_CFG 0x00000200 /* Accept IPv4-mapped if kernel supports */ -#define AI_ADDRCONFIG 0x00000400 /* Only if any address is assigned */ -#define AI_V4MAPPED 0x00000800 /* Accept IPv4-mapped IPv6 address */ - -/* Special recommended flags for getipnodebyname */ -#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) - -/* Constants for getnameinfo() */ -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 - -/* Flag values for getnameinfo() */ -#define NI_NOFQDN 0x00000001 -#define NI_NUMERICHOST 0x00000002 -#define NI_NAMEREQD 0x00000004 -#define NI_NUMERICSERV 0x00000008 -#define NI_DGRAM 0x00000010 -#define NI_WITHSCOPEID 0x00000020 - -/* Scope delimit character. */ -#define SCOPE_DELIMITER '%' - -void endhostent(); -void endnetent(); -void endnetgrent(); -void endprotoent(); -void endservent(); -void freehostent(struct hostent *ip); -struct hostent *gethostbyaddr(const void *name, socklen_t len, int type); -struct hostent *gethostbyname(const char *name); -struct hostent *gethostbyname2(const char *name, int af); -struct hostent *gethostent(); -struct hostent *getipnodebyaddr(const void *addr, size_t len, int af, int *error_num); -struct hostent *getipnodebyname(const char *name, int af, int flags, int *error_num); -struct netent *getnetbyaddr(uint32_t net, int type); -struct netent *getnetbyname(const char *name); -struct netent *getnetent(); -int getnetgrent(char **host, char **user, char **domain); -struct protoent *getprotobyname(const char *name); -struct protoent *getprotobynumber(int proto); -struct protoent *getprotoent(); -struct servent *getservbyname(const char *name, const char *proto); -struct servent *getservbyport(int name, const char *proto); -struct servent *getservent(); -void herror(const char *s); -const char *hstrerror(int err); -int innetgr(const char *netgroup, const char *host, const char *user, const char *domain); -void sethostent(int stayopen); -void setnetent(int stayopen); -void setprotoent(int stayopen); -int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); -int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags); -void freeaddrinfo(struct addrinfo *res); -char *gai_strerror(int errcode); -int setnetgrent(const char *netgroup); -void setservent(int stayopen); - -#endif diff --git a/newlib/libc/sys/phoenix/include/netinet/in.h b/newlib/libc/sys/phoenix/include/netinet/in.h deleted file mode 100644 index 9f73f67..0000000 --- a/newlib/libc/sys/phoenix/include/netinet/in.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in.h 8.3 (Berkeley) 1/3/94 - * $FreeBSD: src/sys/netinet/in.h,v 1.68 2002/04/24 01:26:11 mike Exp $ - */ - - /* Copied from Linux, modified for Phoenix */ - -#ifndef _NETINET_IN_H -#define _NETINET_IN_H - -#include <machine/endian.h> -#include <phoenix/netinet.h> -#include <sys/types.h> - -#if BYTE_ORDER == BIG_ENDIAN -#define htons(a) (a) -#define htonl(a) (a) -#define ntohs(a) (a) -#define ntohl(a) (a) -#error Big endian is not supported! -#else - -static uint32_t htonl(uint32_t hostlong) -{ - return ((hostlong & 0xff) << 24) | ((hostlong & 0xff00) << 8) | ((hostlong & 0xff0000UL) >> 8) | ((hostlong & 0xff000000UL) >> 24); -} - -static uint16_t htons(uint16_t hostshort) -{ - return ((hostshort & 0xff) << 8) | ((hostshort & 0xff00) >> 8); -} - -static uint32_t ntohl(uint32_t netlong) -{ - return htonl(netlong); -} - -static uint16_t ntohs(uint16_t netshort) -{ - return htons(netshort); -} -#endif - -#if __POSIX_VISIBLE >= 200112 -#define IPPROTO_RAW 255 /* Raw IP packet */ -#define INET_ADDRSTRLEN 16 -#endif - -/* - * Constants and structures defined by the internet system, - * Per RFC 790, September 1981, and numerous additions. - */ - -/* Protocols (RFC 1700) */ -#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ -#define IPPROTO_IGMP 2 /* Group mgmt protocol */ -#define IPPROTO_GGP 3 /* Gateway^2 (deprecated) */ -#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ -#define IPPROTO_IPIP IPPROTO_IPV4 -#define IPPROTO_ST 7 /* Stream protocol II */ -#define IPPROTO_EGP 8 /* Exterior gateway protocol */ -#define IPPROTO_PIGP 9 /* Private interior gateway */ -#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ -#define IPPROTO_NVPII 11 /* Network voice protocol*/ -#define IPPROTO_PUP 12 /* Pup */ -#define IPPROTO_ARGUS 13 /* Argus */ -#define IPPROTO_EMCON 14 /* EMCON */ -#define IPPROTO_XNET 15 /* Cross Net Debugger */ -#define IPPROTO_CHAOS 16 /* Chaos*/ -#define IPPROTO_MUX 18 /* Multiplexing */ -#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ -#define IPPROTO_HMP 20 /* Host Monitoring */ -#define IPPROTO_PRM 21 /* Packet Radio Measurement */ -#define IPPROTO_IDP 22 /* Xns idp */ -#define IPPROTO_TRUNK1 23 /* Trunk-1 */ -#define IPPROTO_TRUNK2 24 /* Trunk-2 */ -#define IPPROTO_LEAF1 25 /* Leaf-1 */ -#define IPPROTO_LEAF2 26 /* Leaf-2 */ -#define IPPROTO_RDP 27 /* Reliable Data */ -#define IPPROTO_IRTP 28 /* Reliable Transaction */ -#define IPPROTO_TP 29 /* Tp-4 w/ class negotiation */ -#define IPPROTO_BLT 30 /* Bulk Data Transfer */ -#define IPPROTO_NSP 31 /* Network Services */ -#define IPPROTO_INP 32 /* Merit Internodal */ -#define IPPROTO_SEP 33 /* Sequential Exchange */ -#define IPPROTO_3PC 34 /* Third Party Connect */ -#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ -#define IPPROTO_XTP 36 /* XTP */ -#define IPPROTO_DDP 37 /* Datagram Delivery */ -#define IPPROTO_CMTP 38 /* Control Message Transport */ -#define IPPROTO_TPXX 39 /* TP++ Transport */ -#define IPPROTO_IL 40 /* IL transport protocol */ -#define IPPROTO_IPV6 41 /* IP6 header */ -#define IPPROTO_SDRP 42 /* Source Demand Routing */ -#define IPPROTO_ROUTING 43 /* IP6 routing header */ -#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ -#define IPPROTO_IDRP 45 /* InterDomain Routing*/ -#define IPPROTO_RSVP 46 /* Resource reservation */ -#define IPPROTO_GRE 47 /* General Routing Encap. */ -#define IPPROTO_MHRP 48 /* Mobile Host Routing */ -#define IPPROTO_BHA 49 /* BHA */ -#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ -#define IPPROTO_AH 51 /* IP6 Auth Header */ -#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ -#define IPPROTO_SWIPE 53 /* IP with encryption */ -#define IPPROTO_NHRP 54 /* Next Hop Resolution */ -#define IPPROTO_MOBILE 55 /* IP Mobility */ -#define IPPROTO_TLSP 56 /* Transport Layer Security */ -#define IPPROTO_SKIP 57 /* SKIP */ -#define IPPROTO_ICMPV6 58 /* ICMP6 */ -#define IPPROTO_NONE 59 /* IP6 no next header */ -#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ -#define IPPROTO_AHIP 61 /* Any host internal protocol */ -#define IPPROTO_CFTP 62 /* CFTP */ -#define IPPROTO_HELLO 63 /* "hello" routing protocol */ -#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ -#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ -#define IPPROTO_RVD 66 /* Remote Virtual Disk */ -#define IPPROTO_IPPC 67 /* Pluribus Packet Core */ -#define IPPROTO_ADFS 68 /* Any distributed FS */ -#define IPPROTO_SATMON 69 /* Satnet Monitoring */ -#define IPPROTO_VISA 70 /* VISA Protocol */ -#define IPPROTO_IPCV 71 /* Packet Core Utility */ -#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ -#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ -#define IPPROTO_WSN 74 /* Wang Span Network */ -#define IPPROTO_PVP 75 /* Packet Video Protocol */ -#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ -#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ -#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ -#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ -#define IPPROTO_EON 80 /* ISO cnlp */ -#define IPPROTO_VMTP 81 /* VMTP */ -#define IPPROTO_SVMTP 82 /* Secure VMTP */ -#define IPPROTO_VINES 83 /* Banyon VINES */ -#define IPPROTO_TTP 84 /* TTP */ -#define IPPROTO_IGP 85 /* NSFNET-IGP */ -#define IPPROTO_DGP 86 /* Dissimilar gateway prot. */ -#define IPPROTO_TCF 87 /* TCF */ -#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ -#define IPPROTO_OSPFIGP 89 /* OSPFIGP */ -#define IPPROTO_SRPC 90 /* Strite RPC protocol */ -#define IPPROTO_LARP 91 /* Locus Address Resoloution */ -#define IPPROTO_MTP 92 /* Multicast Transport */ -#define IPPROTO_AX25 93 /* AX.25 Frames */ -#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ -#define IPPROTO_MICP 95 /* Mobile Int.ing control */ -#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ -#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ -#define IPPROTO_ENCAP 98 /* Encapsulation header */ -#define IPPROTO_APES 99 /* Aany private encr. scheme */ -#define IPPROTO_GMTP 100 /* GMTP*/ -#define IPPROTO_IPCOMP 108 /* Payload compression (IPComp) */ -/* 101-254: Partly Unassigned */ -#define IPPROTO_PIM 103 /* Protocol Independent Mcast */ -#define IPPROTO_PGM 113 /* PGM */ -/* 255: Reserved */ -/* BSD Private, local use, namespace incursion */ -#define IPPROTO_DIVERT 254 /* Divert pseudo-protocol */ -#define IPPROTO_MAX 256 - -/* Last return value of *_input(), meaning "all job for this pkt is done". */ -#define IPPROTO_DONE 257 - -/* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root). (IP_PORTRANGE_LOW) */ -#define IPPORT_RESERVED 1024 - -/* Default local port range, used by both IP_PORTRANGE_DEFAULT and IP_PORTRANGE_HIGH. */ -#define IPPORT_HIFIRSTAUTO 49152 -#define IPPORT_HILASTAUTO 65535 - -/* - * Scanning for a free reserved port return a value below IPPORT_RESERVED, - * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was - * 512, but that conflicts with some well-known-services that firewalls may - * have a fit if we use. - */ -#define IPPORT_RESERVEDSTART 600 - -#define IPPORT_MAX 65535 - -/* - * Definitions of bits in internet address integers. - * On subnets, the decomposition of addresses to host and net parts - * is done according to subnet mask, not the masks here. - */ -#define IN_CLASSA(i) (((u_int32_t) (i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(i) (((u_int32_t) (i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(i) (((u_int32_t) (i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff - -#define IN_CLASSD(i) (((u_int32_t) (i) & 0xf0000000) == 0xe0000000) -#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ -#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ -#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ -#define IN_MULTICAST(i) IN_CLASSD(i) - -#define IN_EXPERIMENTAL(i) (((u_int32_t) (i) & 0xf0000000) == 0xf0000000) -#define IN_BADCLASS(i) (((u_int32_t) (i) & 0xf0000000) == 0xf0000000) - -#define INADDR_LOOPBACK (u_int32_t) 0x7f000001 -#define INADDR_NONE 0xffffffff /* -1 return */ - -#define INADDR_UNSPEC_GROUP (u_int32_t) 0xe0000000 /* 224.0.0.0 */ -#define INADDR_ALLHOSTS_GROUP (u_int32_t) 0xe0000001 /* 224.0.0.1 */ -#define INADDR_ALLRTRS_GROUP (u_int32_t) 0xe0000002 /* 224.0.0.2 */ -#define INADDR_MAX_LOCAL_GROUP (u_int32_t) 0xe00000ff /* 224.0.0.255 */ - -#define IN_LOOPBACKNET 127 /* Official */ - -/* Defaults and limits for options */ -#define IP_DEFAULT_MULTICAST_TTL 1 /* Normally limit m'casts to 1 hop */ -#define IP_DEFAULT_MULTICAST_LOOP 1 /* Normally hear sends if a member */ -#define IP_MAX_MEMBERSHIPS 20 /* Per socket */ - -/* Argument for IP_PORTRANGE - which range to search when port is unspecified at bind() or connect() */ -#define IP_PORTRANGE_DEFAULT 0 /* Default range */ -#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ -#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ - -/* - * Definitions for inet sysctl operations. - * - * Third level is protocol number. - * Fourth level is desired variable within that protocol. - */ -#define IPPROTO_MAXID (IPPROTO_AH + 1) /* Don't list to IPPROTO_MAX */ - -#define CTL_IPPROTO_NAMES { \ - { "ip", CTLTYPE_NODE }, \ - { "icmp", CTLTYPE_NODE }, \ - { "igmp", CTLTYPE_NODE }, \ - { "ggp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "tcp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { "egp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "pup", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "udp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "idp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "ipsec", CTLTYPE_NODE }, \ -} - -/* Names for IP sysctl objects */ -#define IPCTL_FORWARDING 1 /* Act as router */ -#define IPCTL_SENDREDIRECTS 2 /* May send redirects when forwarding */ -#define IPCTL_DEFTTL 3 /* Default TTL */ -#ifdef notyet -#define IPCTL_DEFMTU 4 /* Default MTU */ -#endif -#define IPCTL_RTEXPIRE 5 /* Cloned route expiration time */ -#define IPCTL_RTMINEXPIRE 6 /* Min value for expiration time */ -#define IPCTL_RTMAXCACHE 7 /* Trigger level for dynamic expire */ -#define IPCTL_SOURCEROUTE 8 /* May perform source routes */ -#define IPCTL_DIRECTEDBROADCAST 9 /* May re-broadcast received packets */ -#define IPCTL_INTRQMAXLEN 10 /* Max length of netisr queue */ -#define IPCTL_INTRQDROPS 11 /* Number of netisr q drops */ -#define IPCTL_STATS 12 /* Ipstat structure */ -#define IPCTL_ACCEPTSOURCEROUTE 13 /* May accept source routed packets */ -#define IPCTL_FASTFORWARDING 14 /* Use fast IP forwarding code */ -#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ -#define IPCTL_GIF_TTL 16 /* Default TTL for gif encap packet */ -#define IPCTL_MAXID 17 - -#define IPCTL_NAMES { \ - { 0, 0 }, \ - { "forwarding", CTLTYPE_INT }, \ - { "redirect", CTLTYPE_INT }, \ - { "ttl", CTLTYPE_INT }, \ - { "mtu", CTLTYPE_INT }, \ - { "rtexpire", CTLTYPE_INT }, \ - { "rtminexpire", CTLTYPE_INT }, \ - { "rtmaxcache", CTLTYPE_INT }, \ - { "sourceroute", CTLTYPE_INT }, \ - { "directed-broadcast", CTLTYPE_INT }, \ - { "intr-queue-maxlen", CTLTYPE_INT }, \ - { "intr-queue-drops", CTLTYPE_INT }, \ - { "stats", CTLTYPE_STRUCT }, \ - { "accept_sourceroute", CTLTYPE_INT }, \ - { "fastforwarding", CTLTYPE_INT }, \ -} - -#endif diff --git a/newlib/libc/sys/phoenix/include/netinet/in_systm.h b/newlib/libc/sys/phoenix/include/netinet/in_systm.h deleted file mode 100644 index c262a89..0000000 --- a/newlib/libc/sys/phoenix/include/netinet/in_systm.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/netinet/in_systm.h,v 1.10 2002/03/19 21:25:46 alfred Exp $ - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#ifndef _NETINET_IN_SYSTM_H -#define _NETINET_IN_SYSTM_H - -#include <sys/types.h> - -/* - * Network types. - * - * Internally the system keeps counters in the headers with the bytes - * swapped so that VAX instructions will work on them. It reverses - * the bytes before transmission at each protocol level. The n_ types - * represent the types with the bytes in ``high-ender'' order. - */ -typedef u_int16_t n_short; /* short as received from the net */ -typedef u_int32_t n_long; /* long as received from the net */ - -typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */ - -#endif diff --git a/newlib/libc/sys/phoenix/include/netinet/ip.h b/newlib/libc/sys/phoenix/include/netinet/ip.h deleted file mode 100644 index 189172e..0000000 --- a/newlib/libc/sys/phoenix/include/netinet/ip.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip.h 8.2 (Berkeley) 6/1/94 - * $FreeBSD: src/sys/netinet/ip.h,v 1.19 2001/12/14 19:37:32 rwatson Exp $ - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#ifndef _NETINET_IP_H -#define _NETINET_IP_H - -#include <netinet/in_systm.h> - -/* Definitions for internet protocol version 4. Per RFC 791, September 1981. */ -#define IPVERSION 4 - -/* Structure of an internet header, naked of options. */ -struct ip { -#ifdef _IP_VHL - u_char ip_vhl; /* version << 4 | header length >> 2 */ -#else -#if BYTE_ORDER == LITTLE_ENDIAN - u_int ip_hl: 4, /* header length */ - ip_v: 4; /* version */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - u_int ip_v: 4, /* version */ - ip_hl: 4; /* header length */ -#endif -#endif /* not _IP_VHL */ - u_char ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ -#define IP_RF 0x8000 /* reserved fragment flag */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src, ip_dst; /* source and dest address */ -}; - -#ifdef _IP_VHL -#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl)) -#define IP_VHL_HL(vhl) ((vhl) & 0x0f) -#define IP_VHL_V(vhl) ((vhl) >> 4) -#define IP_VHL_BORING 0x45 -#endif - -#define IP_MAXPACKET 65535 /* maximum packet size */ - -/* - * Definitions for IP type of service (ip_tos) - */ -#define IPTOS_LOWDELAY 0x10 -#define IPTOS_THROUGHPUT 0x08 -#define IPTOS_RELIABILITY 0x04 -#define IPTOS_MINCOST 0x02 -/* ECN bits proposed by Sally Floyd */ -#define IPTOS_CE 0x01 /* congestion experienced */ -#define IPTOS_ECT 0x02 /* ECN-capable transport */ - -/* - * Definitions for IP precedence (also in ip_tos) (hopefully unused) - */ -#define IPTOS_PREC_NETCONTROL 0xe0 -#define IPTOS_PREC_INTERNETCONTROL 0xc0 -#define IPTOS_PREC_CRITIC_ECP 0xa0 -#define IPTOS_PREC_FLASHOVERRIDE 0x80 -#define IPTOS_PREC_FLASH 0x60 -#define IPTOS_PREC_IMMEDIATE 0x40 -#define IPTOS_PREC_PRIORITY 0x20 -#define IPTOS_PREC_ROUTINE 0x00 - -/* Definitions for options. */ -#define IPOPT_COPIED(o) ((o)&0x80) -#define IPOPT_CLASS(o) ((o)&0x60) -#define IPOPT_NUMBER(o) ((o)&0x1f) - -#define IPOPT_CONTROL 0x00 -#define IPOPT_RESERVED1 0x20 -#define IPOPT_DEBMEAS 0x40 -#define IPOPT_RESERVED2 0x60 - -#define IPOPT_EOL 0 /* end of option list */ -#define IPOPT_NOP 1 /* no operation */ - -#define IPOPT_RR 7 /* record packet route */ -#define IPOPT_TS 68 /* timestamp */ -#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ -#define IPOPT_LSRR 131 /* loose source route */ -#define IPOPT_ESO 133 /* extended security */ -#define IPOPT_CIPSO 134 /* commerical security */ -#define IPOPT_SATID 136 /* satnet id */ -#define IPOPT_SSRR 137 /* strict source route */ -#define IPOPT_RA 148 /* router alert */ - -/* Offsets to fields in options other than EOL and NOP. */ -#define IPOPT_OPTVAL 0 /* option ID */ -#define IPOPT_OLEN 1 /* option length */ -#define IPOPT_OFFSET 2 /* offset within option */ -#define IPOPT_MINOFF 4 /* min value of above */ - -/* Time stamp option structure. */ -struct ip_timestamp { - u_char ipt_code; /* IPOPT_TS */ - u_char ipt_len; /* size of structure (variable) */ - u_char ipt_ptr; /* index of current entry */ -#if BYTE_ORDER == LITTLE_ENDIAN - u_int ipt_flg: 4, /* flags, see below */ - ipt_oflw: 4; /* overflow counter */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - u_int ipt_oflw: 4, /* overflow counter */ - ipt_flg: 4; /* flags, see below */ -#endif - union ipt_timestamp { - n_long ipt_time[1]; - struct ipt_ta { - struct in_addr ipt_addr; - n_long ipt_time; - } ipt_ta[1]; - } ipt_timestamp; -}; - -/* flag bits for ipt_flg */ -#define IPOPT_TS_TSONLY 0 /* timestamps only */ -#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ -#define IPOPT_TS_PRESPEC 3 /* specified modules only */ - -/* bits for security (not byte swapped) */ -#define IPOPT_SECUR_UNCLASS 0x0000 -#define IPOPT_SECUR_CONFID 0xf135 -#define IPOPT_SECUR_EFTO 0x789a -#define IPOPT_SECUR_MMMM 0xbc4d -#define IPOPT_SECUR_RESTR 0xaf13 -#define IPOPT_SECUR_SECRET 0xd788 -#define IPOPT_SECUR_TOPSECRET 0x6bc5 - -/* Internet implementation parameters. */ -#define MAXTTL 255 /* maximum time to live (seconds) */ -#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ -#define IPFRAGTTL 60 /* time to live for frags, slowhz */ -#define IPTTLDEC 1 /* subtracted when forwarding */ - -#define IP_MSS 576 /* default maximum segment size */ - -#endif diff --git a/newlib/libc/sys/phoenix/include/netinet6/in6.h b/newlib/libc/sys/phoenix/include/netinet6/in6.h deleted file mode 100644 index 865f234..0000000 --- a/newlib/libc/sys/phoenix/include/netinet6/in6.h +++ /dev/null @@ -1,420 +0,0 @@ -/* $FreeBSD: src/sys/netinet6/in6.h,v 1.19 2002/04/19 04:46:22 suz Exp $ */ -/* $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ */ - -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in.h 8.3 (Berkeley) 1/3/94 - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#ifndef _NETINET6_IN6_H -#define _NETINET6_IN6_H - -#include <phoenix/netinet6.h> -#include <sys/types.h> - -/* - * Identification of the network protocol stack - * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE - * has the table of implementation/integration differences. - */ -#define __KAME__ -#define __KAME_VERSION "20010528/FreeBSD" - -/* - * Local port number conventions: - * - * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), - * unless a kernel is compiled with IPNOPRIVPORTS defined. - * - * When a user does a bind(2) or connect(2) with a port number of zero, - * a non-conflicting local port address is chosen. - * - * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although - * that is settable by sysctl(3); net.inet.ip.anonportmin and - * net.inet.ip.anonportmax respectively. - * - * A user may set the IPPROTO_IP option IP_PORTRANGE to change this - * default assignment range. - * - * The value IP_PORTRANGE_DEFAULT causes the default behavior. - * - * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, - * and exists only for FreeBSD compatibility purposes. - * - * The value IP_PORTRANGE_LOW changes the range to the "low" are - * that is (by convention) restricted to privileged processes. - * This convention is based on "vouchsafe" principles only. - * It is only secure if you trust the remote host to restrict these ports. - * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. - */ - -#define IPV6PORT_RESERVED 1024 -#define IPV6PORT_ANONMIN 49152 -#define IPV6PORT_ANONMAX 65535 -#define IPV6PORT_RESERVEDMIN 600 -#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1) - -/* Socket address for IPv6 */ -#ifndef _XOPEN_SOURCE -#define SIN6_LEN -#endif - -/* Definition of some useful macros to handle IP6 addresses */ -#define IN6ADDR_ANY_INIT \ - {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} -#define IN6ADDR_LOOPBACK_INIT \ - {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} -#define IN6ADDR_NODELOCAL_ALLNODES_INIT \ - {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} -#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ - {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} -#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ - {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} - -extern const struct in6_addr in6addr_any; -extern const struct in6_addr in6addr_loopback; -extern const struct in6_addr in6addr_nodelocal_allnodes; -extern const struct in6_addr in6addr_linklocal_allnodes; -extern const struct in6_addr in6addr_linklocal_allrouters; - -/* - * Equality - * NOTE: Some of kernel programming environment (for example, openbsd/sparc) - * does not supply memcmp(). For userland memcmp() is preferred as it is - * in ANSI standard. - */ - -#define IN6_ARE_ADDR_EQUAL(a, b) (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) - -/* Unspecified */ -#define IN6_IS_ADDR_UNSPECIFIED(a) \ - ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0)) - -/* Loopback */ -#define IN6_IS_ADDR_LOOPBACK(a) \ - ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) - -/* IPv4 compatible */ -#define IN6_IS_ADDR_V4COMPAT(a) \ - ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1))) - -/* Mapped */ -#define IN6_IS_ADDR_V4MAPPED(a) \ - ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) - -/* KAME Scope Values */ -#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 -#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 -#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 -#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ -#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e - -/* - * Unicast Scope - * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). - */ -#define IN6_IS_ADDR_LINKLOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) -#define IN6_IS_ADDR_SITELOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) - -/* Multicast */ -#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) -#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) - -/* Multicast Scope */ -#define IN6_IS_ADDR_MC_NODELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) -#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL)) -#define IN6_IS_ADDR_MC_SITELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) -#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) -#define IN6_IS_ADDR_MC_GLOBAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) - -/* IP6 route structure */ -#ifndef _XOPEN_SOURCE -struct route_in6 { - struct rtentry *ro_rt; - struct sockaddr_in6 ro_dst; -}; -#endif - -/* - * Options for use with [gs]etsockopt at the IPV6 level. - * First word of comment is data type; bool is stored in int. - */ -#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ -#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ -#define IPV6_MULTICAST_IF 9 /* u_char; set/get IP6 multicast i/f */ -#define IPV6_MULTICAST_HOPS 10 /* u_char; set/get IP6 multicast hops */ -#define IPV6_MULTICAST_LOOP 11 /* u_char; set/get IP6 multicast loopback */ -#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */ -#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */ -#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ -#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ -/* RFC2292 options */ -#define IPV6_PKTINFO 19 /* bool; send/recv if, src/dst addr */ -#define IPV6_HOPLIMIT 20 /* bool; hop limit */ -#define IPV6_NEXTHOP 21 /* bool; next hop addr */ -#define IPV6_HOPOPTS 22 /* bool; hop-by-hop option */ -#define IPV6_DSTOPTS 23 /* bool; destination option */ -#define IPV6_RTHDR 24 /* bool; routing header */ -#define IPV6_PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */ -#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ -#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */ -#define IPV6_BINDV6ONLY IPV6_V6ONLY -#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ -#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */ -#define IPV6_FW_ADD 30 /* add a firewall rule to chain */ -#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */ -#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */ -#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */ -#define IPV6_FW_GET 34 /* get entire firewall rule chain */ - -/* to define items, should talk with KAME guys first, for *BSD compatibility */ -#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */ -#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */ -#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ - -/* Defaults and limits for options */ -#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */ -#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ - -/* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. */ -struct ipv6_mreq { - struct in6_addr ipv6mr_multiaddr; - unsigned int ipv6mr_interface; -}; - -/* IPV6_PKTINFO: Packet information(RFC2292 sec 5) */ -struct in6_pktinfo { - struct in6_addr ipi6_addr; /* src/dst IPv6 address */ - unsigned int ipi6_ifindex; /* send/recv interface index */ -}; - -/* - * Argument for IPV6_PORTRANGE: - * - which range to search when port is unspecified at bind() or connect() - */ -#define IPV6_PORTRANGE_DEFAULT 0 /* default range */ -#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ -#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ - -#ifndef _XOPEN_SOURCE -/* - * Definitions for inet6 sysctl operations. - * - * Third level is protocol number. - * Fourth level is desired variable within that protocol. - */ -#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */ - -#define CTL_IPV6PROTO_NAMES { \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, \ - { "tcp6", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "udp6", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, \ - { "ip6", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, \ - { "ipsec6", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "icmp6", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "pim6", CTLTYPE_NODE }, \ -} - -/* - * Names for IP sysctl objects - */ -#define IPV6CTL_FORWARDING 1 /* act as router */ -#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ -#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ -#ifdef notyet -#define IPV6CTL_DEFMTU 4 /* default MTU */ -#endif -#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ -#define IPV6CTL_STATS 6 /* stats */ -#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ -#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */ -#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */ -#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */ -#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */ -#define IPV6CTL_ACCEPT_RTADV 12 -#define IPV6CTL_KEEPFAITH 13 -#define IPV6CTL_LOG_INTERVAL 14 -#define IPV6CTL_HDRNESTLIMIT 15 -#define IPV6CTL_DAD_COUNT 16 -#define IPV6CTL_AUTO_FLOWLABEL 17 -#define IPV6CTL_DEFMCASTHLIM 18 -#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ -#define IPV6CTL_KAME_VERSION 20 -#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ -#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ -#define IPV6CTL_V6ONLY 24 -#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */ -#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */ -#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */ - -#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */ -#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */ -#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */ -#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */ -#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */ - -/* New entries should be added here from current IPV6CTL_MAXID value. */ -/* to define items, should talk with KAME guys first, for *BSD compatibility */ -#define IPV6CTL_MAXID 37 - -#endif /* !_XOPEN_SOURCE */ - -/* Redefinition of mbuf flags */ -#define M_AUTHIPHDR M_PROTO2 -#define M_DECRYPTED M_PROTO3 -#define M_LOOP M_PROTO4 -#define M_AUTHIPDGM M_PROTO5 - -struct cmsghdr; - -int inet6_option_space(int); -int inet6_option_init(void *, struct cmsghdr **, int); -int inet6_option_append(struct cmsghdr *, const uint8_t *, int, int); -uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int); -int inet6_option_next(const struct cmsghdr *, uint8_t **); -int inet6_option_find(const struct cmsghdr *, uint8_t **, int); -size_t inet6_rthdr_space(int, int); -struct cmsghdr *inet6_rthdr_init(void *, int); -int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *, unsigned int); -int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int); -int inet6_rthdr_segments(const struct cmsghdr *); -struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int); -int inet6_rthdr_getflags(const struct cmsghdr *, int); -int inet6_opt_init(void *, size_t); -int inet6_opt_append(void *, size_t, int, uint8_t, size_t, uint8_t, void **); -int inet6_opt_finish(void *, size_t, int); -int inet6_opt_set_val(void *, size_t, void *, int); -int inet6_opt_next(void *, size_t, int, uint8_t *, size_t *, void **); -int inet6_opt_find(void *, size_t, int, uint8_t, size_t *, void **); -int inet6_opt_get_val(void *, size_t, void *, int); -size_t inet6_rth_space(int, int); -void *inet6_rth_init(void *, int, int, int); -int inet6_rth_add(void *, const struct in6_addr *); -int inet6_rth_reverse(const void *, void *); -int inet6_rth_segments(const void *); -struct in6_addr *inet6_rth_getaddr(const void *, int); - -#endif diff --git a/newlib/libc/sys/phoenix/include/netpacket/packet.h b/newlib/libc/sys/phoenix/include/netpacket/packet.h deleted file mode 100644 index 28be5ac..0000000 --- a/newlib/libc/sys/phoenix/include/netpacket/packet.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef NETPACKET_PACKET_H -#define NETPACKET_PACKET_H - -struct sockaddr_ll { - unsigned short int sll_family; - unsigned short int sll_protocol; - int sll_ifindex; - unsigned short int sll_hatype; - unsigned char sll_pkttype; - unsigned char sll_halen; - unsigned char sll_addr[8]; - }; - -#define PACKET_ADD_MEMBERSHIP 1 -#define PACKET_DROP_MEMBERSHIP 2 -#define PACKET_RECV_OUTPUT 3 -#define PACKET_RX_RING 5 -#define PACKET_STATISTICS 6 - -#define PACKET_HOST 0 -#define PACKET_BROADCAST 1 -#define PACKET_MULTICAST 2 -#define PACKET_OTHERHOST 3 -#define PACKET_OUTGOING 4 -#define PACKET_LOOPBACK 5 -#define PACKET_FASTROUTE 6 - -struct packet_mreq { - int mr_ifindex; - unsigned short int mr_type; - unsigned short int mr_alen; - unsigned char mr_address[8]; -}; - -#define PACKET_MR_MULTICAST 0 -#define PACKET_MR_PROMISC 1 -#define PACKET_MR_ALLMULTI 2 - -#endif diff --git a/newlib/libc/sys/phoenix/include/poll.h b/newlib/libc/sys/phoenix/include/poll.h deleted file mode 100644 index 06c4ec5..0000000 --- a/newlib/libc/sys/phoenix/include/poll.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef POLL_H -#define POLL_H - -#include <sys/poll.h> - -#endif diff --git a/newlib/libc/sys/phoenix/include/semaphore.h b/newlib/libc/sys/phoenix/include/semaphore.h deleted file mode 100644 index 4a0438f..0000000 --- a/newlib/libc/sys/phoenix/include/semaphore.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef SEMAPHORE_H -#define SEMAPHORE_H - -#include <time.h> - -/* System specific semaphore definition. */ -typedef struct { - int fd; -} sem_t; - -/* Value returned if `sem_open' failed. */ -#define SEM_FAILED ((sem_t *) 0) - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) - -int sem_init(sem_t *sem, int pshared, unsigned int value); -int sem_destroy(sem_t *sem); -sem_t *sem_open(const char *name, int oflag, ...); -int sem_close(sem_t *sem); -int sem_unlink(const char *name); -int sem_wait(sem_t *sem); -int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout); -int sem_trywait(sem_t *sem); -int sem_post(sem_t *sem); -int sem_getvalue(sem_t * sem, int *sval); - -#endif diff --git a/newlib/libc/sys/phoenix/include/syslog.h b/newlib/libc/sys/phoenix/include/syslog.h deleted file mode 100644 index adf9e1e..0000000 --- a/newlib/libc/sys/phoenix/include/syslog.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef SYSLOG_H -#define SYSLOG_H - -#include <stdlib.h> - -#define LOG_EMERG 0 /* System is unusable */ -#define LOG_ALERT 1 /* Action must be taken immediately */ -#define LOG_CRIT 2 /* Critical conditions */ -#define LOG_ERR 3 /* Error conditions */ -#define LOG_WARNING 4 /* Warning conditions */ -#define LOG_NOTICE 5 /* Normal but significant condition */ -#define LOG_INFO 6 /* Informational */ -#define LOG_DEBUG 7 /* Debug-level messages */ - -#define LOG_PRIMASK 0x07 /* Mask to extract priority part (internal) */ -#define LOG_PRI(p) ((p) & LOG_PRIMASK) /* Extract priority */ -#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) - -#ifdef SYSLOG_NAMES -#define INTERNAL_NOPRI 0x10 /* The "no priority" priority */ -#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) /* Mark "facility" */ -typedef struct _code { - char *c_name; - int c_val; -} CODE; - -CODE prioritynames[] = { - "alert", LOG_ALERT, - "crit", LOG_CRIT, - "debug", LOG_DEBUG, - "emerg", LOG_EMERG, - "err", LOG_ERR, - "error", LOG_ERR, /* DEPRECATED */ - "info", LOG_INFO, - "none", INTERNAL_NOPRI, /* INTERNAL */ - "notice", LOG_NOTICE, - "panic", LOG_EMERG, /* DEPRECATED */ - "warn", LOG_WARNING, /* DEPRECATED */ - "warning", LOG_WARNING, - NULL, -1, -}; -#endif - -/* Facility codes */ -#define LOG_KERN (0 << 3) /* Kernel messages */ -#define LOG_USER (1 << 3) /* Random user-level messages */ -#define LOG_MAIL (2 << 3) /* Mail system */ -#define LOG_DAEMON (3 << 3) /* System daemons */ -#define LOG_AUTH (4 << 3) /* Security/authorization messages */ -#define LOG_SYSLOG (5 << 3) /* Messages generated internally by syslogd */ -#define LOG_LPR (6 << 3) /* Line printer subsystem */ -#define LOG_NEWS (7 << 3) /* Network news subsystem */ -#define LOG_UUCP (8 << 3) /* UUCP subsystem */ -#define LOG_CRON (9 << 3) /* Clock daemon */ -#define LOG_AUTHPRIV (10 << 3) /* Security/authorization messages (private) */ - -/* Other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16 << 3) /* Reserved for local use */ -#define LOG_LOCAL1 (17 << 3) /* Reserved for local use */ -#define LOG_LOCAL2 (18 << 3) /* Reserved for local use */ -#define LOG_LOCAL3 (19 << 3) /* Reserved for local use */ -#define LOG_LOCAL4 (20 << 3) /* Reserved for local use */ -#define LOG_LOCAL5 (21 << 3) /* Reserved for local use */ -#define LOG_LOCAL6 (22 << 3) /* Reserved for local use */ -#define LOG_LOCAL7 (23 << 3) /* Reserved for local use */ - -#define LOG_NFACILITIES 24 /* Current number of facilities */ -#define LOG_FACMASK 0x03f8 /* Mask to extract facility part */ -#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) /* Facility of pri */ - -#ifdef SYSLOG_NAMES -CODE facilitynames[] = { - "auth", LOG_AUTH, - "authpriv", LOG_AUTHPRIV, - "cron", LOG_CRON, - "daemon", LOG_DAEMON, - "kern", LOG_KERN, - "lpr", LOG_LPR, - "mail", LOG_MAIL, - "mark", INTERNAL_MARK, /* INTERNAL */ - "news", LOG_NEWS, - "security", LOG_AUTH, /* DEPRECATED */ - "syslog", LOG_SYSLOG, - "user", LOG_USER, - "uucp", LOG_UUCP, - "local0", LOG_LOCAL0, - "local1", LOG_LOCAL1, - "local2", LOG_LOCAL2, - "local3", LOG_LOCAL3, - "local4", LOG_LOCAL4, - "local5", LOG_LOCAL5, - "local6", LOG_LOCAL6, - "local7", LOG_LOCAL7, - NULL, -1, -}; -#endif - -/* Arguments to setlogmask */ -#define LOG_MASK(pri) (1 << (pri)) /* Mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri) + 1)) - 1) /* All priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything. - * LOG_NDELAY is the inverse of what it used to be. - */ -#define LOG_PID 0x01 /* Log the pid with each message */ -#define LOG_CONS 0x02 /* Log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* Delay open until first syslog() (default) */ -#define LOG_NDELAY 0x08 /* Don't delay open */ -#define LOG_NOWAIT 0x10 /* Don't wait for console forks: DEPRECATED */ -#define LOG_PERROR 0x20 /* Log to stderr as well */ - -void openlog(const char *ident, int option, int facility); -void syslog(int priority, const char *format, ...); -void closelog(); - -#endif diff --git a/newlib/libc/sys/phoenix/include/time.h b/newlib/libc/sys/phoenix/include/time.h deleted file mode 100644 index 41fb137..0000000 --- a/newlib/libc/sys/phoenix/include/time.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef TIME_H -#define TIME_H - -#include <_ansi.h> -#include <phoenix/time.h> -#include <sys/reent.h> -#include <sys/time.h> -#include <sys/types.h> - -extern int _daylight; -extern long _timezone; -extern char *_tzname[2]; - -/* POSIX defines the external tzname being defined in time.h */ -#ifndef tzname -#define tzname _tzname -#endif - -void tzset(); - -clock_t clock(); -int clock_gettime(clockid_t clock_id, struct timespec *tp); -int clock_settime(clockid_t clock_id, const struct timespec *tp); -int clock_getres(clockid_t clock_id, struct timespec *res); - -double difftime(time_t time1, time_t time0); -time_t mktime(struct tm *tm); -time_t time(time_t *t); - -char *asctime(const struct tm *tm); -char *ctime(const time_t *timep); -struct tm *gmtime(const time_t *timep); -struct tm *localtime(const time_t *timep); - -char *asctime_r(const struct tm *tm, char *buf); -char *ctime_r(const time_t *timep, char *buf); -struct tm *gmtime_r(const time_t *timep, struct tm *result); -struct tm *localtime_r(const time_t *timep, struct tm *result); - -size_t strftime(char *s, size_t max, const char *format, const struct tm *tm); - -int nanosleep(const struct timespec *req, struct timespec *rem); - -#endif diff --git a/newlib/libc/sys/phoenix/io.c b/newlib/libc/sys/phoenix/io.c deleted file mode 100644 index 1e059ee..0000000 --- a/newlib/libc/sys/phoenix/io.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <fcntl.h> -#include <stdarg.h> -#include <sys/stat.h> -#include <sys/types.h> - -int open(const char *pathname, int flags, ...) -{ - int mode = S_IFREG | S_IRWXUGO; - - if (flags & O_CREAT) { - va_list arg; - va_start(arg, flags); - mode = va_arg(arg, int); - va_end(arg); - } - - int ret = syscall3(int, SYS_OPEN, pathname, flags, mode); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -ssize_t read(int fd, void *buf, size_t count) -{ - int ret = syscall3(int, SYS_READ, fd, buf, count); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -ssize_t write(int fd, const void *buf, size_t count) -{ - int ret = syscall3(int, SYS_WRITE, fd, buf, count); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -off_t lseek(int fd, off_t offset, int whence) -{ - int ret = syscall3(int, SYS_LSEEK, fd, offset, whence); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int close(int fd) -{ - int ret = syscall1(int, SYS_CLOSE, fd); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int _close(int fd) -{ - return close(fd); -} diff --git a/newlib/libc/sys/phoenix/ioctl.c b/newlib/libc/sys/phoenix/ioctl.c deleted file mode 100644 index 4971606..0000000 --- a/newlib/libc/sys/phoenix/ioctl.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <stdarg.h> - -int ioctl(int d, int request, ...) -{ - va_list ap; - va_start(ap, request); - int ret = syscall3(int, SYS_IOCTL, d, request, va_arg(ap, void *)); - va_end(ap); - - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/machine/arm/Makefile.inc b/newlib/libc/sys/phoenix/machine/arm/Makefile.inc deleted file mode 100644 index 01d45d7..0000000 --- a/newlib/libc/sys/phoenix/machine/arm/Makefile.inc +++ /dev/null @@ -1 +0,0 @@ -libc_a_SOURCES += %D%/syscall.S diff --git a/newlib/libc/sys/phoenix/machine/arm/crt0.S b/newlib/libc/sys/phoenix/machine/arm/crt0.S deleted file mode 100644 index 0ab7da6..0000000 --- a/newlib/libc/sys/phoenix/machine/arm/crt0.S +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - - .syntax unified - .section .text, "ax" - .global _start - .global main - .global exit - .global environ - .global __progname - - .align 4 - -_start: - /* Ignore return address passed on the top of stack. */ - pop {lr} - ldmfd sp, {r0-r2} - ldr r3, =environ - ldr r4, =__progname - ldr r5, [r1] - str r2, [r3] - str r5, [r4] - - /* Align stack. */ - bic sp, #0x00000007 - ldr lr, =main - blx lr - ldr lr, =exit - blx lr - - .section .data -__progname: - .word 0
\ No newline at end of file diff --git a/newlib/libc/sys/phoenix/machine/arm/syscall.S b/newlib/libc/sys/phoenix/machine/arm/syscall.S deleted file mode 100644 index a773249..0000000 --- a/newlib/libc/sys/phoenix/machine/arm/syscall.S +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - - .thumb - .syntax unified - .section .text, "ax" - .global _syscall5 - .global _syscall3 - .global hal_cpuRestoreCtx - - .type _syscall5, %function - .func _syscall5 - -_syscall5: - push {r4, r5} - ldr r4, [sp, #8] - ldr r5, [sp, #12] - svc #255 - pop {r4, r5} - bx lr - .endfunc - - .type _syscall3, %function - .func _syscall3 - -_syscall3: - svc #255 - bx lr - .endfunc - - .end diff --git a/newlib/libc/sys/phoenix/mmap.c b/newlib/libc/sys/phoenix/mmap.c deleted file mode 100644 index ea71307..0000000 --- a/newlib/libc/sys/phoenix/mmap.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <malloc.h> -#include <sys/mman.h> -#include <sys/stat.h> -#include <unistd.h> - -void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) -{ - void *ret = NULL; - MmapArg_t arg = { - .fd = fd, - .addr = addr, - .pflags = prot, - .mflags = flags, - .offs = offset, - .len = length, - .raddr = &ret - }; - - struct stat st; - if (fstat(fd, &st) < 0) - return NULL; - - if (st.st_mode & S_IFREG) { - if (prot != PROT_READ) { - errno = ENOSYS; - return MAP_FAILED; - } - - if ((ret = malloc(length)) == 0) { - errno = ENOMEM; - return MAP_FAILED; - } - - if (pread(fd, ret, length, offset) < 0) { - free(ret); - return MAP_FAILED; - } - } - else { - int err = syscall1(int, SYS_MMAP, &arg); - if(err < 0) { - errno = -err; - return MAP_FAILED; - } - } - - return ret; -} - -int munmap(void *addr, size_t length) -{ - int ret = syscall2(int, SYS_MUNMAP, addr, length); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/mount.c b/newlib/libc/sys/phoenix/mount.c deleted file mode 100644 index 859c8ec..0000000 --- a/newlib/libc/sys/phoenix/mount.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data) -{ - int ret = syscall5(int, SYS_MOUNT, source, target, filesystemtype, mountflags, data); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int umount2(const char *target, int flags) -{ - int ret = syscall2(int, SYS_UMOUNT, target, flags); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int umount(const char *target) -{ - return umount2(target, 0); -} diff --git a/newlib/libc/sys/phoenix/nanosleep.c b/newlib/libc/sys/phoenix/nanosleep.c deleted file mode 100644 index 0424233..0000000 --- a/newlib/libc/sys/phoenix/nanosleep.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/time.h> -#include <sys/types.h> - -int nanosleep(const struct timespec *req, struct timespec *rem) -{ - int ret = syscall2(int, SYS_NANOSLEEP, req, rem); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/net/domainname.c b/newlib/libc/sys/phoenix/net/domainname.c deleted file mode 100644 index 12ed1fe..0000000 --- a/newlib/libc/sys/phoenix/net/domainname.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -#define NAME_GET 0 -#define NAME_SET 1 - -int getdomainname(char *name, size_t len) -{ - int ret = syscall3(int, SYS_DOMAINNAME, name, len, NAME_GET); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int setdomainname(const char *name, size_t len) -{ - int ret = syscall3(int, SYS_DOMAINNAME, name, len, NAME_SET); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/net/freeaddrinfo.c b/newlib/libc/sys/phoenix/net/freeaddrinfo.c deleted file mode 100644 index 19b8bd7..0000000 --- a/newlib/libc/sys/phoenix/net/freeaddrinfo.c +++ /dev/null @@ -1,52 +0,0 @@ -/* The Inner Net License, Version 2.00 - - The author(s) grant permission for redistribution and use in source and -binary forms, with or without modification, of the software and documentation -provided that the following conditions are met: - -0. If you receive a version of the software that is specifically labelled - as not being for redistribution (check the version message and/or README), - you are not permitted to redistribute that version of the software in any - way or form. -1. All terms of the all other applicable copyrights and licenses must be - followed. -2. Redistributions of source code must retain the authors' copyright - notice(s), this list of conditions, and the following disclaimer. -3. Redistributions in binary form must reproduce the authors' copyright - notice(s), this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. -4. [The copyright holder has authorized the removal of this clause.] -5. Neither the name(s) of the author(s) nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - If these license terms cause you a real problem, contact the author. */ - -/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <malloc.h> -#include <netdb.h> -#include <stdio.h> - -void freeaddrinfo(struct addrinfo *res) -{ - while (res != NULL) { - struct addrinfo *p = res; - res = res->ai_next; - free(p->ai_canonname); - free(p); - } -} diff --git a/newlib/libc/sys/phoenix/net/getaddrinfo.c b/newlib/libc/sys/phoenix/net/getaddrinfo.c deleted file mode 100644 index ad9166d..0000000 --- a/newlib/libc/sys/phoenix/net/getaddrinfo.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Mar 8, 2000 by Hajimu UMEMOTO <ume@mahoroba.org> - * $Id: getaddrinfo.c,v 1.2 2002/05/22 17:56:56 snsimon Exp $ - * - * This module is besed on ssh-1.2.27-IPv6-1.5 written by - * KIKUCHI Takahiro <kick@kyoto.wide.ad.jp> - */ -/* - * Copyright (c) 2001 Carnegie Mellon University. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The name "Carnegie Mellon University" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For permission or any other legal - * details, please contact - * Office of Technology Transfer - * Carnegie Mellon University - * 5000 Forbes Avenue - * Pittsburgh, PA 15213-3890 - * (412) 268-4387, fax: (412) 268-7395 - * tech-transfer@andrew.cmu.edu - * - * 4. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by Computing Services - * at Carnegie Mellon University (http://www.cmu.edu/computing/)." - * - * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * fake library for ssh - * - * This file includes getaddrinfo(), freeaddrinfo() and gai_strerror(). - * These funtions are defined in rfc2133. - * - * But these functions are not implemented correctly. The minimum subset - * is implemented for ssh use only. For example, this routine assumes - * that ai_family is AF_INET. Don't use it for another purpose. - * - * In the case not using 'configure --enable-ipv6', this getaddrinfo.c - * will be used if you have broken getaddrinfo or no getaddrinfo. - */ - -#include <arpa/inet.h> -#include <ctype.h> -#include <errno.h> -#include <netdb.h> -#include <netinet/in.h> -#include <stdlib.h> -#include <string.h> -#include <sys/socket.h> - -static struct addrinfo *malloc_ai(int port, u_long addr, int socktype, int proto) -{ - struct addrinfo *ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); - if (ai) { - memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); - ai->ai_addr = (struct sockaddr *)(ai + 1); - /* XXX -- ssh doesn't use sa_len */ - ai->ai_addrlen = sizeof(struct sockaddr_in); -#ifdef HAVE_SOCKADDR_SA_LEN - ai->ai_addr->sa_len = sizeof(struct sockaddr_in); -#endif - ai->ai_addr->sa_family = ai->ai_family = AF_INET; - ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; - ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; - ai->ai_socktype = socktype; - ai->ai_protocol = proto; - return ai; - } - - return NULL; -} - -int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) -{ - struct addrinfo *cur, *prev = NULL; - struct hostent *hp; - struct in_addr in; - int i, port = 0, socktype, proto; - - if (hints && hints->ai_family != PF_INET && hints->ai_family != PF_UNSPEC) - return EAI_FAMILY; - - socktype = (hints && hints->ai_socktype) ? hints->ai_socktype : SOCK_STREAM; - if (hints && hints->ai_protocol) - proto = hints->ai_protocol; - else { - switch (socktype) { - case SOCK_DGRAM: - proto = IPPROTO_UDP; - break; - case SOCK_STREAM: - proto = IPPROTO_TCP; - break; - default: - proto = 0; - break; - } - } - - if (service) { - if (isdigit((int)*service)) - port = htons(atoi(service)); - else { - struct servent *se; - char *pe_proto; - - switch (socktype) { - case SOCK_DGRAM: - pe_proto = "udp"; - break; - case SOCK_STREAM: - pe_proto = "tcp"; - break; - default: - pe_proto = NULL; - break; - } - if ((se = getservbyname(service, pe_proto)) == NULL) - return EAI_SERVICE; - - port = se->s_port; - } - } - if (!node) { - if (hints && hints->ai_flags & AI_PASSIVE) - *res = malloc_ai(port, htonl(0x00000000), socktype, proto); - else - *res = malloc_ai(port, htonl(0x7f000001), socktype, proto); - if (*res) - return 0; - else - return EAI_MEMORY; - } - if (inet_aton(node, &in)) { - *res = malloc_ai(port, in.s_addr, socktype, proto); - if (*res) - return 0; - else - return EAI_MEMORY; - } - if (hints && hints->ai_flags & AI_NUMERICHOST) - return EAI_NODATA; - if ((hp = gethostbyname(node)) && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { - for (i = 0; hp->h_addr_list[i]; i++) { - if ((cur = malloc_ai(port, ((struct in_addr *)hp->h_addr_list[i])->s_addr, socktype, proto)) == NULL) { - if (*res) - freeaddrinfo(*res); - return EAI_MEMORY; - } - if (prev) - prev->ai_next = cur; - else - *res = cur; - prev = cur; - } - if (hints && hints->ai_flags & AI_CANONNAME && *res) { - /* NOT sasl_strdup for compatibility */ - if (((*res)->ai_canonname = strdup(hp->h_name)) == NULL) { - freeaddrinfo(*res); - return EAI_MEMORY; - } - } - return 0; - } - return EAI_NODATA; -} diff --git a/newlib/libc/sys/phoenix/net/gethostbyaddr.c b/newlib/libc/sys/phoenix/net/gethostbyaddr.c deleted file mode 100644 index 0a40a44..0000000 --- a/newlib/libc/sys/phoenix/net/gethostbyaddr.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <netdb.h> - -struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} diff --git a/newlib/libc/sys/phoenix/net/gethostbyname.c b/newlib/libc/sys/phoenix/net/gethostbyname.c deleted file mode 100644 index a7dbe6a..0000000 --- a/newlib/libc/sys/phoenix/net/gethostbyname.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <netdb.h> - -struct hostent *gethostbyname(const char *name) -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} diff --git a/newlib/libc/sys/phoenix/net/getnameinfo.c b/newlib/libc/sys/phoenix/net/getnameinfo.c deleted file mode 100644 index db670f7..0000000 --- a/newlib/libc/sys/phoenix/net/getnameinfo.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <netdb.h> - -int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags) -{ - /* TODO: implement. */ - errno = ENOSYS; - return EAI_SYSTEM; -} diff --git a/newlib/libc/sys/phoenix/net/getservbyname.c b/newlib/libc/sys/phoenix/net/getservbyname.c deleted file mode 100644 index 97ac465..0000000 --- a/newlib/libc/sys/phoenix/net/getservbyname.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <netdb.h> - -struct servent *getservbyname(const char *name, const char *proto) -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} diff --git a/newlib/libc/sys/phoenix/net/getservbyport.c b/newlib/libc/sys/phoenix/net/getservbyport.c deleted file mode 100644 index ac23fc8..0000000 --- a/newlib/libc/sys/phoenix/net/getservbyport.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <netdb.h> - -struct servent *getservbyport(int port, const char *proto) -{ - /* TODO: implement. */ - errno = ENOSYS; - return NULL; -} diff --git a/newlib/libc/sys/phoenix/net/herror.c b/newlib/libc/sys/phoenix/net/herror.c deleted file mode 100644 index f45ae65..0000000 --- a/newlib/libc/sys/phoenix/net/herror.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <netdb.h> -#include <reent.h> - -const char *hstrerror(int err) -{ - errno = ENOSYS; - return NULL; -} - -int *__h_errno_location() -{ - return &(_REENT->_new._reent._h_errno); -} diff --git a/newlib/libc/sys/phoenix/net/hostname.c b/newlib/libc/sys/phoenix/net/hostname.c deleted file mode 100644 index 280750b..0000000 --- a/newlib/libc/sys/phoenix/net/hostname.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -#define NAME_GET 0 -#define NAME_SET 1 - -int gethostname(char *name, size_t len) -{ - int ret = syscall3(int, SYS_HOSTNAME, name, len, NAME_GET); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int sethostname(const char *name, size_t len) -{ - int ret = syscall3(int, SYS_HOSTNAME, name, len, NAME_SET); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/net/inet_addr.c b/newlib/libc/sys/phoenix/net/inet_addr.c deleted file mode 100644 index 23b2cc2..0000000 --- a/newlib/libc/sys/phoenix/net/inet_addr.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $KAME: inet_addr.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ - -/* - * ++Copyright++ 1983, 1990, 1993 - * - - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> - -in_addr_t inet_addr(const char *cp) -{ - struct in_addr val; - - if (inet_aton(cp, &val)) - return val.s_addr; - - return INADDR_NONE; -} diff --git a/newlib/libc/sys/phoenix/net/inet_aton.c b/newlib/libc/sys/phoenix/net/inet_aton.c deleted file mode 100644 index aa6c1de..0000000 --- a/newlib/libc/sys/phoenix/net/inet_aton.c +++ /dev/null @@ -1,163 +0,0 @@ -/* $KAME: inet_addr.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ - -/* - * ++Copyright++ 1983, 1990, 1993 - * - - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <ctype.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdlib.h> - -int inet_aton(const char *cp, struct in_addr *inp) -{ - u_long parts[4]; - in_addr_t val; - char *c; - char *endptr; - int gotend, n; - c = (char *)cp; - n = 0; - /* - * Run through the string, grabbing numbers until - * the end of the string, or some error - */ - gotend = 0; - - while (!gotend) { - errno = 0; - val = strtoul(c, &endptr, 0); - - if (errno == ERANGE) /* Fail completely if it overflowed. */ - return 0; - - /* - * If the whole string is invalid, endptr will equal - * c.. this way we can make sure someone hasn't - * gone '.12' or something which would get past - * the next check. - */ - if (endptr == c) - return 0; - - parts[n] = val; - c = endptr; - - /* Check the next character past the previous number's end */ - switch (*c) { - case '.': - - /* Make sure we only do 3 dots .. */ - if (n == 3) /* Whoops. Quit. */ - return 0; - - n++; - c++; - break; - - case '\0': - gotend = 1; - break; - - default: - if (isspace((unsigned char)*c)) { - gotend = 1; - break; - } - - else - return 0; /* Invalid character, so fail */ - } - } - - /* - * Concoct the address according to - * the number of parts specified. - */ - - switch (n) { - case 0: /* a -- 32 bits */ - /* - * Nothing is necessary here. Overflow checking was - * already done in strtoul(). - */ - break; - - case 1: /* a.b -- 8.24 bits */ - if (val > 0xffffff || parts[0] > 0xff) - return 0; - - val |= parts[0] << 24; - break; - - case 2: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff) - return 0; - - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 3: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff || - parts[2] > 0xff) - return 0; - - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - - if (inp != NULL) - inp->s_addr = htonl(val); - - return 1; -} diff --git a/newlib/libc/sys/phoenix/net/inet_lnaof.c b/newlib/libc/sys/phoenix/net/inet_lnaof.c deleted file mode 100644 index 8af1e22..0000000 --- a/newlib/libc/sys/phoenix/net/inet_lnaof.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <netinet/in.h> -#include <sys/param.h> - -in_addr_t inet_lnaof(struct in_addr in) -{ - register u_int32_t i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return (i) & IN_CLASSA_HOST; - else if (IN_CLASSB(i)) - return (i) & IN_CLASSB_HOST; - else - return (i) & IN_CLASSC_HOST; -} diff --git a/newlib/libc/sys/phoenix/net/inet_makeaddr.c b/newlib/libc/sys/phoenix/net/inet_makeaddr.c deleted file mode 100644 index 5af4541..0000000 --- a/newlib/libc/sys/phoenix/net/inet_makeaddr.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <netinet/in.h> -#include <sys/param.h> - -struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host) -{ - struct in_addr in; - - if (net < 128) - in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); - else if (net < 65536) - in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); - else if (net < 16777216L) - in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); - else - in.s_addr = net | host; - - in.s_addr = htonl(in.s_addr); - return in; -} diff --git a/newlib/libc/sys/phoenix/net/inet_net_ntop.c b/newlib/libc/sys/phoenix/net/inet_net_ntop.c deleted file mode 100644 index 7b25143..0000000 --- a/newlib/libc/sys/phoenix/net/inet_net_ntop.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* Author: Paul Vixie (ISC), July 1996 */ -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdio.h> -#include <sys/types.h> - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -static char *inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) -{ - char *odst = dst; - char *t; - u_int m; - int b; - - if (bits < 0 || bits > 32) { - errno = EINVAL; - return (NULL); - } - - if (bits == 0) { - if (size < sizeof "0") - goto emsgsize; - - *dst++ = '0'; - *dst = '\0'; - } - - /* Format whole octets. */ - for (b = bits / 8; b > 0; b--) { - if (size < sizeof "255.") - goto emsgsize; - - t = dst; - dst += SPRINTF((dst, "%u", *src++)); - - if (b > 1) { - *dst++ = '.'; - *dst = '\0'; - } - - size -= (size_t)(dst - t); - } - - /* Format partial octet. */ - b = bits % 8; - - if (b > 0) { - if (size < sizeof ".255") - goto emsgsize; - - t = dst; - - if (dst != odst) - *dst++ = '.'; - - m = ((1 << b) - 1) << (8 - b); - dst += SPRINTF((dst, "%u", *src & m)); - size -= (size_t)(dst - t); - } - - /* Format CIDR /width. */ - if (size < sizeof "/32") - goto emsgsize; - - dst += SPRINTF((dst, "/%u", bits)); - return (odst); -emsgsize: - errno = EMSGSIZE; - return (NULL); -} - -char *inet_net_ntop(int af, const void *netp, int bits, char *pres, size_t psize) -{ - switch (af) { - case AF_INET: - return inet_net_ntop_ipv4(netp, bits, pres, psize); - - default: - errno = EAFNOSUPPORT; - return NULL; - } -} diff --git a/newlib/libc/sys/phoenix/net/inet_net_pton.c b/newlib/libc/sys/phoenix/net/inet_net_pton.c deleted file mode 100644 index 071ada9..0000000 --- a/newlib/libc/sys/phoenix/net/inet_net_pton.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* Author: Paul Vixie (ISC), June 1996 */ -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <assert.h> -#include <ctype.h> -#include <errno.h> -#include <netinet/in.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/types.h> - -static int inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) -{ - static const char xdigits[] = "0123456789abcdef"; - static const char digits[] = "0123456789"; - int n, ch, tmp, dirty, bits; - const u_char *odst = dst; - ch = *src++; - - if (ch == '0' && (src[0] == 'x' || src[0] == 'X') && isascii(src[1]) && isxdigit(src[1])) { - /* Hexadecimal: Eat nybble string. */ - if (size <= 0) - goto emsgsize; - - *dst = 0, dirty = 0; - src++; /* skip x or X. */ - - while ((ch = *src++) != '\0' && - isascii(ch) && isxdigit(ch)) { - if (isupper(ch)) - ch = tolower(ch); - - n = strchr(xdigits, ch) - xdigits; - assert(n >= 0 && n <= 15); - *dst |= n; - - if (!dirty++) - *dst <<= 4; - - else - if (size-- > 0) - *++dst = 0, dirty = 0; - - else - goto emsgsize; - } - - if (dirty) - size--; - } - else { - if (isascii(ch) && isdigit(ch)) { - /* Decimal: eat dotted digit string. */ - for (;;) { - tmp = 0; - - do { - n = strchr(digits, ch) - digits; - assert(n >= 0 && n <= 9); - tmp *= 10; - tmp += n; - - if (tmp > 255) - goto enoent; - } - while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); - - if (size-- <= 0) - goto emsgsize; - - *dst++ = (u_char) tmp; - - if (ch == '\0' || ch == '/') - break; - - if (ch != '.') - goto enoent; - - ch = *src++; - - if (!isascii(ch) || !isdigit(ch)) - goto enoent; - } - } - else - goto enoent; - } - - bits = -1; - - if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { - /* CIDR width specifier. Nothing can follow it. */ - ch = *src++; /* Skip over the /. */ - bits = 0; - - do { - n = strchr(digits, ch) - digits; - assert(n >= 0 && n <= 9); - bits *= 10; - bits += n; - } - while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); - - if (ch != '\0') - goto enoent; - - if (bits > 32) - goto emsgsize; - } - - /* Firey death and destruction unless we prefetched EOS. */ - if (ch != '\0') - goto enoent; - - /* If nothing was written to the destination, we found no address. */ - if (dst == odst) - goto enoent; - - /* If no CIDR spec was given, infer width from net class. */ - if (bits == -1) { - if (*odst >= 240) /* Class E */ - bits = 32; - - else - if (*odst >= 224) /* Class D */ - bits = 4; - - else - if (*odst >= 192) /* Class C */ - bits = 24; - - else - if (*odst >= 128) /* Class B */ - bits = 16; - - else /* Class A */ - bits = 8; - - /* If imputed mask is narrower than specified octets, widen. */ - if (bits >= 8 && bits < ((dst - odst) * 8)) - bits = (dst - odst) * 8; - } - - /* Extend network to cover the actual mask. */ - while (bits > ((dst - odst) * 8)) { - if (size-- <= 0) - goto emsgsize; - - *dst++ = '\0'; - } - - return (bits); -enoent: - errno = ENOENT; - return -1; - -emsgsize: - errno = EMSGSIZE; - return -1; -} - -int inet_net_pton(int af, const char *pres, void *netp, size_t nsize) -{ - switch (af) { - case AF_INET: - return inet_net_pton_ipv4(pres, netp, nsize); - - default: - errno = EAFNOSUPPORT; - return -1; - } -} diff --git a/newlib/libc/sys/phoenix/net/inet_netof.c b/newlib/libc/sys/phoenix/net/inet_netof.c deleted file mode 100644 index b92ce20..0000000 --- a/newlib/libc/sys/phoenix/net/inet_netof.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <netinet/in.h> -#include <sys/param.h> - -in_addr_t inet_netof(struct in_addr in) -{ - register u_int32_t i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return ((i) & IN_CLASSA_NET) >> IN_CLASSA_NSHIFT; - else if (IN_CLASSB(i)) - return ((i) & IN_CLASSB_NET) >> IN_CLASSB_NSHIFT; - else - return ((i) & IN_CLASSC_NET) >> IN_CLASSC_NSHIFT; -} diff --git a/newlib/libc/sys/phoenix/net/inet_network.c b/newlib/libc/sys/phoenix/net/inet_network.c deleted file mode 100644 index 831b8ee..0000000 --- a/newlib/libc/sys/phoenix/net/inet_network.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <ctype.h> -#include <netinet/in.h> -#include <sys/types.h> - -in_addr_t inet_network(const char *cp) -{ - register u_int32_t val, base, n, i; - register char c; - u_int32_t parts[4], *pp = parts; - int digit; - -again: - val = 0; - base = 10; - digit = 0; - - if (*cp == '0') - digit = 1, base = 8, cp++; - - if (*cp == 'x' || *cp == 'X') - base = 16, cp++; - - while ((c = *cp) != 0) { - if (isdigit(c)) { - if (base == 8 && (c == '8' || c == '9')) - return INADDR_NONE; - - val = (val * base) + (c - '0'); - cp++; - digit = 1; - continue; - } - - if (base == 16 && isxdigit(c)) { - val = (val << 4) + (tolower (c) + 10 - 'a'); - cp++; - digit = 1; - continue; - } - - break; - } - - if (!digit) - return INADDR_NONE; - - if (pp >= parts + 4 || val > 0xff) - return INADDR_NONE; - - if (*cp == '.') { - *pp++ = val, cp++; - goto again; - } - - if (*cp && !isspace(*cp)) - return INADDR_NONE; - - if (pp >= parts + 4 || val > 0xff) - return INADDR_NONE; - - *pp++ = val; - n = pp - parts; - - for (val = 0, i = 0; i < n; i++) { - val <<= 8; - val |= parts[i] & 0xff; - } - - return val; -} diff --git a/newlib/libc/sys/phoenix/net/inet_ntoa.c b/newlib/libc/sys/phoenix/net/inet_ntoa.c deleted file mode 100644 index 211049c..0000000 --- a/newlib/libc/sys/phoenix/net/inet_ntoa.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <stdio.h> -#include <arpa/inet.h> - -static char static_buffer[18]; - -char *inet_ntoa(struct in_addr in) -{ - unsigned char *bytes = (unsigned char *) ∈ - snprintf(static_buffer, sizeof(static_buffer), "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]); - return static_buffer; -} diff --git a/newlib/libc/sys/phoenix/net/inet_ntop.c b/newlib/libc/sys/phoenix/net/inet_ntop.c deleted file mode 100644 index 5ad0711..0000000 --- a/newlib/libc/sys/phoenix/net/inet_ntop.c +++ /dev/null @@ -1,171 +0,0 @@ -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* Author: Paul Vixie, 1996 */ -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <arpa/nameser.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdio.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/types.h> - -#define SPRINTF(x) ((socklen_t) sprintf x) - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size) -{ - static const char fmt[] = "%u.%u.%u.%u"; - char tmp[sizeof "255.255.255.255"]; - - if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { - errno = ENOSPC; - return NULL; - } - - strcpy(dst, tmp); - return dst; -} - -static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")], *tp; - struct { - int base, len; - } best, cur; - u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; - int i; - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof words); - - for (i = 0; i < NS_IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - - best.base = -1; - cur.base = -1; - - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - if (words[i] == 0) { - if (cur.base == -1) - cur.base = i, cur.len = 1; - - else - cur.len++; - } - - else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - - cur.base = -1; - } - } - } - - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) - *tp++ = ':'; - - continue; - } - - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *tp++ = ':'; - - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src + 12, tp, sizeof tmp - (tp - tmp))) - return NULL; - - tp += strlen(tp); - break; - } - - tp += SPRINTF((tp, "%x", words[i])); - } - - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == - (NS_IN6ADDRSZ / NS_INT16SZ)) - *tp++ = ':'; - - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((socklen_t)(tp - tmp) > size) { - errno = ENOSPC; - return NULL; - } - - strcpy(dst, tmp); - return dst; -} - -const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) -{ - switch (af) { - case AF_INET: - return inet_ntop4(src, dst, size); - - case AF_INET6: - return inet_ntop6(src, dst, size); - - default: - errno = EAFNOSUPPORT; - return NULL; - } - - /* NOTREACHED */ -} diff --git a/newlib/libc/sys/phoenix/net/inet_pton.c b/newlib/libc/sys/phoenix/net/inet_pton.c deleted file mode 100644 index 3b3296a..0000000 --- a/newlib/libc/sys/phoenix/net/inet_pton.c +++ /dev/null @@ -1,198 +0,0 @@ -/* $KAME: inet_pton.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ - -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* Author: Paul Vixie, 1996 */ -/* Copied from Linux, modified for Phoenix-RTOS. */ - -#include <arpa/inet.h> -#include <arpa/nameser.h> -#include <errno.h> -#include <netinet/in.h> -#include <string.h> -#include <sys/types.h> - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4(const char *src, u_char *dst) -{ - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - u_char tmp[NS_INADDRSZ], *tp; - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr(digits, ch)) != NULL) { - u_int new = *tp * 10 + (pch - digits); - - if (new > 255) - return 0; - - *tp = new; - - if (! saw_digit) { - if (++octets > 4) - return 0; - - saw_digit = 1; - } - } - - else - if (ch == '.' && saw_digit) { - if (octets == 4) - return 0; - - *++tp = 0; - saw_digit = 0; - } - - else - return 0; - } - - if (octets < 4) - return 0; - - memcpy(dst, tmp, NS_INADDRSZ); - return 1; -} - -static int inet_pton6(const char *src, u_char *dst) -{ - static const char xdigits_l[] = "0123456789abcdef"; - static const char xdigits_u[] = "0123456789ABCDEF"; - u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - u_int val; - - memset((tp = tmp), '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; - - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return 0; - - curtok = src; - saw_xdigit = 0; - val = 0; - - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - - if (val > 0xffff) - return 0; - - saw_xdigit = 1; - continue; - } - - if (ch == ':') { - curtok = src; - - if (!saw_xdigit) { - if (colonp) - return 0; - - colonp = tp; - continue; - } - - if (tp + NS_INT16SZ > endp) - return 0; - - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += NS_INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - - return 0; - } - - if (saw_xdigit) { - if (tp + NS_INT16SZ > endp) - return 0; - - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - } - - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - - tp = endp; - } - - if (tp != endp) - return 0; - - memcpy(dst, tmp, NS_IN6ADDRSZ); - return 1; -} - -int inet_pton(int af, const char *src, void *dst) -{ - switch (af) { - case AF_INET: - return inet_pton4(src, dst); - - case AF_INET6: - return inet_pton6(src, dst); - - default: - errno = EAFNOSUPPORT; - return -1; - } - - /* NOTREACHED */ -} diff --git a/newlib/libc/sys/phoenix/net/nametoindex.c b/newlib/libc/sys/phoenix/net/nametoindex.c deleted file mode 100644 index b11b10f..0000000 --- a/newlib/libc/sys/phoenix/net/nametoindex.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <stdio.h> -#include <string.h> - -unsigned int if_nametoindex(const char *ifname) -{ - if (strcmp(ifname, "eth0") != 0) { - errno = EINVAL; - return 0; - } - - return 1; -} - -char *if_indextoname(unsigned int ifindex, char *ifname) -{ - if (ifindex != 1) { - errno = ENXIO; - return NULL; - } - - strcpy(ifname, "eth0"); - return ifname; -} diff --git a/newlib/libc/sys/phoenix/net/network.c b/newlib/libc/sys/phoenix/net/network.c deleted file mode 100644 index 2f49574..0000000 --- a/newlib/libc/sys/phoenix/net/network.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -int network_setUp(const char *interface) -{ - int ret = syscall2(int, SYS_NET_CONFIGURE, interface, 1); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int network_setDown(const char *interface) -{ - int ret = syscall2(int, SYS_NET_CONFIGURE, interface, 0); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/phoenix.c b/newlib/libc/sys/phoenix/phoenix.c deleted file mode 100644 index 8d57546..0000000 --- a/newlib/libc/sys/phoenix/phoenix.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ diff --git a/newlib/libc/sys/phoenix/pid.c b/newlib/libc/sys/phoenix/pid.c deleted file mode 100644 index 09b2636..0000000 --- a/newlib/libc/sys/phoenix/pid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <sys/types.h> - -pid_t getpid() -{ - return syscall0(int, SYS_GETPID); -} - -pid_t getppid() -{ - return syscall0(int, SYS_GETPPID); -} diff --git a/newlib/libc/sys/phoenix/pipe.c b/newlib/libc/sys/phoenix/pipe.c deleted file mode 100644 index 4743362..0000000 --- a/newlib/libc/sys/phoenix/pipe.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -int pipe(int pipefd[2]) -{ - int ret = syscall1(int, SYS_PIPE, pipefd); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/poll.c b/newlib/libc/sys/phoenix/poll.c deleted file mode 100644 index f15e1ca..0000000 --- a/newlib/libc/sys/phoenix/poll.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <poll.h> - -int poll(struct pollfd *fds, nfds_t nfds, int timeout) -{ - int ret = syscall3(int, SYS_POLL, fds, nfds, timeout); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/realpath.c b/newlib/libc/sys/phoenix/realpath.c deleted file mode 100644 index 0727402..0000000 --- a/newlib/libc/sys/phoenix/realpath.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Written 2000 by Werner Almesberger */ - -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <sys/dirent.h> -#include <sys/stat.h> -#include <unistd.h> - -static int resolve_path(char *path, char *result, char *pos) -{ - if (*path == '/') { - *result = '/'; - pos = result+1; - ++path; - } - - *pos = 0; - if (!*path) - return 0; - - while (1) { - struct stat st; - - char *slash = *path ? strchr(path,'/') : NULL; - if (slash) - *slash = 0; - - if (!path[0] || (path[0] == '.' && (!path[1] || (path[1] == '.' && !path[2])))) { - --pos; - if (pos != result && path[0] && path[1]) - while (*--pos != '/'); - } - else { - strcpy(pos,path); - if (lstat(result,&st) < 0) - return -1; - - if (S_ISLNK(st.st_mode)) { - char buf[PATH_MAX_SIZE]; - - if (readlink(result,buf,sizeof(buf)) < 0) - return -1; - - *pos = 0; - if (slash) { - *slash = '/'; - strcat(buf, slash); - } - - strcpy(path,buf); - if (*path == '/') - result[1] = 0; - - pos = strchr(result,0); - continue; - } - - pos = strchr(result,0); - } - - if (slash) { - *pos++ = '/'; - path = slash + 1; - } - - *pos = 0; - if (!slash) - break; - } - - return 0; -} - -char *realpath(const char *path, char *resolved_path) -{ - char cwd[PATH_MAX_SIZE]; - char *path_copy; - int res; - - if (!*path) { - errno = ENOENT; - return NULL; - } - - if (!getcwd(cwd, sizeof(cwd))) - return NULL; - - strcpy(resolved_path, "/"); - if (resolve_path(cwd, resolved_path, resolved_path)) - return NULL; - - strcat(resolved_path, "/"); - path_copy = strdup(path); - if (!path_copy) - return NULL; - - res = resolve_path(path_copy, resolved_path, strchr(resolved_path, 0)); - free(path_copy); - if (res) - return NULL; - - return resolved_path; -} diff --git a/newlib/libc/sys/phoenix/reboot.c b/newlib/libc/sys/phoenix/reboot.c deleted file mode 100644 index 4769d78..0000000 --- a/newlib/libc/sys/phoenix/reboot.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -int reboot(int how) -{ - int ret = syscall1(int, SYS_REBOOT, how); - if(ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/resource.c b/newlib/libc/sys/phoenix/resource.c deleted file mode 100644 index 12ba5b2..0000000 --- a/newlib/libc/sys/phoenix/resource.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sched.h> -#include <sys/resource.h> -#include <sys/sched.h> -#include <sys/types.h> - -int getpriority(int which, id_t who) -{ - struct sched_param param; - if (which != PRIO_PROCESS) { - errno = ENOSYS; - return -1; - } - - int ret = sched_getparam(who, ¶m); - if (ret < 0) { - errno = -ret; - return -1; - } - - errno = EOK; - return param.sched_priority; -} - -int setpriority(int which, id_t who, int prio) -{ - struct sched_param param; - if (which != PRIO_PROCESS) { - errno = ENOSYS; - return -1; - } - - param.sched_priority = prio; - int ret = sched_setparam(who, ¶m); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int getrlimit(int resource, struct rlimit *rlim) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int setrlimit(int resource, const struct rlimit *rlim) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int getrusage(int who, struct rusage *usage) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/phoenix/sbrk.c b/newlib/libc/sys/phoenix/sbrk.c deleted file mode 100644 index 64fba4d..0000000 --- a/newlib/libc/sys/phoenix/sbrk.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <stdint.h> - -extern const char _end[]; /* Defined by the linker */ - -void *sbrk(intptr_t increment) -{ - static char *heap_end = (char *) _end; - char *prev_heap_end = heap_end; - - if (increment != 0) { - int ret= syscall2(int, SYS_SBRK, increment, heap_end); - if (ret != 0) { - errno = -ret; - return (void *) -1; - } - - heap_end += increment; - } - - return (void *) prev_heap_end; -} diff --git a/newlib/libc/sys/phoenix/sched.c b/newlib/libc/sys/phoenix/sched.c deleted file mode 100644 index 9e92363..0000000 --- a/newlib/libc/sys/phoenix/sched.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.*/
-
-#include "syscall.h"
-
-#include <errno.h>
-
-#include <sys/sched.h>
-#include <sys/types.h>
-
-int sched_getparam(pid_t pid, struct sched_param *param)
-{
- int ret = syscall2(int, SYS_SCHED_GETPARAM, pid, param);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
-
-int sched_setparam(pid_t pid, const struct sched_param *param)
-{
- int ret = syscall2(int, SYS_SCHED_SETPARAM, pid, param);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
-
-int sched_getscheduler(pid_t pid)
-{
- int ret = syscall1(int, SYS_SCHED_GETSCHEDULER, pid);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
-
-int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)
-{
- int ret = syscall3(int, SYS_SCHED_SETSCHEDULER, pid, policy, param);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
-
-int sched_get_priority_max(int policy)
-{
- int ret = syscall1(int, SYS_SCHED_GET_PRIORITY_MAX, policy);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
-
-int sched_get_priority_min(int policy)
-{
- int ret = syscall1(int, SYS_SCHED_GET_PRIORITY_MIN, policy);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
-
-int sched_yield(void)
-{
- int ret = syscall0(int, SYS_SCHED_YIELD);
- if(ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
-}
diff --git a/newlib/libc/sys/phoenix/select.c b/newlib/libc/sys/phoenix/select.c deleted file mode 100644 index 2374163..0000000 --- a/newlib/libc/sys/phoenix/select.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/time.h> -#include <sys/types.h> - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) -{ - int ret = syscall5(int, SYS_SELECT, nfds, readfds, writefds, exceptfds, timeout); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/semaphore.c b/newlib/libc/sys/phoenix/semaphore.c deleted file mode 100644 index 617ffc5..0000000 --- a/newlib/libc/sys/phoenix/semaphore.c +++ /dev/null @@ -1,168 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> -#include <fcntl.h> -#include <malloc.h> -#include <semaphore.h> -#include <stdarg.h> -#include <string.h> -#include <sys/dirent.h> -#include <sys/ioctl.h> -#include <sys/ipc.h> -#include <sys/stat.h> -#include <unistd.h> - -int sem_init(sem_t *sem, int pshared, unsigned int value) -{ - errno = ENOSYS; - return -1; -} - -int sem_destroy(sem_t *sem) -{ - errno = ENOSYS; - return -1; -} - -sem_t *sem_open(const char *name, int oflag, ...) -{ - sem_t *sem = (sem_t *) malloc(sizeof(sem_t)); - if(sem == NULL) { - errno = ENOMEM; - return SEM_FAILED; - } - - if (*name == '/') - ++name; - - char sem_name[PATH_MAX_SIZE + 24] = "/dev/ipc/sem_"; - strncpy(sem_name + 13, name, PATH_MAX_SIZE + 10); - - int mode = S_IRWXUGO; - int initval = 1; - if (oflag & O_CREAT) { - va_list ap; - va_start(ap, oflag); - mode = va_arg(ap, int); - initval = va_arg(ap, int); - va_end(ap); - } - - sem->fd = open(sem_name, oflag, mode); - if (sem->fd != -1) { - int flags = fcntl(sem->fd, F_GETFD, 0); - if (flags >= 0) { - flags |= FD_CLOEXEC; - flags = fcntl (sem->fd, F_SETFD, flags); - } - - if (flags == -1) { - close (sem->fd); - free(sem); - return SEM_FAILED; - } - } - else { - free(sem); - return SEM_FAILED; - } - - if (sem != SEM_FAILED && (oflag | O_CREAT)) { - if (ioctl(sem->fd, IPC_SEM_INIT, initval) < 0) { - free(sem); - return SEM_FAILED; - } - } - - return sem; -} - -int sem_close(sem_t *sem) -{ - if (sem == NULL || sem->fd < 0) { - errno = EINVAL; - return -1; - } - - close(sem->fd); - free(sem); - - return 0; -} - -int sem_unlink(const char *name) -{ - return unlink(name); -} - -int sem_wait(sem_t *sem) -{ - if(sem == NULL || sem->fd < 0) { - errno = EINVAL; - return -1; - } - - return ioctl(sem->fd, IPC_SEM_DOWN, 0); -} - -int sem_timedwait(sem_t * sem, const struct timespec *abs_timeout) -{ - if(sem == NULL || sem->fd < 0) { - errno = EINVAL; - return -1; - } - - return ioctl(sem->fd, IPC_SEM_DOWN_TIMEOUT, 0); -} - -int sem_trywait(sem_t *sem) -{ - if(sem == NULL || sem->fd < 0) { - errno = EINVAL; - return -1; - } - - return ioctl(sem->fd, IPC_SEM_TRYDOWN, 0); -} - -int sem_post(sem_t *sem) -{ - if(sem == NULL || sem->fd < 0) { - errno = EINVAL; - return -1; - } - - return ioctl(sem->fd, IPC_SEM_UP, 0); -} - -int sem_getvalue (sem_t *sem, int *sval) -{ - if(sem == NULL || sem->fd < 0) { - errno = EINVAL; - return -1; - } - - return ioctl(sem->fd, IPC_SEM_GETVAL, (unsigned long) sval); -} diff --git a/newlib/libc/sys/phoenix/setmntent.c b/newlib/libc/sys/phoenix/setmntent.c deleted file mode 100644 index 52cd8b3..0000000 --- a/newlib/libc/sys/phoenix/setmntent.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <stdio.h> - -FILE *setmntent(const char *filename, const char *type) -{ - return fopen(filename, type); -} diff --git a/newlib/libc/sys/phoenix/shm.c b/newlib/libc/sys/phoenix/shm.c deleted file mode 100644 index caccd48..0000000 --- a/newlib/libc/sys/phoenix/shm.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <fcntl.h> -#include <string.h> -#include <sys/dirent.h> -#include <sys/ioctl.h> -#include <sys/ipc.h> -#include <unistd.h> - -int shm_open(const char *name, int oflag, mode_t mode) -{ - char shm_name[PATH_MAX_SIZE + 24] = "/dev/ipc/shm_"; - - if (*name == '/') - ++name; - - strncpy(shm_name + 13, name, PATH_MAX_SIZE + 10); - - int fd = open(shm_name, oflag, mode); - if (fd >= 0) { - int flags = fcntl(fd, F_GETFD, 0); - if (flags >= 0) { - flags |= FD_CLOEXEC; - flags = fcntl(fd, F_SETFD, flags); - } - - if (flags == -1) { - close(fd); - return -1; - } - } - - if (fd != -1 && (oflag | O_CREAT)) { - if (ioctl(fd, IPC_SHM_INIT, 0) < 0) { - close(fd); - return -1; - } - } - - return fd; -} - -int shm_unlink(const char *name) -{ - return unlink(name); -} diff --git a/newlib/libc/sys/phoenix/signal.c b/newlib/libc/sys/phoenix/signal.c deleted file mode 100644 index eca7896..0000000 --- a/newlib/libc/sys/phoenix/signal.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <signal.h> -#include <sys/types.h> - -int kill(pid_t pid, int sig) -{ - int ret = syscall2(int, SYS_KILL, pid, sig); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -sighandler_t signal(int signum, sighandler_t handler) -{ - /* TODO: implement. */ - errno = ENOSYS; - return SIG_ERR; -} - -int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int sigsuspend(const sigset_t *mask) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int raise(int sig) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/phoenix/socket.c b/newlib/libc/sys/phoenix/socket.c deleted file mode 100644 index 39e4ab2..0000000 --- a/newlib/libc/sys/phoenix/socket.c +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <phoenix/socket_args.h> -#include <sys/socket.h> - -int socket(int domain, int type, int protocol) -{ - int ret = syscall3(int, SYS_SOCKET, domain, type, protocol); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) -{ - int ret = syscall3(int, SYS_BIND, sockfd, addr, addrlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int listen(int sockfd, int backlog) -{ - int ret = syscall2(int, SYS_LISTEN, sockfd, backlog); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) -{ - int ret = syscall3(int, SYS_ACCEPT, sockfd, addr, addrlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) -{ - int ret = syscall3(int, SYS_CONNECT, sockfd, addr, addrlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) -{ - struct sendto_args args = { sockfd, buf, len, flags, dest_addr, addrlen }; - - int ret = syscall1(int, SYS_SENDTO, &args); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int send(int sockfd, const void *buf, size_t len, int flags) -{ - return sendto(sockfd, buf, len, flags, NULL, 0); -} - -int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) -{ - struct recvfrom_args args = { sockfd, buf, len, flags, src_addr, addrlen }; - - int ret = syscall1(int, SYS_RECVFROM, &args); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int recv(int sockfd, void *buf, size_t len, int flags) -{ - return recvfrom(sockfd, buf, len, flags, NULL, NULL); -} - -int shutdown(int sockfd, int how) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen) -{ - int ret = syscall3(int, SYS_GETPEERNAME, sockfd, addr, addrlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/sockopt.c b/newlib/libc/sys/phoenix/sockopt.c deleted file mode 100644 index 6486e7b..0000000 --- a/newlib/libc/sys/phoenix/sockopt.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <phoenix/socket_args.h> -#include <phoenix/sockios.h> -#include <sys/ioctl.h> -#include <sys/socket.h> - -int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) -{ - int ret = syscall3(int, SYS_GETSOCKNAME, sockfd, addr, addrlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen) -{ - struct sockopt_args args; - args.level = level; - args.optname = optname; - args.optval = optval; - args.optlen = *optlen; - - int ret = ioctl(sockfd, IOC_GETSOCKOPT, &args); - if (ret < 0) { - errno = -ret; - return -1; - } - - *optlen = args.optlen; - return ret; -} - -int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen) -{ - struct sockopt_args args; - args.level = level; - args.optname = optname; - args.optval = (void *) optval; - args.optlen = optlen; - - int ret = ioctl(sockfd, IOC_SETSOCKOPT, &args); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/stat.c b/newlib/libc/sys/phoenix/stat.c deleted file mode 100644 index aec0367..0000000 --- a/newlib/libc/sys/phoenix/stat.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/stat.h> - -int stat(const char *pathname, struct stat *buf) -{ - int ret = syscall2(int, SYS_STAT, pathname, buf); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int fstat(int fd, struct stat *buf) -{ - int ret = syscall2(int, SYS_FSTAT, fd, buf); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int lstat(const char *pathname, struct stat *buf) -{ - int ret = syscall2(int, SYS_LSTAT, pathname, buf); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -mode_t umask(mode_t mask) -{ - return syscall1(int, SYS_UMASK, mask); -} diff --git a/newlib/libc/sys/phoenix/statfs.c b/newlib/libc/sys/phoenix/statfs.c deleted file mode 100644 index 3b9202a..0000000 --- a/newlib/libc/sys/phoenix/statfs.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/vfs.h> - -int statfs(const char *path, struct statfs *buf) -{ - int ret = syscall2(int, SYS_STATFS, path, buf); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/symlink.c b/newlib/libc/sys/phoenix/symlink.c deleted file mode 100644 index 90fade0..0000000 --- a/newlib/libc/sys/phoenix/symlink.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -int symlink(const char *target, const char *linkpath) -{ - int ret = syscall2(int, SYS_SYMLINK, target, linkpath); - if (ret < 0) { - errno = -ret; - ret = -1; - } - - return ret; -} - -int readlink(const char *pathname, char *buf, size_t bufsize) -{ - int ret = syscall3(int, SYS_READLINK, pathname, buf, bufsize); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int link(const char *oldpath, const char *newpath) -{ - int ret = syscall2(int, SYS_LINK, oldpath, newpath); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/sync.c b/newlib/libc/sys/phoenix/sync.c deleted file mode 100644 index 6f72640..0000000 --- a/newlib/libc/sys/phoenix/sync.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> - -void sync() -{ - int ret = syscall0(int, SYS_SYNC); - if (ret < 0) - errno = -ret; -} - -int fsync(int fd) -{ - int ret = syscall1(int, SYS_FSYNC, fd); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int fdatasync(int fd) -{ - return fsync(fd); -} diff --git a/newlib/libc/sys/phoenix/sys/_default_fcntl.h b/newlib/libc/sys/phoenix/sys/_default_fcntl.h deleted file mode 100644 index 49b73dd..0000000 --- a/newlib/libc/sys/phoenix/sys/_default_fcntl.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS__DEFAULT_FCNTL_H -#define _SYS__DEFAULT_FCNTL_H - -#include <_ansi.h> -#include <phoenix/_default_fcntl.h> -#include <sys/types.h> - -int open(const char *pathname, int flags, ...); -int _open(const char *pathname, int flags, ...); -int creat(const char *pathname, mode_t mode); -int fcntl(int fd, int cmd, ...); -int flock(int fd, int operation); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/_null.h b/newlib/libc/sys/phoenix/sys/_null.h deleted file mode 100644 index f63ecd0..0000000 --- a/newlib/libc/sys/phoenix/sys/_null.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef NULL - -#if !defined(__cplusplus) -#define NULL ((void *) 0) -#else -#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 -#define NULL __null -#else -#if defined(__LP64__) -#define NULL (0L) -#else -#define NULL 0 -#endif -#endif -#endif - -#endif diff --git a/newlib/libc/sys/phoenix/sys/_timespec.h b/newlib/libc/sys/phoenix/sys/_timespec.h deleted file mode 100644 index 8ee632c..0000000 --- a/newlib/libc/sys/phoenix/sys/_timespec.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS__TIMESPEC_H -#define _SYS__TIMESPEC_H - -#include <phoenix/time.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/_timeval.h b/newlib/libc/sys/phoenix/sys/_timeval.h deleted file mode 100644 index 8a18d88..0000000 --- a/newlib/libc/sys/phoenix/sys/_timeval.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS__TIMEVAL_H -#define _SYS__TIMEVAL_H - -#include <phoenix/time.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/_types.h b/newlib/libc/sys/phoenix/sys/_types.h deleted file mode 100644 index 39a3c52..0000000 --- a/newlib/libc/sys/phoenix/sys/_types.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS__TYPES_H -#define _SYS__TYPES_H - -#include <machine/_types.h> - -#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 -typedef int _ssize_t; -#else -typedef long _ssize_t; -#endif - -typedef long _off_t; -typedef long _fpos_t; - -typedef long int __off_t; -typedef long int __loff_t; -typedef long __suseconds_t; -#define _CLOCK_T_ unsigned long - -#define __need_wint_t -#include <stddef.h> - -/* Conversion state information. */ -typedef struct { - int __count; - union { - wint_t __wch; - unsigned char __wchb[4]; - } __value; -} _mbstate_t; - -struct __flock_mutex_t_tmp; -typedef struct { - int __a; - int __b; - struct { - long int __c1; - int __c2; - } __c; - int __d; - struct __flock_mutex_t_tmp *__e; -} __flock_mutex_t; - -typedef struct { - __flock_mutex_t mutex; -} _flock_t; - -#endif diff --git a/newlib/libc/sys/phoenix/sys/dirent.h b/newlib/libc/sys/phoenix/sys/dirent.h deleted file mode 100644 index 3db2673..0000000 --- a/newlib/libc/sys/phoenix/sys/dirent.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_DIRENT_H -#define _SYS_DIRENT_H - -#include <phoenix/fs.h> -#include <sys/lock.h> -#include <sys/types.h> - -#define PATH_MAX_SIZE 1024 - -#define HAVE_DD_LOCK - -typedef struct { - int dd_fd; /* Directory file. */ - int dd_loc; /* Position in buffer. */ - int dd_seek; - char *dd_buf; /* Pointer to buffer. */ - int dd_len; /* Buffer size. */ - int dd_size; /* Data size in buffer. */ - _LOCK_RECURSIVE_T dd_lock; -} DIR; - -#define __dirfd(dir) (dir)->dd_fd - -#define _seekdir seekdir - -/* Declare which dirent fields are available in Phoenix-RTOS. */ -#undef _DIRENT_HAVE_D_NAMLEN -#define _DIRENT_HAVE_D_OFF -#define _DIRENT_HAVE_D_RECLEN - -#define d_fileno d_ino /* Backwards compatibility. */ - -#ifdef __USE_LARGEFILE64 -#define dirent64 dirent -#endif - -#endif diff --git a/newlib/libc/sys/phoenix/sys/errno.h b/newlib/libc/sys/phoenix/sys/errno.h deleted file mode 100644 index 6d5b001..0000000 --- a/newlib/libc/sys/phoenix/sys/errno.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_ERRNO_H -#define _SYS_ERRNO_H - -#include <phoenix/errno.h> -#include <sys/reent.h> - -#ifndef _REENT_ONLY -#define errno (*__errno()) -extern int *__errno (void); -#endif - -/* Don't use these variables directly. Use strerror instead. */ -extern __IMPORT const char * const _sys_errlist[]; -extern __IMPORT int _sys_nerr; - -#define __errno_r(ptr) ((ptr)->_errno) - -#endif diff --git a/newlib/libc/sys/phoenix/sys/ioctl.h b/newlib/libc/sys/phoenix/sys/ioctl.h deleted file mode 100644 index ab246a5..0000000 --- a/newlib/libc/sys/phoenix/sys/ioctl.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H - -#include <phoenix/ioctl/pty.h> - -int ioctl(int d, int request, ...); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/ipc.h b/newlib/libc/sys/phoenix/sys/ipc.h deleted file mode 100644 index c2f0da4..0000000 --- a/newlib/libc/sys/phoenix/sys/ipc.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_IPC_H -#define _SYS_IPC_H - -#include <phoenix/ipc.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/mman.h b/newlib/libc/sys/phoenix/sys/mman.h deleted file mode 100644 index c5f9539..0000000 --- a/newlib/libc/sys/phoenix/sys/mman.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_MMAN_H -#define _SYS_MMAN_H - -#include <phoenix/shm.h> -#include <phoenix/mmap.h> -#include <sys/types.h> - -void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); -int munmap(void *addr, size_t length); - -int shm_open(const char *name, int oflag, mode_t mode); -int shm_unlink(const char *name); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/mount.h b/newlib/libc/sys/phoenix/sys/mount.h deleted file mode 100644 index f661eeb..0000000 --- a/newlib/libc/sys/phoenix/sys/mount.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_MOUNT_H -#define _SYS_MOUNT_H - -#define MS_NOSUID 0x0001 -#define MS_NODEV 0x0002 -#define MS_NOEXEC 0x0004 -#define MS_SYNCHRONOUS 0x0008 -#define MS_NOATIME 0x0010 -#define MS_NODIRATIME 0x0020 -#define MS_MANDLOCK 0x0040 -#define MS_RDONLY 0x0080 -#define MS_REMOUNT 0x0100 - -int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); -int umount(const char *target); -int umount2(const char *target, int flags); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/network.h b/newlib/libc/sys/phoenix/sys/network.h deleted file mode 100644 index 6aaf299..0000000 --- a/newlib/libc/sys/phoenix/sys/network.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_NETWORK_H -#define _SYS_NETWORK_H - -int network_setUp(const char *interface); -int network_setDown(const char *interface); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/param.h b/newlib/libc/sys/phoenix/sys/param.h deleted file mode 100644 index c006009..0000000 --- a/newlib/libc/sys/phoenix/sys/param.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H - -#include <machine/endian.h> -#include <machine/param.h> -#include <sys/config.h> - -#ifndef HZ -#define HZ (60) -#endif - -#ifndef NOFILE -#define NOFILE (60) -#endif - -#ifndef PATHSIZE -#define PATHSIZE (1024) -#endif - -#define MAXPATHLEN PATHSIZE -#define MAXSYMLINKS 20 - -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - -#endif diff --git a/newlib/libc/sys/phoenix/sys/poll.h b/newlib/libc/sys/phoenix/sys/poll.h deleted file mode 100644 index b994ad0..0000000 --- a/newlib/libc/sys/phoenix/sys/poll.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_POLL_H -#define _SYS_POLL_H - -#include <phoenix/poll.h> - -int poll(struct pollfd *fds, nfds_t nfds, int timeout); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/reboot.h b/newlib/libc/sys/phoenix/sys/reboot.h deleted file mode 100644 index 417ed0f..0000000 --- a/newlib/libc/sys/phoenix/sys/reboot.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_REBOOT_H -#define _SYS_REBOOT_H - -#include <phoenix/reboot.h> - -int reboot(int how); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/resource.h b/newlib/libc/sys/phoenix/sys/resource.h deleted file mode 100644 index a1ca33d..0000000 --- a/newlib/libc/sys/phoenix/sys/resource.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H - -#include <sys/time.h> -#include <sys/types.h> - -#define RUSAGE_SELF 0 -#define RUSAGE_CHILDREN (-1) -#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ -#define RUSAGE_THREAD 1 /* Only the calling thread */ - -struct rusage { - struct timeval ru_utime; /* User time used */ - struct timeval ru_stime; /* System time used */ - long ru_maxrss; /* Maximum resident set size */ - long ru_ixrss; /* Integral shared memory size */ - long ru_idrss; /* Integral unshared data size */ - long ru_isrss; /* Integral unshared stack size */ - long ru_minflt; /* Page reclaims */ - long ru_majflt; /* Page faults */ - long ru_nswap; /* Swaps */ - long ru_inblock; /* Block input operations */ - long ru_oublock; /* Block output operations */ - long ru_msgsnd; /* Messages sent */ - long ru_msgrcv; /* Messages received */ - long ru_nsignals; /* Signals received */ - long ru_nvcsw; /* Voluntary context switches */ - long ru_nivcsw; /* Involuntary */ -}; - -typedef unsigned long rlim_t; - -struct rlimit { - rlim_t rlim_cur; - rlim_t rlim_max; -}; - -#define RLIM64_INFINITY (~0ULL) - -struct rlimit64 { - uint64_t rlim_cur; - uint64_t rlim_max; -}; - -#define PRIO_MIN (-20) -#define PRIO_MAX 20 -#define PRIO_PROCESS 0 -#define PRIO_PGRP 1 -#define PRIO_USER 2 - -/* - * Limit the stack by to some sane default: root can always - * increase this limit if needed. 8MB seems reasonable. - */ -#define _STK_LIM (8 * 1024 * 1024) - -/* - * GPG2 wants 64kB of mlocked memory, to make sure pass phrases - * and other sensitive information are never written to disk. - */ -#define MLOCK_LIMIT ((PAGE_SIZE > 64 * 1024) ? PAGE_SIZE : 64 * 1024) - -#define RLIMIT_CPU 0 /* CPU time in sec */ -#define RLIMIT_FSIZE 1 /* Maximum filesize */ -#define RLIMIT_DATA 2 /* Max data size */ -#define RLIMIT_STACK 3 /* Max stack size */ -#define RLIMIT_CORE 4 /* Max core file size */ -#define RLIMIT_RSS 5 /* Max resident set size */ -#define RLIMIT_NPROC 6 /* Max number of processes */ -#define RLIMIT_NOFILE 7 /* Max number of open files */ -#define RLIMIT_OFILE RLIMIT_NOFILE -#define RLIMIT_MEMLOCK 8 /* Max locked-in-memory address space */ -#define RLIMIT_AS 9 /* Address space limit */ -#define RLIMIT_LOCKS 10 /* Maximum file locks held */ -#define RLIMIT_SIGPENDING 11 /* Max number of pending signals */ -#define RLIMIT_MSGQUEUE 12 /* Maximum bytes in POSIX mqueues */ -#define RLIMIT_NICE 13 /* Max nice prio allowed to raise to 0-39 for nice level 19 .. -20 */ -#define RLIMIT_RTPRIO 14 /* Maximum realtime priority */ -#define RLIMIT_RTTIME 15 /* Timeout for RT tasks in us */ -#define RLIM_NLIMITS 16 - -#ifndef RLIM_INFINITY -#define RLIM_INFINITY (~0UL) -#endif - -/* RLIMIT_STACK default maximum - some architectures override it. */ -#ifndef _STK_LIM_MAX -#define _STK_LIM_MAX RLIM_INFINITY -#endif - -int getpriority(int which, id_t who); -int setpriority(int which, id_t who, int prio); -int getrlimit(int resource, struct rlimit *rlim); -int setrlimit(int resource, const struct rlimit *rlim); -int getrusage(int who, struct rusage *usage); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/sched.h b/newlib/libc/sys/phoenix/sys/sched.h deleted file mode 100644 index 93b1946..0000000 --- a/newlib/libc/sys/phoenix/sys/sched.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_SCHED_H -#define _SYS_SCHED_H - -#include <bits/posix_opt.h> - -#define SCHED_OTHER 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 - -struct sched_param { - int sched_priority; /* Process execution scheduling priority */ -}; - -#endif diff --git a/newlib/libc/sys/phoenix/sys/select.h b/newlib/libc/sys/phoenix/sys/select.h deleted file mode 100644 index fc9d7c7..0000000 --- a/newlib/libc/sys/phoenix/sys/select.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H - -#include <phoenix/time.h> -#include <sys/cdefs.h> -#include <sys/signal.h> -#include <sys/types.h> - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); -int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/shm.h b/newlib/libc/sys/phoenix/sys/shm.h deleted file mode 100644 index d9332ef..0000000 --- a/newlib/libc/sys/phoenix/sys/shm.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_SHM_H -#define _SYS_SHM_H - -#include <phoenix/shm.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/signal.h b/newlib/libc/sys/phoenix/sys/signal.h deleted file mode 100644 index a5e07e1..0000000 --- a/newlib/libc/sys/phoenix/sys/signal.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_SIGNAL_H -#define _SYS_SIGNAL_H - -#include <phoenix/signal.h> -#include <sys/types.h> - -typedef void (*_sig_func_ptr)(int); -typedef _sig_func_ptr __sighandler_t; -typedef _sig_func_ptr sighandler_t; -typedef unsigned long sigset_t; - -#define SIGEV_NONE 1 /* No asynchronous notification shall be delivered when the event of interest occurs. */ -#define SIGEV_SIGNAL 2 /* A queued signal, with an application defined value, shall be delivered when the event of interest occurs. */ -#define SIGEV_THREAD 3 /* A notification function shall be called to perform notification. */ - -union sigval { - int sival_int; /* Integer signal value */ - void *sival_ptr; /* Pointer signal value */ -}; - -struct sigevent { - int sigev_notify; /* Notification type */ - int sigev_signo; /* Signal number */ - union sigval sigev_value; /* Signal value */ -#if defined(_POSIX_THREADS) - void (*sigev_notify_function)(union sigval); /* Notification function */ - pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */ -#endif -}; - -#define SI_USER 1 /* Sent by a user. kill(), abort(), etc */ -#define SI_QUEUE 2 /* Sent by sigqueue() */ -#define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */ -#define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */ -#define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */ - -typedef struct { - int si_signo; /* Signal number */ - int si_code; /* Cause of the signal */ - union sigval si_value; /* Signal value */ -} siginfo_t; - -#define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */ -#define SA_SIGINFO 2 /* Invoke the signal catching function with three arguments instead of one. */ -#define SA_RESTART 4 - -struct sigaction { - int sa_flags; /* Special flags to affect behavior of signal */ - sigset_t sa_mask; /* Additional set of signals to be blocked during execution of signal-catching function. */ - union { - _sig_func_ptr _handler; /* SIG_DFL, SIG_IGN, or pointer to a function */ - void (*_sigaction)(int, siginfo_t *, void *); - } _signal_handlers; -}; - -#define sa_handler _signal_handlers._handler -#define sa_sigaction _signal_handlers._sigaction - -#define SIG_SETMASK 0 /* Set mask with sigprocmask() */ -#define SIG_BLOCK 1 /* Set of signals to block */ -#define SIG_UNBLOCK 2 /* Set of signals to, well, unblock */ - -int kill(pid_t pid, int sig); -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); -int sigaddset(sigset_t *set, int signum); -int sigdelset(sigset_t *set, int signum); -int sigismember(const sigset_t *set, int signum); -int sigfillset(sigset_t *set); -int sigemptyset(sigset_t *set); -int sigpending(sigset_t *set); -int sigsuspend(const sigset_t *mask); -int sigpause(int sigmask); -int sigprocmask(int how, const sigset_t *set, sigset_t *oldset); -int sigblock(int mask); -int sigmask(int signum); -int sigsetmask(int mask); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/socket.h b/newlib/libc/sys/phoenix/sys/socket.h deleted file mode 100644 index 78776f5..0000000 --- a/newlib/libc/sys/phoenix/sys/socket.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H - -#include <phoenix/netinet.h> -#include <phoenix/netinet6.h> -#include <phoenix/socket.h> -#include <phoenix/sockios.h> -#include <sys/types.h> - -#define _SS_MAXSIZE 128U -#define _SS_ALIGNSIZE (sizeof(int64_t)) -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - sizeof(sa_family_t)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) - -struct sockaddr_storage { - unsigned char ss_len; /* Aaddress length */ - sa_family_t ss_family; /* Address family */ - char __ss_pad1[_SS_PAD1SIZE]; - int64_t __ss_align; /* Force desired structure storage alignment */ - char __ss_pad2[_SS_PAD2SIZE]; -}; - -#define HAVE_STRUCT_SOCKADDR_STORAGE -#define HAVE_STRUCT_IN6_ADDR -#define HAVE_STRUCT_SOCKADDR_IN6 - -int socket(int domain, int type, int protocol); -int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); -int listen(int sockfd, int backlog); -int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); -int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); -int sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen); -int send(int sockfd, const void *buf, size_t len, int flags); -int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); -int recv(int sockfd, void *buf, size_t len, int flags); - -int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen); -int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen); -int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen); - -int shutdown(int, int); -int socketpair(int, int, int, int *); - -int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/stat.h b/newlib/libc/sys/phoenix/sys/stat.h deleted file mode 100644 index c65b35a..0000000 --- a/newlib/libc/sys/phoenix/sys/stat.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_STAT_H -#define _SYS_STAT_H - -#include <phoenix/stat.h> -#include <sys/types.h> - -#define _IFMT 0170000 -#define _IFDIR 0040000 -#define _IFCHR 0020000 -#define _IFBLK 0060000 -#define _IFREG 0100000 -#define _IFLNK 0120000 -#define _IFSOCK 0140000 -#define _IFIFO 0010000 - -#define S_BLKSIZE 1024 - -#define S_IREAD 0000400 /* Read permission, owner. */ -#define S_IWRITE 0000200 /* Write permission, owner. */ -#define S_IEXEC 0000100 /* Execute/search permission, owner. */ -#define S_ENFMT 0002000 /* Enforcement-mode locking. */ - -#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */ -#define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */ -#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */ - -#define S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -int chmod(const char *pathname, mode_t mode); -int fchmod(int fd, mode_t mode); -int stat(const char *pathname, struct stat *buf); -int fstat(int fd, struct stat *buf); -int lstat(const char *pathname, struct stat *buf); -int mkdir(const char *pathname, mode_t mode); -int mkfifo(const char *pathname, mode_t mode); -int mknod(const char *pathname, mode_t mode, dev_t dev); -mode_t umask(mode_t mask); - -#ifdef __LARGE64_FILES -struct stat64; -int fstat64(int fd, struct stat64 *buf); -#endif - -#endif diff --git a/newlib/libc/sys/phoenix/sys/statfs.h b/newlib/libc/sys/phoenix/sys/statfs.h deleted file mode 100644 index 2fa0613..0000000 --- a/newlib/libc/sys/phoenix/sys/statfs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_STATFS_H -#define _SYS_STATFS_H - -#include <sys/vfs.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/stdio.h b/newlib/libc/sys/phoenix/sys/stdio.h deleted file mode 100644 index 42da0d2..0000000 --- a/newlib/libc/sys/phoenix/sys/stdio.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_STDIO_H -#define _SYS_STDIO_H - -#if !defined(__SINGLE_THREAD__) -#if !defined(_flockfile) -#define _flockfile(fp) ((void) 0) -#endif -#if !defined(_funlockfile) -#define _funlockfile(fp) ((void) 0) -#endif -#endif - -#define getline __getline -#define getdelim __getdelim - -#endif diff --git a/newlib/libc/sys/phoenix/sys/termios.h b/newlib/libc/sys/phoenix/sys/termios.h deleted file mode 100644 index ae93d77..0000000 --- a/newlib/libc/sys/phoenix/sys/termios.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_TERMIOS_H_ -#define _SYS_TERMIOS_H_ - -#include <phoenix/termios.h> -#include <sys/types.h> - -int tcgetattr(int fd, struct termios *termios_p); -int tcsetattr(int fd, int mode, const struct termios *termios_p); -int tcsendbreak(int fd, int duration); -int tcflush(int fd, int queue_selector); -int tcdrain(int fd); -pid_t tcgetsid(int fd); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/time.h b/newlib/libc/sys/phoenix/sys/time.h deleted file mode 100644 index da8e802..0000000 --- a/newlib/libc/sys/phoenix/sys/time.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_TIME_H -#define _SYS_TIME_H - -#include <phoenix/time.h> - -struct timezone { - int tz_minuteswest; /* Minutes west of Greenwich */ - int tz_dsttime; /* Type of dst correction */ -}; - -#define DST_NONE 0 /* Not on dst */ -#define DST_USA 1 /* USA style dst */ -#define DST_AUST 2 /* Australian style dst */ -#define DST_WET 3 /* Western European dst */ -#define DST_MET 4 /* Middle European dst */ -#define DST_EET 5 /* Eastern European dst */ -#define DST_CAN 6 /* Canada */ - -int gettimeofday(struct timeval *tv, void *tz); -int settimeofday(const struct timeval *tv, const struct timezone *tz); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/timespec.h b/newlib/libc/sys/phoenix/sys/timespec.h deleted file mode 100644 index 29f2d89..0000000 --- a/newlib/libc/sys/phoenix/sys/timespec.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_TIMESPEC_H -#define _SYS_TIMESPEC_H - -#include <phoenix/time.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/timeval.h b/newlib/libc/sys/phoenix/sys/timeval.h deleted file mode 100644 index 4809214..0000000 --- a/newlib/libc/sys/phoenix/sys/timeval.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_TIMEVAL_H -#define _SYS_TIMEVAL_H - -#include <phoenix/time.h> - -#endif diff --git a/newlib/libc/sys/phoenix/sys/types.h b/newlib/libc/sys/phoenix/sys/types.h deleted file mode 100644 index c0c9198..0000000 --- a/newlib/libc/sys/phoenix/sys/types.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -#include <machine/types.h> -#include <machine/_types.h> -#include <stdint.h> -#include <sys/_types.h> -#include <sys/_null.h> - -#include <phoenix/types.h> - -typedef __uint32_t __ino_t ; -typedef __uint64_t __ino64_t; -typedef __uint64_t __off64_t; -typedef __uint32_t __key_t; -typedef __uint32_t __useconds_t; -typedef __uint32_t __daddr_t; -typedef char * caddr_t; -typedef __uint32_t __nlink_t; -typedef __uint8_t __u_char; -typedef unsigned short __u_short; -typedef unsigned __u_int; -typedef unsigned long __u_long; - -typedef _CLOCK_T_ clock_t; -typedef _ssize_t ssize_t; -typedef __ino_t ino_t; -typedef __ino64_t ino64_t; -typedef __off64_t off64_t; -typedef __off_t off_t; -typedef __loff_t loff_t; -typedef __key_t key_t; -typedef __suseconds_t suseconds_t; -typedef __useconds_t useconds_t; -typedef __daddr_t daddr_t; -typedef char * caddr_t; -typedef __nlink_t nlink_t; -typedef pid_t id_t; -typedef __u_char u_char; -typedef __u_short u_short; -typedef __u_int u_int; -typedef __u_long u_long; -typedef __uint8_t u_int8_t; -typedef __uint16_t u_int16_t; -typedef __uint32_t u_int32_t; -typedef __uint64_t u_int64_t; -typedef __uint8_t uint8_t; -typedef __uint16_t uint16_t; -typedef __uint32_t uint32_t; -typedef __uint64_t uint64_t; -typedef __int8_t int8_t; -typedef __int16_t int16_t; -typedef __int32_t int32_t; -typedef __int64_t int64_t; - -typedef __uint32_t __blksize_t; -typedef __int64_t __blkcnt_t; -typedef __int64_t sbintime_t; -typedef __blkcnt_t blkcnt_t; - -#define __time_t_defined -#define __gid_t_defined -#define __uid_t_defined -#define __ssize_t_defined -#define __key_t_defined -#define __off_t_defined -#define __off64_t_defined - -static inline unsigned int dev_major (unsigned long int dev) -{ - return ((dev >> 16) & 0xffff); -} - -static inline unsigned int dev_minor (unsigned long int dev) -{ - return (dev & 0xffff); -} - -static inline unsigned long int dev_makedev (unsigned int major, unsigned int minor) -{ - return (minor & 0xffff) | ((major & 0xffff) << 16); -} - -/* Access the functions with their traditional names. */ -# define major(dev) dev_major(dev) -# define minor(dev) dev_minor(dev) -# define makedev(maj, min) dev_makedev(maj, min) - -#endif diff --git a/newlib/libc/sys/phoenix/sys/uio.h b/newlib/libc/sys/phoenix/sys/uio.h deleted file mode 100644 index c9f50d5..0000000 --- a/newlib/libc/sys/phoenix/sys/uio.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_UIO_H -#define _SYS_UIO_H - -#include <sys/types.h> - -#define UIO_MAXIOV 1024 - -struct iovec { - void *iov_base; - size_t iov_len; -}; - -ssize_t readv(int fd, const struct iovec *iov, int iovcnt); -ssize_t writev(int fd, const struct iovec *iov, int iovcnt); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/un.h b/newlib/libc/sys/phoenix/sys/un.h deleted file mode 100644 index 02816f7..0000000 --- a/newlib/libc/sys/phoenix/sys/un.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_UN_H -#define _SYS_UN_H - -#include <netinet/in.h> -#include <sys/socket.h> - -/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ -struct sockaddr_un { - sa_family_t sun_family; - char sun_path[108]; -}; - -/* Evaluate to actual length of the `sockaddr_un' structure. */ -# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen ((ptr)->sun_path)) - -#endif diff --git a/newlib/libc/sys/phoenix/sys/unistd.h b/newlib/libc/sys/phoenix/sys/unistd.h deleted file mode 100644 index 77b96dd..0000000 --- a/newlib/libc/sys/phoenix/sys/unistd.h +++ /dev/null @@ -1,309 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_UNISTD_H -#define _SYS_UNISTD_H - -#include <_ansi.h> -#include <features.h> -#include <sys/types.h> -#define __need_size_t -#define __need_ptrdiff_t -#include <stddef.h> -#include <sys/select.h> - -extern char **environ; - -void _exit(int status) _ATTRIBUTE ((__noreturn__)); - -int access(const char *pathname, int mode); -unsigned int alarm(unsigned seconds); -int chdir(const char *path); -int chmod(const char *pathname, mode_t mode); -int chown(const char *pathname, uid_t owner, gid_t group); -int chroot(const char *path); -int close(int fd); -int _close(int fd); -char *ctermid(char *s); -char *cuserid(char *string); -int daemon(int nochdir, int noclose); -int dup(int oldfd); -int dup2(int olffd, int newfd); -int execl(const char *path, const char *arg, ...); -int execle(const char *path, const char *arg, ...); -int execlp(const char *file, const char *arg, ...); -int execv(const char *path, char *const argv[]); -int execve(const char *filename, char *const argv[], char *const envp[]); -int _execve(const char *filename, char *const argv[], char *const envp[]); -int execvp(const char *file, char *const argv[]); -int execvpe(const char *file, char *const argv[], char *const envp[]); -int fchdir(int fd); -int fchmod(int fd, mode_t mode); -int fchown(int fd, uid_t owner, gid_t group); -int fdatasync(int fd); -pid_t fork(); -long fpathconf(int fd, int name); -int fsync(int fd); -int ftruncate(int fd, off_t length); -char *getcwd(char *buf, size_t size); -int getdomainname(char *name, size_t len); -int getentropy(void *buf, size_t buflen); -gid_t getegid(); -uid_t geteuid(); -gid_t getgid(); -int getgroups(int size, gid_t list[]); -int gethostname(char *name, size_t len); -char *getlogin(); -#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) -int getlogin_r(char *buf, size_t bufsize); -#endif -char *getpass(const char *prompt); -int getpagesize(); -pid_t getpgid(pid_t pid); -pid_t getpgrp(); -pid_t getpid(); -pid_t getppid(); -uid_t getuid(); -char *getusershell(); -char *getwd(char *buf); -int isatty(int fd); -int _isatty(int fd); -int issetugid(); -int fchown(int fd, uid_t owner, gid_t group); -int lchown(const char *pathname, uid_t owner, gid_t group); -int link(const char *oldpath, const char *newpath); -int nice(int inc); -off_t lseek(int fd, off_t offset, int whence); -long pathconf(const char *path, int name); -int pause(); -int pipe(int pipefd[2]); -ssize_t pread(int fd, void *buf, size_t count, off_t offset); -ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); -ssize_t read(int fd, void *buf, size_t count); -ssize_t readlink(const char *pathname, char *buf, size_t bufsiz); -int rmdir(const char *pathname); -void *sbrk(intptr_t increment); -int setegid(gid_t egid); -int seteuid(uid_t euid); -int setgid(gid_t gid); -int sethostname(const char *name, size_t len); -int setpgid(pid_t pid, pid_t pgid); -int setpgrp(void); -pid_t setsid(void); -int setuid(uid_t uid); -unsigned int sleep(unsigned int seconds); -void swab(const void *from, void *to, ssize_t n); -int symlink(const char *target, const char *linkpath); -long sysconf(int name); -pid_t tcgetpgrp(int fd); -int tcsetpgrp(int fd, pid_t pgrp); -int truncate(const char *path, off_t ); -char *ttyname(int fd); -int ttyname_r(int fd, char *buf, size_t buflen); -int unlink(const char *pathname); -int usleep(useconds_t usec); -int vhangup(); -ssize_t write(int fd, const void *buf, size_t count); - -extern char *optarg; /* getopt(3) external variables */ -extern int optind, opterr, optopt; -int getopt(int argc, char * const argv[], const char *optstring); -extern int optreset; /* getopt(3) external variable */ - -pid_t vfork(); - -extern char *suboptarg; /* getsubopt(3) external variable */ -int getsubopt(char **optionp, char * const *tokens, char **valuep); - -#define F_OK 0 -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -#include <sys/features.h> - -#define STDIN_FILENO 0 /* Standard input file descriptor */ -#define STDOUT_FILENO 1 /* Standard output file descriptor */ -#define STDERR_FILENO 2 /* Standard error file descriptor */ - -/* sysconf values per IEEE Std 1003.1, 2008 Edition */ -#define _SC_ARG_MAX 0 -#define _SC_CHILD_MAX 1 -#define _SC_CLK_TCK 2 -#define _SC_NGROUPS_MAX 3 -#define _SC_OPEN_MAX 4 -#define _SC_JOB_CONTROL 5 -#define _SC_SAVED_IDS 6 -#define _SC_VERSION 7 -#define _SC_PAGESIZE 8 -#define _SC_PAGE_SIZE _SC_PAGESIZE -/* These are non-POSIX values we accidentally introduced in 2000 without - guarding them. Keeping them unguarded for backward compatibility. */ -#define _SC_NPROCESSORS_CONF 9 -#define _SC_NPROCESSORS_ONLN 10 -#define _SC_PHYS_PAGES 11 -#define _SC_AVPHYS_PAGES 12 -/* End of non-POSIX values. */ -#define _SC_MQ_OPEN_MAX 13 -#define _SC_MQ_PRIO_MAX 14 -#define _SC_RTSIG_MAX 15 -#define _SC_SEM_NSEMS_MAX 16 -#define _SC_SEM_VALUE_MAX 17 -#define _SC_SIGQUEUE_MAX 18 -#define _SC_TIMER_MAX 19 -#define _SC_TZNAME_MAX 20 -#define _SC_ASYNCHRONOUS_IO 21 -#define _SC_FSYNC 22 -#define _SC_MAPPED_FILES 23 -#define _SC_MEMLOCK 24 -#define _SC_MEMLOCK_RANGE 25 -#define _SC_MEMORY_PROTECTION 26 -#define _SC_MESSAGE_PASSING 27 -#define _SC_PRIORITIZED_IO 28 -#define _SC_REALTIME_SIGNALS 29 -#define _SC_SEMAPHORES 30 -#define _SC_SHARED_MEMORY_OBJECTS 31 -#define _SC_SYNCHRONIZED_IO 32 -#define _SC_TIMERS 33 -#define _SC_AIO_LISTIO_MAX 34 -#define _SC_AIO_MAX 35 -#define _SC_AIO_PRIO_DELTA_MAX 36 -#define _SC_DELAYTIMER_MAX 37 -#define _SC_THREAD_KEYS_MAX 38 -#define _SC_THREAD_STACK_MIN 39 -#define _SC_THREAD_THREADS_MAX 40 -#define _SC_TTY_NAME_MAX 41 -#define _SC_THREADS 42 -#define _SC_THREAD_ATTR_STACKADDR 43 -#define _SC_THREAD_ATTR_STACKSIZE 44 -#define _SC_THREAD_PRIORITY_SCHEDULING 45 -#define _SC_THREAD_PRIO_INHERIT 46 -#define _SC_THREAD_PRIO_PROTECT 47 -#define _SC_THREAD_PRIO_CEILING _SC_THREAD_PRIO_PROTECT -#define _SC_THREAD_PROCESS_SHARED 48 -#define _SC_THREAD_SAFE_FUNCTIONS 49 -#define _SC_GETGR_R_SIZE_MAX 50 -#define _SC_GETPW_R_SIZE_MAX 51 -#define _SC_LOGIN_NAME_MAX 52 -#define _SC_THREAD_DESTRUCTOR_ITERATIONS 53 -#define _SC_ADVISORY_INFO 54 -#define _SC_ATEXIT_MAX 55 -#define _SC_BARRIERS 56 -#define _SC_BC_BASE_MAX 57 -#define _SC_BC_DIM_MAX 58 -#define _SC_BC_SCALE_MAX 59 -#define _SC_BC_STRING_MAX 60 -#define _SC_CLOCK_SELECTION 61 -#define _SC_COLL_WEIGHTS_MAX 62 -#define _SC_CPUTIME 63 -#define _SC_EXPR_NEST_MAX 64 -#define _SC_HOST_NAME_MAX 65 -#define _SC_IOV_MAX 66 -#define _SC_IPV6 67 -#define _SC_LINE_MAX 68 -#define _SC_MONOTONIC_CLOCK 69 -#define _SC_RAW_SOCKETS 70 -#define _SC_READER_WRITER_LOCKS 71 -#define _SC_REGEXP 72 -#define _SC_RE_DUP_MAX 73 -#define _SC_SHELL 74 -#define _SC_SPAWN 75 -#define _SC_SPIN_LOCKS 76 -#define _SC_SPORADIC_SERVER 77 -#define _SC_SS_REPL_MAX 78 -#define _SC_SYMLOOP_MAX 79 -#define _SC_THREAD_CPUTIME 80 -#define _SC_THREAD_SPORADIC_SERVER 81 -#define _SC_TIMEOUTS 82 -#define _SC_TRACE 83 -#define _SC_TRACE_EVENT_FILTER 84 -#define _SC_TRACE_EVENT_NAME_MAX 85 -#define _SC_TRACE_INHERIT 86 -#define _SC_TRACE_LOG 87 -#define _SC_TRACE_NAME_MAX 88 -#define _SC_TRACE_SYS_MAX 89 -#define _SC_TRACE_USER_EVENT_MAX 90 -#define _SC_TYPED_MEMORY_OBJECTS 91 -#define _SC_V7_ILP32_OFF32 92 -#define _SC_V6_ILP32_OFF32 _SC_V7_ILP32_OFF32 -#define _SC_XBS5_ILP32_OFF32 _SC_V7_ILP32_OFF32 -#define _SC_V7_ILP32_OFFBIG 93 -#define _SC_V6_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG -#define _SC_XBS5_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG -#define _SC_V7_LP64_OFF64 94 -#define _SC_V6_LP64_OFF64 _SC_V7_LP64_OFF64 -#define _SC_XBS5_LP64_OFF64 _SC_V7_LP64_OFF64 -#define _SC_V7_LPBIG_OFFBIG 95 -#define _SC_V6_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG -#define _SC_XBS5_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG -#define _SC_XOPEN_CRYPT 96 -#define _SC_XOPEN_ENH_I18N 97 -#define _SC_XOPEN_LEGACY 98 -#define _SC_XOPEN_REALTIME 99 -#define _SC_STREAM_MAX 100 -#define _SC_PRIORITY_SCHEDULING 101 -#define _SC_XOPEN_REALTIME_THREADS 102 -#define _SC_XOPEN_SHM 103 -#define _SC_XOPEN_STREAMS 104 -#define _SC_XOPEN_UNIX 105 -#define _SC_XOPEN_VERSION 106 -#define _SC_2_CHAR_TERM 107 -#define _SC_2_C_BIND 108 -#define _SC_2_C_DEV 109 -#define _SC_2_FORT_DEV 110 -#define _SC_2_FORT_RUN 111 -#define _SC_2_LOCALEDEF 112 -#define _SC_2_PBS 113 -#define _SC_2_PBS_ACCOUNTING 114 -#define _SC_2_PBS_CHECKPOINT 115 -#define _SC_2_PBS_LOCATE 116 -#define _SC_2_PBS_MESSAGE 117 -#define _SC_2_PBS_TRACK 118 -#define _SC_2_SW_DEV 119 -#define _SC_2_UPE 120 -#define _SC_2_VERSION 121 -#define _SC_THREAD_ROBUST_PRIO_INHERIT 122 -#define _SC_THREAD_ROBUST_PRIO_PROTECT 123 -#define _SC_XOPEN_UUCP 124 -#define _SC_LEVEL1_ICACHE_SIZE 125 -#define _SC_LEVEL1_ICACHE_ASSOC 126 -#define _SC_LEVEL1_ICACHE_LINESIZE 127 -#define _SC_LEVEL1_DCACHE_SIZE 128 -#define _SC_LEVEL1_DCACHE_ASSOC 129 -#define _SC_LEVEL1_DCACHE_LINESIZE 130 -#define _SC_LEVEL2_CACHE_SIZE 131 -#define _SC_LEVEL2_CACHE_ASSOC 132 -#define _SC_LEVEL2_CACHE_LINESIZE 133 -#define _SC_LEVEL3_CACHE_SIZE 134 -#define _SC_LEVEL3_CACHE_ASSOC 135 -#define _SC_LEVEL3_CACHE_LINESIZE 136 -#define _SC_LEVEL4_CACHE_SIZE 137 -#define _SC_LEVEL4_CACHE_ASSOC 138 -#define _SC_LEVEL4_CACHE_LINESIZE 139 - -#endif diff --git a/newlib/libc/sys/phoenix/sys/utmp.h b/newlib/libc/sys/phoenix/sys/utmp.h deleted file mode 100644 index dfab157..0000000 --- a/newlib/libc/sys/phoenix/sys/utmp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Written 2000 by Werner Almesberger */ -/* Some things copied from glibc's /usr/include/bits/utmp.h */ - -#ifndef _SYS_UTMP_H -#define _SYS_UTMP_H - -#include <sys/types.h> - -#define UTMP_FILE "/var/run/utmp" - -#define UT_LINESIZE 32 -#define UT_NAMESIZE 32 -#define UT_HOSTSIZE 256 - -struct utmp { - short int ut_type; - pid_t ut_pid; - char ut_line[UT_LINESIZE]; - char ut_id[4]; - char ut_user[UT_NAMESIZE]; - char ut_host[UT_HOSTSIZE]; - char __filler[52]; -}; - -#define ut_name ut_user - -#define RUN_LVL 1 -#define BOOT_TIME 2 -#define NEW_TIME 3 -#define OLD_TIME 4 -#define INIT_PROCESS 5 -#define LOGIN_PROCESS 6 -#define USER_PROCESS 7 -#define DEAD_PROCESS 8 - -struct utmp *_getutline(struct utmp *ut); -struct utmp *getutent(); -struct utmp *getutid(struct utmp *ut); -struct utmp *getutline(struct utmp *ut); -void endutent(); -void pututline(struct utmp *ut); -void setutent(); -void utmpname(const char *file); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/utsname.h b/newlib/libc/sys/phoenix/sys/utsname.h deleted file mode 100644 index 2590f19..0000000 --- a/newlib/libc/sys/phoenix/sys/utsname.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#include <phoenix/uname.h> - -int uname(struct utsname *buf); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/vfs.h b/newlib/libc/sys/phoenix/sys/vfs.h deleted file mode 100644 index 918fee7..0000000 --- a/newlib/libc/sys/phoenix/sys/vfs.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_VFS_H -#define _SYS_VFS_H - -#include <phoenix/statfs.h> - -/* Declare which statfs fields are available in Phoenix-RTOS. */ -#define _STATFS_F_NAMELEN -#define _STATFS_F_FRSIZE -#define _STATFS_F_FLAGS - -int statfs(const char *path, struct statfs *buf); -int fstatfs(int fd, struct statfs *buf); - -#endif diff --git a/newlib/libc/sys/phoenix/sys/wait.h b/newlib/libc/sys/phoenix/sys/wait.h deleted file mode 100644 index 59b0f8c..0000000 --- a/newlib/libc/sys/phoenix/sys/wait.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H - -#include <sys/types.h> - -#define WNOHANG 1 -#define WUNTRACED 2 - -#define WIFEXITED(status) (!WTERMSIG(status)) -#define WEXITSTATUS(status) (((status) >> 8) & 0xff) -#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) -#define WTERMSIG(status) ((status ) & 0x7f) -#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) -#define WSTOPSIG(status) WEXITSTATUS(status) -#define WCOREDUMP(status) ((status) & 0x80) - -pid_t wait(int *status); -pid_t waitpid(pid_t pid, int *status, int options); -pid_t _wait(int *status); - -#endif diff --git a/newlib/libc/sys/phoenix/syscall.h b/newlib/libc/sys/phoenix/syscall.h deleted file mode 100644 index e1373ce..0000000 --- a/newlib/libc/sys/phoenix/syscall.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#ifndef PHOENIX_SYSCALL_H -#define PHOENIX_SYSCALL_H - -#include <sys/_null.h> - -#define SYS_SBRK 0 -#define SYS_READ 1 -#define SYS_WRITE 2 -#define SYS_OPEN 3 -#define SYS_CLOSE 4 -#define SYS_FORK 5 -#define SYS_NANOSLEEP 6 -#define SYS_EXECVE 7 -#define SYS_GETPID 8 -#define SYS_EXIT 9 -#define SYS_WAITPID 10 -#define SYS_GETPPID 11 -#define SYS_LSEEK 12 -#define SYS_FSTAT 13 -#define SYS_STAT 14 -#define SYS_ISATTY 15 -#define SYS_PIPE 16 -#define SYS_LSTAT 17 -#define SYS_FCNTL 18 -#define SYS_DUP2 19 -#define SYS_SOCKET 20 -#define SYS_CONNECT 21 -#define SYS_SELECT 22 -#define SYS_GETCWD 23 -#define SYS_SETCWD 24 -#define SYS_BIND 25 -#define SYS_LISTEN 26 -#define SYS_ACCEPT 27 -#define SYS_GETDENTS 28 -#define SYS_MKDIR 29 -#define SYS_CHMOD 30 -#define SYS_IOCTL 31 -#define SYS_RMDIR 32 -#define SYS_MKNOD 33 -#define SYS_FSYNC 34 -#define SYS_FTRUNCATE 35 -#define SYS_ACCESS 36 -#define SYS_SENDTO 37 -#define SYS_RECVFROM 38 -#define SYS_GETSOCKNAME 39 -#define SYS_GETPEERNAME 40 -#define SYS_POLL 41 -#define SYS_CLOCK_GETTIME 42 -#define SYS_UNLINK 43 -#define SYS_LINK 44 -#define SYS_SYMLINK 45 -#define SYS_READLINK 46 -#define SYS_GETUID 47 -#define SYS_SETUID 48 -#define SYS_GETEUID 49 -#define SYS_SETEUID 50 -#define SYS_SETREUID 51 -#define SYS_GETGID 52 -#define SYS_SETGID 53 -#define SYS_GETEGID 54 -#define SYS_SETEGID 55 -#define SYS_SETREGID 56 -#define SYS_GETGROUPS 57 -#define SYS_SETGROUPS 58 -#define SYS_GETGRGID 59 -#define SYS_UMASK 60 -#define SYS_CHOWN 61 -#define SYS_LCHOWN 62 -#define SYS_FCHOWN 63 -#define SYS_FCHMOD 64 -#define SYS_TRUNCATE 65 -#define SYS_SCHED_GETPARAM 66 -#define SYS_SCHED_GETSCHEDULER 67 -#define SYS_SCHED_GET_PRIORITY_MAX 68 -#define SYS_SCHED_GET_PRIORITY_MIN 69 -#define SYS_SCHED_SETPARAM 70 -#define SYS_SCHED_SETSCHEDULER 71 -#define SYS_SCHED_YIELD 72 -#define SYS_MOUNT 73 -#define SYS_UMOUNT 74 -#define SYS_KILL 75 -#define SYS_CLOCK_SETTIME 76 -#define SYS_NET_CONFIGURE 77 -#define SYS_UNAME 78 -#define SYS_HOSTNAME 79 -#define SYS_DOMAINNAME 80 -#define SYS_CHTIMES 81 -#define SYS_REBOOT 82 -#define SYS_SYNC 83 -#define SYS_STATFS 84 -#define SYS_MMAP 85 -#define SYS_MUNMAP 86 - -void *_syscall5(unsigned syscallNo, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5); - -#define syscall0(rettype, no) (rettype) _syscall5(no, NULL, NULL, NULL, NULL,NULL) -#define syscall1(rettype, no, a1) (rettype) _syscall5(no, (void *) a1, NULL, NULL, NULL, NULL) -#define syscall2(rettype, no, a1, a2) (rettype) _syscall5(no, (void *) a1, (void *) a2, NULL, NULL, NULL) -#define syscall3(rettype, no, a1, a2, a3) (rettype) _syscall5(no, (void *) a1, (void *) a2, (void *) a3, NULL, NULL) -#define syscall4(rettype, no, a1, a2, a3, a4) (rettype) _syscall5(no, (void *) a1, (void *) a2, (void *) a3, (void *) a4, NULL) -#define syscall5(rettype, no, a1, a2, a3, a4, a5) (rettype) _syscall5(no, (void *) a1, (void *) a2, (void *) a3, (void *) a4, (void *) a5) - -#endif diff --git a/newlib/libc/sys/phoenix/sysconf.c b/newlib/libc/sys/phoenix/sysconf.c deleted file mode 100644 index 08eb439..0000000 --- a/newlib/libc/sys/phoenix/sysconf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <errno.h> - -long sysconf(int name) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/phoenix/syslog.c b/newlib/libc/sys/phoenix/syslog.c deleted file mode 100644 index c38800e..0000000 --- a/newlib/libc/sys/phoenix/syslog.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include <arpa/inet.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#include <sys/socket.h> -#include <syslog.h> -#include <unistd.h> - -#define BUFFER_SIZE 1024 -#define LOG_MAX_SIZE (3 * 512) - -struct { - int socket; - struct sockaddr_in addr; - const char *ident; - int option; - int facility; - int tried; -} client = { - .ident = NULL, - .socket = -1, - .option = 0, - .facility = 0, -}; - -void openlog(const char *ident, int option, int facility) -{ - if (client.socket != -1) - return; - - client.ident = ident; - client.option = option; - client.facility = facility; - - if (client.ident == NULL) - client.ident = "app"; - - if ((client.socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { - printf("Socket failed: %s\n", strerror(errno)); - return; - } - - memset(&(client.addr), 0, sizeof(client.addr)); - client.addr.sin_family = AF_INET; - client.addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - client.addr.sin_port = htons(31000); -} - -void syslog(int priority, const char *format, ...) -{ - char buffer[BUFFER_SIZE]; - char msg[LOG_MAX_SIZE]; - memset(buffer, 0, sizeof(buffer)); - memset(msg, 0, sizeof(msg)); - - if (LOG_FAC(priority) == 0) - priority |= client.facility; - - va_list args; - va_start(args, format); - vsnprintf(buffer, sizeof(buffer), format, args); - va_end(args); - - snprintf(msg, sizeof(msg), "<%d> %s[%d]: %s", priority, client.ident, getpid(), buffer); - - if (sendto(client.socket, msg, strlen(msg), 0, (struct sockaddr *) &(client.addr), sizeof(client.addr)) == -1) { - printf("Send failed: %s\n", strerror(errno)); - return; - } -} - -void closelog() -{ - if (client.socket == -1) - return; - - close(client.socket); - client.ident = NULL; - client.socket = -1; -} diff --git a/newlib/libc/sys/phoenix/time.c b/newlib/libc/sys/phoenix/time.c deleted file mode 100644 index f10de7f..0000000 --- a/newlib/libc/sys/phoenix/time.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ -#include "syscall.h" - -#include <errno.h> -#include <sys/times.h> -#include <time.h> - -/* Global variables. */ -int _daylight = 0; -long _timezone = 0; -char *_tzname[2] = {"GMT", "GMT"}; - -time_t time(time_t *t) -{ - struct timespec tp; - int ret = clock_gettime(CLOCK_REALTIME, &tp); - if (ret < 0) { - errno = -ret; - return -1; - } - - if (t != NULL) - *t = tp.tv_sec; - - return tp.tv_sec; -} - -int stime(const time_t *t) -{ - if (t == NULL) { - errno = EINVAL; - return -1; - } - - struct timespec tp; - tp.tv_sec = *t; - - int ret = clock_settime(CLOCK_REALTIME, &tp); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int gettimeofday(struct timeval *tv, void *tz) -{ - struct timespec tp; - int ret = clock_gettime(CLOCK_REALTIME, &tp); - if (ret < 0) { - errno = -ret; - return -1; - } - - tv->tv_sec = tp.tv_sec; - tv->tv_usec = tp.tv_nsec / 1000; - - return ret; -} - -int settimeofday(const struct timeval *tv, const struct timezone *tz) -{ - struct timespec tp; - tp.tv_sec = tv->tv_sec; - tp.tv_nsec = tv->tv_usec * 1000; - - int ret = clock_settime(CLOCK_REALTIME, &tp); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -clock_t times(struct tms *buf) -{ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/phoenix/truncate.c b/newlib/libc/sys/phoenix/truncate.c deleted file mode 100644 index 0669955..0000000 --- a/newlib/libc/sys/phoenix/truncate.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/types.h> - -int truncate(const char *path, off_t length) -{ - int ret = syscall2(int, SYS_TRUNCATE, path, length); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int ftruncate(int fd, off_t length) -{ - int ret = syscall2(int, SYS_FTRUNCATE, fd, length); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/tty.c b/newlib/libc/sys/phoenix/tty.c deleted file mode 100644 index ab944e0..0000000 --- a/newlib/libc/sys/phoenix/tty.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/ioctl.h> -#include <sys/termios.h> - -int _isatty(int fd) -{ - int ret = syscall1(int, SYS_ISATTY, fd); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int tcgetattr(int fd, struct termios *termios_p) -{ - int ret = ioctl(fd, TCGETS, termios_p); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int tcsetattr(int fd, int mode, const struct termios *termios_p) -{ - int cmd; - switch (mode) { - case TCSANOW: - cmd = TCSETS; - break; - case TCSADRAIN: - cmd = TCSETSW; - break; - case TCSAFLUSH: - cmd = TCSETSF; - break; - default: - errno = EINVAL; - return -1; - } - - int ret = ioctl(fd, cmd, termios_p); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int tcsendbreak(int fd, int duration) -{ - int ret = ioctl(fd, TCSBRK, duration); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int tcflush(int fd, int queue_selector) -{ - int ret = ioctl(fd, TCFLSH, queue_selector); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int tcdrain(int fd) -{ - int ret = ioctl(fd, TCDRAIN, 0); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -pid_t tcgetsid(int fd) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} - -int tcsetpgrp(int fd, pid_t pgrp) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/phoenix/uname.c b/newlib/libc/sys/phoenix/uname.c deleted file mode 100644 index 9f7b071..0000000 --- a/newlib/libc/sys/phoenix/uname.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/utsname.h> - -int uname(struct utsname *buf) -{ - int ret = syscall1(int, SYS_UNAME, buf); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; -} diff --git a/newlib/libc/sys/phoenix/utime.c b/newlib/libc/sys/phoenix/utime.c deleted file mode 100644 index 265363f..0000000 --- a/newlib/libc/sys/phoenix/utime.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <stdio.h> -#include <time.h> -#include <utime.h> - -int utime(const char *filename, const struct utimbuf *times) -{ - struct timespec t[2]; - if (times) { - t[0].tv_sec = times->actime; - t[0].tv_nsec = 0; - t[1].tv_sec = times->modtime; - t[1].tv_nsec = 0; - } - - int ret = syscall2(int, SYS_CHTIMES, filename, times ? &t : NULL); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -int utimes(const char *filename, const struct timeval times[2]) -{ - struct timespec t[2]; - if (times) { - t[0].tv_sec = times[0].tv_sec; - t[0].tv_nsec = times[0].tv_usec * 1000; - t[1].tv_sec = times[1].tv_sec; - t[1].tv_nsec = times[1].tv_usec * 1000; - } - - int ret = syscall2(int, SYS_CHTIMES, filename, times ? &t : NULL); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} diff --git a/newlib/libc/sys/phoenix/wait.c b/newlib/libc/sys/phoenix/wait.c deleted file mode 100644 index 914e2ab..0000000 --- a/newlib/libc/sys/phoenix/wait.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2016 Phoenix Systems - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE.*/ - -#include "syscall.h" - -#include <errno.h> -#include <sys/resource.h> -#include <sys/wait.h> - -pid_t wait(int *status) -{ - int ret = waitpid(-1, status, 0); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -pid_t waitpid(pid_t pid, int *status, int options) -{ - int ret = syscall3(int, SYS_WAITPID, pid, status, options); - if (ret < 0) { - errno = -ret; - return -1; - } - - return ret; -} - -pid_t wait3(int *status, int options, struct rusage *rusage) -{ - /* TODO: implement. */ - errno = ENOSYS; - return -1; -} |