mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-20 16:01:10 +08:00
Add Phoenix-RTOS port for ARM.
Port contributed by Jakub Sejdak <jakub.sejdak@phoesys.com>
This commit is contained in:
parent
3312579f44
commit
ba72ae0f93
133
newlib/libc/sys/phoenix/Makefile.am
Normal file
133
newlib/libc/sys/phoenix/Makefile.am
Normal file
@ -0,0 +1,133 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
INCLUDES = -I$(srcdir)/include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(INCLTDL)
|
||||
|
||||
SUBDIRS = machine
|
||||
|
||||
SUBLIBS = \
|
||||
$(PHOENIX_MACH_LIB)
|
||||
|
||||
SOURCES = \
|
||||
net/domainname.c \
|
||||
net/freeaddrinfo.c \
|
||||
net/getaddrinfo.c \
|
||||
net/gethostbyaddr.c \
|
||||
net/gethostbyname.c \
|
||||
net/getnameinfo.c \
|
||||
net/getservbyname.c \
|
||||
net/getservbyport.c \
|
||||
net/herror.c \
|
||||
net/hostname.c \
|
||||
net/inet_addr.c \
|
||||
net/inet_aton.c \
|
||||
net/inet_lnaof.c \
|
||||
net/inet_makeaddr.c \
|
||||
net/inet_net_ntop.c \
|
||||
net/inet_net_pton.c \
|
||||
net/inet_netof.c \
|
||||
net/inet_network.c \
|
||||
net/inet_ntoa.c \
|
||||
net/inet_ntop.c \
|
||||
net/inet_pton.c \
|
||||
net/network.c \
|
||||
alarm.c \
|
||||
chmod.c \
|
||||
chown.c \
|
||||
clocks.c \
|
||||
dup.c \
|
||||
endmntent.c \
|
||||
exec.c \
|
||||
fcntl.c \
|
||||
fork.c \
|
||||
fs.c \
|
||||
getmntent.c \
|
||||
getpagesize.c \
|
||||
groups.c \
|
||||
ids.c \
|
||||
io.c \
|
||||
ioctl.c \
|
||||
mmap.c \
|
||||
mount.c \
|
||||
nanosleep.c \
|
||||
phoenix.c \
|
||||
pid.c \
|
||||
pipe.c \
|
||||
poll.c \
|
||||
realpath.c \
|
||||
reboot.c \
|
||||
resource.c \
|
||||
sbrk.c \
|
||||
sched.c \
|
||||
select.c \
|
||||
semaphore.c \
|
||||
setmntent.c \
|
||||
shm.c \
|
||||
signal.c \
|
||||
socket.c \
|
||||
sockopt.c \
|
||||
stat.c \
|
||||
statfs.c \
|
||||
symlink.c \
|
||||
sync.c \
|
||||
sysconf.c \
|
||||
syslog.c \
|
||||
time.c \
|
||||
truncate.c \
|
||||
tty.c \
|
||||
uname.c \
|
||||
utime.c \
|
||||
wait.c
|
||||
|
||||
ADD_OBJS =
|
||||
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(SOURCES)
|
||||
lib_a_LIBADD = $(ADD_OBJS)
|
||||
lib_a_DEPENDENCIES = $(ADD_OBJS)
|
||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||
LIBC_COMPILE = $(COMPILE)
|
||||
noinst_DATA =
|
||||
|
||||
lib.a: $(lib_a_OBJECTS)
|
||||
rm -f $@
|
||||
rm -rf tmp
|
||||
mkdir tmp
|
||||
cd tmp; \
|
||||
for i in $(SUBLIBS); do \
|
||||
$(AR) x ../$$i; \
|
||||
done;
|
||||
$(AR) $(AR_FLAGS) $@ tmp/*.o $^
|
||||
$(RANLIB) $@
|
||||
rm -rf tmp
|
||||
|
||||
all-local: crt0.o
|
||||
|
||||
crt0.o: machine/crt0.o
|
||||
rm -f $@
|
||||
ln machine/crt0.o $@ >/dev/null 2>/dev/null || cp machine/crt0.o $@
|
||||
|
||||
machine/crt0.o: ; @true
|
||||
|
||||
AM_CFLAGS = -I $(srcdir)/../../stdio
|
||||
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \
|
||||
for i in $(srcdir)/include/arpa/*.h; do \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \
|
||||
done; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \
|
||||
for i in $(srcdir)/include/net/*.h; do \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \
|
||||
done; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \
|
||||
for i in $(srcdir)/include/netinet/*.h; do \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \
|
||||
done; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \
|
||||
for i in $(srcdir)/include/netinet6/*.h; do \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \
|
||||
done;
|
1094
newlib/libc/sys/phoenix/Makefile.in
Normal file
1094
newlib/libc/sys/phoenix/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
1012
newlib/libc/sys/phoenix/aclocal.m4
vendored
Normal file
1012
newlib/libc/sys/phoenix/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
29
newlib/libc/sys/phoenix/alarm.c
Normal file
29
newlib/libc/sys/phoenix/alarm.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* 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;
|
||||
}
|
146
newlib/libc/sys/phoenix/bits/posix_opt.h
Normal file
146
newlib/libc/sys/phoenix/bits/posix_opt.h
Normal file
@ -0,0 +1,146 @@
|
||||
/* 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
|
50
newlib/libc/sys/phoenix/chmod.c
Normal file
50
newlib/libc/sys/phoenix/chmod.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* 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;
|
||||
}
|
61
newlib/libc/sys/phoenix/chown.c
Normal file
61
newlib/libc/sys/phoenix/chown.c
Normal file
@ -0,0 +1,61 @@
|
||||
/* 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;
|
||||
}
|
50
newlib/libc/sys/phoenix/clocks.c
Normal file
50
newlib/libc/sys/phoenix/clocks.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* 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;
|
||||
}
|
4904
newlib/libc/sys/phoenix/configure
vendored
Normal file
4904
newlib/libc/sys/phoenix/configure
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
newlib/libc/sys/phoenix/configure.in
Normal file
19
newlib/libc/sys/phoenix/configure.in
Normal file
@ -0,0 +1,19 @@
|
||||
dnl This is the newlib/libc/sys/phoenix configure.in file.
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([newlib],[NEWLIB_VERSION])
|
||||
AC_CONFIG_SRCDIR([phoenix.c])
|
||||
|
||||
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
|
||||
AC_CONFIG_AUX_DIR(../../../..)
|
||||
|
||||
NEWLIB_CONFIGURE(../../..)
|
||||
|
||||
AC_CONFIG_SUBDIRS(machine)
|
||||
|
||||
PHOENIX_MACH_LIB=machine/lib.${aext}
|
||||
AC_SUBST(PHOENIX_MACH_LIB)
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
50
newlib/libc/sys/phoenix/dup.c
Normal file
50
newlib/libc/sys/phoenix/dup.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* 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;
|
||||
}
|
31
newlib/libc/sys/phoenix/endmntent.c
Normal file
31
newlib/libc/sys/phoenix/endmntent.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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;
|
||||
}
|
55
newlib/libc/sys/phoenix/exec.c
Normal file
55
newlib/libc/sys/phoenix/exec.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* 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);
|
||||
}
|
48
newlib/libc/sys/phoenix/fcntl.c
Normal file
48
newlib/libc/sys/phoenix/fcntl.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* 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;
|
||||
}
|
44
newlib/libc/sys/phoenix/fork.c
Normal file
44
newlib/libc/sys/phoenix/fork.c
Normal file
@ -0,0 +1,44 @@
|
||||
/* 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>
|
||||
|
||||
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();
|
||||
}
|
130
newlib/libc/sys/phoenix/fs.c
Normal file
130
newlib/libc/sys/phoenix/fs.c
Normal file
@ -0,0 +1,130 @@
|
||||
/* 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);
|
||||
}
|
101
newlib/libc/sys/phoenix/getmntent.c
Normal file
101
newlib/libc/sys/phoenix/getmntent.c
Normal file
@ -0,0 +1,101 @@
|
||||
/* 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) {
|
||||
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));
|
||||
}
|
31
newlib/libc/sys/phoenix/getpagesize.c
Normal file
31
newlib/libc/sys/phoenix/getpagesize.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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;
|
||||
}
|
100
newlib/libc/sys/phoenix/groups.c
Normal file
100
newlib/libc/sys/phoenix/groups.c
Normal file
@ -0,0 +1,100 @@
|
||||
/* 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 NULL;
|
||||
}
|
137
newlib/libc/sys/phoenix/ids.c
Normal file
137
newlib/libc/sys/phoenix/ids.c
Normal file
@ -0,0 +1,137 @@
|
||||
/* 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();
|
||||
}
|
46
newlib/libc/sys/phoenix/include/arpa/inet.h
Normal file
46
newlib/libc/sys/phoenix/include/arpa/inet.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* 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 <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
|
44
newlib/libc/sys/phoenix/include/arpa/nameser.h
Normal file
44
newlib/libc/sys/phoenix/include/arpa/nameser.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* 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
|
331
newlib/libc/sys/phoenix/include/arpa/telnet.h
Normal file
331
newlib/libc/sys/phoenix/include/arpa/telnet.h
Normal file
@ -0,0 +1,331 @@
|
||||
/*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* @(#)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
|
30
newlib/libc/sys/phoenix/include/features.h
Normal file
30
newlib/libc/sys/phoenix/include/features.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* 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
|
66
newlib/libc/sys/phoenix/include/mntent.h
Normal file
66
newlib/libc/sys/phoenix/include/mntent.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* 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
|
299
newlib/libc/sys/phoenix/include/net/if.h
Normal file
299
newlib/libc/sys/phoenix/include/net/if.h
Normal file
@ -0,0 +1,299 @@
|
||||
/*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* @(#)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 <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 */
|
||||
};
|
||||
|
||||
#define IFF_UP 0x1 /* Interface is up */
|
||||
#define IFF_BROADCAST 0x2 /* Broadcast address valid */
|
||||
#define IFF_DEBUG 0x4 /* Turn on debugging */
|
||||
#define IFF_LOOPBACK 0x8 /* Is a loopback net */
|
||||
#define IFF_POINTOPOINT 0x10 /* Interface is point-to-point link */
|
||||
#define IFF_NOTRAILERS 0x20 /* Avoid use of trailers */
|
||||
#define IFF_RUNNING 0x40 /* Resources allocated */
|
||||
#define IFF_NOARP 0x80 /* No address resolution protocol */
|
||||
#define IFF_PROMISC 0x100 /* Receive all packets */
|
||||
#define IFF_ALLMULTI 0x200 /* Receive all multicast packets */
|
||||
#define IFF_OACTIVE 0x400 /* Transmission in progress */
|
||||
#define IFF_SIMPLEX 0x800 /* Can't hear own transmissions */
|
||||
#define IFF_LINK0 0x1000 /* Per link layer defined bit */
|
||||
#define IFF_LINK1 0x2000 /* Per link layer defined bit */
|
||||
#define IFF_LINK2 0x4000 /* Per link layer defined bit */
|
||||
#define IFF_ALTPHYS IFF_LINK2 /* Use alternate physical connection */
|
||||
#define IFF_MULTICAST 0x8000 /* Supports multicast */
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
* Interface request structure used for socket
|
||||
* ioctl's. All interface ioctl's must have parameter
|
||||
* definitions which begin with ifr_name. The
|
||||
* remainder may be interface specific.
|
||||
*/
|
||||
struct ifreq {
|
||||
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
struct sockaddr ifru_netmask;
|
||||
short ifru_flags[2];
|
||||
short ifru_index;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
int ifru_phys;
|
||||
int ifru_media;
|
||||
caddr_t ifru_data;
|
||||
int ifru_cap[2];
|
||||
} ifr_ifru;
|
||||
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* Address */
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* Other end of p-to-p link */
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* Broadcast address */
|
||||
#define ifr_netmask ifr_ifru.ifru_netmask /* Interface net mask */
|
||||
#define ifr_flags ifr_ifru.ifru_flags[0] /* Flags */
|
||||
#define ifr_prevflags ifr_ifru.ifru_flags[1] /* Flags */
|
||||
#define ifr_metric ifr_ifru.ifru_metric /* Metric */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* Mtu */
|
||||
#define ifr_phys ifr_ifru.ifru_phys /* Physical wire */
|
||||
#define ifr_media ifr_ifru.ifru_media /* Physical media */
|
||||
#define ifr_data ifr_ifru.ifru_data /* For use by interface */
|
||||
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* Requested capabilities */
|
||||
#define ifr_curcap ifr_ifru.ifru_cap[1] /* Current capabilities */
|
||||
#define ifr_index ifr_ifru.ifru_index /* Interface index */
|
||||
};
|
||||
|
||||
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
|
229
newlib/libc/sys/phoenix/include/netdb.h
Normal file
229
newlib/libc/sys/phoenix/include/netdb.h
Normal file
@ -0,0 +1,229 @@
|
||||
/*-
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* -
|
||||
* 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
|
398
newlib/libc/sys/phoenix/include/netinet/in.h
Normal file
398
newlib/libc/sys/phoenix/include/netinet/in.h
Normal file
@ -0,0 +1,398 @@
|
||||
/*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* @(#)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 <netinet6/in6.h>
|
||||
#include <sys/socket.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
|
||||
|
||||
/* Protocols common to RFC 1700, POSIX, and X/Open. */
|
||||
#define IPPROTO_IP 0 /* Dummy for IP */
|
||||
#define IPPROTO_ICMP 1 /* Control message protocol */
|
||||
#define IPPROTO_TCP 6 /* TCP */
|
||||
#define IPPROTO_UDP 17 /* User datagram protocol */
|
||||
|
||||
#define INADDR_ANY (u_int32_t) 0x00000000
|
||||
#define INADDR_BROADCAST (u_int32_t) 0xffffffff /* Must be masked */
|
||||
|
||||
typedef uint32_t in_addr_t;
|
||||
typedef uint16_t in_port_t;
|
||||
|
||||
/* Internet address (a structure for historical reasons). */
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
/* Socket address, internet style. */
|
||||
struct sockaddr_in {
|
||||
uint8_t sin_len;
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
char sin_zero[8];
|
||||
};
|
||||
|
||||
#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 structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
struct in_addr imr_interface; /* Local IP address of interface */
|
||||
};
|
||||
|
||||
/* 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
|
57
newlib/libc/sys/phoenix/include/netinet/in_systm.h
Normal file
57
newlib/libc/sys/phoenix/include/netinet/in_systm.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* @(#)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
|
180
newlib/libc/sys/phoenix/include/netinet/ip.h
Normal file
180
newlib/libc/sys/phoenix/include/netinet/ip.h
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* @(#)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
|
445
newlib/libc/sys/phoenix/include/netinet6/in6.h
Normal file
445
newlib/libc/sys/phoenix/include/netinet6/in6.h
Normal file
@ -0,0 +1,445 @@
|
||||
/* $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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
*
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
*/
|
||||
|
||||
/* Copied from Linux, modified for Phoenix-RTOS. */
|
||||
|
||||
#ifndef _NETINET6_IN6_H
|
||||
#define _NETINET6_IN6_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)
|
||||
|
||||
/* IPv6 address */
|
||||
struct in6_addr {
|
||||
union {
|
||||
uint8_t __u6_addr8[16];
|
||||
uint16_t __u6_addr16[8];
|
||||
uint32_t __u6_addr32[4];
|
||||
} __u6_addr; /* 128-bit IP6 address */
|
||||
};
|
||||
|
||||
#define s6_addr __u6_addr.__u6_addr8
|
||||
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
/* Socket address for IPv6 */
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define SIN6_LEN
|
||||
#endif
|
||||
|
||||
struct sockaddr_in6 {
|
||||
uint8_t sin6_family; /* AF_INET6 (sa_family_t) */
|
||||
uint16_t sin6_port; /* Transport layer port # (in_port_t) */
|
||||
uint32_t sin6_flowinfo; /* IP6 flow information */
|
||||
struct in6_addr sin6_addr; /* IP6 address */
|
||||
uint32_t sin6_scope_id; /* scope zone index */
|
||||
};
|
||||
|
||||
|
||||
/* 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
|
30
newlib/libc/sys/phoenix/include/poll.h
Normal file
30
newlib/libc/sys/phoenix/include/poll.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* 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
|
52
newlib/libc/sys/phoenix/include/semaphore.h
Normal file
52
newlib/libc/sys/phoenix/include/semaphore.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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
|
143
newlib/libc/sys/phoenix/include/syslog.h
Normal file
143
newlib/libc/sys/phoenix/include/syslog.h
Normal file
@ -0,0 +1,143 @@
|
||||
/* 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
|
85
newlib/libc/sys/phoenix/include/time.h
Normal file
85
newlib/libc/sys/phoenix/include/time.h
Normal file
@ -0,0 +1,85 @@
|
||||
/* 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
|
||||
|
||||
typedef struct __tzrule_struct {
|
||||
char ch;
|
||||
int m;
|
||||
int n;
|
||||
int d;
|
||||
int s;
|
||||
time_t change;
|
||||
long offset;
|
||||
} __tzrule_type;
|
||||
|
||||
typedef struct __tzinfo_struct {
|
||||
int __tznorth;
|
||||
int __tzyear;
|
||||
__tzrule_type __tzrule[2];
|
||||
} __tzinfo_type;
|
||||
|
||||
__tzinfo_type *__gettzinfo();
|
||||
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
|
100
newlib/libc/sys/phoenix/io.c
Normal file
100
newlib/libc/sys/phoenix/io.c
Normal file
@ -0,0 +1,100 @@
|
||||
/* 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);
|
||||
}
|
43
newlib/libc/sys/phoenix/ioctl.c
Normal file
43
newlib/libc/sys/phoenix/ioctl.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* 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;
|
||||
}
|
25
newlib/libc/sys/phoenix/machine/Makefile.am
Normal file
25
newlib/libc/sys/phoenix/machine/Makefile.am
Normal file
@ -0,0 +1,25 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
SUBDIRS = $(machine_dir) .
|
||||
|
||||
noinst_DATA = $(CRT0) lib.a
|
||||
|
||||
$(CRT0): $(machine_dir)/$(CRT0)
|
||||
rm -f $@
|
||||
ln $(machine_dir)/$(CRT0) $@ >/dev/null 2>/dev/null \
|
||||
|| cp $(machine_dir)/$(CRT0) $@
|
||||
|
||||
$(machine_dir)/$(CRT0): ; @true
|
||||
|
||||
CLEANFILES = $(CRT0)
|
||||
|
||||
lib.a: $(machine_dir)/lib.a
|
||||
rm -f $@
|
||||
ln $< $@ >/dev/null 2>/dev/null || cp $< $@
|
||||
|
||||
doc:
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../.. -I ../../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
511
newlib/libc/sys/phoenix/machine/Makefile.in
Normal file
511
newlib/libc/sys/phoenix/machine/Makefile.in
Normal file
@ -0,0 +1,511 @@
|
||||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) \
|
||||
$(srcdir)/../../../../../mkinstalldirs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/../../../../acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
DATA = $(noinst_DATA)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CRT0 = @CRT0@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
|
||||
NO_INCLUDE_LIST = @NO_INCLUDE_LIST@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
READELF = @READELF@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
aext = @aext@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libm_machine_dir = @libm_machine_dir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lpfx = @lpfx@
|
||||
machine_dir = @machine_dir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
newlib_basedir = @newlib_basedir@
|
||||
oext = @oext@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
subdirs = @subdirs@
|
||||
sys_dir = @sys_dir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
SUBDIRS = $(machine_dir) .
|
||||
noinst_DATA = $(CRT0) lib.a
|
||||
CLEANFILES = $(CRT0)
|
||||
ACLOCAL_AMFLAGS = -I ../../../.. -I ../../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --cygnus \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --cygnus Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
check-am:
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA)
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
|
||||
install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive distclean distclean-generic \
|
||||
distclean-tags dvi dvi-am html html-am info info-am install \
|
||||
install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
$(CRT0): $(machine_dir)/$(CRT0)
|
||||
rm -f $@
|
||||
ln $(machine_dir)/$(CRT0) $@ >/dev/null 2>/dev/null \
|
||||
|| cp $(machine_dir)/$(CRT0) $@
|
||||
|
||||
$(machine_dir)/$(CRT0): ; @true
|
||||
|
||||
lib.a: $(machine_dir)/lib.a
|
||||
rm -f $@
|
||||
ln $< $@ >/dev/null 2>/dev/null || cp $< $@
|
||||
|
||||
doc:
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
1012
newlib/libc/sys/phoenix/machine/aclocal.m4
vendored
Normal file
1012
newlib/libc/sys/phoenix/machine/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
newlib/libc/sys/phoenix/machine/arm/Makefile.am
Normal file
21
newlib/libc/sys/phoenix/machine/arm/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = syscall.S
|
||||
|
||||
AM_CFLAGS = -I$(srcdir)/../..
|
||||
AM_CCASFLAGS = -I$(srcdir)/../.. $(INCLUDES)
|
||||
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(LIB_SOURCES)
|
||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
|
||||
noinst_DATA =
|
||||
|
||||
all-local: crt0.o
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../../.. -I ../../../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
448
newlib/libc/sys/phoenix/machine/arm/Makefile.in
Normal file
448
newlib/libc/sys/phoenix/machine/arm/Makefile.in
Normal file
@ -0,0 +1,448 @@
|
||||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) \
|
||||
$(srcdir)/../../../../../../mkinstalldirs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/../../../../../acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../../mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
ARFLAGS = cru
|
||||
lib_a_AR = $(AR) $(ARFLAGS)
|
||||
lib_a_LIBADD =
|
||||
am__objects_1 = lib_a-syscall.$(OBJEXT)
|
||||
am_lib_a_OBJECTS = $(am__objects_1)
|
||||
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(lib_a_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
DATA = $(noinst_DATA)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
|
||||
NO_INCLUDE_LIST = @NO_INCLUDE_LIST@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
READELF = @READELF@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
aext = @aext@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libm_machine_dir = @libm_machine_dir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lpfx = @lpfx@
|
||||
machine_dir = @machine_dir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
newlib_basedir = @newlib_basedir@
|
||||
oext = @oext@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sys_dir = @sys_dir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
LIB_SOURCES = syscall.S
|
||||
AM_CFLAGS = -I$(srcdir)/../..
|
||||
AM_CCASFLAGS = -I$(srcdir)/../.. $(INCLUDES)
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(LIB_SOURCES)
|
||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
|
||||
noinst_DATA =
|
||||
ACLOCAL_AMFLAGS = -I ../../../../.. -I ../../../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .o .obj
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --cygnus \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --cygnus Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES)
|
||||
-rm -f lib.a
|
||||
$(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
|
||||
$(RANLIB) lib.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.S.o:
|
||||
$(CPPASCOMPILE) -c -o $@ $<
|
||||
|
||||
.S.obj:
|
||||
$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
lib_a-syscall.o: syscall.S
|
||||
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-syscall.o `test -f 'syscall.S' || echo '$(srcdir)/'`syscall.S
|
||||
|
||||
lib_a-syscall.obj: syscall.S
|
||||
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-syscall.obj `if test -f 'syscall.S'; then $(CYGPATH_W) 'syscall.S'; else $(CYGPATH_W) '$(srcdir)/syscall.S'; fi`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
check-am:
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES) $(DATA) all-local
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am all-local am--refresh check check-am \
|
||||
clean clean-generic clean-noinstLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-tags dvi dvi-am \
|
||||
html html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am
|
||||
|
||||
|
||||
all-local: crt0.o
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
1012
newlib/libc/sys/phoenix/machine/arm/aclocal.m4
vendored
Normal file
1012
newlib/libc/sys/phoenix/machine/arm/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4748
newlib/libc/sys/phoenix/machine/arm/configure
vendored
Normal file
4748
newlib/libc/sys/phoenix/machine/arm/configure
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
newlib/libc/sys/phoenix/machine/arm/configure.in
Normal file
14
newlib/libc/sys/phoenix/machine/arm/configure.in
Normal file
@ -0,0 +1,14 @@
|
||||
dnl This is the newlib/libc/sys/phoenix/machine/arm configure.in file.
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([newlib],[NEWLIB_VERSION])
|
||||
AC_CONFIG_SRCDIR([crt0.S])
|
||||
|
||||
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
|
||||
AC_CONFIG_AUX_DIR(../../../../../..)
|
||||
|
||||
NEWLIB_CONFIGURE(../../../../..)
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
47
newlib/libc/sys/phoenix/machine/arm/crt0.S
Normal file
47
newlib/libc/sys/phoenix/machine/arm/crt0.S
Normal file
@ -0,0 +1,47 @@
|
||||
/* 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
|
||||
|
||||
.align 4
|
||||
|
||||
_start:
|
||||
/* Ignore return address passed on the top of stack. */
|
||||
pop {lr}
|
||||
ldmfd sp, {r0-r2}
|
||||
ldr r3, =environ
|
||||
str r2, [r3]
|
||||
|
||||
/* Align stack. */
|
||||
bic sp, #0x00000007
|
||||
ldr lr, =main
|
||||
blx lr
|
||||
ldr lr, =exit
|
||||
blx lr
|
||||
|
5
newlib/libc/sys/phoenix/machine/arm/regenerate.sh
Normal file
5
newlib/libc/sys/phoenix/machine/arm/regenerate.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
aclocal-1.11 -I ../../../../../ -I ../../../../../../
|
||||
/usr/local/bin/autoconf
|
||||
automake-1.11 --cygnus Makefile
|
52
newlib/libc/sys/phoenix/machine/arm/syscall.S
Normal file
52
newlib/libc/sys/phoenix/machine/arm/syscall.S
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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
|
4935
newlib/libc/sys/phoenix/machine/configure
vendored
Normal file
4935
newlib/libc/sys/phoenix/machine/configure
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
newlib/libc/sys/phoenix/machine/configure.in
Normal file
31
newlib/libc/sys/phoenix/machine/configure.in
Normal file
@ -0,0 +1,31 @@
|
||||
dnl This is the newlib/libc/sys configure.in file.
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([newlib],[NEWLIB_VERSION])
|
||||
AC_CONFIG_SRCDIR([arm])
|
||||
|
||||
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
|
||||
AC_CONFIG_AUX_DIR(../../../../..)
|
||||
|
||||
NEWLIB_CONFIGURE(../../../..)
|
||||
|
||||
if test -n "${machine_dir}"; then
|
||||
case ${machine_dir} in
|
||||
arm) AC_CONFIG_SUBDIRS(arm) ;;
|
||||
esirisc) AC_CONFIG_SUBDIRS(esirisc) ;;
|
||||
i386) AC_CONFIG_SUBDIRS(i386) ;;
|
||||
powerpc) AC_CONFIG_SUBDIRS(powerpc) ;;
|
||||
esac;
|
||||
fi
|
||||
|
||||
CRT0=
|
||||
if test -n "${machine_dir}"; then
|
||||
CRT0=crt0.o
|
||||
fi
|
||||
AC_SUBST(CRT0)
|
||||
|
||||
AM_CONDITIONAL(HAVE_MACHINE_DIR, test x${machine_dir} != x)
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
5
newlib/libc/sys/phoenix/machine/regenerate.sh
Normal file
5
newlib/libc/sys/phoenix/machine/regenerate.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
aclocal-1.11 -I ../../../../ -I ../../../../../
|
||||
/usr/local/bin/autoconf
|
||||
automake-1.11 --cygnus Makefile
|
86
newlib/libc/sys/phoenix/mmap.c
Normal file
86
newlib/libc/sys/phoenix/mmap.c
Normal file
@ -0,0 +1,86 @@
|
||||
/* 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;
|
||||
}
|
54
newlib/libc/sys/phoenix/mount.c
Normal file
54
newlib/libc/sys/phoenix/mount.c
Normal file
@ -0,0 +1,54 @@
|
||||
/* 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);
|
||||
}
|
40
newlib/libc/sys/phoenix/nanosleep.c
Normal file
40
newlib/libc/sys/phoenix/nanosleep.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* 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;
|
||||
}
|
52
newlib/libc/sys/phoenix/net/domainname.c
Normal file
52
newlib/libc/sys/phoenix/net/domainname.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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;
|
||||
}
|
52
newlib/libc/sys/phoenix/net/freeaddrinfo.c
Normal file
52
newlib/libc/sys/phoenix/net/freeaddrinfo.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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);
|
||||
}
|
||||
}
|
185
newlib/libc/sys/phoenix/net/getaddrinfo.c
Normal file
185
newlib/libc/sys/phoenix/net/getaddrinfo.c
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
33
newlib/libc/sys/phoenix/net/gethostbyaddr.c
Normal file
33
newlib/libc/sys/phoenix/net/gethostbyaddr.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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;
|
||||
}
|
33
newlib/libc/sys/phoenix/net/gethostbyname.c
Normal file
33
newlib/libc/sys/phoenix/net/gethostbyname.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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;
|
||||
}
|
33
newlib/libc/sys/phoenix/net/getnameinfo.c
Normal file
33
newlib/libc/sys/phoenix/net/getnameinfo.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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;
|
||||
}
|
33
newlib/libc/sys/phoenix/net/getservbyname.c
Normal file
33
newlib/libc/sys/phoenix/net/getservbyname.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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;
|
||||
}
|
33
newlib/libc/sys/phoenix/net/getservbyport.c
Normal file
33
newlib/libc/sys/phoenix/net/getservbyport.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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;
|
||||
}
|
38
newlib/libc/sys/phoenix/net/herror.c
Normal file
38
newlib/libc/sys/phoenix/net/herror.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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);
|
||||
}
|
52
newlib/libc/sys/phoenix/net/hostname.c
Normal file
52
newlib/libc/sys/phoenix/net/hostname.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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;
|
||||
}
|
70
newlib/libc/sys/phoenix/net/inet_addr.c
Normal file
70
newlib/libc/sys/phoenix/net/inet_addr.c
Normal file
@ -0,0 +1,70 @@
|
||||
/* $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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
* -
|
||||
* 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;
|
||||
}
|
166
newlib/libc/sys/phoenix/net/inet_aton.c
Normal file
166
newlib/libc/sys/phoenix/net/inet_aton.c
Normal file
@ -0,0 +1,166 @@
|
||||
/* $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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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.
|
||||
* -
|
||||
* 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 <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;
|
||||
}
|
46
newlib/libc/sys/phoenix/net/inet_lnaof.c
Normal file
46
newlib/libc/sys/phoenix/net/inet_lnaof.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
51
newlib/libc/sys/phoenix/net/inet_makeaddr.c
Normal file
51
newlib/libc/sys/phoenix/net/inet_makeaddr.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
107
newlib/libc/sys/phoenix/net/inet_net_ntop.c
Normal file
107
newlib/libc/sys/phoenix/net/inet_net_ntop.c
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
190
newlib/libc/sys/phoenix/net/inet_net_pton.c
Normal file
190
newlib/libc/sys/phoenix/net/inet_net_pton.c
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
46
newlib/libc/sys/phoenix/net/inet_netof.c
Normal file
46
newlib/libc/sys/phoenix/net/inet_netof.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
102
newlib/libc/sys/phoenix/net/inet_network.c
Normal file
102
newlib/libc/sys/phoenix/net/inet_network.c
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
35
newlib/libc/sys/phoenix/net/inet_ntoa.c
Normal file
35
newlib/libc/sys/phoenix/net/inet_ntoa.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* 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;
|
||||
}
|
171
newlib/libc/sys/phoenix/net/inet_ntop.c
Normal file
171
newlib/libc/sys/phoenix/net/inet_ntop.c
Normal file
@ -0,0 +1,171 @@
|
||||
/* 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 */
|
||||
}
|
198
newlib/libc/sys/phoenix/net/inet_pton.c
Normal file
198
newlib/libc/sys/phoenix/net/inet_pton.c
Normal file
@ -0,0 +1,198 @@
|
||||
/* $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 */
|
||||
}
|
49
newlib/libc/sys/phoenix/net/network.c
Normal file
49
newlib/libc/sys/phoenix/net/network.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* 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;
|
||||
}
|
23
newlib/libc/sys/phoenix/phoenix.c
Normal file
23
newlib/libc/sys/phoenix/phoenix.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* 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.*/
|
37
newlib/libc/sys/phoenix/pid.c
Normal file
37
newlib/libc/sys/phoenix/pid.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* 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);
|
||||
}
|
38
newlib/libc/sys/phoenix/pipe.c
Normal file
38
newlib/libc/sys/phoenix/pipe.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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;
|
||||
}
|
39
newlib/libc/sys/phoenix/poll.c
Normal file
39
newlib/libc/sys/phoenix/poll.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* 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;
|
||||
}
|
104
newlib/libc/sys/phoenix/realpath.c
Normal file
104
newlib/libc/sys/phoenix/realpath.c
Normal file
@ -0,0 +1,104 @@
|
||||
/* 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;
|
||||
}
|
38
newlib/libc/sys/phoenix/reboot.c
Normal file
38
newlib/libc/sys/phoenix/reboot.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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;
|
||||
}
|
5
newlib/libc/sys/phoenix/regenerate.sh
Normal file
5
newlib/libc/sys/phoenix/regenerate.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
aclocal-1.11 -I ../../../ -I ../../../../
|
||||
/usr/local/bin/autoconf
|
||||
automake-1.11 --cygnus Makefile
|
88
newlib/libc/sys/phoenix/resource.c
Normal file
88
newlib/libc/sys/phoenix/resource.c
Normal file
@ -0,0 +1,88 @@
|
||||
/* 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;
|
||||
}
|
48
newlib/libc/sys/phoenix/sbrk.c
Normal file
48
newlib/libc/sys/phoenix/sbrk.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* 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;
|
||||
}
|
107
newlib/libc/sys/phoenix/sched.c
Normal file
107
newlib/libc/sys/phoenix/sched.c
Normal file
@ -0,0 +1,107 @@
|
||||
/* 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;
|
||||
}
|
40
newlib/libc/sys/phoenix/select.c
Normal file
40
newlib/libc/sys/phoenix/select.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* 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;
|
||||
}
|
168
newlib/libc/sys/phoenix/semaphore.c
Normal file
168
newlib/libc/sys/phoenix/semaphore.c
Normal file
@ -0,0 +1,168 @@
|
||||
/* 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);
|
||||
}
|
30
newlib/libc/sys/phoenix/setmntent.c
Normal file
30
newlib/libc/sys/phoenix/setmntent.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* 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);
|
||||
}
|
68
newlib/libc/sys/phoenix/shm.c
Normal file
68
newlib/libc/sys/phoenix/shm.c
Normal file
@ -0,0 +1,68 @@
|
||||
/* 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);
|
||||
}
|
75
newlib/libc/sys/phoenix/signal.c
Normal file
75
newlib/libc/sys/phoenix/signal.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* 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;
|
||||
}
|
137
newlib/libc/sys/phoenix/socket.c
Normal file
137
newlib/libc/sys/phoenix/socket.c
Normal file
@ -0,0 +1,137 @@
|
||||
/* 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/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;
|
||||
}
|
75
newlib/libc/sys/phoenix/sockopt.c
Normal file
75
newlib/libc/sys/phoenix/sockopt.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* 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/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 setsockopt_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 setsockopt_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;
|
||||
}
|
66
newlib/libc/sys/phoenix/stat.c
Normal file
66
newlib/libc/sys/phoenix/stat.c
Normal file
@ -0,0 +1,66 @@
|
||||
/* 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);
|
||||
}
|
39
newlib/libc/sys/phoenix/statfs.c
Normal file
39
newlib/libc/sys/phoenix/statfs.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* 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;
|
||||
}
|
60
newlib/libc/sys/phoenix/symlink.c
Normal file
60
newlib/libc/sys/phoenix/symlink.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* 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;
|
||||
}
|
45
newlib/libc/sys/phoenix/sync.c
Normal file
45
newlib/libc/sys/phoenix/sync.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* 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;
|
||||
}
|
38
newlib/libc/sys/phoenix/sys/_default_fcntl.h
Normal file
38
newlib/libc/sys/phoenix/sys/_default_fcntl.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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
|
41
newlib/libc/sys/phoenix/sys/_null.h
Normal file
41
newlib/libc/sys/phoenix/sys/_null.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* 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
|
30
newlib/libc/sys/phoenix/sys/_timespec.h
Normal file
30
newlib/libc/sys/phoenix/sys/_timespec.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* 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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user