From cb1f1a4a106a7ca93d36173ceeed3a3a4790ab96 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Sun, 9 Oct 2005 12:32:18 +0000 Subject: [PATCH] - Removed the various workarounds associated with , required for building code that references the networking API. It is now possible, provided you build your code with an existing TCP/IP API header file set (such as from the "Roadshow" SDK) without running into data type or function prototype declaration conflicts. I have added local versions of , , , , , , and and updated , and accordingly. Note that some of the function prototypes will conflict with the bsdsocket.library/usergroup.library API, which is why you can disable the declarations through the __NO_NET_API preprocessor symbol: if defined, none of the function prototypes will be defined. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15036 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/GNUmakefile.68k | 24 ++- library/GNUmakefile.os4 | 22 +- library/changes | 12 ++ library/include/arpa/inet.h | 80 +++++++ library/include/dirent.h | 14 +- library/include/dos.h | 14 +- library/include/fcntl.h | 14 +- library/include/ftw.h | 14 +- library/include/grp.h | 45 +++- library/include/inttypes.h | 14 +- library/include/netdb.h | 174 ++++++++++++++++ library/include/netinet/in.h | 260 +++++++++++++++++++++++ library/include/pwd.h | 45 +++- library/include/stdio.h | 14 +- library/include/stdlib.h | 14 +- library/include/string.h | 14 +- library/include/strings.h | 14 +- library/include/sys/amigaos-va.h | 14 +- library/include/sys/filio.h | 72 +++++++ library/include/sys/ioccom.h | 78 +++++++ library/include/sys/ioctl.h | 68 ++++++ library/include/sys/mount.h | 14 +- library/include/sys/select.h | 102 +++++++++ library/include/sys/socket.h | 346 +++++++++++++++++++++++++++++++ library/include/sys/stat.h | 24 ++- library/include/sys/types.h | 26 +-- library/include/sys/uio.h | 14 +- library/include/termios.h | 26 ++- library/include/time.h | 14 +- library/include/unistd.h | 50 +++-- library/include/utime.h | 14 +- library/include/wchar.h | 14 +- library/include/wctype.h | 14 +- library/smakefile | 20 +- library/socket_bind.c | 6 +- library/socket_connect.c | 6 +- library/socket_gethostbyaddr.c | 4 +- library/socket_gethostname.c | 4 +- library/socket_getnetbyaddr.c | 4 +- library/socket_headers.h | 18 +- library/socket_inet_makeaddr.c | 4 +- library/socket_inet_netof.c | 6 +- library/socket_inet_network.c | 6 +- library/socket_ioctl.c | 4 +- library/socket_recvfrom.c | 6 +- library/socket_sendmsg.c | 6 +- library/socket_sendto.c | 6 +- library/usergroup_headers.h | 12 +- library/usergroup_setsid.c | 4 +- 49 files changed, 1599 insertions(+), 195 deletions(-) create mode 100644 library/include/arpa/inet.h create mode 100644 library/include/netdb.h create mode 100644 library/include/netinet/in.h create mode 100644 library/include/sys/filio.h create mode 100644 library/include/sys/ioccom.h create mode 100644 library/include/sys/ioctl.h create mode 100644 library/include/sys/select.h create mode 100644 library/include/sys/socket.h diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k index e7c2407..d6b687e 100644 --- a/library/GNUmakefile.68k +++ b/library/GNUmakefile.68k @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.68k,v 1.67 2005-08-27 12:12:50 obarthel Exp $ +# $Id: GNUmakefile.68k,v 1.68 2005-10-09 12:32:18 obarthel Exp $ # # :ts=8 # @@ -569,15 +569,17 @@ MATH_LIB = \ math_erfcf.o \ math_erff.o \ math_exp.o \ - math_expf.o \ math_exp2.o \ math_exp2f.o \ + math_expf.o \ math_expm1.o \ math_expm1f.o \ math_fabs.o \ math_fabsf.o \ math_floor.o \ math_floorf.o \ + math_fma.o \ + math_fmaf.o \ math_fmod.o \ math_fmodf.o \ math_fpclassify.o \ @@ -602,28 +604,38 @@ MATH_LIB = \ math_lgamma.o \ math_lgammaf.o \ math_log.o \ - math_log2.o \ - math_log2f.o \ math_log10.o \ math_log10f.o \ math_log1p.o \ math_log1pf.o \ + math_log2.o \ + math_log2f.o \ math_logb.o \ math_logbf.o \ math_logf.o \ + math_lrint.o \ + math_lrintf.o \ + math_lround.o \ + math_lroundf.o \ math_modf.o \ math_modff.o \ math_nan.o \ math_nanf.o \ + math_nearbyint.o \ + math_nearbyintf.o \ math_nextafter.o \ math_nextafterf.o \ math_pow.o \ math_powf.o \ math_remainder.o \ math_remainderf.o \ + math_remquo.o \ + math_remquof.o \ math_rem_pio2f.o \ math_rint.o \ math_rintf.o \ + math_round.o \ + math_roundf.o \ math_scalbn.o \ math_scalbnf.o \ math_signbit.o \ @@ -637,6 +649,10 @@ MATH_LIB = \ math_tanf.o \ math_tanh.o \ math_tanhf.o \ + math_tgamma.o \ + math_tgammaf.o \ + math_trunc.o \ + math_truncf.o \ stdio_asprintf.o \ stdio_flush.o \ stdio_flush_all_files.o \ diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index 02694d6..447e23e 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.74 2005-09-03 14:45:14 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.75 2005-10-09 12:32:18 obarthel Exp $ # # :ts=8 # @@ -581,15 +581,17 @@ MATH_LIB = \ math_erfcf.o \ math_erff.o \ math_exp.o \ - math_expf.o \ math_exp2.o \ math_exp2f.o \ + math_expf.o \ math_expm1.o \ math_expm1f.o \ math_fabs.o \ math_fabsf.o \ math_floor.o \ math_floorf.o \ + math_fma.o \ + math_fmaf.o \ math_fmod.o \ math_fmodf.o \ math_fpclassify.o \ @@ -620,28 +622,36 @@ MATH_LIB = \ math_lgamma.o \ math_lgammaf.o \ math_log.o \ - math_log2.o \ - math_log2f.o \ math_log10.o \ math_log10f.o \ math_log1p.o \ math_log1pf.o \ + math_log2.o \ + math_log2f.o \ math_logb.o \ math_logbf.o \ math_logf.o \ + math_lround.o \ + math_lroundf.o \ math_modf.o \ math_modff.o \ math_nan.o \ math_nanf.o \ + math_nearbyint.o \ + math_nearbyintf.o \ math_nextafter.o \ math_nextafterf.o \ math_pow.o \ math_powf.o \ math_remainder.o \ math_remainderf.o \ + math_remquo.o \ + math_remquof.o \ math_rem_pio2f.o \ math_rint.o \ math_rintf.o \ + math_round.o \ + math_roundf.o \ math_scalbn.o \ math_scalbnf.o \ math_signbit.o \ @@ -655,6 +665,10 @@ MATH_LIB = \ math_tanf.o \ math_tanh.o \ math_tanhf.o \ + math_tgamma.o \ + math_tgammaf.o \ + math_trunc.o \ + math_truncf.o \ stdio_asprintf.o \ stdio_flush.o \ stdio_flush_all_files.o \ diff --git a/library/changes b/library/changes index 5bba762..02e75a2 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,15 @@ +- Removed the various workarounds associated with , required + for building code that references the networking API. It is now possible, + provided you build your code with an existing TCP/IP API header file + set (such as from the "Roadshow" SDK) without running into data type + or function prototype declaration conflicts. I have added local versions + of , , , , , + , and and updated , + and accordingly. Note that some of the function prototypes + will conflict with the bsdsocket.library/usergroup.library API, which is + why you can disable the declarations through the __NO_NET_API preprocessor + symbol: if defined, none of the function prototypes will be defined. + - Implemented lrintf(), lrint(), lroundf(), lround(), nearbyintf(), nearbyint(), remquof(), remquo(), roundf(), round(), tgammaf(), tgamma(), truncf(), trunc(). Sort of implemented fmaf() and fma(), diff --git a/library/include/arpa/inet.h b/library/include/arpa/inet.h new file mode 100644 index 0000000..cdafd74 --- /dev/null +++ b/library/include/arpa/inet.h @@ -0,0 +1,80 @@ +/* + * $Id: inet.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 + +/****************************************************************************/ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern in_addr_t inet_addr(const char *cp); +extern int inet_aton(const char *cp, struct in_addr *pin); +extern in_addr_t inet_lnaof(struct in_addr in); +extern struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna); +extern in_addr_t inet_netof(struct in_addr in); +extern in_addr_t inet_network(const char *cp); +extern char *inet_ntoa(struct in_addr in); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _ARPA_INET_H */ diff --git a/library/include/dirent.h b/library/include/dirent.h index 9a34f00..80911e7 100644 --- a/library/include/dirent.h +++ b/library/include/dirent.h @@ -1,5 +1,5 @@ /* - * $Id: dirent.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: dirent.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,12 +40,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _SYS_TYPES_H #include #endif /* _SYS_TYPES_H */ @@ -56,6 +50,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + #define NAME_MAX FILENAME_MAX /****************************************************************************/ diff --git a/library/include/dos.h b/library/include/dos.h index 5660cc2..54f85f4 100644 --- a/library/include/dos.h +++ b/library/include/dos.h @@ -1,5 +1,5 @@ /* - * $Id: dos.h,v 1.10 2005-07-03 10:36:48 obarthel Exp $ + * $Id: dos.h,v 1.11 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,12 +40,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDIO_H #include #endif /* _STDIO_H */ @@ -62,6 +56,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* * The Workbench startup message passed to this program; this may be NULL * if the program was started from shell instead. diff --git a/library/include/fcntl.h b/library/include/fcntl.h index 42e7048..448381b 100644 --- a/library/include/fcntl.h +++ b/library/include/fcntl.h @@ -1,5 +1,5 @@ /* - * $Id: fcntl.h,v 1.5 2005-04-03 10:22:48 obarthel Exp $ + * $Id: fcntl.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,12 +40,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _SYS_TYPES_H #include #endif /* _SYS_TYPES_H */ @@ -56,6 +50,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + #define O_RDONLY 0 #define O_WRONLY 1 #define O_RDWR 2 diff --git a/library/include/ftw.h b/library/include/ftw.h index fcfba01..fa8e77a 100644 --- a/library/include/ftw.h +++ b/library/include/ftw.h @@ -1,5 +1,5 @@ /* - * $Id: ftw.h,v 1.1 2005-03-02 12:57:56 obarthel Exp $ + * $Id: ftw.h,v 1.2 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,12 +36,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - /* The following is not part of the ISO 'C' (1994) standard. */ /****************************************************************************/ @@ -50,6 +44,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* Values passed to the user function (argument #3). */ enum { diff --git a/library/include/grp.h b/library/include/grp.h index 031a802..f68c05e 100644 --- a/library/include/grp.h +++ b/library/include/grp.h @@ -1,5 +1,5 @@ /* - * $Id: grp.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: grp.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,15 +40,25 @@ /****************************************************************************/ +#ifndef _SYS_TYPES_H +#include +#endif /* _SYS_TYPES_H */ + +/****************************************************************************/ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /****************************************************************************/ -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif /****************************************************************************/ @@ -62,6 +72,33 @@ struct group /****************************************************************************/ +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern void endgrent(void); +extern struct group *getgrent(void); +extern struct group *getgrgid(gid_t gid); +extern struct group *getgrnam(const char *name); +extern void setgrent(void); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/library/include/inttypes.h b/library/include/inttypes.h index 81c1cc4..cfd3c3f 100644 --- a/library/include/inttypes.h +++ b/library/include/inttypes.h @@ -1,5 +1,5 @@ /* - * $Id: inttypes.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $ + * $Id: inttypes.h,v 1.3 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -56,6 +56,12 @@ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* printf() format specifications for different types. */ /* "Decimal" */ @@ -315,4 +321,10 @@ extern uintmax_t wcstoumax(const wchar_t *str, char **ptr, int base); /****************************************************************************/ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + #endif /* _INTTYPES_H */ diff --git a/library/include/netdb.h b/library/include/netdb.h new file mode 100644 index 0000000..3321e7f --- /dev/null +++ b/library/include/netdb.h @@ -0,0 +1,174 @@ +/* + * $Id: netdb.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 _NETDB_H +#define _NETDB_H + +/****************************************************************************/ + +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +#define MAXHOSTNAMELEN 256 /* max hostname size */ + +/****************************************************************************/ + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +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 */ +}; + +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ + +/* + * 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 */ + in_addr_t 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 # */ +}; + +/****************************************************************************/ + +/* + * 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-Authoritive 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 */ + +/****************************************************************************/ + +extern int h_errno; + +/****************************************************************************/ + +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type); +extern struct hostent *gethostbyname(const char *name); +extern struct netent *getnetbyaddr(in_addr_t net, int type); +extern struct netent *getnetbyname(const char *name); +extern struct protoent *getprotobyname(const char *name); +extern struct protoent *getprotobynumber(int proto); +extern struct servent *getservbyname(const char *name, const char *proto); +extern struct servent *getservbyport(int port, const char *proto); +extern const char *hstrerror(int err); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETDB_H */ diff --git a/library/include/netinet/in.h b/library/include/netinet/in.h new file mode 100644 index 0000000..f139210 --- /dev/null +++ b/library/include/netinet/in.h @@ -0,0 +1,260 @@ +/* + * $Id: in.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 _NETINET_IN_H +#define _NETINET_IN_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Data types. + */ +typedef unsigned long in_addr_t; +typedef unsigned short in_port_t; + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + + +/* + * Local port number conventions: + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Internet address (a structure for historical reasons) + */ +struct in_addr +{ + unsigned long s_addr; +}; + +/* + * 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) (((unsigned long)(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) (((unsigned long)(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) (((unsigned long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((unsigned long)(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) (((unsigned long)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((unsigned long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY 0x00000000UL +#define INADDR_BROADCAST 0xffffffffUL /* must be masked */ +#define INADDR_NONE 0xffffffff /* -1 return */ + +#define INADDR_UNSPEC_GROUP 0xe0000000UL /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP 0xe0000001UL /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP 0xe00000ffUL /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Socket address, internet style. + */ +struct sockaddr_in +{ + unsigned char sin_len; + unsigned char sin_family; + unsigned short sin_port; + struct in_addr sin_addr; + unsigned char sin_zero[8]; +}; + +/* + * Structure used to describe IP options. + * Used to store options internally, to pass them to a process, + * or to restore options retrieved earlier. + * The ip_dst is used for the first-hop gateway when using a source route + * (this gets put into the header proper). + */ +struct ip_opts +{ + struct in_addr ip_dst; /* first hop, 0 w/o src rt */ + unsigned char ip_options[40]; /* actually variable in size */ +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* unsigned char; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* unsigned char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* unsigned char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ + +/* + * 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; must fit in one mbuf */ + +/* + * 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 */ +}; + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */ + +/* + * 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_MAXID 5 + +/****************************************************************************/ + +/* + * Macros for network/external number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) +#define NTOHS(x) (x) +#define HTONL(x) (x) +#define HTONS(x) (x) + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #p #pragma default-al +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IN_H */ diff --git a/library/include/pwd.h b/library/include/pwd.h index 1f874f0..afd9fe9 100644 --- a/library/include/pwd.h +++ b/library/include/pwd.h @@ -1,5 +1,5 @@ /* - * $Id: pwd.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: pwd.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,15 +40,25 @@ /****************************************************************************/ +#ifndef _SYS_TYPES_H +#include +#endif /* _SYS_TYPES_H */ + +/****************************************************************************/ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /****************************************************************************/ -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif /****************************************************************************/ @@ -65,6 +75,33 @@ struct passwd /****************************************************************************/ +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern void endpwent(void); +extern struct passwd *getpwent(void); +extern struct passwd *getpwnam(const char *name); +extern struct passwd *getpwuid(uid_t uid); +extern void setpwent(void); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/library/include/stdio.h b/library/include/stdio.h index e4e68b6..7cc66ca 100644 --- a/library/include/stdio.h +++ b/library/include/stdio.h @@ -1,5 +1,5 @@ /* - * $Id: stdio.h,v 1.17 2005-09-04 11:28:00 obarthel Exp $ + * $Id: stdio.h,v 1.18 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,12 +36,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ @@ -56,6 +50,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* 'End of file' indicator returned by, for example, fgetc() */ #define EOF (-1) diff --git a/library/include/stdlib.h b/library/include/stdlib.h index a4f50e4..a4cec9c 100644 --- a/library/include/stdlib.h +++ b/library/include/stdlib.h @@ -1,5 +1,5 @@ /* - * $Id: stdlib.h,v 1.11 2005-05-12 13:21:47 obarthel Exp $ + * $Id: stdlib.h,v 1.12 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,18 +36,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* Maximum number of bytes in a multibyte character */ #define MB_CUR_MAX 2 diff --git a/library/include/string.h b/library/include/string.h index 9946646..3a5a365 100644 --- a/library/include/string.h +++ b/library/include/string.h @@ -1,5 +1,5 @@ /* - * $Id: string.h,v 1.7 2005-01-02 09:07:21 obarthel Exp $ + * $Id: string.h,v 1.8 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,18 +36,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + extern char *strerror(int error_number); extern char *strcat(char *dest, const char *src); extern char *strncat(char *dest, const char *src, size_t n); diff --git a/library/include/strings.h b/library/include/strings.h index 5fa8b64..646f205 100644 --- a/library/include/strings.h +++ b/library/include/strings.h @@ -1,5 +1,5 @@ /* - * $Id: strings.h,v 1.4 2005-03-02 12:57:56 obarthel Exp $ + * $Id: strings.h,v 1.5 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,18 +40,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* These come from 4.4BSD. */ extern int strcasecmp(const char *s1, const char *s2); extern int strncasecmp(const char *s1, const char *s2, size_t len); diff --git a/library/include/sys/amigaos-va.h b/library/include/sys/amigaos-va.h index 01f2272..8a553fa 100644 --- a/library/include/sys/amigaos-va.h +++ b/library/include/sys/amigaos-va.h @@ -1,5 +1,5 @@ /* - * $Id: amigaos-va.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: amigaos-va.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,18 +40,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDARG_H #include #endif /* _STDARG_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* Define the AmigaOS specific varargs macros, if didn't already define them. */ diff --git a/library/include/sys/filio.h b/library/include/sys/filio.h new file mode 100644 index 0000000..f40fa8f --- /dev/null +++ b/library/include/sys/filio.h @@ -0,0 +1,72 @@ +/* + * $Id: filio.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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_FILIO_H +#define _SYS_FILIO_H + +/****************************************************************************/ + +#ifndef _SYS_IOCCOM_H +#include +#endif /* _SYS_IOCCOM_H */ + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +/* Generic file-descriptor ioctl's. */ +#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ +#define FIONCLEX _IO('f', 2) /* remove close on exec */ +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ +#define FIOSETOWN _IOW('f', 124, int) /* set owner */ +#define FIOGETOWN _IOR('f', 123, int) /* get owner */ + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _SYS_FILIO_H */ diff --git a/library/include/sys/ioccom.h b/library/include/sys/ioccom.h new file mode 100644 index 0000000..89b2f45 --- /dev/null +++ b/library/include/sys/ioccom.h @@ -0,0 +1,78 @@ +/* + * $Id: ioccom.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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_IOCCOM_H +#define _SYS_IOCCOM_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ +#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define IOCPARM_MAX NBPG /* max size of ioctl args, mult. of NBPG */ + +#define IOC_VOID (0x20000000UL) /* no parameters */ +#define IOC_OUT (0x40000000UL) /* copy parameters out */ +#define IOC_IN (0x80000000UL) /* copy parameters in */ +#define IOC_INOUT (IOC_IN|IOC_OUT) /* copy paramters in and out */ +#define IOC_DIRMASK (0xe0000000UL) /* mask for IN/OUT/VOID */ + +#define _IOC(inout,group,num,len) \ + (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) + +#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _SYS_IOCCOM_H */ diff --git a/library/include/sys/ioctl.h b/library/include/sys/ioctl.h new file mode 100644 index 0000000..fc095bb --- /dev/null +++ b/library/include/sys/ioctl.h @@ -0,0 +1,68 @@ +/* + * $Id: ioctl.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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_IOTCL_H +#define _SYS_IOTCL_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern int ioctl(int fildes, int request, ... /* arg */); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _SYS_IOTCL_H */ diff --git a/library/include/sys/mount.h b/library/include/sys/mount.h index 7d0e4fc..71072cf 100644 --- a/library/include/sys/mount.h +++ b/library/include/sys/mount.h @@ -1,5 +1,5 @@ /* - * $Id: mount.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: mount.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,18 +40,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _SYS_TYPES_H #include #endif /* _SYS_TYPES_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + typedef struct { long val[2]; } fsid_t; /* file system id type */ /****************************************************************************/ diff --git a/library/include/sys/select.h b/library/include/sys/select.h new file mode 100644 index 0000000..d38266e --- /dev/null +++ b/library/include/sys/select.h @@ -0,0 +1,102 @@ +/* + * $Id: select.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifndef _STRING_H +#include +#endif /* _STRING_H */ + +#ifndef _SYS_TIME_H +#include +#endif /* _SYS_TIME_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +/* + * select() uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields. + * + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 256 +#endif + +typedef struct fd_set +{ + unsigned long bits[(FD_SETSIZE + 31) / 32]; +} fd_set; + +#define FD_SET(n,p) ((void)((n) < FD_SETSIZE ? (p)->bits[((unsigned long)n) >> 5] |= (1UL << (((unsigned long)n) & 31)) : 0)) +#define FD_CLR(n,p) ((void)((n) < FD_SETSIZE ? (p)->bits[((unsigned long)n) >> 5] &= ~(1UL << (((unsigned long)n) & 31)) : 0)) +#define FD_ISSET(n,p) ((n) < FD_SETSIZE && ((p)->bits[((unsigned long)n) >> 5] & (1UL << (((unsigned long)n) & 31))) != 0) +#define FD_COPY(f,t) ((void)memmove(t,f,sizeof(*(f)))) +#define FD_ZERO(p) ((void)memset(p,0,sizeof(*(p)))) + +/****************************************************************************/ + +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern int select(int nfds, fd_set *readfds,fd_set *writefds, fd_set *errorfds,struct timeval *timeout); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _SYS_SELECT_H */ diff --git a/library/include/sys/socket.h b/library/include/sys/socket.h new file mode 100644 index 0000000..d14999c --- /dev/null +++ b/library/include/sys/socket.h @@ -0,0 +1,346 @@ +/* + * $Id: socket.h,v 1.1 2005-10-09 12:32:18 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifndef _STDDEF_H +#include +#endif /* _STDDEF_H */ + +#ifndef _SYS_UIO_H_ +#include +#endif /* _SYS_UIO_H_ */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif #endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Definitions related to sockets: types, address families, options. + */ + +typedef unsigned long socklen_t; + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +/* This is a private option which is used exclusively + * by this Amiga TCP/IP stack implementation and should not + * be used by user code. + */ +#define SO_EVENTMASK 0x2001 + +/* + * Structure used for manipulating linger optio * + */ +struct linger +{ + int l_onoff; /* option on/off */ + int l_linger; /* linger time in seconds */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ + +#define AF_MAX 26 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr +{ + unsigned char sa_len; /* total length */ + unsigned char sa_family; /* address family */ + unsigned char sa_data[14]; /* actually longer; address value */ +}; + +/* + * Structure used by kernel to pass protocol + * inf * inf * inf * informati + */ +struct sockproto +{ + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX /* same format as AF_NS */ +#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP + +#define PF_MAX AF_MAX + +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_MAXID 4 + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr +{ + void * msg_name; /* optional address */ + unsigned long msg_namelen; /* size of address */ + struct iovec * msg_iov; /* scatter/gather array */ + unsigned long msg_iovlen; /* # elements in msg_iov */ + void * msg_control; /* ancillary data, see below */ + unsigned long msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr +{ + unsigned long cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by unsigned char cmsg_data[]; */ +}; + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((unsigned char *)((cmsg) + 1)) + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((void *)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((void *)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of LONG) */ + +/****************************************************************************/ + +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern int accept(int sockfd,struct sockaddr *cliaddr,socklen_t *addrlen); +extern int bind(int socket, const struct sockaddr *address, socklen_t address_len); +extern int connect(int socket, const struct sockaddr *address, socklen_t address_len); +extern int getpeername(int socket, struct sockaddr *address, socklen_t *address_len); +extern int getsockname(int socket, struct sockaddr *address, socklen_t *address_len); +extern int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len); +extern int listen(int socket, int backlog); +extern ssize_t recv(int socket, void *buffer, size_t length, int flags); +extern ssize_t recvfrom(int socket, void *buffer, size_t length,int flags, struct sockaddr *address,socklen_t *address_len); +extern ssize_t recvmsg(int socket, struct msghdr *message, int flags); +extern ssize_t send(int socket, const void *buffer, size_t length, int flags); +extern ssize_t sendmsg(int socket, const struct msghdr *message, int flags); +extern ssize_t sendto(int socket, const void *message, size_t length,int flags, const struct sockaddr *dest_addr,socklen_t dest_len); +extern int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len); +extern int shutdown(int socket, int how); +extern int socket(int domain, int type, int protocol); + +#endif /* __NO_NET_API */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _SYS_SOCKET_H */ diff --git a/library/include/sys/stat.h b/library/include/sys/stat.h index 0f24284..37fd224 100644 --- a/library/include/sys/stat.h +++ b/library/include/sys/stat.h @@ -1,5 +1,5 @@ /* - * $Id: stat.h,v 1.5 2005-04-02 13:25:55 obarthel Exp $ + * $Id: stat.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,12 +40,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _SYS_TYPES_H #include #endif /* _SYS_TYPES_H */ @@ -60,6 +54,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_ISVTX 0001000 /* save swapped text even after use */ @@ -134,8 +134,18 @@ extern int chmod(const char * path_name, mode_t mode); extern int fchmod(int file_descriptor, mode_t mode); extern int mkdir(const char * path_name, mode_t mode); extern int rmdir(const char * path_name); + +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + extern mode_t umask(mode_t new_mask); +#endif /* __NO_NET_API */ + /****************************************************************************/ #ifdef __cplusplus diff --git a/library/include/sys/types.h b/library/include/sys/types.h index be8db94..ac82a6f 100644 --- a/library/include/sys/types.h +++ b/library/include/sys/types.h @@ -1,5 +1,5 @@ /* - * $Id: types.h,v 1.5 2005-07-15 14:31:37 obarthel Exp $ + * $Id: types.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,6 +40,18 @@ /****************************************************************************/ +#ifndef _TIME_H +#include +#endif /* _TIME_H */ + +/****************************************************************************/ + +#ifndef _STDDEF_H +#include +#endif /* _STDDEF_H */ + +/****************************************************************************/ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -61,18 +73,6 @@ typedef unsigned int uid_t; /****************************************************************************/ -#ifndef _TIME_H -#include -#endif /* _TIME_H */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/library/include/sys/uio.h b/library/include/sys/uio.h index 1d71a18..98a7770 100644 --- a/library/include/sys/uio.h +++ b/library/include/sys/uio.h @@ -1,5 +1,5 @@ /* - * $Id: uio.h,v 1.1 2005-04-03 10:22:48 obarthel Exp $ + * $Id: uio.h,v 1.2 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,12 +40,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _SYS_TYPES_H #include #endif /* _SYS_TYPES_H */ @@ -56,6 +50,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* * The size of MAX_IOVEC is rather arbitrary since there is no kernel support * for vectored I/O and even a single struct iovec can overflow a ssize_t. diff --git a/library/include/termios.h b/library/include/termios.h index 8e7a88c..c5f4301 100644 --- a/library/include/termios.h +++ b/library/include/termios.h @@ -1,5 +1,5 @@ /* - * $Id: termios.h,v 1.1 2005-06-04 10:46:23 obarthel Exp $ + * $Id: termios.h,v 1.2 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -31,14 +31,25 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _TERMIOS_H +#define _TERMIOS_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ /* * Almost-but-not-quite termios. */ -#ifndef _TERMIOS_H -#define _TERMIOS_H - typedef unsigned int tcflag_t; typedef unsigned char cc_t; typedef unsigned int speed_t; @@ -186,4 +197,11 @@ extern speed_t cfgetospeed(struct termios *tios_p); extern int cfsetispeed(struct termios *tios_p,speed_t input_speed); extern int cfsetospeed(struct termios *tios_p,speed_t output_speed); +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ #endif /* _TERMIOS_H */ diff --git a/library/include/time.h b/library/include/time.h index 7d41061..fb50330 100644 --- a/library/include/time.h +++ b/library/include/time.h @@ -1,5 +1,5 @@ /* - * $Id: time.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: time.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,18 +36,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + /* * Divide the number returned by clock() by CLOCKS_PER_SEC to obtain * the elapsed time in seconds diff --git a/library/include/unistd.h b/library/include/unistd.h index c94a22a..2787aac 100644 --- a/library/include/unistd.h +++ b/library/include/unistd.h @@ -1,5 +1,5 @@ /* - * $Id: unistd.h,v 1.13 2005-07-12 13:35:58 obarthel Exp $ + * $Id: unistd.h,v 1.14 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,16 +40,20 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _FCNTL_H #include #endif /* _FCNTL_H */ +#if !defined(__NO_NET_API) && !defined(_SYS_SELECT_H) +#include +#endif /* __NO_NET_API && _SYS_SELECT_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /****************************************************************************/ /* Endianness: we assume a big endian memory layout (for 68k and PowerPC). */ @@ -118,11 +122,33 @@ extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int lin /****************************************************************************/ -/* If desired, also include the networking API, as integrated into - the clib2 libnet.a library. */ -#if defined(__USE_CLIB2_NETLIB) && !defined(_SYS_CLIB2_NET_H) -#include -#endif /* __USE_CLIB2_NETLIB && !_SYS_CLIB2_NET_H */ +/* + * The following prototypes may clash with the bsdsocket.library or + * usergroup.library API definitions. + */ + +#ifndef __NO_NET_API + +extern long gethostid(void); +extern int gethostname(const char *name, size_t namelen); +extern char *crypt(const char *key, const char *salt); +extern gid_t getegid(void); +extern uid_t geteuid(void); +extern gid_t getgid(void); +extern int getgroups(int gidsetsize, gid_t grouplist[]); +extern char * getpass(const char *prompt); +extern uid_t getuid(void); +extern int initgroups(const char *name, gid_t basegid); +extern int setegid(gid_t gid); +extern int seteuid(uid_t uid); +extern int setgid(gid_t gid); +extern int setgroups(int ngroups, const gid_t *gidset); +extern int setregid(gid_t rgid, gid_t egid); +extern int setreuid(uid_t ruid, uid_t euid); +extern pid_t setsid(void); +extern int setuid(uid_t uid); + +#endif /* __NO_NET_API */ /****************************************************************************/ diff --git a/library/include/utime.h b/library/include/utime.h index 974f530..c634141 100644 --- a/library/include/utime.h +++ b/library/include/utime.h @@ -1,5 +1,5 @@ /* - * $Id: utime.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ + * $Id: utime.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,18 +40,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _TIME_H #include #endif /* _TIME_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + struct utimbuf { time_t actime; /* Access time */ diff --git a/library/include/wchar.h b/library/include/wchar.h index e83516d..a967d1e 100644 --- a/library/include/wchar.h +++ b/library/include/wchar.h @@ -1,5 +1,5 @@ /* - * $Id: wchar.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ + * $Id: wchar.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,12 +36,6 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ @@ -60,6 +54,12 @@ extern "C" { /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + #define WEOF (-1) #define WCHAR_MAX 65535 #define WCHAR_MIN 0 diff --git a/library/include/wctype.h b/library/include/wctype.h index 789a63a..54b14d8 100644 --- a/library/include/wctype.h +++ b/library/include/wctype.h @@ -1,5 +1,5 @@ /* - * $Id: wctype.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ + * $Id: wctype.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -36,18 +36,18 @@ /****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - #ifndef _WCHAR_H #include #endif /* _WCHAR_H */ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + typedef long wctype_t; /* ZZZ */ typedef long wctrans_t; /* ZZZ */ diff --git a/library/smakefile b/library/smakefile index 619ef56..d9295c2 100644 --- a/library/smakefile +++ b/library/smakefile @@ -1,5 +1,5 @@ # -# $Id: smakefile,v 1.49 2005-07-12 13:35:53 obarthel Exp $ +# $Id: smakefile,v 1.50 2005-10-09 12:32:18 obarthel Exp $ # # :ts=8 # @@ -215,6 +215,8 @@ MATH_OBJ = \ math_fdimf.o \ math_floor.o \ math_floorf.o \ + math_fma.o \ + math_fmaf.o \ math_fmax.o \ math_fmaxf.o \ math_fmin.o \ @@ -250,19 +252,29 @@ MATH_OBJ = \ math_logb.o \ math_logbf.o \ math_logf.o \ + math_lrint.o \ + math_lrintf.o \ + math_lround.o \ + math_lroundf.o \ math_modf.o \ math_modff.o \ math_nan.o \ math_nanf.o \ + math_nearbyint.o \ + math_nearbyintf.o \ math_nextafter.o \ math_nextafterf.o \ math_pow.o \ math_powf.o \ math_remainder.o \ math_remainderf.o \ + math_remquo.o \ + math_remquof.o \ math_rem_pio2f.o \ math_rint.o \ math_rintf.o \ + math_round.o \ + math_roundf.o \ math_scalbn.o \ math_scalbnf.o \ math_signbit.o \ @@ -275,7 +287,11 @@ MATH_OBJ = \ math_tan.o \ math_tanf.o \ math_tanh.o \ - math_tanhf.o + math_tanhf.o \ + math_tgamma.o \ + math_tgammaf.o \ + math_trunc.o \ + math_truncf.o MOUNT_OBJ = \ mount_convertinfo.o \ diff --git a/library/socket_bind.c b/library/socket_bind.c index ae85c6a..aba66c4 100644 --- a/library/socket_bind.c +++ b/library/socket_bind.c @@ -1,5 +1,5 @@ /* - * $Id: socket_bind.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ + * $Id: socket_bind.c,v 1.6 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -48,7 +48,7 @@ /****************************************************************************/ int -bind(int sockfd,struct sockaddr *name,int namelen) +bind(int sockfd,const struct sockaddr *name,socklen_t namelen) { struct fd * fd; int result = ERROR; @@ -84,7 +84,7 @@ bind(int sockfd,struct sockaddr *name,int namelen) goto out; PROFILE_OFF(); - result = __bind((LONG)fd->fd_DefaultFile,name,namelen); + result = __bind((LONG)fd->fd_DefaultFile,(struct sockaddr *)name,namelen); PROFILE_ON(); out: diff --git a/library/socket_connect.c b/library/socket_connect.c index 421cdd2..fd3d2a8 100644 --- a/library/socket_connect.c +++ b/library/socket_connect.c @@ -1,5 +1,5 @@ /* - * $Id: socket_connect.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ + * $Id: socket_connect.c,v 1.7 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -48,7 +48,7 @@ /****************************************************************************/ int -connect(int sockfd,struct sockaddr *name,socklen_t namelen) +connect(int sockfd,const struct sockaddr *name,socklen_t namelen) { struct fd * fd; int result = ERROR; @@ -84,7 +84,7 @@ connect(int sockfd,struct sockaddr *name,socklen_t namelen) goto out; PROFILE_OFF(); - result = __connect((LONG)fd->fd_DefaultFile,name,namelen); + result = __connect((LONG)fd->fd_DefaultFile,(struct sockaddr *)name,namelen); PROFILE_ON(); out: diff --git a/library/socket_gethostbyaddr.c b/library/socket_gethostbyaddr.c index 9ae9f41..c79c4a2 100644 --- a/library/socket_gethostbyaddr.c +++ b/library/socket_gethostbyaddr.c @@ -1,5 +1,5 @@ /* - * $Id: socket_gethostbyaddr.c,v 1.4 2005-06-20 07:43:59 obarthel Exp $ + * $Id: socket_gethostbyaddr.c,v 1.5 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -48,7 +48,7 @@ /****************************************************************************/ struct hostent * -gethostbyaddr(const char *addr, socklen_t len, int type) +gethostbyaddr(const void *addr, socklen_t len, int type) { struct hostent *result = NULL; diff --git a/library/socket_gethostname.c b/library/socket_gethostname.c index afc064f..fb2c6a5 100644 --- a/library/socket_gethostname.c +++ b/library/socket_gethostname.c @@ -1,5 +1,5 @@ /* - * $Id: socket_gethostname.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ + * $Id: socket_gethostname.c,v 1.5 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -48,7 +48,7 @@ /****************************************************************************/ int -gethostname(const char *hostname,int size) +gethostname(const char *hostname,size_t size) { int result = ERROR; diff --git a/library/socket_getnetbyaddr.c b/library/socket_getnetbyaddr.c index 1fb06eb..a117290 100644 --- a/library/socket_getnetbyaddr.c +++ b/library/socket_getnetbyaddr.c @@ -1,5 +1,5 @@ /* - * $Id: socket_getnetbyaddr.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ + * $Id: socket_getnetbyaddr.c,v 1.3 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -42,7 +42,7 @@ /****************************************************************************/ struct netent * -getnetbyaddr(long net,int type) +getnetbyaddr(in_addr_t net,int type) { struct netent *result = NULL; diff --git a/library/socket_headers.h b/library/socket_headers.h index d5a7028..4fcf7fe 100644 --- a/library/socket_headers.h +++ b/library/socket_headers.h @@ -1,5 +1,5 @@ /* - * $Id: socket_headers.h,v 1.8 2005-03-18 12:38:23 obarthel Exp $ + * $Id: socket_headers.h,v 1.9 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -40,6 +40,22 @@ #include #endif /* _NETINET_IN_H */ +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +#ifndef _SYS_FILIO_H +#include +#endif /* _SYS_FILIO_H */ + +#ifndef _ARPA_INET_H +#include +#endif /* _ARPA_INET_H */ + +#ifndef _NETDB_H +#include +#endif /* _NETDB_H */ + /****************************************************************************/ #ifndef _STDIO_HEADERS_H diff --git a/library/socket_inet_makeaddr.c b/library/socket_inet_makeaddr.c index c2949de..2e7ce27 100644 --- a/library/socket_inet_makeaddr.c +++ b/library/socket_inet_makeaddr.c @@ -1,5 +1,5 @@ /* - * $Id: socket_inet_makeaddr.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ + * $Id: socket_inet_makeaddr.c,v 1.3 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -42,7 +42,7 @@ /****************************************************************************/ struct in_addr -inet_makeaddr(int net,int host) +inet_makeaddr(in_addr_t net,in_addr_t host) { struct in_addr result; diff --git a/library/socket_inet_netof.c b/library/socket_inet_netof.c index cf5064c..9b4897e 100644 --- a/library/socket_inet_netof.c +++ b/library/socket_inet_netof.c @@ -1,5 +1,5 @@ /* - * $Id: socket_inet_netof.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ + * $Id: socket_inet_netof.c,v 1.3 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -41,10 +41,10 @@ /****************************************************************************/ -unsigned long +in_addr_t inet_netof(struct in_addr in) { - unsigned long result; + in_addr_t result; ENTER(); diff --git a/library/socket_inet_network.c b/library/socket_inet_network.c index 4991bf0..89d7f52 100644 --- a/library/socket_inet_network.c +++ b/library/socket_inet_network.c @@ -1,5 +1,5 @@ /* - * $Id: socket_inet_network.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ + * $Id: socket_inet_network.c,v 1.4 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -47,10 +47,10 @@ /****************************************************************************/ -unsigned long +in_addr_t inet_network(const char *cp) { - unsigned long result = ~0UL; + in_addr_t result = ~0UL; ENTER(); diff --git a/library/socket_ioctl.c b/library/socket_ioctl.c index 1344856..6606cbd 100644 --- a/library/socket_ioctl.c +++ b/library/socket_ioctl.c @@ -1,5 +1,5 @@ /* - * $Id: socket_ioctl.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ + * $Id: socket_ioctl.c,v 1.9 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -52,7 +52,7 @@ /****************************************************************************/ int -ioctl(int sockfd,unsigned long request, ... /* char *arg */) +ioctl(int sockfd,int request, ... /* char *arg */) { va_list arg; char * param; diff --git a/library/socket_recvfrom.c b/library/socket_recvfrom.c index 272291c..b772b5a 100644 --- a/library/socket_recvfrom.c +++ b/library/socket_recvfrom.c @@ -1,5 +1,5 @@ /* - * $Id: socket_recvfrom.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ + * $Id: socket_recvfrom.c,v 1.7 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -47,8 +47,8 @@ /****************************************************************************/ -int -recvfrom(int sockfd,void *buff,int len,int flags,struct sockaddr *from,socklen_t *fromlen) +ssize_t +recvfrom(int sockfd,void *buff,size_t len,int flags,struct sockaddr *from,socklen_t *fromlen) { struct fd * fd; int result = ERROR; diff --git a/library/socket_sendmsg.c b/library/socket_sendmsg.c index 634a090..bfbb7a4 100644 --- a/library/socket_sendmsg.c +++ b/library/socket_sendmsg.c @@ -1,5 +1,5 @@ /* - * $Id: socket_sendmsg.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ + * $Id: socket_sendmsg.c,v 1.6 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -48,7 +48,7 @@ /****************************************************************************/ int -sendmsg(int sockfd,struct msghdr *msg,int flags) +sendmsg(int sockfd,const struct msghdr *msg,int flags) { struct fd * fd; int result = ERROR; @@ -84,7 +84,7 @@ sendmsg(int sockfd,struct msghdr *msg,int flags) goto out; PROFILE_OFF(); - result = __sendmsg((LONG)fd->fd_DefaultFile,msg,flags); + result = __sendmsg((LONG)fd->fd_DefaultFile,(struct msghdr *)msg,flags); PROFILE_ON(); out: diff --git a/library/socket_sendto.c b/library/socket_sendto.c index 06b504b..9190dea 100644 --- a/library/socket_sendto.c +++ b/library/socket_sendto.c @@ -1,5 +1,5 @@ /* - * $Id: socket_sendto.c,v 1.8 2005-06-20 07:43:59 obarthel Exp $ + * $Id: socket_sendto.c,v 1.9 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -48,7 +48,7 @@ /****************************************************************************/ int -sendto(int sockfd,const void *buff,int len,int flags,struct sockaddr *to,socklen_t tolen) +sendto(int sockfd,const void *buff,size_t len,int flags,const struct sockaddr *to,socklen_t tolen) { struct fd * fd; int result = ERROR; @@ -87,7 +87,7 @@ sendto(int sockfd,const void *buff,int len,int flags,struct sockaddr *to,socklen goto out; PROFILE_OFF(); - result = __sendto((LONG)fd->fd_DefaultFile,(void *)buff,len,flags,to,tolen); + result = __sendto((LONG)fd->fd_DefaultFile,(void *)buff,len,flags,(struct sockaddr *)to,tolen); PROFILE_ON(); out: diff --git a/library/usergroup_headers.h b/library/usergroup_headers.h index 68afbfa..7ad67cd 100644 --- a/library/usergroup_headers.h +++ b/library/usergroup_headers.h @@ -1,5 +1,5 @@ /* - * $Id: usergroup_headers.h,v 1.6 2005-03-18 12:38:25 obarthel Exp $ + * $Id: usergroup_headers.h,v 1.7 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -54,6 +54,16 @@ /****************************************************************************/ +#ifndef _PWD_H +#include +#endif /* _PWD_H */ + +#ifndef _GRP_H +#include +#endif /* _GRP_H */ + +/****************************************************************************/ + extern struct Library * NOCOMMON __UserGroupBase; /****************************************************************************/ diff --git a/library/usergroup_setsid.c b/library/usergroup_setsid.c index d3a7e5f..7c64719 100644 --- a/library/usergroup_setsid.c +++ b/library/usergroup_setsid.c @@ -1,5 +1,5 @@ /* - * $Id: usergroup_setsid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ + * $Id: usergroup_setsid.c,v 1.3 2005-10-09 12:32:18 obarthel Exp $ * * :ts=4 * @@ -41,7 +41,7 @@ /****************************************************************************/ -long +pid_t setsid(void) { long result;