hrev54388 adds 3 changesets to branch 'master'
old head: ebffd73fc540b4dcac1f50c82cb68ab8e40b5e65
new head: 4a230cfc6cbfb8413d9a02f81384fa4e201c23cd
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=4a230cfc6cbf+%5Eebffd73fc540
----------------------------------------------------------------------------
6996e5b271b2: headers: More removal of the BSD Advertising Clause.
Taken from FreeBSD; some minor cleanup elsewhere.
udp.h rewritten entirely as it contained no copyrightable
material and bears little resemblance to BSD's.
657f041aee41: fnmatch: Replace BSD implementation with musl one.
The BSD implementation was under the Advertising Clause,
so we might as well take the opportunity to replace the
implementation entirely with musl's.
Header also rewritten to be a Haiku one; the constants
are left unchanged of course.
4a230cfc6cbf: SPARC: Remove ancient BSD arch headers.
None of these were used; they were all imported with the original
root Haiku commit, and they are totally unrelated to PulkoMandy's
new SPARC work. Plus, they were also under a BSD Advertising Clause
license.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
17 files changed, 472 insertions(+), 1101 deletions(-)
headers/posix/arpa/nameser_compat.h | 32 +--
headers/posix/fnmatch.h | 61 +----
headers/posix/glob.h | 6 +-
headers/posix/netinet/ip_icmp.h | 141 +++++-----
headers/posix/netinet/ip_var.h | 97 +++----
headers/posix/netinet/udp.h | 45 +--
headers/private/kernel/arch/sparc/DEFS.h | 44 ---
headers/private/kernel/arch/sparc/promdev.h | 86 ------
headers/private/kernel/arch/sparc/saerrno.h | 59 ----
headers/private/kernel/arch/sparc/saioctl.h | 54 ----
headers/private/kernel/arch/sparc/stand.h | 214 ---------------
headers/private/kernel/arch/sparc/va-sparc.h | 166 -----------
src/system/libroot/posix/Jamfile | 1 -
src/system/libroot/posix/fnmatch.c | 230 ----------------
src/system/libroot/posix/musl/Jamfile | 2 +
src/system/libroot/posix/musl/regex/Jamfile | 15 +
src/system/libroot/posix/musl/regex/fnmatch.c | 320 ++++++++++++++++++++++
############################################################################
Commit: 6996e5b271b2ac592db6b7da2bdc25057b174af0
URL: https://git.haiku-os.org/haiku/commit/?id=6996e5b271b2
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri Jul 3 19:00:37 2020 UTC
headers: More removal of the BSD Advertising Clause.
Taken from FreeBSD; some minor cleanup elsewhere.
udp.h rewritten entirely as it contained no copyrightable
material and bears little resemblance to BSD's.
----------------------------------------------------------------------------
diff --git a/headers/posix/arpa/nameser_compat.h
b/headers/posix/arpa/nameser_compat.h
index bf4714aafa..16bcc3868f 100644
--- a/headers/posix/arpa/nameser_compat.h
+++ b/headers/posix/arpa/nameser_compat.h
@@ -1,6 +1,7 @@
-/* Copyright (c) 1983, 1989
+/*
+ * Copyright (c) 1983, 1989
* 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:
@@ -9,14 +10,10 @@
* 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
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -29,12 +26,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/*
- * from nameser.h 8.1 (Berkeley) 6/2/93
- * $Id: nameser_compat.h 24644 2008-03-29 12:37:05Z bonefish $
- */
-
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
@@ -43,14 +34,13 @@
#include <endian.h>
#if !defined(BYTE_ORDER) || \
- (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
- BYTE_ORDER != PDP_ENDIAN)
+ (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN)
/* you must determine what the correct bit order is for
* your compiler - the next line is an intentional error
* which will force your compiles to bomb until you fix
* the above macros.
*/
- error "Undefined or invalid BYTE_ORDER";
+#error "Undefined or invalid BYTE_ORDER";
#endif
/*
@@ -66,7 +56,7 @@ typedef struct {
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
- unsigned aa: 1; /* authoritive answer */
+ unsigned aa: 1; /* authoritative answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
@@ -76,11 +66,11 @@ typedef struct {
unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
#endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
- unsigned aa :1; /* authoritive answer */
+ unsigned aa :1; /* authoritative answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
@@ -178,6 +168,8 @@ typedef struct {
#define T_ATMA ns_t_atma
#define T_NAPTR ns_t_naptr
#define T_A6 ns_t_a6
+#define T_DNAME ns_t_dname
+#define T_OPT ns_t_opt
#define T_TSIG ns_t_tsig
#define T_IXFR ns_t_ixfr
#define T_AXFR ns_t_axfr
diff --git a/headers/posix/glob.h b/headers/posix/glob.h
index ed2557c2f8..bc9a0dfa7b 100644
--- a/headers/posix/glob.h
+++ b/headers/posix/glob.h
@@ -13,11 +13,7 @@
* 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
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/headers/posix/netinet/ip_icmp.h b/headers/posix/netinet/ip_icmp.h
index b3a99292b3..a3b6e5174a 100644
--- a/headers/posix/netinet/ip_icmp.h
+++ b/headers/posix/netinet/ip_icmp.h
@@ -1,7 +1,6 @@
-/* Parts of this file are covered under the following copyright */
/*
* Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
+ * 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
@@ -11,11 +10,7 @@
* 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
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -30,10 +25,8 @@
* 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_icmp.h 8.1 (Berkeley) 6/10/93
*/
-
+
#ifndef NETINET_IP_ICMP_H
#define NETINET_IP_ICMP_H
@@ -54,7 +47,7 @@ struct icmp {
uint16_t icd_seq;
} ih_idseq;
int32_t ih_void;
-
+
/* ICMP_UNREACH_NEEDFRAG (RFC 1191) */
struct ih_pmtu {
uint16_t ipm_void;
@@ -88,78 +81,78 @@ struct icmp {
#define icmp_ttime icmp_dun.id_ts.its_ttime
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_mask icmp_dun.id_mask
-#define icmp_data icmp_dun.id_data
+#define icmp_data icmp_dun.id_data
#define ICMP_MINLEN 8 /* absolute minimum length */
#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8)
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
/* Definition of type and code field values.
- *http://www.iana.org/assignments/icmp-parameters
+ * http://www.iana.org/assignments/icmp-parameters
*/
-#define ICMP_ECHOREPLY 0/* echo reply */
-#define ICMP_UNREACH 3/* dest unreachable, codes: */
-#define ICMP_SOURCEQUENCH 4/* packet lost, slow down */
-#define ICMP_REDIRECT 5/* shorter route, codes: */
-#define ICMP_ALTHOSTADDR 6/* alternate host address */
-#define ICMP_ECHO 8/* echo service */
-#define ICMP_ROUTERADVERT 9/* router advertisement */
-#define ICMP_ROUTERSOLICIT 10/* router solicitation */
-#define ICMP_TIMXCEED 11/* time exceeded, code: */
-#define ICMP_PARAMPROB 12/* ip header bad */
-#define ICMP_TSTAMP 13/* timestamp request */
-#define ICMP_TSTAMPREPLY 14/* timestamp reply */
-#define ICMP_IREQ 15/* information request */
-#define ICMP_IREQREPLY 16/* information reply */
-#define ICMP_MASKREQ 17/* address mask request */
-#define ICMP_MASKREPLY 18/* address mask reply */
-#define ICMP_TRACEROUTE 30/* traceroute */
-#define ICMP_DATACONVERR 31/* data conversion error */
-#define ICMP_MOBILE_REDIRECT 32/* mobile host redirect */
-#define ICMP_IPV6_WHEREAREYOU 33/* IPv6 where-are-you */
-#define ICMP_IPV6_IAMHERE 34/* IPv6 i-am-here */
-#define ICMP_MOBILE_REGREQUEST 35/* mobile registration req */
-#define ICMP_MOBILE_REGREPLY 36/* mobile registration reply */
-#define ICMP_SKIP 39/* SKIP */
-#define ICMP_PHOTURIS 40/* Photuris */
+#define ICMP_ECHOREPLY 0 /* echo reply */
+#define ICMP_UNREACH 3 /* dest unreachable, codes: */
+#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
+#define ICMP_REDIRECT 5 /* shorter route, codes: */
+#define ICMP_ALTHOSTADDR 6 /* alternate host address */
+#define ICMP_ECHO 8 /* echo service */
+#define ICMP_ROUTERADVERT 9 /* router advertisement */
+#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
+#define ICMP_TIMXCEED 11 /* time exceeded, code: */
+#define ICMP_PARAMPROB 12 /* ip header bad */
+#define ICMP_TSTAMP 13 /* timestamp request */
+#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
+#define ICMP_IREQ 15 /* information request */
+#define ICMP_IREQREPLY 16 /* information reply */
+#define ICMP_MASKREQ 17 /* address mask request */
+#define ICMP_MASKREPLY 18 /* address mask reply */
+#define ICMP_TRACEROUTE 30 /* traceroute */
+#define ICMP_DATACONVERR 31 /* data conversion error */
+#define ICMP_MOBILE_REDIRECT 32 /* mobile host redirect */
+#define ICMP_IPV6_WHEREAREYOU 33 /* IPv6 where-are-you */
+#define ICMP_IPV6_IAMHERE 34 /* IPv6 i-am-here */
+#define ICMP_MOBILE_REGREQUEST 35 /* mobile registration req */
+#define ICMP_MOBILE_REGREPLY 36 /* mobile registration reply */
+#define ICMP_SKIP 39 /* SKIP */
+#define ICMP_PHOTURIS 40 /* Photuris */
#define ICMP_MAXTYPE 40
-#define ICMP_UNREACH_NET 0/* bad net */
-#define ICMP_UNREACH_HOST 1/* bad host */
-#define ICMP_UNREACH_PROTOCOL 2/* bad protocol */
-#define ICMP_UNREACH_PORT 3/* bad port */
-#define ICMP_UNREACH_NEEDFRAG 4/* IP_DF caused drop */
-#define ICMP_UNREACH_SRCFAIL 5/* src route failed */
-#define ICMP_UNREACH_NET_UNKNOWN 6/* unknown net */
-#define ICMP_UNREACH_HOST_UNKNOWN 7/* unknown host */
-#define ICMP_UNREACH_ISOLATED 8/* src host isolated */
-#define ICMP_UNREACH_NET_PROHIB 9/* for crypto devs */
-#define ICMP_UNREACH_HOST_PROHIB 10/* ditto */
-#define ICMP_UNREACH_TOSNET 11/* bad tos for net */
-#define ICMP_UNREACH_TOSHOST 12/* bad tos for host */
-#define ICMP_UNREACH_FILTER_PROHIB 13/* prohibited access */
-#define ICMP_UNREACH_HOST_PRECEDENCE 14/* precedence violat'n*/
-#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15/* precedence cutoff */
-
-#define ICMP_REDIRECT_NET 0/* for network */
-#define ICMP_REDIRECT_HOST 1/* for host */
-#define ICMP_REDIRECT_TOSNET 2/* for tos and net */
-#define ICMP_REDIRECT_TOSHOST 3/* for tos and host */
-
-#define ICMP_ROUTERADVERT_NORMAL 0/* normal advertisement */
-#define ICMP_ROUTERADVERT_NOROUTE_COMMON16/* selective routing */
-
-#define ICMP_TIMXCEED_INTRANS 0/* ttl==0 in transit */
-#define ICMP_TIMXCEED_REASS 1/* ttl==0 in reass */
-
-#define ICMP_PARAMPROB_ERRATPTR 0/* req. opt. absent */
-#define ICMP_PARAMPROB_OPTABSENT 1/* req. opt. absent */
-#define ICMP_PARAMPROB_LENGTH 2/* bad length */
-
-#define ICMP_PHOTURIS_UNKNOWN_INDEX 1/* unknown sec index */
-#define ICMP_PHOTURIS_AUTH_FAILED 2/* auth failed */
-#define ICMP_PHOTURIS_DECRYPT_FAILED 3/* decrypt failed */
+#define ICMP_UNREACH_NET 0 /* bad net */
+#define ICMP_UNREACH_HOST 1 /* bad host */
+#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
+#define ICMP_UNREACH_PORT 3 /* bad port */
+#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
+#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
+#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
+#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
+#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
+#define ICMP_UNREACH_NET_PROHIB 9 /* for crypto devs */
+#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */
+#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
+#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
+#define ICMP_UNREACH_FILTER_PROHIB 13 /* prohibited access */
+#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* precedence violat'n*/
+#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* precedence cutoff */
+
+#define ICMP_REDIRECT_NET 0 /* for network */
+#define ICMP_REDIRECT_HOST 1 /* for host */
+#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
+#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
+
+#define ICMP_ROUTERADVERT_NORMAL 0 /* normal advertisement */
+#define ICMP_ROUTERADVERT_NOROUTE_COMMON 16 /* selective routing */
+
+#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
+#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
+
+#define ICMP_PARAMPROB_ERRATPTR 0 /* req. opt. absent */
+#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
+#define ICMP_PARAMPROB_LENGTH 2 /* bad length */
+
+#define ICMP_PHOTURIS_UNKNOWN_INDEX 1 /* unknown sec index */
+#define ICMP_PHOTURIS_AUTH_FAILED 2 /* auth failed */
+#define ICMP_PHOTURIS_DECRYPT_FAILED 3 /* decrypt failed */
#define ICMP_INFOTYPE(type) \
@@ -167,6 +160,6 @@ struct icmp {
(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
- (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#endif /* NETINET_IP_ICMP_H */
diff --git a/headers/posix/netinet/ip_var.h b/headers/posix/netinet/ip_var.h
index c09d2ced41..950b93f682 100644
--- a/headers/posix/netinet/ip_var.h
+++ b/headers/posix/netinet/ip_var.h
@@ -1,4 +1,3 @@
-/* Parts of this file are covered under the following copyright */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -11,11 +10,7 @@
* 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
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -30,8 +25,6 @@
* 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_var.h 8.1 (Berkeley) 6/10/93
*/
#ifndef NETINET_IP_VAR_H
@@ -51,7 +44,7 @@ struct ipovly {
uint16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
-};
+};
/*
* Structure stored in mbuf in inpcb.ip_options
@@ -64,7 +57,7 @@ struct ipovly {
struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
-};
+};
/*
* Structure attached to inpcb.ip_moptions and
@@ -106,59 +99,37 @@ struct ipq {
};
struct ipstat {
- int32_t ips_total; /* total packets received */
- int32_t ips_badsum; /* checksum bad */
- int32_t ips_tooshort; /* packet too short */
- int32_t ips_toosmall; /* not enough data */
- int32_t ips_badhlen; /* ip header length < data size */
- int32_t ips_badlen; /* ip length < ip header length */
- int32_t ips_fragments; /* fragments received */
- int32_t ips_fragdropped; /* frags dropped (dups, out of space)
*/
- int32_t ips_fragtimeout; /* fragments timed out */
- int32_t ips_forward; /* packets forwarded */
- int32_t ips_cantforward; /* packets rcvd for unreachable dest
*/
- int32_t ips_redirectsent; /* packets forwarded on same net */
- int32_t ips_noproto; /* unknown or unsupported protocol */
- int32_t ips_delivered; /* datagrams delivered to upper
level*/
- int32_t ips_localout; /* total ip packets generated here */
- int32_t ips_odropped; /* lost packets due to nobufs, etc. */
- int32_t ips_reassembled; /* total packets reassembled ok */
- int32_t ips_fragmented; /* datagrams sucessfully fragmented */
- int32_t ips_ofragments; /* output fragments created */
- int32_t ips_cantfrag; /* don't fragment flag was set, etc.
*/
- int32_t ips_badoptions; /* error in option processing */
- int32_t ips_noroute; /* packets discarded due to no route
*/
- int32_t ips_badvers; /* ip version != 4 */
- int32_t ips_rawout; /* total raw ip packets generated */
- int32_t ips_badfrags; /* malformed fragments (bad length) */
- int32_t ips_rcvmemdrop; /* frags dropped for lack of memory */
- int32_t ips_toolong; /* ip length > max ip packet size */
- int32_t ips_nogif; /* no match gif found */
- int32_t ips_badaddr; /* invalid address on header */
- int32_t ips_inhwcsum; /* hardware checksummed on input */
- int32_t ips_outhwcsum; /* hardware checksummed on output */
+ int32_t ips_total; /* total packets received */
+ int32_t ips_badsum; /* checksum bad */
+ int32_t ips_tooshort; /* packet too short */
+ int32_t ips_toosmall; /* not enough data */
+ int32_t ips_badhlen; /* ip header length < data size */
+ int32_t ips_badlen; /* ip length < ip header length */
+ int32_t ips_fragments; /* fragments received */
+ int32_t ips_fragdropped; /* frags dropped (dups, out of space)
*/
+ int32_t ips_fragtimeout; /* fragments timed out */
+ int32_t ips_forward; /* packets forwarded */
+ int32_t ips_cantforward; /* packets rcvd for unreachable dest */
+ int32_t ips_redirectsent; /* packets forwarded on same net */
+ int32_t ips_noproto; /* unknown or unsupported protocol */
+ int32_t ips_delivered; /* datagrams delivered to upper level*/
+ int32_t ips_localout; /* total ip packets generated here */
+ int32_t ips_odropped; /* lost packets due to nobufs, etc. */
+ int32_t ips_reassembled; /* total packets reassembled ok */
+ int32_t ips_fragmented; /* datagrams sucessfully fragmented */
+ int32_t ips_ofragments; /* output fragments created */
+ int32_t ips_cantfrag; /* don't fragment flag was set, etc. */
+ int32_t ips_badoptions; /* error in option processing */
+ int32_t ips_noroute; /* packets discarded due to no route */
+ int32_t ips_badvers; /* ip version != 4 */
+ int32_t ips_rawout; /* total raw ip packets generated */
+ int32_t ips_badfrags; /* malformed fragments (bad length) */
+ int32_t ips_rcvmemdrop; /* frags dropped for lack of memory */
+ int32_t ips_toolong; /* ip length > max ip packet size */
+ int32_t ips_nogif; /* no match gif found */
+ int32_t ips_badaddr; /* invalid address on header */
+ int32_t ips_inhwcsum; /* hardware checksummed on input */
+ int32_t ips_outhwcsum; /* hardware checksummed on output */
};
-/* #ifdef _KERNEL_MODE */
-
-#define IP_FORWARDING 0x1 /* most
of ip header exists */
-#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast
packets */
-#define IP_RAWOUTPUT 0x4 /* raw
ip header exists */
-#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing
tables */
-#define IP_MTUDISC 0x10 /* pmtu
discovery, set DF */
-
-#if 0
-/* struct ipstat ipstat; */
-
-void ipv4_input(struct mbuf *, int);
-int ipv4_output(struct mbuf *, struct mbuf *, struct route *, int, void *);
-int ipv4_ctloutput(int, struct socket *, int, int, struct mbuf **);
-
-int ip_dooptions(struct mbuf *);
-void ip_stripoptions (struct mbuf *, struct mbuf *);
-struct mbuf *ip_srcroute(void);
-
-
-#endif /* _KERNEL_MODE */
-
#endif /* NETINET_IP_VAR_H */
diff --git a/headers/posix/netinet/udp.h b/headers/posix/netinet/udp.h
index 083d0172c6..5a06dfdd3d 100644
--- a/headers/posix/netinet/udp.h
+++ b/headers/posix/netinet/udp.h
@@ -1,42 +1,9 @@
/*
- * 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.
- *
- *@(#)udp.h8.1 (Berkeley) 6/10/93
- */
-
-#ifndef NETINET_UDP_H
-#define NETINET_UDP_H
+ * Copyright 2020, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
#include <stdint.h>
@@ -47,4 +14,4 @@ struct udphdr {
uint16_t uh_sum;
};
-#endif /* NETINET_UDP_H */
+#endif /* _NETINET_UDP_H */
############################################################################
Commit: 657f041aee41527c4f33e5194aeb4ebcc1d210dc
URL: https://git.haiku-os.org/haiku/commit/?id=657f041aee41
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri Jul 3 19:09:33 2020 UTC
fnmatch: Replace BSD implementation with musl one.
The BSD implementation was under the Advertising Clause,
so we might as well take the opportunity to replace the
implementation entirely with musl's.
Header also rewritten to be a Haiku one; the constants
are left unchanged of course.
----------------------------------------------------------------------------
diff --git a/headers/posix/fnmatch.h b/headers/posix/fnmatch.h
index 8db113197d..4fdac3e7ad 100644
--- a/headers/posix/fnmatch.h
+++ b/headers/posix/fnmatch.h
@@ -1,62 +1,31 @@
-/*-
- * Copyright (c) 1992, 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.
- *
- * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
+/*
+ * Copyright 2020, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
*/
+#ifndef _FNMATCH_H
+#define _FNMATCH_H
-#ifndef _FNMATCH_H_
-#define _FNMATCH_H_
+#define FNM_NOESCAPE 0x01
+#define FNM_PATHNAME 0x02
+#define FNM_PERIOD 0x04
-#define FNM_NOMATCH 1 /* Match failed. */
+#define FNM_LEADING_DIR 0x08
+#define FNM_CASEFOLD 0x10
+#define FNM_IGNORECASE FNM_CASEFOLD
+#define FNM_FILE_NAME FNM_PATHNAME
-#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
-#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
-#define FNM_PERIOD 0x04 /* Period must be matched by
period. */
-
-#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
-#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
-#define FNM_IGNORECASE FNM_CASEFOLD
-#define FNM_FILE_NAME FNM_PATHNAME
+#define FNM_NOMATCH 1
#ifdef __cplusplus
extern "C" {
#endif
-extern int fnmatch(const char *pattern, const char *string, int flags);
+extern int fnmatch(const char *, const char *, int);
#ifdef __cplusplus
}
#endif
-#endif /* _FNMATCH_H_ */
+#endif /* _FNMATCH_H */
diff --git a/src/system/libroot/posix/Jamfile b/src/system/libroot/posix/Jamfile
index 104bc3f740..f0b59497f3 100644
--- a/src/system/libroot/posix/Jamfile
+++ b/src/system/libroot/posix/Jamfile
@@ -23,7 +23,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
dirent.c
errno.c
fcntl.cpp
- fnmatch.c
fts.c
ftw.c
glob.c
diff --git a/src/system/libroot/posix/fnmatch.c
b/src/system/libroot/posix/fnmatch.c
deleted file mode 100644
index 48dcdf9824..0000000000
--- a/src/system/libroot/posix/fnmatch.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * 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.
- */
-
-
-/*
- * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
- * Compares a filename or pathname to a pattern.
- */
-
-#include <ctype.h>
-#include <fnmatch.h>
-#include <string.h>
-#include <stdio.h>
-
-//#include "collate.h"
-
-#define EOS '\0'
-
-#define RANGE_MATCH 1
-#define RANGE_NOMATCH 0
-#define RANGE_ERROR (-1)
-
-static int rangematch(const char *, char, int, char **);
-
-int
-fnmatch(pattern, string, flags)
- const char *pattern, *string;
- int flags;
-{
- const char *stringstart;
- char *newp;
- char c, test;
-
- for (stringstart = string;;)
- switch (c = *pattern++) {
- case EOS:
- if ((flags & FNM_LEADING_DIR) && *string == '/')
- return (0);
- return (*string == EOS ? 0 : FNM_NOMATCH);
- case '?':
- if (*string == EOS)
- return (FNM_NOMATCH);
- if (*string == '/' && (flags & FNM_PATHNAME))
- return (FNM_NOMATCH);
- if (*string == '.' && (flags & FNM_PERIOD) &&
- (string == stringstart ||
- ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
- return (FNM_NOMATCH);
- ++string;
- break;
- case '*':
- c = *pattern;
- /* Collapse multiple stars. */
- while (c == '*')
- c = *++pattern;
-
- if (*string == '.' && (flags & FNM_PERIOD) &&
- (string == stringstart ||
- ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
- return (FNM_NOMATCH);
-
- /* Optimize for pattern with * at end or before /. */
- if (c == EOS)
- if (flags & FNM_PATHNAME)
- return ((flags & FNM_LEADING_DIR) ||
- strchr(string, '/') == NULL ?
- 0 : FNM_NOMATCH);
- else
- return (0);
- else if (c == '/' && flags & FNM_PATHNAME) {
- if ((string = strchr(string, '/')) == NULL)
- return (FNM_NOMATCH);
- break;
- }
-
- /* General case, use recursion. */
- while ((test = *string) != EOS) {
- if (!fnmatch(pattern, string, flags &
~FNM_PERIOD))
- return (0);
- if (test == '/' && flags & FNM_PATHNAME)
- break;
- ++string;
- }
- return (FNM_NOMATCH);
- case '[':
- if (*string == EOS)
- return (FNM_NOMATCH);
- if (*string == '/' && (flags & FNM_PATHNAME))
- return (FNM_NOMATCH);
- if (*string == '.' && (flags & FNM_PERIOD) &&
- (string == stringstart ||
- ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
- return (FNM_NOMATCH);
-
- switch (rangematch(pattern, *string, flags, &newp)) {
- case RANGE_ERROR:
- goto norm;
- case RANGE_MATCH:
- pattern = newp;
- break;
- case RANGE_NOMATCH:
- return (FNM_NOMATCH);
- }
- ++string;
- break;
- case '\\':
- if (!(flags & FNM_NOESCAPE)) {
- if ((c = *pattern++) == EOS) {
- c = '\\';
- --pattern;
- }
- }
- /* FALLTHROUGH */
- default:
- norm:
- if (c == *string)
- ;
- else if ((flags & FNM_CASEFOLD) &&
- (tolower((unsigned char)c) ==
- tolower((unsigned char)*string)))
- ;
- else
- return (FNM_NOMATCH);
- string++;
- break;
- }
- /* NOTREACHED */
-}
-
-static int
-rangematch(pattern, test, flags, newp)
- const char *pattern;
- char test;
- int flags;
- char **newp;
-{
- int negate, ok;
- char c, c2;
-
- /*
- * A bracket expression starting with an unquoted circumflex
- * character produces unspecified results (IEEE 1003.2-1992,
- * 3.13.2). This implementation treats it like '!', for
- * consistency with the regular expression syntax.
- * J.T. Conklin (conklin@xxxxxxxxxxxxxxxx)
- */
- if ( (negate = (*pattern == '!' || *pattern == '^')) )
- ++pattern;
-
- if (flags & FNM_CASEFOLD)
- test = tolower((unsigned char)test);
-
- /*
- * A right bracket shall lose its special meaning and represent
- * itself in a bracket expression if it occurs first in the list.
- * -- POSIX.2 2.8.3.2
- */
- ok = 0;
- c = *pattern++;
- do {
- if (c == '\\' && !(flags & FNM_NOESCAPE))
- c = *pattern++;
- if (c == EOS)
- return (RANGE_ERROR);
-
- if (c == '/' && (flags & FNM_PATHNAME))
- return (RANGE_NOMATCH);
-
- if (flags & FNM_CASEFOLD)
- c = tolower((unsigned char)c);
-
- if (*pattern == '-'
- && (c2 = *(pattern+1)) != EOS && c2 != ']') {
- pattern += 2;
- if (c2 == '\\' && !(flags & FNM_NOESCAPE))
- c2 = *pattern++;
- if (c2 == EOS)
- return (RANGE_ERROR);
-
- if (flags & FNM_CASEFOLD)
- c2 = tolower((unsigned char)c2);
-
- if (
-// ToDo: collate stuff disabled
-// __collate_load_error ?
- c <= test && test <= c2
-// : __collate_range_cmp(c, test) <= 0
-// && __collate_range_cmp(test, c2) <= 0
- )
- ok = 1;
- } else if (c == test)
- ok = 1;
- } while ((c = *pattern++) != ']');
-
- *newp = (char *)pattern;
- return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
-}
diff --git a/src/system/libroot/posix/musl/Jamfile
b/src/system/libroot/posix/musl/Jamfile
index 42c328562f..ba22757cea 100644
--- a/src/system/libroot/posix/musl/Jamfile
+++ b/src/system/libroot/posix/musl/Jamfile
@@ -8,6 +8,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
MergeObjectFromObjects <$(architecture)>posix_musl.o :
:
<$(architecture)>posix_musl_math.o
+ <$(architecture)>posix_musl_regex.o
<$(architecture)>posix_musl_string.o
;
}
@@ -18,4 +19,5 @@ for arch in $(TARGET_ARCHS) {
HaikuSubInclude math $(arch) ;
}
+HaikuSubInclude regex ;
HaikuSubInclude string ;
diff --git a/src/system/libroot/posix/musl/regex/Jamfile
b/src/system/libroot/posix/musl/regex/Jamfile
new file mode 100644
index 0000000000..4748a966d3
--- /dev/null
+++ b/src/system/libroot/posix/musl/regex/Jamfile
@@ -0,0 +1,15 @@
+SubDir HAIKU_TOP src system libroot posix musl regex ;
+
+SubDirSysHdrs [ FDirName $(SUBDIR) .. include ] ;
+UseHeaders [ FDirName $(SUBDIR) .. internal ] ;
+
+local architectureObject ;
+for architectureObject in [ MultiArchSubDirSetup ] {
+ on $(architectureObject) {
+ local architecture = $(TARGET_PACKAGING_ARCH) ;
+
+ MergeObject <$(architecture)>posix_musl_regex.o :
+ fnmatch.c
+ ;
+ }
+}
diff --git a/src/system/libroot/posix/musl/regex/fnmatch.c
b/src/system/libroot/posix/musl/regex/fnmatch.c
new file mode 100644
index 0000000000..7f6b65f32e
--- /dev/null
+++ b/src/system/libroot/posix/musl/regex/fnmatch.c
@@ -0,0 +1,320 @@
+/*
+ * An implementation of what I call the "Sea of Stars" algorithm for
+ * POSIX fnmatch(). The basic idea is that we factor the pattern into
+ * a head component (which we match first and can reject without ever
+ * measuring the length of the string), an optional tail component
+ * (which only exists if the pattern contains at least one star), and
+ * an optional "sea of stars", a set of star-separated components
+ * between the head and tail. After the head and tail matches have
+ * been removed from the input string, the components in the "sea of
+ * stars" are matched sequentially by searching for their first
+ * occurrence past the end of the previous match.
+ *
+ * - Rich Felker, April 2012
+ */
+
+#include <string.h>
+#include <fnmatch.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#define END 0
+#define UNMATCHABLE -2
+#define BRACKET -3
+#define QUESTION -4
+#define STAR -5
+
+static int str_next(const char *str, size_t n, size_t *step)
+{
+ if (!n) {
+ *step = 0;
+ return 0;
+ }
+ if (str[0] >= 128U) {
+ wchar_t wc;
+ int k = mbtowc(&wc, str, n);
+ if (k<0) {
+ *step = 1;
+ return -1;
+ }
+ *step = k;
+ return wc;
+ }
+ *step = 1;
+ return str[0];
+}
+
+static int pat_next(const char *pat, size_t m, size_t *step, int flags)
+{
+ int esc = 0;
+ if (!m || !*pat) {
+ *step = 0;
+ return END;
+ }
+ *step = 1;
+ if (pat[0]=='\\' && pat[1] && !(flags & FNM_NOESCAPE)) {
+ *step = 2;
+ pat++;
+ esc = 1;
+ goto escaped;
+ }
+ if (pat[0]=='[') {
+ size_t k = 1;
+ if (k<m) if (pat[k] == '^' || pat[k] == '!') k++;
+ if (k<m) if (pat[k] == ']') k++;
+ for (; k<m && pat[k] && pat[k]!=']'; k++) {
+ if (k+1<m && pat[k+1] && pat[k]=='[' && (pat[k+1]==':'
|| pat[k+1]=='.' || pat[k+1]=='=')) {
+ int z = pat[k+1];
+ k+=2;
+ if (k<m && pat[k]) k++;
+ while (k<m && pat[k] && (pat[k-1]!=z ||
pat[k]!=']')) k++;
+ if (k==m || !pat[k]) break;
+ }
+ }
+ if (k==m || !pat[k]) {
+ *step = 1;
+ return '[';
+ }
+ *step = k+1;
+ return BRACKET;
+ }
+ if (pat[0] == '*')
+ return STAR;
+ if (pat[0] == '?')
+ return QUESTION;
+escaped:
+ if (pat[0] >= 128U) {
+ wchar_t wc;
+ int k = mbtowc(&wc, pat, m);
+ if (k<0) {
+ *step = 0;
+ return UNMATCHABLE;
+ }
+ *step = k + esc;
+ return wc;
+ }
+ return pat[0];
+}
+
+static int casefold(int k)
+{
+ int c = towupper(k);
+ return c == k ? towlower(k) : c;
+}
+
+static int match_bracket(const char *p, int k, int kfold)
+{
+ wchar_t wc;
+ int inv = 0;
+ p++;
+ if (*p=='^' || *p=='!') {
+ inv = 1;
+ p++;
+ }
+ if (*p==']') {
+ if (k==']') return !inv;
+ p++;
+ } else if (*p=='-') {
+ if (k=='-') return !inv;
+ p++;
+ }
+ wc = p[-1];
+ for (; *p != ']'; p++) {
+ if (p[0]=='-' && p[1]!=']') {
+ wchar_t wc2;
+ int l = mbtowc(&wc2, p+1, 4);
+ if (l < 0) return 0;
+ if (wc <= wc2)
+ if ((unsigned)k-wc <= wc2-wc ||
+ (unsigned)kfold-wc <= wc2-wc)
+ return !inv;
+ p += l-1;
+ continue;
+ }
+ if (p[0]=='[' && (p[1]==':' || p[1]=='.' || p[1]=='=')) {
+ const char *p0 = p+2;
+ int z = p[1];
+ p+=3;
+ while (p[-1]!=z || p[0]!=']') p++;
+ if (z == ':' && p-1-p0 < 16) {
+ char buf[16];
+ memcpy(buf, p0, p-1-p0);
+ buf[p-1-p0] = 0;
+ if (iswctype(k, wctype(buf)) ||
+ iswctype(kfold, wctype(buf)))
+ return !inv;
+ }
+ continue;
+ }
+ if (*p < 128U) {
+ wc = (unsigned char)*p;
+ } else {
+ int l = mbtowc(&wc, p, 4);
+ if (l < 0) return 0;
+ p += l-1;
+ }
+ if (wc==k || wc==kfold) return !inv;
+ }
+ return inv;
+}
+
+static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t
n, int flags)
+{
+ const char *p, *ptail, *endpat;
+ const char *s, *stail, *endstr;
+ size_t pinc, sinc, tailcnt=0;
+ int c, k, kfold;
+
+ if (flags & FNM_PERIOD) {
+ if (*str == '.' && *pat != '.')
+ return FNM_NOMATCH;
+ }
+ for (;;) {
+ switch ((c = pat_next(pat, m, &pinc, flags))) {
+ case UNMATCHABLE:
+ return FNM_NOMATCH;
+ case STAR:
+ pat++;
+ m--;
+ break;
+ default:
+ k = str_next(str, n, &sinc);
+ if (k <= 0)
+ return (c==END) ? 0 : FNM_NOMATCH;
+ str += sinc;
+ n -= sinc;
+ kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
+ if (c == BRACKET) {
+ if (!match_bracket(pat, k, kfold))
+ return FNM_NOMATCH;
+ } else if (c != QUESTION && k != c && kfold != c) {
+ return FNM_NOMATCH;
+ }
+ pat+=pinc;
+ m-=pinc;
+ continue;
+ }
+ break;
+ }
+
+ /* Compute real pat length if it was initially unknown/-1 */
+ m = strnlen(pat, m);
+ endpat = pat + m;
+
+ /* Find the last * in pat and count chars needed after it */
+ for (p=ptail=pat; p<endpat; p+=pinc) {
+ switch (pat_next(p, endpat-p, &pinc, flags)) {
+ case UNMATCHABLE:
+ return FNM_NOMATCH;
+ case STAR:
+ tailcnt=0;
+ ptail = p+1;
+ break;
+ default:
+ tailcnt++;
+ break;
+ }
+ }
+
+ /* Past this point we need not check for UNMATCHABLE in pat,
+ * because all of pat has already been parsed once. */
+
+ /* Compute real str length if it was initially unknown/-1 */
+ n = strnlen(str, n);
+ endstr = str + n;
+ if (n < tailcnt) return FNM_NOMATCH;
+
+ /* Find the final tailcnt chars of str, accounting for UTF-8.
+ * On illegal sequences we may get it wrong, but in that case
+ * we necessarily have a matching failure anyway. */
+ for (s=endstr; s>str && tailcnt; tailcnt--) {
+ if (s[-1] < 128U) s--;
+ else while ((unsigned char)*--s-0x80U<0x40 && s>str);
+ }
+ if (tailcnt) return FNM_NOMATCH;
+ stail = s;
+
+ /* Check that the pat and str tails match */
+ p = ptail;
+ for (;;) {
+ c = pat_next(p, endpat-p, &pinc, flags);
+ p += pinc;
+ if ((k = str_next(s, endstr-s, &sinc)) <= 0) {
+ if (c != END) return FNM_NOMATCH;
+ break;
+ }
+ s += sinc;
+ kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
+ if (c == BRACKET) {
+ if (!match_bracket(p-pinc, k, kfold))
+ return FNM_NOMATCH;
+ } else if (c != QUESTION && k != c && kfold != c) {
+ return FNM_NOMATCH;
+ }
+ }
+
+ /* We're all done with the tails now, so throw them out */
+ endstr = stail;
+ endpat = ptail;
+
+ /* Match pattern components until there are none left */
+ while (pat<endpat) {
+ p = pat;
+ s = str;
+ for (;;) {
+ c = pat_next(p, endpat-p, &pinc, flags);
+ p += pinc;
+ /* Encountering * completes/commits a component */
+ if (c == STAR) {
+ pat = p;
+ str = s;
+ break;
+ }
+ k = str_next(s, endstr-s, &sinc);
+ if (!k)
+ return FNM_NOMATCH;
+ kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
+ if (c == BRACKET) {
+ if (!match_bracket(p-pinc, k, kfold))
+ break;
+ } else if (c != QUESTION && k != c && kfold != c) {
+ break;
+ }
+ s += sinc;
+ }
+ if (c == STAR) continue;
+ /* If we failed, advance str, by 1 char if it's a valid
+ * char, or past all invalid bytes otherwise. */
+ k = str_next(str, endstr-str, &sinc);
+ if (k > 0) str += sinc;
+ else for (str++; str_next(str, endstr-str, &sinc)<0; str++);
+ }
+
+ return 0;
+}
+
+int fnmatch(const char *pat, const char *str, int flags)
+{
+ const char *s, *p;
+ size_t inc;
+ int c;
+ if (flags & FNM_PATHNAME) for (;;) {
+ for (s=str; *s && *s!='/'; s++);
+ for (p=pat; (c=pat_next(p, -1, &inc, flags))!=END && c!='/';
p+=inc);
+ if (c!=*s && (!*s || !(flags & FNM_LEADING_DIR)))
+ return FNM_NOMATCH;
+ if (fnmatch_internal(pat, p-pat, str, s-str, flags))
+ return FNM_NOMATCH;
+ if (!c) return 0;
+ str = s+1;
+ pat = p+inc;
+ } else if (flags & FNM_LEADING_DIR) {
+ for (s=str; *s; s++) {
+ if (*s != '/') continue;
+ if (!fnmatch_internal(pat, -1, str, s-str, flags))
+ return 0;
+ }
+ }
+ return fnmatch_internal(pat, -1, str, -1, flags);
+}
############################################################################
Revision: hrev54388
Commit: 4a230cfc6cbfb8413d9a02f81384fa4e201c23cd
URL: https://git.haiku-os.org/haiku/commit/?id=4a230cfc6cbf
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri Jul 3 19:13:24 2020 UTC
SPARC: Remove ancient BSD arch headers.
None of these were used; they were all imported with the original
root Haiku commit, and they are totally unrelated to PulkoMandy's
new SPARC work. Plus, they were also under a BSD Advertising Clause
license.
----------------------------------------------------------------------------
diff --git a/headers/private/kernel/arch/sparc/DEFS.h
b/headers/private/kernel/arch/sparc/DEFS.h
deleted file mode 100644
index f0b72ae3a8..0000000000
--- a/headers/private/kernel/arch/sparc/DEFS.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: DEFS.h,v 1.2 1997/11/07 15:57:30 niklas Exp $ */
-/* $NetBSD: DEFS.h,v 1.2 1994/10/26 06:39:51 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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.
- *
- * @(#)DEFS.h 8.1 (Berkeley) 6/4/93
- */
-
-#include <machine/asm.h>
-
diff --git a/headers/private/kernel/arch/sparc/promdev.h
b/headers/private/kernel/arch/sparc/promdev.h
deleted file mode 100644
index afb0f6a359..0000000000
--- a/headers/private/kernel/arch/sparc/promdev.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: promdev.h,v 1.1 1997/09/17 10:46:19 downsj Exp $ */
-/* $NetBSD: promdev.h,v 1.3 1995/09/18 21:31:50 pk Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * 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 Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 <machine/bsd_openprom.h>
-
-struct promdata {
- int fd; /* Openboot descriptor */
- struct saioreq *si; /* Oldmon IO request */
- int devtype; /* Kind of device we're booting from */
-#define DT_BLOCK 1
-#define DT_NET 2
-#define DT_BYTE 3
- /* Hooks for netif.c */
- int (*xmit) __P((struct promdata *, void *, size_t));
- int (*recv) __P((struct promdata *, void *, size_t));
-};
-
-#define LOADADDR ((caddr_t)0x4000)
-#define DDB_MAGIC0 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('0') )
-#define DDB_MAGIC1 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('1') )
-#define DDB_MAGIC DDB_MAGIC0
-
-extern struct promvec *promvec;
-extern char *prom_bootdevice;
-extern char *prom_bootfile;
-extern int prom_boothow;
-extern int hz;
-extern int cputyp, nbpg, pgofset, pgshift;
-extern int debug;
-
-extern void prom_init __P((void));
-
-/* Note: dvma_*() routines are for "oldmon" machines only */
-extern char *dvma_mapin __P((char *, size_t));
-extern char *dvma_mapout __P((char *, size_t));
-extern char *dvma_alloc __P((int));
-
-/*
- * duplicates from pmap.c for mapping device on "oldmon" machines.
- */
-#include <sparc/asm.h>
-
-#define getcontext() lduba(AC_CONTEXT, ASI_CONTROL)
-#define setcontext(c) stba(AC_CONTEXT, ASI_CONTROL, c)
-#define getsegmap(va) (cputyp == CPU_SUN4C \
- ? lduba(va, ASI_SEGMAP) \
- : lduha(va, ASI_SEGMAP))
-#define setsegmap(va, pmeg) (cputyp == CPU_SUN4C \
- ? stba(va, ASI_SEGMAP, pmeg) \
- : stha(va, ASI_SEGMAP, pmeg))
-#define getregmap(va) ((unsigned)lduha(va+2, ASI_REGMAP) >> 8)
-#define setregmap(va, smeg) stha(va+2, ASI_REGMAP, (smeg << 8))
-
-#define getpte(va) lda(va, ASI_PTE)
-#define setpte(va, pte) sta(va, ASI_PTE, pte)
-
diff --git a/headers/private/kernel/arch/sparc/saerrno.h
b/headers/private/kernel/arch/sparc/saerrno.h
deleted file mode 100644
index 8630c50aff..0000000000
--- a/headers/private/kernel/arch/sparc/saerrno.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: saerrno.h,v 1.4 1996/10/29 08:00:58 mickey Exp $ */
-/* $NetBSD: saerrno.h,v 1.6 1995/09/18 21:19:45 pk Exp $ */
-
-/*
- * Copyright (c) 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.
- *
- * @(#)saerrno.h 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/errno.h>
-
-extern int errno;
-
-/* special stand error codes */
-#define EADAPT (ELAST+1) /* bad adaptor */
-#define ECTLR (ELAST+2) /* bad controller */
-#define EUNIT (ELAST+3) /* bad drive */
-#define EPART (ELAST+4) /* bad partition */
-#define ERDLAB (ELAST+5) /* can't read disk label */
-#define EUNLAB (ELAST+6) /* unlabeled disk */
-#define EOFFSET (ELAST+7) /* relative seek not supported */
-#define ECMD (ELAST+8) /* undefined driver command */
-#define EBSE (ELAST+9) /* bad sector error */
-#define EWCK (ELAST+10) /* write check error */
-#define EECC (ELAST+11) /* uncorrectable ecc error */
-#define EHER (ELAST+12) /* hard error */
-#define ESALAST (ELAST+12) /* */
-
-char *strerror __P((int err));
-
diff --git a/headers/private/kernel/arch/sparc/saioctl.h
b/headers/private/kernel/arch/sparc/saioctl.h
deleted file mode 100644
index 47c2f1bb0d..0000000000
--- a/headers/private/kernel/arch/sparc/saioctl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: saioctl.h,v 1.2 1996/09/23 14:19:04 mickey Exp $ */
-/* $NetBSD: saioctl.h,v 1.2 1994/10/26 05:45:04 cgd Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)saioctl.h 8.1 (Berkeley) 6/11/93
- */
-
-/* ioctl's -- for disks just now */
-#define SAIOHDR (('d'<<8)|1) /* next i/o includes header */
-#define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */
-#define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header &
data */
-#define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector
forwarding */
-#define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding
*/
-#define SAIOECCLIM (('d'<<8)|6) /* set limit to ecc correction,
bits */
-#define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures
*/
-#define SAIORETRIES (('d'<<8)|8) /* set retry count for unit */
-#define SAIODEVDATA (('d'<<8)|9) /* get pointer to pack label */
-#define SAIOSSI (('d'<<8)|10) /* set skip sector inhibit */
-#define SAIONOSSI (('d'<<8)|11) /* inhibit skip sector handling
*/
-#define SAIOSSDEV (('d'<<8)|12) /* is device skip sector type?
*/
-#define SAIODEBUG (('d'<<8)|13) /* enable/disable debugging */
-#define SAIOGBADINFO (('d'<<8)|14) /* get bad-sector table */
-
diff --git a/headers/private/kernel/arch/sparc/stand.h
b/headers/private/kernel/arch/sparc/stand.h
deleted file mode 100644
index e84234c41c..0000000000
--- a/headers/private/kernel/arch/sparc/stand.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $OpenBSD: stand.h,v 1.35 1998/07/29 00:38:36 mickey Exp $ */
-/* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)stand.h 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef __STDC__
-#include <machine/stdarg.h>
-#else
-#include <machine/varargs.h>
-#endif
-#include "saioctl.h"
-#include "saerrno.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-struct open_file;
-
-/*
- * Useful macros
- */
-#define NENTS(x) sizeof(x)/sizeof(x[0])
-/* don't define if libkern included */
-#ifndef LIBKERN_INLINE
-#define max(a,b) (((a)>(b))? (a) : (b))
-#define min(a,b) (((a)>(b))? (b) : (a))
-#endif
-
-/*
- * This structure is used to define file system operations in a file system
- * independent way.
- */
-struct fs_ops {
- int (*open) __P((char *path, struct open_file *f));
- int (*close) __P((struct open_file *f));
- int (*read) __P((struct open_file *f, void *buf,
- size_t size, size_t *resid));
- int (*write) __P((struct open_file *f, void *buf,
- size_t size, size_t *resid));
- off_t (*seek) __P((struct open_file *f, off_t offset, int where));
- int (*stat) __P((struct open_file *f, struct stat *sb));
- int (*readdir) __P((struct open_file *f, char *));
-};
-
-extern struct fs_ops file_system[];
-extern int nfsys;
-
-/* where values for lseek(2) */
-#define SEEK_SET 0 /* set file offset to offset */
-#define SEEK_CUR 1 /* set file offset to current plus
offset */
-#define SEEK_END 2 /* set file offset to EOF plus offset */
-
-/* Device switch */
-struct devsw {
- char *dv_name;
- int (*dv_strategy) __P((void *devdata, int rw,
- daddr_t blk, size_t size,
- void *buf, size_t *rsize));
- int (*dv_open) __P((struct open_file *f, ...));
- int (*dv_close) __P((struct open_file *f));
- int (*dv_ioctl) __P((struct open_file *f, u_long cmd, void *data));
-};
-
-extern struct devsw devsw[]; /* device array */
-extern int ndevs; /* number of elements in devsw[] */
-
-extern struct consdev constab[];
-extern struct consdev *cn_tab;
-
-struct open_file {
- int f_flags; /* see F_* below */
- struct devsw *f_dev; /* pointer to device operations */
- void *f_devdata; /* device specific data */
- struct fs_ops *f_ops; /* pointer to file system operations */
- void *f_fsdata; /* file system specific data */
- off_t f_offset; /* current file offset (F_RAW) */
-};
-
-#define SOPEN_MAX 4
-extern struct open_file files[];
-
-/* f_flags values */
-#define F_READ 0x0001 /* file opened for reading */
-#define F_WRITE 0x0002 /* file opened for writing */
-#define F_RAW 0x0004 /* raw device open - no file system */
-#define F_NODEV 0x0008 /* network open - no device */
-
-#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
-#define islower(c) ((c) >= 'a' && (c) <= 'z')
-#define isalpha(c) (isupper(c)||islower(c))
-#define tolower(c) (isupper(c)?((c) - 'A' + 'a'):(c))
-#define toupper(c) (islower(c)?((c) - 'a' + 'A'):(c))
-#define isspace(c) ((c) == ' ' || (c) == '\t')
-#define isdigit(c) ((c) >= '0' && (c) <= '9')
-
-#define btochs(b,c,h,s,nh,ns) \
- c = (b) / ((nh) * (ns)); \
- h = ((b) % ((nh) * (ns))) / (ns); \
- s = ((b) % ((nh) * (ns))) % (ns);
-
-void *alloc __P((u_int));
-void *alloca __P((size_t));
-void free __P((void *, u_int));
-struct disklabel;
-char *getdisklabel __P((const char *, struct disklabel *));
-u_int dkcksum __P((struct disklabel *));
-
-void printf __P((const char *, ...));
-void sprintf __P((char *, const char *, ...));
-void vprintf __P((const char *, _BSD_VA_LIST_));
-void twiddle __P((void));
-void gets __P((char *));
-__dead void panic __P((const char *, ...)) __attribute__((noreturn));
-__dead void _rtt __P((void)) __attribute__((noreturn));
-#define bzero(s,n) ((void)memset((s),0,(n)))
-#define bcmp(s1,s2,n) (memcmp((s2),(s1),(n)))
-#define bcopy(s1,s2,n) ((void)memcpy((s2),(s1),(n)))
-void *memcpy __P((void *, const void *, size_t));
-int memcmp __P((const void *, const void*, size_t));
-char *strncpy __P((char *, const char *, size_t));
-char *strcpy __P((char *, const char *));
-int strncmp __P((const char *, const char *, size_t));
-size_t strlen __P((const char *));
-long strtol __P((const char *, char **, int));
-char *strchr __P((const char *, int));
-void *memset __P((void *, int, size_t));
-void exec __P((char *, void *, int));
-void exit __P((void));
-int open __P((const char *, int));
-int close __P((int));
-void closeall __P((void));
-ssize_t read __P((int, void *, size_t));
-ssize_t write __P((int, void *, size_t));
-int stat __P((const char *path, struct stat *sb));
-int fstat __P((int fd, struct stat *sb));
-int opendir __P((char *));
-int readdir __P((int, char *));
-void closedir __P((int));
-int nodev __P((void));
-int noioctl __P((struct open_file *, u_long, void *));
-void nullsys __P((void));
-
-int null_open __P((char *path, struct open_file *f));
-int null_close __P((struct open_file *f));
-ssize_t null_read __P((struct open_file *f, void *buf,
- size_t size, size_t *resid));
-ssize_t null_write __P((struct open_file *f, void *buf,
- size_t size, size_t *resid));
-off_t null_seek __P((struct open_file *f, off_t offset, int where));
-int null_stat __P((struct open_file *f, struct stat *sb));
-int null_readdir __P((struct open_file *f, char *name));
-char *ttyname __P((int)); /* match userland decl, but ignore !0 */
-dev_t ttydev __P((char *));
-void cninit __P((void));
-int cnset __P((dev_t));
-void cnputc __P((int));
-int cngetc __P((void));
-int cnischar __P((void));
-int cnspeed __P((dev_t, int));
-u_int sleep __P((u_int));
-void usleep __P((u_int));
-char *ctime __P((const time_t *));
-
-void putchar __P((int));
-int getchar __P((void));
-
-#ifdef __INTERNAL_LIBSA_CREAD
-int oopen __P((const char *, int));
-int oclose __P((int));
-ssize_t oread __P((int, void *, size_t));
-off_t olseek __P((int, off_t, int));
-#endif
-
-/* Machine dependent functions */
-int devopen __P((struct open_file *, const char *, char **));
-void machdep_start __P((char *, int, char *, char *, char *));
-time_t getsecs __P((void));
-
diff --git a/headers/private/kernel/arch/sparc/va-sparc.h
b/headers/private/kernel/arch/sparc/va-sparc.h
deleted file mode 100644
index 56f915a5ed..0000000000
--- a/headers/private/kernel/arch/sparc/va-sparc.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* This is just like the default gvarargs.h
- except for differences described below. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-#if ! defined (__svr4__) && ! defined (__linux__) && ! defined (__arch64__)
-/* This has to be a char * to be compatible with Sun.
- i.e., we have to pass a `va_list' to vsprintf. */
-typedef char * __gnuc_va_list;
-#else
-/* This has to be a void * to be compatible with Sun svr4.
- i.e., we have to pass a `va_list' to vsprintf. */
-typedef void * __gnuc_va_list;
-#endif
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#ifdef _STDARG_H
-
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that LASTARG is correct. */
-#if defined (__GCC_NEW_VARARGS__) || defined (__arch64__)
-#define va_start(AP, LASTARG) \
- (__builtin_next_arg (LASTARG), AP = (char *) __builtin_saveregs ())
-#else
-#define va_start(AP, LASTARG) \
- (__builtin_saveregs (), AP = ((char *) __builtin_next_arg (LASTARG)))
-#endif
-
-#else
-
-#define va_alist __builtin_va_alist
-#define va_dcl int __builtin_va_alist;...
-
-#if defined (__GCC_NEW_VARARGS__) || defined (__arch64__)
-#define va_start(AP) ((AP) = (char *) __builtin_saveregs ())
-#else
-#define va_start(AP) \
- (__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist))
-#endif
-
-#endif
-
-#ifndef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-
-/* Values returned by __builtin_classify_type. */
-
-enum __va_type_classes {
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-#endif
-#define va_end(pvar) ((void)0)
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-/* RECORD_TYPE args passed using the C calling convention are
- passed by invisible reference. ??? RECORD_TYPE args passed
- in the stack are made to be word-aligned; for an aggregate that is
- not word-aligned, we advance the pointer to the first non-reg slot. */
-
-#ifdef __arch64__
-
-typedef unsigned int __ptrint __attribute__ ((__mode__ (__DI__)));
-
-/* ??? TODO: little endian support */
-
-#define va_arg(pvar, TYPE) \
-__extension__ \
-(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
- char * __result; \
- if (__type == __real_type_class) /* float? */ \
- { \
- if (__alignof__ (TYPE) == 16) \
- (pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \
- __result = (pvar); \
- (pvar) = (char *) (pvar) + sizeof (TYPE); \
- } \
- else if (__type < __record_type_class) /* integer? */ \
- { \
- (pvar) = (char *) (pvar) + 8; \
- __result = (char *) (pvar) - sizeof (TYPE); \
- } \
- else /* aggregate object */ \
- { \
- if (sizeof (TYPE) <= 8) \
- { \
- __result = (pvar); \
- (pvar) = (char *) (pvar) + 8; \
- } \
- else if (sizeof (TYPE) <= 16) \
- { \
- if (__alignof__ (TYPE) == 16) \
- (pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \
- __result = (pvar); \
- (pvar) = (char *) (pvar) + 16; \
- } \
- else \
- { \
- __result = * (void **) (pvar); \
- (pvar) = (char *) (pvar) + 8; \
- } \
- } \
- (TYPE *) __result;}))
-
-#else /* not __arch64__ */
-
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-
-/* We don't declare the union member `d' to have type TYPE
- because that would lose in C++ if TYPE has a constructor. */
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement.
- The casts to char * avoid warnings about invalid pointer arithmetic. */
-#define va_arg(pvar,TYPE) \
-__extension__ \
-(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
- || (__builtin_classify_type (*(TYPE*) 0) == __real_type_class \
- && sizeof (TYPE) == 16)) \
- ? ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE *), \
- *(TYPE **) (void *) ((char *)(pvar) - __va_rounded_size (TYPE *))) \
- : __va_rounded_size (TYPE) == 8 \
- ? ({ union {char __d[sizeof (TYPE)]; int __i[2];} __u; \
- __u.__i[0] = ((int *) (void *) (pvar))[0]; \
- __u.__i[1] = ((int *) (void *) (pvar))[1]; \
- (pvar) = (char *)(pvar) + 8; \
- (TYPE *) (void *) __u.__d; }) \
- : ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
- ((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));}))
-
-#endif /* not __arch64__ */
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
-