modernc.org/z@v1.7.4/internal/minigzip_freebsd_arm.go (about)

     1  // Code generated by 'ccgo -lmodernc.org/z/lib -o internal/minigzip_freebsd_arm.go -trace-translation-units /home/jnml/tmpdir/go-generate-478397193/cdb.json minigzip64', DO NOT EDIT.
     2  
     3  package main
     4  
     5  import (
     6  	"math"
     7  	"reflect"
     8  	"sync/atomic"
     9  	"unsafe"
    10  
    11  	"modernc.org/libc"
    12  	"modernc.org/libc/sys/types"
    13  	"modernc.org/z/lib"
    14  )
    15  
    16  var _ = math.Pi
    17  var _ reflect.Kind
    18  var _ atomic.Value
    19  var _ unsafe.Pointer
    20  var _ *libc.TLS
    21  var _ types.Size_t
    22  
    23  func main() { libc.Start(main1) }
    24  
    25  type ptrdiff_t = int32 /* <builtin>:3:26 */
    26  
    27  type size_t = uint32 /* <builtin>:9:23 */
    28  
    29  type wchar_t = uint32 /* <builtin>:15:24 */
    30  
    31  type rune_t = int32 /* stddef.h:50:18 */
    32  
    33  type max_align_t = struct {
    34  	__max_align1 int64
    35  	__max_align2 float64
    36  } /* stddef.h:69:23 */
    37  
    38  // ISO/IEC 9899:2011 K.3.3.2
    39  type rsize_t = size_t /* stddef.h:81:16 */
    40  
    41  type z_size_t = size_t /* zconf.h:248:21 */
    42  
    43  // Maximum value for memLevel in deflateInit2
    44  
    45  // Maximum value for windowBits in deflateInit2 and inflateInit2.
    46  // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
    47  // created by gzip. (Files created by minigzip can still be extracted by
    48  // gzip.)
    49  
    50  // The memory requirements for deflate are (in bytes):
    51  //             (1 << (windowBits+2)) +  (1 << (memLevel+9))
    52  //  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
    53  //  plus a few kilobytes for small objects. For example, if you want to reduce
    54  //  the default memory requirements from 256K to 128K, compile with
    55  //      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
    56  //  Of course this will generally degrade compression (there's no free lunch).
    57  //
    58  //    The memory requirements for inflate are (in bytes) 1 << windowBits
    59  //  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
    60  //  for small objects.
    61  
    62  // Type declarations
    63  
    64  // The following definitions for FAR are needed only for MSDOS mixed
    65  // model programming (small or medium model with some far allocations).
    66  // This was tested only with MSC; for other MSDOS compilers you may have
    67  // to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
    68  // just define FAR to be empty.
    69  
    70  type Byte = uint8   /* zconf.h:391:24 */ // 8 bits
    71  type uInt = uint32  /* zconf.h:393:24 */ // 16 bits or more
    72  type uLong = uint32 /* zconf.h:394:24 */ // 32 bits or more
    73  
    74  type Bytef = Byte   /* zconf.h:400:22 */
    75  type charf = uint8  /* zconf.h:402:19 */
    76  type intf = int32   /* zconf.h:403:19 */
    77  type uIntf = uInt   /* zconf.h:404:19 */
    78  type uLongf = uLong /* zconf.h:405:19 */
    79  
    80  type voidpc = uintptr /* zconf.h:408:23 */
    81  type voidpf = uintptr /* zconf.h:409:23 */
    82  type voidp = uintptr  /* zconf.h:410:23 */
    83  
    84  // -
    85  // SPDX-License-Identifier: BSD-3-Clause
    86  //
    87  // Copyright (c) 1988, 1993
    88  //	The Regents of the University of California.  All rights reserved.
    89  //
    90  // Redistribution and use in source and binary forms, with or without
    91  // modification, are permitted provided that the following conditions
    92  // are met:
    93  // 1. Redistributions of source code must retain the above copyright
    94  //    notice, this list of conditions and the following disclaimer.
    95  // 2. Redistributions in binary form must reproduce the above copyright
    96  //    notice, this list of conditions and the following disclaimer in the
    97  //    documentation and/or other materials provided with the distribution.
    98  // 3. Neither the name of the University nor the names of its contributors
    99  //    may be used to endorse or promote products derived from this software
   100  //    without specific prior written permission.
   101  //
   102  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   103  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   104  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   105  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   106  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   107  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   108  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   109  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   110  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   111  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   112  // SUCH DAMAGE.
   113  //
   114  //	@(#)limits.h	8.2 (Berkeley) 1/4/94
   115  // $FreeBSD$
   116  
   117  // -
   118  // SPDX-License-Identifier: BSD-3-Clause
   119  //
   120  // Copyright (c) 1991, 1993
   121  //	The Regents of the University of California.  All rights reserved.
   122  //
   123  // This code is derived from software contributed to Berkeley by
   124  // Berkeley Software Design, Inc.
   125  //
   126  // Redistribution and use in source and binary forms, with or without
   127  // modification, are permitted provided that the following conditions
   128  // are met:
   129  // 1. Redistributions of source code must retain the above copyright
   130  //    notice, this list of conditions and the following disclaimer.
   131  // 2. Redistributions in binary form must reproduce the above copyright
   132  //    notice, this list of conditions and the following disclaimer in the
   133  //    documentation and/or other materials provided with the distribution.
   134  // 3. Neither the name of the University nor the names of its contributors
   135  //    may be used to endorse or promote products derived from this software
   136  //    without specific prior written permission.
   137  //
   138  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   139  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   140  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   141  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   142  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   143  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   144  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   145  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   146  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   147  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   148  // SUCH DAMAGE.
   149  //
   150  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   151  // $FreeBSD$
   152  
   153  // -
   154  // SPDX-License-Identifier: BSD-3-Clause
   155  //
   156  // Copyright (c) 1988, 1993
   157  //	The Regents of the University of California.  All rights reserved.
   158  //
   159  // Redistribution and use in source and binary forms, with or without
   160  // modification, are permitted provided that the following conditions
   161  // are met:
   162  // 1. Redistributions of source code must retain the above copyright
   163  //    notice, this list of conditions and the following disclaimer.
   164  // 2. Redistributions in binary form must reproduce the above copyright
   165  //    notice, this list of conditions and the following disclaimer in the
   166  //    documentation and/or other materials provided with the distribution.
   167  // 3. Neither the name of the University nor the names of its contributors
   168  //    may be used to endorse or promote products derived from this software
   169  //    without specific prior written permission.
   170  //
   171  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   172  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   173  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   174  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   175  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   176  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   177  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   178  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   179  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   180  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   181  // SUCH DAMAGE.
   182  //
   183  // $FreeBSD$
   184  
   185  // -
   186  // SPDX-License-Identifier: BSD-3-Clause
   187  //
   188  // Copyright (c) 1991, 1993
   189  //	The Regents of the University of California.  All rights reserved.
   190  //
   191  // This code is derived from software contributed to Berkeley by
   192  // Berkeley Software Design, Inc.
   193  //
   194  // Redistribution and use in source and binary forms, with or without
   195  // modification, are permitted provided that the following conditions
   196  // are met:
   197  // 1. Redistributions of source code must retain the above copyright
   198  //    notice, this list of conditions and the following disclaimer.
   199  // 2. Redistributions in binary form must reproduce the above copyright
   200  //    notice, this list of conditions and the following disclaimer in the
   201  //    documentation and/or other materials provided with the distribution.
   202  // 3. Neither the name of the University nor the names of its contributors
   203  //    may be used to endorse or promote products derived from this software
   204  //    without specific prior written permission.
   205  //
   206  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   207  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   208  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   209  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   210  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   211  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   212  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   213  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   214  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   215  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   216  // SUCH DAMAGE.
   217  //
   218  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   219  // $FreeBSD$
   220  
   221  // -
   222  // SPDX-License-Identifier: BSD-3-Clause
   223  //
   224  // Copyright (c) 1988, 1993
   225  //	The Regents of the University of California.  All rights reserved.
   226  //
   227  // Redistribution and use in source and binary forms, with or without
   228  // modification, are permitted provided that the following conditions
   229  // are met:
   230  // 1. Redistributions of source code must retain the above copyright
   231  //    notice, this list of conditions and the following disclaimer.
   232  // 2. Redistributions in binary form must reproduce the above copyright
   233  //    notice, this list of conditions and the following disclaimer in the
   234  //    documentation and/or other materials provided with the distribution.
   235  // 3. Neither the name of the University nor the names of its contributors
   236  //    may be used to endorse or promote products derived from this software
   237  //    without specific prior written permission.
   238  //
   239  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   240  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   241  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   242  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   243  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   244  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   245  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   246  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   247  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   248  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   249  // SUCH DAMAGE.
   250  //
   251  //	@(#)limits.h	8.3 (Berkeley) 1/4/94
   252  // $FreeBSD$
   253  
   254  // According to ANSI (section 2.2.4.2), the values below must be usable by
   255  // #if preprocessing directives.  Additionally, the expression must have the
   256  // same type as would an expression that is an object of the corresponding
   257  // type converted according to the integral promotions.  The subtraction for
   258  // INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
   259  // unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
   260  
   261  // max value for an unsigned long long
   262  
   263  // Quads and long longs are the same size.  Ensure they stay in sync.
   264  
   265  // Minimum signal stack size.
   266  
   267  // -
   268  // SPDX-License-Identifier: BSD-3-Clause
   269  //
   270  // Copyright (c) 1988, 1993
   271  //	The Regents of the University of California.  All rights reserved.
   272  //
   273  // Redistribution and use in source and binary forms, with or without
   274  // modification, are permitted provided that the following conditions
   275  // are met:
   276  // 1. Redistributions of source code must retain the above copyright
   277  //    notice, this list of conditions and the following disclaimer.
   278  // 2. Redistributions in binary form must reproduce the above copyright
   279  //    notice, this list of conditions and the following disclaimer in the
   280  //    documentation and/or other materials provided with the distribution.
   281  // 3. Neither the name of the University nor the names of its contributors
   282  //    may be used to endorse or promote products derived from this software
   283  //    without specific prior written permission.
   284  //
   285  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   286  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   287  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   288  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   289  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   290  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   291  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   292  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   293  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   294  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   295  // SUCH DAMAGE.
   296  //
   297  //	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
   298  // $FreeBSD$
   299  
   300  // Do not add any new variables here.  (See the comment at the end of
   301  // the file for why.)
   302  
   303  // We leave the following values undefined to force applications to either
   304  // assume conservative values or call sysconf() to get the current value.
   305  //
   306  // HOST_NAME_MAX
   307  //
   308  // (We should do this for most of the values currently defined here,
   309  // but many programs are not prepared to deal with this yet.)
   310  
   311  type z_crc_t = uint32 /* zconf.h:429:17 */
   312  type pthread_once = struct {
   313  	state int32
   314  	mutex pthread_mutex_t
   315  } /* _pthreadtypes.h:52:1 */
   316  
   317  // Primitive system data type definitions required by P1003.1c.
   318  //
   319  // Note that P1003.1c specifies that there are no defined comparison
   320  // or assignment operators for the types pthread_attr_t, pthread_cond_t,
   321  // pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
   322  type pthread_t = uintptr             /* _pthreadtypes.h:67:26 */
   323  type pthread_attr_t = uintptr        /* _pthreadtypes.h:70:30 */
   324  type pthread_mutex_t = uintptr       /* _pthreadtypes.h:71:31 */
   325  type pthread_mutexattr_t = uintptr   /* _pthreadtypes.h:72:35 */
   326  type pthread_cond_t = uintptr        /* _pthreadtypes.h:73:30 */
   327  type pthread_condattr_t = uintptr    /* _pthreadtypes.h:74:34 */
   328  type pthread_key_t = int32           /* _pthreadtypes.h:75:20 */
   329  type pthread_once_t = pthread_once   /* _pthreadtypes.h:76:30 */
   330  type pthread_rwlock_t = uintptr      /* _pthreadtypes.h:77:32 */
   331  type pthread_rwlockattr_t = uintptr  /* _pthreadtypes.h:78:35 */
   332  type pthread_barrier_t = uintptr     /* _pthreadtypes.h:79:33 */
   333  type pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */
   334  type pthread_spinlock_t = uintptr    /* _pthreadtypes.h:81:33 */
   335  
   336  // Additional type definitions:
   337  //
   338  // Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
   339  // use in header symbols.
   340  type pthread_addr_t = uintptr         /* _pthreadtypes.h:89:14 */
   341  type pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */
   342  
   343  type u_char = uint8   /* types.h:52:23 */
   344  type u_short = uint16 /* types.h:53:24 */
   345  type u_int = uint32   /* types.h:54:22 */
   346  type u_long = uint32  /* types.h:55:23 */
   347  type ushort = uint16  /* types.h:57:24 */ // Sys V compatibility
   348  type uint = uint32    /* types.h:58:22 */ // Sys V compatibility
   349  
   350  // XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
   351  // -
   352  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   353  //
   354  // Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
   355  // Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
   356  // All rights reserved.
   357  //
   358  // Redistribution and use in source and binary forms, with or without
   359  // modification, are permitted provided that the following conditions
   360  // are met:
   361  // 1. Redistributions of source code must retain the above copyright
   362  //    notice, this list of conditions and the following disclaimer.
   363  // 2. Redistributions in binary form must reproduce the above copyright
   364  //    notice, this list of conditions and the following disclaimer in the
   365  //    documentation and/or other materials provided with the distribution.
   366  //
   367  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   368  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   369  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   370  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   371  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   372  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   373  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   374  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   375  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   376  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   377  // SUCH DAMAGE.
   378  //
   379  // $FreeBSD$
   380  
   381  type int8_t = int8 /* _stdint.h:36:19 */
   382  
   383  type int16_t = int16 /* _stdint.h:41:20 */
   384  
   385  type int32_t = int32 /* _stdint.h:46:20 */
   386  
   387  type int64_t = int64 /* _stdint.h:51:20 */
   388  
   389  type uint8_t = uint8 /* _stdint.h:56:20 */
   390  
   391  type uint16_t = uint16 /* _stdint.h:61:21 */
   392  
   393  type uint32_t = uint32 /* _stdint.h:66:21 */
   394  
   395  type uint64_t = uint64 /* _stdint.h:71:21 */
   396  
   397  type intptr_t = int32   /* _stdint.h:76:21 */
   398  type uintptr_t = uint32 /* _stdint.h:80:22 */
   399  type intmax_t = int64   /* _stdint.h:84:21 */
   400  type uintmax_t = uint64 /* _stdint.h:88:22 */
   401  
   402  type u_int8_t = uint8   /* types.h:67:19 */ // unsigned integrals (deprecated)
   403  type u_int16_t = uint16 /* types.h:68:20 */
   404  type u_int32_t = uint32 /* types.h:69:20 */
   405  type u_int64_t = uint64 /* types.h:70:20 */
   406  
   407  type u_quad_t = uint64 /* types.h:72:20 */ // quads (deprecated)
   408  type quad_t = int64    /* types.h:73:19 */
   409  type qaddr_t = uintptr /* types.h:74:16 */
   410  
   411  type caddr_t = uintptr   /* types.h:76:14 */ // core address
   412  type c_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const
   413  
   414  type blksize_t = int32 /* types.h:80:21 */
   415  
   416  type cpuwhich_t = int32 /* types.h:84:22 */
   417  type cpulevel_t = int32 /* types.h:85:22 */
   418  type cpusetid_t = int32 /* types.h:86:22 */
   419  
   420  type blkcnt_t = int64 /* types.h:89:20 */
   421  
   422  type clock_t = uint32 /* types.h:94:19 */
   423  
   424  type clockid_t = int32 /* types.h:99:21 */
   425  
   426  type critical_t = int32 /* types.h:103:22 */ // Critical section value
   427  type daddr_t = int64    /* types.h:104:19 */ // disk address
   428  
   429  type dev_t = uint64 /* types.h:107:18 */ // device number or struct cdev
   430  
   431  type fflags_t = uint32 /* types.h:112:20 */ // file flags
   432  
   433  type fixpt_t = uint32 /* types.h:116:19 */ // fixed point number
   434  
   435  type fsblkcnt_t = uint64 /* types.h:119:22 */
   436  type fsfilcnt_t = uint64 /* types.h:120:22 */
   437  
   438  type gid_t = uint32 /* types.h:125:18 */ // group id
   439  
   440  type in_addr_t = uint32 /* types.h:130:20 */ // base type for internet address
   441  
   442  type in_port_t = uint16 /* types.h:135:20 */
   443  
   444  type id_t = int64 /* types.h:140:17 */ // can hold a uid_t or pid_t
   445  
   446  type ino_t = uint64 /* types.h:145:18 */ // inode number
   447  
   448  type key_t = int32 /* types.h:150:18 */ // IPC key (for Sys V IPC)
   449  
   450  type lwpid_t = int32 /* types.h:155:19 */ // Thread ID (a.k.a. LWP)
   451  
   452  type mode_t = uint16 /* types.h:160:18 */ // permissions
   453  
   454  type accmode_t = int32 /* types.h:165:21 */ // access permissions
   455  
   456  type nlink_t = uint64 /* types.h:170:19 */ // link count
   457  
   458  type off_t = int64 /* types.h:175:18 */ // file offset
   459  
   460  type off64_t = int64 /* types.h:180:19 */ // file offset (alias)
   461  
   462  type pid_t = int32 /* types.h:185:18 */ // process id
   463  
   464  type register_t = int32 /* types.h:189:22 */
   465  
   466  type rlim_t = int64 /* types.h:192:18 */ // resource limit
   467  
   468  type sbintime_t = int64 /* types.h:196:19 */
   469  
   470  type segsz_t = int32 /* types.h:198:19 */ // segment size (in pages)
   471  
   472  type ssize_t = int32 /* types.h:206:19 */
   473  
   474  type suseconds_t = int32 /* types.h:211:23 */ // microseconds (signed)
   475  
   476  type time_t = int64 /* types.h:216:18 */
   477  
   478  type timer_t = uintptr /* types.h:221:19 */
   479  
   480  type mqd_t = uintptr /* types.h:226:17 */
   481  
   482  type u_register_t = uint32 /* types.h:230:24 */
   483  
   484  type uid_t = uint32 /* types.h:233:18 */ // user id
   485  
   486  type useconds_t = uint32 /* types.h:238:22 */ // microseconds (unsigned)
   487  
   488  type cap_ioctl_t = uint32 /* types.h:244:23 */
   489  
   490  // Types suitable for exporting physical addresses, virtual addresses
   491  // (pointers), and memory object sizes from the kernel independent of native
   492  // word size.  These should be used in place of vm_paddr_t, (u)intptr_t, and
   493  // size_t in structs which contain such types that are shared with userspace.
   494  type kpaddr_t = uint64 /* types.h:260:20 */
   495  type kvaddr_t = uint64 /* types.h:261:20 */
   496  type ksize_t = uint64  /* types.h:262:20 */
   497  type kssize_t = int64  /* types.h:263:19 */
   498  
   499  type vm_offset_t = uint32  /* types.h:265:23 */
   500  type vm_ooffset_t = uint64 /* types.h:266:20 */
   501  type vm_paddr_t = uint32   /* types.h:267:22 */
   502  type vm_pindex_t = uint64  /* types.h:268:20 */
   503  type vm_size_t = uint32    /* types.h:269:21 */
   504  
   505  type rman_res_t = uint64 /* types.h:271:25 */
   506  
   507  func __bitcount32(tls *libc.TLS, _x uint32) uint32 { /* types.h:335:1: */
   508  
   509  	_x = _x&uint32(0x55555555) + _x&0xaaaaaaaa>>1
   510  	_x = _x&uint32(0x33333333) + _x&0xcccccccc>>2
   511  	_x = (_x + _x>>4) & uint32(0x0f0f0f0f)
   512  	_x = _x + _x>>8
   513  	_x = (_x + _x>>16) & uint32(0x000000ff)
   514  	return _x
   515  }
   516  
   517  // -
   518  // SPDX-License-Identifier: BSD-3-Clause
   519  //
   520  // Copyright (c) 1992, 1993
   521  //	The Regents of the University of California.  All rights reserved.
   522  //
   523  // Redistribution and use in source and binary forms, with or without
   524  // modification, are permitted provided that the following conditions
   525  // are met:
   526  // 1. Redistributions of source code must retain the above copyright
   527  //    notice, this list of conditions and the following disclaimer.
   528  // 2. Redistributions in binary form must reproduce the above copyright
   529  //    notice, this list of conditions and the following disclaimer in the
   530  //    documentation and/or other materials provided with the distribution.
   531  // 3. Neither the name of the University nor the names of its contributors
   532  //    may be used to endorse or promote products derived from this software
   533  //    without specific prior written permission.
   534  //
   535  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   536  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   537  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   538  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   539  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   540  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   541  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   542  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   543  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   544  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   545  // SUCH DAMAGE.
   546  //
   547  // $FreeBSD$
   548  
   549  // -
   550  // SPDX-License-Identifier: BSD-3-Clause
   551  //
   552  // Copyright (c) 1991, 1993
   553  //	The Regents of the University of California.  All rights reserved.
   554  //
   555  // This code is derived from software contributed to Berkeley by
   556  // Berkeley Software Design, Inc.
   557  //
   558  // Redistribution and use in source and binary forms, with or without
   559  // modification, are permitted provided that the following conditions
   560  // are met:
   561  // 1. Redistributions of source code must retain the above copyright
   562  //    notice, this list of conditions and the following disclaimer.
   563  // 2. Redistributions in binary form must reproduce the above copyright
   564  //    notice, this list of conditions and the following disclaimer in the
   565  //    documentation and/or other materials provided with the distribution.
   566  // 3. Neither the name of the University nor the names of its contributors
   567  //    may be used to endorse or promote products derived from this software
   568  //    without specific prior written permission.
   569  //
   570  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   571  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   572  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   573  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   574  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   575  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   576  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   577  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   578  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   579  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   580  // SUCH DAMAGE.
   581  //
   582  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   583  // $FreeBSD$
   584  
   585  // -
   586  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   587  //
   588  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   589  // All rights reserved.
   590  //
   591  // Redistribution and use in source and binary forms, with or without
   592  // modification, are permitted provided that the following conditions
   593  // are met:
   594  // 1. Redistributions of source code must retain the above copyright
   595  //    notice, this list of conditions and the following disclaimer.
   596  // 2. Redistributions in binary form must reproduce the above copyright
   597  //    notice, this list of conditions and the following disclaimer in the
   598  //    documentation and/or other materials provided with the distribution.
   599  //
   600  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   601  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   602  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   603  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   604  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   605  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   606  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   607  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   608  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   609  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   610  // SUCH DAMAGE.
   611  //
   612  // $FreeBSD$
   613  
   614  // -
   615  // SPDX-License-Identifier: BSD-3-Clause
   616  //
   617  // Copyright (c) 1982, 1986, 1989, 1991, 1993
   618  //	The Regents of the University of California.  All rights reserved.
   619  // (c) UNIX System Laboratories, Inc.
   620  // All or some portions of this file are derived from material licensed
   621  // to the University of California by American Telephone and Telegraph
   622  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
   623  // the permission of UNIX System Laboratories, Inc.
   624  //
   625  // Redistribution and use in source and binary forms, with or without
   626  // modification, are permitted provided that the following conditions
   627  // are met:
   628  // 1. Redistributions of source code must retain the above copyright
   629  //    notice, this list of conditions and the following disclaimer.
   630  // 2. Redistributions in binary form must reproduce the above copyright
   631  //    notice, this list of conditions and the following disclaimer in the
   632  //    documentation and/or other materials provided with the distribution.
   633  // 3. Neither the name of the University nor the names of its contributors
   634  //    may be used to endorse or promote products derived from this software
   635  //    without specific prior written permission.
   636  //
   637  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   638  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   639  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   640  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   641  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   642  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   643  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   644  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   645  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   646  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   647  // SUCH DAMAGE.
   648  //
   649  //	@(#)signal.h	8.4 (Berkeley) 5/4/95
   650  // $FreeBSD$
   651  
   652  // sigset_t macros.
   653  
   654  type __sigset = struct{ __bits [4]uint32 } /* _sigset.h:53:9 */
   655  
   656  // -
   657  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   658  //
   659  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   660  // All rights reserved.
   661  //
   662  // Redistribution and use in source and binary forms, with or without
   663  // modification, are permitted provided that the following conditions
   664  // are met:
   665  // 1. Redistributions of source code must retain the above copyright
   666  //    notice, this list of conditions and the following disclaimer.
   667  // 2. Redistributions in binary form must reproduce the above copyright
   668  //    notice, this list of conditions and the following disclaimer in the
   669  //    documentation and/or other materials provided with the distribution.
   670  //
   671  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   672  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   673  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   674  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   675  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   676  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   677  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   678  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   679  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   680  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   681  // SUCH DAMAGE.
   682  //
   683  // $FreeBSD$
   684  
   685  // -
   686  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   687  //
   688  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   689  // All rights reserved.
   690  //
   691  // Redistribution and use in source and binary forms, with or without
   692  // modification, are permitted provided that the following conditions
   693  // are met:
   694  // 1. Redistributions of source code must retain the above copyright
   695  //    notice, this list of conditions and the following disclaimer.
   696  // 2. Redistributions in binary form must reproduce the above copyright
   697  //    notice, this list of conditions and the following disclaimer in the
   698  //    documentation and/or other materials provided with the distribution.
   699  //
   700  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   701  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   702  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   703  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   704  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   705  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   706  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   707  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   708  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   709  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   710  // SUCH DAMAGE.
   711  //
   712  // $FreeBSD$
   713  
   714  // Structure returned by gettimeofday(2) system call, and used in other calls.
   715  type timeval = struct {
   716  	tv_sec  time_t
   717  	tv_usec suseconds_t
   718  	_       [4]byte
   719  } /* _timeval.h:49:1 */
   720  
   721  // -
   722  // SPDX-License-Identifier: BSD-3-Clause
   723  //
   724  // Copyright (c) 1982, 1986, 1993
   725  //	The Regents of the University of California.  All rights reserved.
   726  //
   727  // Redistribution and use in source and binary forms, with or without
   728  // modification, are permitted provided that the following conditions
   729  // are met:
   730  // 1. Redistributions of source code must retain the above copyright
   731  //    notice, this list of conditions and the following disclaimer.
   732  // 2. Redistributions in binary form must reproduce the above copyright
   733  //    notice, this list of conditions and the following disclaimer in the
   734  //    documentation and/or other materials provided with the distribution.
   735  // 3. Neither the name of the University nor the names of its contributors
   736  //    may be used to endorse or promote products derived from this software
   737  //    without specific prior written permission.
   738  //
   739  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   740  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   741  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   742  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   743  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   744  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   745  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   746  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   747  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   748  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   749  // SUCH DAMAGE.
   750  //
   751  //	@(#)time.h	8.5 (Berkeley) 5/4/95
   752  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
   753  //	$FreeBSD$
   754  
   755  // -
   756  // SPDX-License-Identifier: BSD-3-Clause
   757  //
   758  // Copyright (c) 1991, 1993
   759  //	The Regents of the University of California.  All rights reserved.
   760  //
   761  // This code is derived from software contributed to Berkeley by
   762  // Berkeley Software Design, Inc.
   763  //
   764  // Redistribution and use in source and binary forms, with or without
   765  // modification, are permitted provided that the following conditions
   766  // are met:
   767  // 1. Redistributions of source code must retain the above copyright
   768  //    notice, this list of conditions and the following disclaimer.
   769  // 2. Redistributions in binary form must reproduce the above copyright
   770  //    notice, this list of conditions and the following disclaimer in the
   771  //    documentation and/or other materials provided with the distribution.
   772  // 3. Neither the name of the University nor the names of its contributors
   773  //    may be used to endorse or promote products derived from this software
   774  //    without specific prior written permission.
   775  //
   776  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   777  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   778  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   779  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   780  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   781  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   782  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   783  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   784  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   785  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   786  // SUCH DAMAGE.
   787  //
   788  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   789  // $FreeBSD$
   790  
   791  // -
   792  // SPDX-License-Identifier: BSD-3-Clause
   793  //
   794  // Copyright (c) 1982, 1986, 1993
   795  //	The Regents of the University of California.  All rights reserved.
   796  //
   797  // Redistribution and use in source and binary forms, with or without
   798  // modification, are permitted provided that the following conditions
   799  // are met:
   800  // 1. Redistributions of source code must retain the above copyright
   801  //    notice, this list of conditions and the following disclaimer.
   802  // 2. Redistributions in binary form must reproduce the above copyright
   803  //    notice, this list of conditions and the following disclaimer in the
   804  //    documentation and/or other materials provided with the distribution.
   805  // 3. Neither the name of the University nor the names of its contributors
   806  //    may be used to endorse or promote products derived from this software
   807  //    without specific prior written permission.
   808  //
   809  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   810  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   811  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   812  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   813  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   814  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   815  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   816  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   817  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   818  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   819  // SUCH DAMAGE.
   820  //
   821  //	@(#)time.h	8.5 (Berkeley) 5/4/95
   822  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
   823  //	$FreeBSD$
   824  
   825  // -
   826  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   827  //
   828  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   829  // All rights reserved.
   830  //
   831  // Redistribution and use in source and binary forms, with or without
   832  // modification, are permitted provided that the following conditions
   833  // are met:
   834  // 1. Redistributions of source code must retain the above copyright
   835  //    notice, this list of conditions and the following disclaimer.
   836  // 2. Redistributions in binary form must reproduce the above copyright
   837  //    notice, this list of conditions and the following disclaimer in the
   838  //    documentation and/or other materials provided with the distribution.
   839  //
   840  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   841  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   842  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   843  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   844  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   845  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   846  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   847  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   848  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   849  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   850  // SUCH DAMAGE.
   851  //
   852  // $FreeBSD$
   853  
   854  type timespec = struct {
   855  	tv_sec  time_t
   856  	tv_nsec int32
   857  	_       [4]byte
   858  } /* _timespec.h:46:1 */
   859  
   860  // Structure defined by POSIX.1b to be like a itimerval, but with
   861  // timespecs. Used in the timer_*() system calls.
   862  type itimerspec = struct {
   863  	it_interval struct {
   864  		tv_sec  time_t
   865  		tv_nsec int32
   866  		_       [4]byte
   867  	}
   868  	it_value struct {
   869  		tv_sec  time_t
   870  		tv_nsec int32
   871  		_       [4]byte
   872  	}
   873  } /* timespec.h:60:1 */
   874  
   875  type fd_mask = uint32 /* select.h:46:19 */
   876  
   877  type sigset_t = __sigset /* select.h:51:20 */
   878  
   879  // Select uses bit masks of file descriptors in longs.  These macros
   880  // manipulate such bit fields (the filesystem macros use chars).
   881  // FD_SETSIZE may be defined by the user, but the default here should
   882  // be enough for most uses.
   883  
   884  type fd_set1 = struct{ __fds_bits [32]uint32 } /* select.h:73:9 */
   885  
   886  // Select uses bit masks of file descriptors in longs.  These macros
   887  // manipulate such bit fields (the filesystem macros use chars).
   888  // FD_SETSIZE may be defined by the user, but the default here should
   889  // be enough for most uses.
   890  
   891  type fd_set = fd_set1 /* select.h:75:3 */
   892  
   893  // -
   894  // SPDX-License-Identifier: BSD-2-Clause
   895  //
   896  // Copyright (c) 2017 Poul-Henning Kamp.  All rights reserved.
   897  //
   898  // Redistribution and use in source and binary forms, with or without
   899  // modification, are permitted provided that the following conditions
   900  // are met:
   901  // 1. Redistributions of source code must retain the above copyright
   902  //    notice, this list of conditions and the following disclaimer.
   903  // 2. Redistributions in binary form must reproduce the above copyright
   904  //    notice, this list of conditions and the following disclaimer in the
   905  //    documentation and/or other materials provided with the distribution.
   906  //
   907  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   908  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   909  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   910  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   911  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   912  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   913  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   914  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   915  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   916  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   917  // SUCH DAMAGE.
   918  //
   919  // $FreeBSD$
   920  
   921  // -
   922  // SPDX-License-Identifier: BSD-3-Clause
   923  //
   924  // Copyright (c) 2002 David E. O'Brien.  All rights reserved.
   925  //
   926  // Redistribution and use in source and binary forms, with or without
   927  // modification, are permitted provided that the following conditions
   928  // are met:
   929  // 1. Redistributions of source code must retain the above copyright
   930  //    notice, this list of conditions and the following disclaimer.
   931  // 2. Redistributions in binary form must reproduce the above copyright
   932  //    notice, this list of conditions and the following disclaimer in the
   933  //    documentation and/or other materials provided with the distribution.
   934  // 3. Neither the name of the University nor the names of its contributors
   935  //    may be used to endorse or promote products derived from this software
   936  //    without specific prior written permission.
   937  //
   938  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   939  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   940  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   941  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   942  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   943  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   944  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   945  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   946  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   947  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   948  // SUCH DAMAGE.
   949  //
   950  // $FreeBSD$
   951  
   952  // -
   953  // SPDX-License-Identifier: BSD-3-Clause
   954  //
   955  // Copyright (c) 1991, 1993
   956  //	The Regents of the University of California.  All rights reserved.
   957  //
   958  // This code is derived from software contributed to Berkeley by
   959  // Berkeley Software Design, Inc.
   960  //
   961  // Redistribution and use in source and binary forms, with or without
   962  // modification, are permitted provided that the following conditions
   963  // are met:
   964  // 1. Redistributions of source code must retain the above copyright
   965  //    notice, this list of conditions and the following disclaimer.
   966  // 2. Redistributions in binary form must reproduce the above copyright
   967  //    notice, this list of conditions and the following disclaimer in the
   968  //    documentation and/or other materials provided with the distribution.
   969  // 3. Neither the name of the University nor the names of its contributors
   970  //    may be used to endorse or promote products derived from this software
   971  //    without specific prior written permission.
   972  //
   973  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   974  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   975  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   976  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   977  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   978  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   979  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   980  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   981  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   982  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   983  // SUCH DAMAGE.
   984  //
   985  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   986  // $FreeBSD$
   987  
   988  // -
   989  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   990  //
   991  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   992  // All rights reserved.
   993  //
   994  // Redistribution and use in source and binary forms, with or without
   995  // modification, are permitted provided that the following conditions
   996  // are met:
   997  // 1. Redistributions of source code must retain the above copyright
   998  //    notice, this list of conditions and the following disclaimer.
   999  // 2. Redistributions in binary form must reproduce the above copyright
  1000  //    notice, this list of conditions and the following disclaimer in the
  1001  //    documentation and/or other materials provided with the distribution.
  1002  //
  1003  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1004  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1005  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1006  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1007  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1008  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1009  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1010  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1011  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1012  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1013  // SUCH DAMAGE.
  1014  //
  1015  // $FreeBSD$
  1016  
  1017  type va_list = uintptr /* _stdarg.h:41:27 */ // select(2)
  1018  
  1019  type crypt_data = struct {
  1020  	initialized int32
  1021  	__buf       [256]uint8
  1022  } /* unistd.h:489:1 */
  1023  
  1024  // getopt(3) external variable
  1025  
  1026  // MVS linker does not support external names larger than 8 bytes
  1027  
  1028  //
  1029  //     The 'zlib' compression library provides in-memory compression and
  1030  //   decompression functions, including integrity checks of the uncompressed data.
  1031  //   This version of the library supports only one compression method (deflation)
  1032  //   but other algorithms will be added later and will have the same stream
  1033  //   interface.
  1034  //
  1035  //     Compression can be done in a single step if the buffers are large enough,
  1036  //   or can be done by repeated calls of the compression function.  In the latter
  1037  //   case, the application must provide more input and/or consume the output
  1038  //   (providing more output space) before each call.
  1039  //
  1040  //     The compressed data format used by default by the in-memory functions is
  1041  //   the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
  1042  //   around a deflate stream, which is itself documented in RFC 1951.
  1043  //
  1044  //     The library also supports reading and writing files in gzip (.gz) format
  1045  //   with an interface similar to that of stdio using the functions that start
  1046  //   with "gz".  The gzip format is different from the zlib format.  gzip is a
  1047  //   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
  1048  //
  1049  //     This library can optionally read and write gzip and raw deflate streams in
  1050  //   memory as well.
  1051  //
  1052  //     The zlib format was designed to be compact and fast for use in memory
  1053  //   and on communications channels.  The gzip format was designed for single-
  1054  //   file compression on file systems, has a larger header than zlib to maintain
  1055  //   directory information, and uses a different, slower check method than zlib.
  1056  //
  1057  //     The library does not install any signal handler.  The decoder checks
  1058  //   the consistency of the compressed data, so the library should never crash
  1059  //   even in the case of corrupted input.
  1060  
  1061  type alloc_func = uintptr /* zlib.h:81:16 */
  1062  type free_func = uintptr  /* zlib.h:82:16 */
  1063  
  1064  type z_stream_s = struct {
  1065  	next_in   uintptr
  1066  	avail_in  uInt
  1067  	total_in  uLong
  1068  	next_out  uintptr
  1069  	avail_out uInt
  1070  	total_out uLong
  1071  	msg       uintptr
  1072  	state     uintptr
  1073  	zalloc    alloc_func
  1074  	zfree     free_func
  1075  	opaque    voidpf
  1076  	data_type int32
  1077  	adler     uLong
  1078  	reserved  uLong
  1079  } /* zlib.h:86:9 */
  1080  
  1081  type z_stream = z_stream_s /* zlib.h:106:3 */
  1082  
  1083  type z_streamp = uintptr /* zlib.h:108:22 */
  1084  
  1085  //
  1086  //      gzip header information passed to and from zlib routines.  See RFC 1952
  1087  //   for more details on the meanings of these fields.
  1088  type gz_header_s = struct {
  1089  	text      int32
  1090  	time      uLong
  1091  	xflags    int32
  1092  	os        int32
  1093  	extra     uintptr
  1094  	extra_len uInt
  1095  	extra_max uInt
  1096  	name      uintptr
  1097  	name_max  uInt
  1098  	comment   uintptr
  1099  	comm_max  uInt
  1100  	hcrc      int32
  1101  	done      int32
  1102  } /* zlib.h:114:9 */
  1103  
  1104  //
  1105  //      gzip header information passed to and from zlib routines.  See RFC 1952
  1106  //   for more details on the meanings of these fields.
  1107  type gz_header = gz_header_s /* zlib.h:129:3 */
  1108  
  1109  type gz_headerp = uintptr /* zlib.h:131:23 */
  1110  //
  1111  //      inflateGetHeader() requests that gzip header information be stored in the
  1112  //    provided gz_header structure.  inflateGetHeader() may be called after
  1113  //    inflateInit2() or inflateReset(), and before the first call of inflate().
  1114  //    As inflate() processes the gzip stream, head->done is zero until the header
  1115  //    is completed, at which time head->done is set to one.  If a zlib stream is
  1116  //    being decoded, then head->done is set to -1 to indicate that there will be
  1117  //    no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
  1118  //    used to force inflate() to return immediately after header processing is
  1119  //    complete and before any actual data is decompressed.
  1120  //
  1121  //      The text, time, xflags, and os fields are filled in with the gzip header
  1122  //    contents.  hcrc is set to true if there is a header CRC.  (The header CRC
  1123  //    was valid if done is set to one.) If extra is not Z_NULL, then extra_max
  1124  //    contains the maximum number of bytes to write to extra.  Once done is true,
  1125  //    extra_len contains the actual extra field length, and extra contains the
  1126  //    extra field, or that field truncated if extra_max is less than extra_len.
  1127  //    If name is not Z_NULL, then up to name_max characters are written there,
  1128  //    terminated with a zero unless the length is greater than name_max.  If
  1129  //    comment is not Z_NULL, then up to comm_max characters are written there,
  1130  //    terminated with a zero unless the length is greater than comm_max.  When any
  1131  //    of extra, name, or comment are not Z_NULL and the respective field is not
  1132  //    present in the header, then that field is set to Z_NULL to signal its
  1133  //    absence.  This allows the use of deflateSetHeader() with the returned
  1134  //    structure to duplicate the header.  However if those fields are set to
  1135  //    allocated memory, then the application will need to save those pointers
  1136  //    elsewhere so that they can be eventually freed.
  1137  //
  1138  //      If inflateGetHeader is not used, then the header information is simply
  1139  //    discarded.  The header is always checked for validity, including the header
  1140  //    CRC if present.  inflateReset() will reset the process to discard the header
  1141  //    information.  The application would need to call inflateGetHeader() again to
  1142  //    retrieve the header from the next gzip stream.
  1143  //
  1144  //      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
  1145  //    stream state was inconsistent.
  1146  
  1147  //
  1148  // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
  1149  //                                         unsigned char FAR *window));
  1150  //
  1151  //      Initialize the internal stream state for decompression using inflateBack()
  1152  //    calls.  The fields zalloc, zfree and opaque in strm must be initialized
  1153  //    before the call.  If zalloc and zfree are Z_NULL, then the default library-
  1154  //    derived memory allocation routines are used.  windowBits is the base two
  1155  //    logarithm of the window size, in the range 8..15.  window is a caller
  1156  //    supplied buffer of that size.  Except for special applications where it is
  1157  //    assured that deflate was used with small window sizes, windowBits must be 15
  1158  //    and a 32K byte window must be supplied to be able to decompress general
  1159  //    deflate streams.
  1160  //
  1161  //      See inflateBack() for the usage of these routines.
  1162  //
  1163  //      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
  1164  //    the parameters are invalid, Z_MEM_ERROR if the internal state could not be
  1165  //    allocated, or Z_VERSION_ERROR if the version of the library does not match
  1166  //    the version of the header file.
  1167  
  1168  type in_func = uintptr  /* zlib.h:1092:18 */
  1169  type out_func = uintptr /* zlib.h:1094:13 */
  1170  //
  1171  //      Same as uncompress, except that sourceLen is a pointer, where the
  1172  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
  1173  //    source bytes consumed.
  1174  
  1175  // gzip file access functions
  1176  
  1177  //
  1178  //      This library supports reading and writing files in gzip (.gz) format with
  1179  //    an interface similar to that of stdio, using the functions that start with
  1180  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
  1181  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
  1182  
  1183  type gzFile_s = struct {
  1184  	have uint32
  1185  	next uintptr
  1186  	pos  off_t
  1187  } /* zlib.h:1300:9 */
  1188  
  1189  //
  1190  //      Same as uncompress, except that sourceLen is a pointer, where the
  1191  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
  1192  //    source bytes consumed.
  1193  
  1194  // gzip file access functions
  1195  
  1196  //
  1197  //      This library supports reading and writing files in gzip (.gz) format with
  1198  //    an interface similar to that of stdio, using the functions that start with
  1199  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
  1200  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
  1201  
  1202  type gzFile = uintptr /* zlib.h:1300:25 */
  1203  
  1204  // -
  1205  // SPDX-License-Identifier: BSD-3-Clause
  1206  //
  1207  // Copyright (c) 1990, 1993
  1208  //	The Regents of the University of California.  All rights reserved.
  1209  //
  1210  // This code is derived from software contributed to Berkeley by
  1211  // Chris Torek.
  1212  //
  1213  // Redistribution and use in source and binary forms, with or without
  1214  // modification, are permitted provided that the following conditions
  1215  // are met:
  1216  // 1. Redistributions of source code must retain the above copyright
  1217  //    notice, this list of conditions and the following disclaimer.
  1218  // 2. Redistributions in binary form must reproduce the above copyright
  1219  //    notice, this list of conditions and the following disclaimer in the
  1220  //    documentation and/or other materials provided with the distribution.
  1221  // 3. Neither the name of the University nor the names of its contributors
  1222  //    may be used to endorse or promote products derived from this software
  1223  //    without specific prior written permission.
  1224  //
  1225  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1226  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1227  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1228  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1229  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1230  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1231  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1232  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1233  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1234  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1235  // SUCH DAMAGE.
  1236  //
  1237  //	@(#)stdio.h	8.5 (Berkeley) 4/29/95
  1238  // $FreeBSD$
  1239  
  1240  // -
  1241  // SPDX-License-Identifier: BSD-3-Clause
  1242  //
  1243  // Copyright (c) 1991, 1993
  1244  //	The Regents of the University of California.  All rights reserved.
  1245  //
  1246  // This code is derived from software contributed to Berkeley by
  1247  // Berkeley Software Design, Inc.
  1248  //
  1249  // Redistribution and use in source and binary forms, with or without
  1250  // modification, are permitted provided that the following conditions
  1251  // are met:
  1252  // 1. Redistributions of source code must retain the above copyright
  1253  //    notice, this list of conditions and the following disclaimer.
  1254  // 2. Redistributions in binary form must reproduce the above copyright
  1255  //    notice, this list of conditions and the following disclaimer in the
  1256  //    documentation and/or other materials provided with the distribution.
  1257  // 3. Neither the name of the University nor the names of its contributors
  1258  //    may be used to endorse or promote products derived from this software
  1259  //    without specific prior written permission.
  1260  //
  1261  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1262  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1263  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1264  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1265  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1266  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1267  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1268  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1269  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1270  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1271  // SUCH DAMAGE.
  1272  //
  1273  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  1274  // $FreeBSD$
  1275  
  1276  // -
  1277  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1278  //
  1279  // Copyright (c) 2003 Marcel Moolenaar
  1280  // All rights reserved.
  1281  //
  1282  // Redistribution and use in source and binary forms, with or without
  1283  // modification, are permitted provided that the following conditions
  1284  // are met:
  1285  //
  1286  // 1. Redistributions of source code must retain the above copyright
  1287  //    notice, this list of conditions and the following disclaimer.
  1288  // 2. Redistributions in binary form must reproduce the above copyright
  1289  //    notice, this list of conditions and the following disclaimer in the
  1290  //    documentation and/or other materials provided with the distribution.
  1291  //
  1292  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  1293  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1294  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1295  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  1296  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  1297  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1298  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1299  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1300  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1301  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1302  //
  1303  // $FreeBSD$
  1304  
  1305  // -
  1306  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1307  //
  1308  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  1309  // All rights reserved.
  1310  //
  1311  // Redistribution and use in source and binary forms, with or without
  1312  // modification, are permitted provided that the following conditions
  1313  // are met:
  1314  // 1. Redistributions of source code must retain the above copyright
  1315  //    notice, this list of conditions and the following disclaimer.
  1316  // 2. Redistributions in binary form must reproduce the above copyright
  1317  //    notice, this list of conditions and the following disclaimer in the
  1318  //    documentation and/or other materials provided with the distribution.
  1319  //
  1320  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1321  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1322  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1323  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1324  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1325  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1326  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1327  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1328  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1329  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1330  // SUCH DAMAGE.
  1331  //
  1332  // $FreeBSD$
  1333  
  1334  type fpos_t = int64 /* stdio.h:47:18 */
  1335  
  1336  // NB: to fit things in six character monocase externals, the stdio
  1337  // code uses the prefix `__s' for stdio objects, typically followed
  1338  // by a three-character attempt at a mnemonic.
  1339  
  1340  // stdio buffers
  1341  type __sbuf = struct {
  1342  	_base uintptr
  1343  	_size int32
  1344  } /* stdio.h:91:1 */
  1345  
  1346  // stdio state variables.
  1347  //
  1348  // The following always hold:
  1349  //
  1350  //	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  1351  //		_lbfsize is -_bf._size, else _lbfsize is 0
  1352  //	if _flags&__SRD, _w is 0
  1353  //	if _flags&__SWR, _r is 0
  1354  //
  1355  // This ensures that the getc and putc macros (or inline functions) never
  1356  // try to write or read from a file that is in `read' or `write' mode.
  1357  // (Moreover, they can, and do, automatically switch from read mode to
  1358  // write mode, and back, on "r+" and "w+" files.)
  1359  //
  1360  // _lbfsize is used only to make the inline line-buffered output stream
  1361  // code as compact as possible.
  1362  //
  1363  // _ub, _up, and _ur are used when ungetc() pushes back more characters
  1364  // than fit in the current _bf, or when ungetc() pushes back a character
  1365  // that does not match the previous one in _bf.  When this happens,
  1366  // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  1367  // _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  1368  //
  1369  // Certain members of __sFILE are accessed directly via macros or
  1370  // inline functions.  To preserve ABI compat, these members must not
  1371  // be disturbed.  These members are marked below with (*).
  1372  type __sFILE = struct {
  1373  	_p     uintptr
  1374  	_r     int32
  1375  	_w     int32
  1376  	_flags int16
  1377  	_file  int16
  1378  	_bf    struct {
  1379  		_base uintptr
  1380  		_size int32
  1381  	}
  1382  	_lbfsize int32
  1383  	_cookie  uintptr
  1384  	_close   uintptr
  1385  	_read    uintptr
  1386  	_seek    uintptr
  1387  	_write   uintptr
  1388  	_ub      struct {
  1389  		_base uintptr
  1390  		_size int32
  1391  	}
  1392  	_up   uintptr
  1393  	_ur   int32
  1394  	_ubuf [3]uint8
  1395  	_nbuf [1]uint8
  1396  	_lb   struct {
  1397  		_base uintptr
  1398  		_size int32
  1399  	}
  1400  	_blksize     int32
  1401  	_offset      fpos_t
  1402  	_fl_mutex    uintptr
  1403  	_fl_owner    uintptr
  1404  	_fl_count    int32
  1405  	_orientation int32
  1406  	_mbstate     struct {
  1407  		_          [0]uint64
  1408  		__mbstate8 [128]uint8
  1409  	}
  1410  	_flags2 int32
  1411  	_       [4]byte
  1412  } /* stdio.h:124:1 */
  1413  
  1414  type FILE = __sFILE /* stdio.h:165:24 */
  1415  type cookie_io_functions_t = struct {
  1416  	read  uintptr
  1417  	write uintptr
  1418  	seek  uintptr
  1419  	close uintptr
  1420  } /* stdio.h:428:3 */
  1421  
  1422  // -
  1423  // Copyright (c) 2011, 2012 The FreeBSD Foundation
  1424  //
  1425  // Redistribution and use in source and binary forms, with or without
  1426  // modification, are permitted provided that the following conditions
  1427  // are met:
  1428  // 1. Redistributions of source code must retain the above copyright
  1429  //    notice, this list of conditions and the following disclaimer.
  1430  // 2. Redistributions in binary form must reproduce the above copyright
  1431  //    notice, this list of conditions and the following disclaimer in the
  1432  //    documentation and/or other materials provided with the distribution.
  1433  //
  1434  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1435  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1436  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1437  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1438  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1439  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1440  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1441  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1442  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1443  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1444  // SUCH DAMAGE.
  1445  //
  1446  // $FreeBSD$
  1447  
  1448  type locale_t = uintptr /* _strings.h:30:25 */
  1449  
  1450  // xlocale extensions
  1451  
  1452  type errno_t = int32 /* string.h:159:13 */
  1453  
  1454  // -
  1455  // SPDX-License-Identifier: BSD-3-Clause
  1456  //
  1457  // Copyright (c) 1990, 1993
  1458  //	The Regents of the University of California.  All rights reserved.
  1459  //
  1460  // Redistribution and use in source and binary forms, with or without
  1461  // modification, are permitted provided that the following conditions
  1462  // are met:
  1463  // 1. Redistributions of source code must retain the above copyright
  1464  //    notice, this list of conditions and the following disclaimer.
  1465  // 2. Redistributions in binary form must reproduce the above copyright
  1466  //    notice, this list of conditions and the following disclaimer in the
  1467  //    documentation and/or other materials provided with the distribution.
  1468  // 3. Neither the name of the University nor the names of its contributors
  1469  //    may be used to endorse or promote products derived from this software
  1470  //    without specific prior written permission.
  1471  //
  1472  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1473  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1474  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1475  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1476  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1477  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1478  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1479  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1480  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1481  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1482  // SUCH DAMAGE.
  1483  //
  1484  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
  1485  // $FreeBSD$
  1486  
  1487  // -
  1488  // SPDX-License-Identifier: BSD-3-Clause
  1489  //
  1490  // Copyright (c) 1991, 1993
  1491  //	The Regents of the University of California.  All rights reserved.
  1492  //
  1493  // This code is derived from software contributed to Berkeley by
  1494  // Berkeley Software Design, Inc.
  1495  //
  1496  // Redistribution and use in source and binary forms, with or without
  1497  // modification, are permitted provided that the following conditions
  1498  // are met:
  1499  // 1. Redistributions of source code must retain the above copyright
  1500  //    notice, this list of conditions and the following disclaimer.
  1501  // 2. Redistributions in binary form must reproduce the above copyright
  1502  //    notice, this list of conditions and the following disclaimer in the
  1503  //    documentation and/or other materials provided with the distribution.
  1504  // 3. Neither the name of the University nor the names of its contributors
  1505  //    may be used to endorse or promote products derived from this software
  1506  //    without specific prior written permission.
  1507  //
  1508  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1509  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1510  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1511  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1512  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1513  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1514  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1515  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1516  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1517  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1518  // SUCH DAMAGE.
  1519  //
  1520  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  1521  // $FreeBSD$
  1522  
  1523  // -
  1524  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1525  //
  1526  // Copyright (c) 2003 Marcel Moolenaar
  1527  // All rights reserved.
  1528  //
  1529  // Redistribution and use in source and binary forms, with or without
  1530  // modification, are permitted provided that the following conditions
  1531  // are met:
  1532  //
  1533  // 1. Redistributions of source code must retain the above copyright
  1534  //    notice, this list of conditions and the following disclaimer.
  1535  // 2. Redistributions in binary form must reproduce the above copyright
  1536  //    notice, this list of conditions and the following disclaimer in the
  1537  //    documentation and/or other materials provided with the distribution.
  1538  //
  1539  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  1540  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1541  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1542  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  1543  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  1544  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1545  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1546  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1547  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1548  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1549  //
  1550  // $FreeBSD$
  1551  
  1552  // -
  1553  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1554  //
  1555  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  1556  // All rights reserved.
  1557  //
  1558  // Redistribution and use in source and binary forms, with or without
  1559  // modification, are permitted provided that the following conditions
  1560  // are met:
  1561  // 1. Redistributions of source code must retain the above copyright
  1562  //    notice, this list of conditions and the following disclaimer.
  1563  // 2. Redistributions in binary form must reproduce the above copyright
  1564  //    notice, this list of conditions and the following disclaimer in the
  1565  //    documentation and/or other materials provided with the distribution.
  1566  //
  1567  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1568  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1569  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1570  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1571  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1572  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1573  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1574  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1575  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1576  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1577  // SUCH DAMAGE.
  1578  //
  1579  // $FreeBSD$
  1580  
  1581  type div_t = struct {
  1582  	quot int32
  1583  	rem  int32
  1584  } /* stdlib.h:66:3 */
  1585  
  1586  type ldiv_t = struct {
  1587  	quot int32
  1588  	rem  int32
  1589  } /* stdlib.h:71:3 */
  1590  
  1591  // Functions added in C99 which we make conditionally available in the
  1592  // BSD^C89 namespace if the compiler supports `long long'.
  1593  // The #if test is more complicated than it ought to be because
  1594  // __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
  1595  // is not supported in the compilation environment (which therefore means
  1596  // that it can't really be ISO C99).
  1597  //
  1598  // (The only other extension made by C99 in thie header is _Exit().)
  1599  // LONGLONG
  1600  type lldiv_t = struct {
  1601  	quot int64
  1602  	rem  int64
  1603  } /* stdlib.h:142:3 */ // getsubopt(3) external variable
  1604  
  1605  // K.3.6
  1606  type constraint_handler_t = uintptr /* stdlib.h:349:14 */
  1607  
  1608  var prog uintptr /* minigzip.c:336:13: */
  1609  
  1610  // ===========================================================================
  1611  // Display error message and exit
  1612  func error(tls *libc.TLS, msg uintptr) { /* minigzip.c:351:6: */
  1613  	bp := tls.Alloc(16)
  1614  	defer tls.Free(16)
  1615  
  1616  	libc.Xfprintf(tls, libc.X__stderrp, ts, libc.VaList(bp, prog, msg))
  1617  	libc.Xexit(tls, 1)
  1618  }
  1619  
  1620  // ===========================================================================
  1621  // Compress input to output then close both files.
  1622  
  1623  func gz_compress(tls *libc.TLS, in uintptr, out gzFile) { /* minigzip.c:362:6: */
  1624  	bp := tls.Alloc(16388)
  1625  	defer tls.Free(16388)
  1626  
  1627  	// var buf [16384]uint8 at bp, 16384
  1628  
  1629  	var len int32
  1630  	// var err int32 at bp+16384, 4
  1631  
  1632  	for {
  1633  		len = int32(libc.Xfread(tls, bp, uint32(1), uint32(unsafe.Sizeof([16384]uint8{})), in))
  1634  		if func() int32 {
  1635  			if !(libc.X__isthreaded != 0) {
  1636  				return libc.Bool32(int32((*FILE)(unsafe.Pointer(in))._flags)&0x0040 != 0)
  1637  			}
  1638  			return libc.Xferror(tls, in)
  1639  		}() != 0 {
  1640  			libc.Xperror(tls, ts+8)
  1641  			libc.Xexit(tls, 1)
  1642  		}
  1643  		if len == 0 {
  1644  			break
  1645  		}
  1646  
  1647  		if z.Xgzwrite(tls, out, bp, uint32(len)) != len {
  1648  			error(tls, z.Xgzerror(tls, out, bp+16384))
  1649  		}
  1650  	}
  1651  	libc.Xfclose(tls, in)
  1652  	if z.Xgzclose(tls, out) != 0 {
  1653  		error(tls, ts+14)
  1654  	}
  1655  }
  1656  
  1657  // ===========================================================================
  1658  // Uncompress input to output then close both files.
  1659  func gz_uncompress(tls *libc.TLS, in gzFile, out uintptr) { /* minigzip.c:430:6: */
  1660  	bp := tls.Alloc(16388)
  1661  	defer tls.Free(16388)
  1662  
  1663  	// var buf [16384]uint8 at bp, 16384
  1664  
  1665  	var len int32
  1666  	// var err int32 at bp+16384, 4
  1667  
  1668  	for {
  1669  		len = z.Xgzread(tls, in, bp, uint32(unsafe.Sizeof([16384]uint8{})))
  1670  		if len < 0 {
  1671  			error(tls, z.Xgzerror(tls, in, bp+16384))
  1672  		}
  1673  		if len == 0 {
  1674  			break
  1675  		}
  1676  
  1677  		if int32(libc.Xfwrite(tls, bp, uint32(1), uint32(len), out)) != len {
  1678  			error(tls, ts+29)
  1679  		}
  1680  	}
  1681  	if libc.Xfclose(tls, out) != 0 {
  1682  		error(tls, ts+43)
  1683  	}
  1684  
  1685  	if z.Xgzclose(tls, in) != 0 {
  1686  		error(tls, ts+14)
  1687  	}
  1688  }
  1689  
  1690  // ===========================================================================
  1691  // Compress the given file: create a corresponding .gz file and remove the
  1692  // original.
  1693  func file_compress(tls *libc.TLS, file uintptr, mode uintptr) { /* minigzip.c:457:6: */
  1694  	bp := tls.Alloc(1064)
  1695  	defer tls.Free(1064)
  1696  
  1697  	// var outfile [1024]uint8 at bp+40, 1024
  1698  
  1699  	var in uintptr
  1700  	var out gzFile
  1701  
  1702  	if libc.Xstrlen(tls, file)+libc.Xstrlen(tls, ts+57) >= size_t(unsafe.Sizeof([1024]uint8{})) {
  1703  		libc.Xfprintf(tls, libc.X__stderrp, ts+61, libc.VaList(bp, prog))
  1704  		libc.Xexit(tls, 1)
  1705  	}
  1706  
  1707  	libc.Xsnprintf(tls, bp+40, uint32(unsafe.Sizeof([1024]uint8{})), ts+84, libc.VaList(bp+8, file, ts+57))
  1708  
  1709  	in = libc.Xfopen(tls, file, ts+89)
  1710  	if in == uintptr(0) {
  1711  		libc.Xperror(tls, file)
  1712  		libc.Xexit(tls, 1)
  1713  	}
  1714  	out = z.Xgzopen(tls, bp+40, mode)
  1715  	if out == uintptr(0) {
  1716  		libc.Xfprintf(tls, libc.X__stderrp, ts+92, libc.VaList(bp+24, prog, bp+40))
  1717  		libc.Xexit(tls, 1)
  1718  	}
  1719  	gz_compress(tls, in, out)
  1720  
  1721  	libc.Xunlink(tls, file)
  1722  }
  1723  
  1724  // ===========================================================================
  1725  // Uncompress the given file and remove the original.
  1726  func file_uncompress(tls *libc.TLS, file uintptr) { /* minigzip.c:496:6: */
  1727  	bp := tls.Alloc(1064)
  1728  	defer tls.Free(1064)
  1729  
  1730  	// var buf [1024]uint8 at bp+40, 1024
  1731  
  1732  	var infile uintptr
  1733  	var outfile uintptr
  1734  	var out uintptr
  1735  	var in gzFile
  1736  	var len uint32 = libc.Xstrlen(tls, file)
  1737  
  1738  	if len+libc.Xstrlen(tls, ts+57) >= uint32(unsafe.Sizeof([1024]uint8{})) {
  1739  		libc.Xfprintf(tls, libc.X__stderrp, ts+61, libc.VaList(bp, prog))
  1740  		libc.Xexit(tls, 1)
  1741  	}
  1742  
  1743  	libc.Xsnprintf(tls, bp+40, uint32(unsafe.Sizeof([1024]uint8{})), ts+113, libc.VaList(bp+8, file))
  1744  
  1745  	if len > uint32(unsafe.Sizeof([4]uint8{}))-uint32(1) && libc.Xstrcmp(tls, file+uintptr(len)-uintptr(uint32(unsafe.Sizeof([4]uint8{}))-uint32(1)), ts+57) == 0 {
  1746  		infile = file
  1747  		outfile = bp + 40 /* &buf[0] */
  1748  		*(*uint8)(unsafe.Pointer(outfile + uintptr(len-uint32(3)))) = uint8(0)
  1749  	} else {
  1750  		outfile = file
  1751  		infile = bp + 40 /* &buf[0] */
  1752  		libc.Xsnprintf(tls, bp+40+uintptr(len), uint32(unsafe.Sizeof([1024]uint8{}))-len, ts+113, libc.VaList(bp+16, ts+57 /* ".gz" */))
  1753  	}
  1754  	in = z.Xgzopen(tls, infile, ts+89)
  1755  	if in == uintptr(0) {
  1756  		libc.Xfprintf(tls, libc.X__stderrp, ts+92, libc.VaList(bp+24, prog, infile))
  1757  		libc.Xexit(tls, 1)
  1758  	}
  1759  	out = libc.Xfopen(tls, outfile, ts+116)
  1760  	if out == uintptr(0) {
  1761  		libc.Xperror(tls, file)
  1762  		libc.Xexit(tls, 1)
  1763  	}
  1764  
  1765  	gz_uncompress(tls, in, out)
  1766  
  1767  	libc.Xunlink(tls, infile)
  1768  }
  1769  
  1770  // ===========================================================================
  1771  // Usage:  minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...]
  1772  //   -c : write to standard output
  1773  //   -d : decompress
  1774  //   -f : compress with Z_FILTERED
  1775  //   -h : compress with Z_HUFFMAN_ONLY
  1776  //   -r : compress with Z_RLE
  1777  //   -1 to -9 : compression level
  1778  
  1779  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* minigzip.c:556:5: */
  1780  	bp := tls.Alloc(44)
  1781  	defer tls.Free(44)
  1782  
  1783  	var copyout int32 = 0
  1784  	var uncompr int32 = 0
  1785  	var file gzFile
  1786  	var bname uintptr
  1787  	// var outmode [20]uint8 at bp+24, 20
  1788  
  1789  	libc.Xsnprintf(tls, bp+24, uint32(unsafe.Sizeof([20]uint8{})), ts+113, libc.VaList(bp, ts+119))
  1790  
  1791  	prog = *(*uintptr)(unsafe.Pointer(argv))
  1792  	bname = libc.Xstrrchr(tls, *(*uintptr)(unsafe.Pointer(argv)), '/')
  1793  	if bname != 0 {
  1794  		bname++
  1795  	} else {
  1796  		bname = *(*uintptr)(unsafe.Pointer(argv))
  1797  	}
  1798  	argc--
  1799  	argv += 4
  1800  
  1801  	if !(libc.Xstrcmp(tls, bname, ts+124) != 0) {
  1802  		uncompr = 1
  1803  	} else if !(libc.Xstrcmp(tls, bname, ts+131) != 0) {
  1804  		copyout = libc.AssignInt32(&uncompr, 1)
  1805  	}
  1806  
  1807  	for argc > 0 {
  1808  		if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+136) == 0 {
  1809  			copyout = 1
  1810  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+139) == 0 {
  1811  			uncompr = 1
  1812  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+142) == 0 {
  1813  			*(*uint8)(unsafe.Pointer(bp + 24 + 3)) = uint8('f')
  1814  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+145) == 0 {
  1815  			*(*uint8)(unsafe.Pointer(bp + 24 + 3)) = uint8('h')
  1816  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+148) == 0 {
  1817  			*(*uint8)(unsafe.Pointer(bp + 24 + 3)) = uint8('R')
  1818  		} else if int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv))))) == '-' && int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv)) + 1))) >= '1' && int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv)) + 1))) <= '9' && int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv)) + 2))) == 0 {
  1819  			*(*uint8)(unsafe.Pointer(bp + 24 + 2)) = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv)) + 1))
  1820  		} else {
  1821  			break
  1822  		}
  1823  		argc--
  1824  		argv += 4
  1825  	}
  1826  	if int32(*(*uint8)(unsafe.Pointer(bp + 24 + 3))) == ' ' {
  1827  		*(*uint8)(unsafe.Pointer(bp + 24 + 3)) = uint8(0)
  1828  	}
  1829  	if argc == 0 {
  1830  
  1831  		if uncompr != 0 {
  1832  			file = z.Xgzdopen(tls, func() int32 {
  1833  				if !(libc.X__isthreaded != 0) {
  1834  					return int32((*FILE)(unsafe.Pointer(libc.X__stdinp))._file)
  1835  				}
  1836  				return libc.Xfileno(tls, libc.X__stdinp)
  1837  			}(), ts+89)
  1838  			if file == uintptr(0) {
  1839  				error(tls, ts+151)
  1840  			}
  1841  			gz_uncompress(tls, file, libc.X__stdoutp)
  1842  		} else {
  1843  			file = z.Xgzdopen(tls, func() int32 {
  1844  				if !(libc.X__isthreaded != 0) {
  1845  					return int32((*FILE)(unsafe.Pointer(libc.X__stdoutp))._file)
  1846  				}
  1847  				return libc.Xfileno(tls, libc.X__stdoutp)
  1848  			}(), bp+24)
  1849  			if file == uintptr(0) {
  1850  				error(tls, ts+171)
  1851  			}
  1852  			gz_compress(tls, libc.X__stdinp, file)
  1853  		}
  1854  	} else {
  1855  		if copyout != 0 {
  1856  
  1857  		}
  1858  		for __ccgo := true; __ccgo; __ccgo = func() bool { argv += 4; return libc.PreDecInt32(&argc, 1) != 0 }() {
  1859  			if uncompr != 0 {
  1860  				if copyout != 0 {
  1861  					file = z.Xgzopen(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+89)
  1862  					if file == uintptr(0) {
  1863  						libc.Xfprintf(tls, libc.X__stderrp, ts+92, libc.VaList(bp+8, prog, *(*uintptr)(unsafe.Pointer(argv))))
  1864  					} else {
  1865  						gz_uncompress(tls, file, libc.X__stdoutp)
  1866  					}
  1867  				} else {
  1868  					file_uncompress(tls, *(*uintptr)(unsafe.Pointer(argv)))
  1869  				}
  1870  			} else {
  1871  				if copyout != 0 {
  1872  					var in uintptr = libc.Xfopen(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+89)
  1873  
  1874  					if in == uintptr(0) {
  1875  						libc.Xperror(tls, *(*uintptr)(unsafe.Pointer(argv)))
  1876  					} else {
  1877  						file = z.Xgzdopen(tls, func() int32 {
  1878  							if !(libc.X__isthreaded != 0) {
  1879  								return int32((*FILE)(unsafe.Pointer(libc.X__stdoutp))._file)
  1880  							}
  1881  							return libc.Xfileno(tls, libc.X__stdoutp)
  1882  						}(), bp+24)
  1883  						if file == uintptr(0) {
  1884  							error(tls, ts+171)
  1885  						}
  1886  
  1887  						gz_compress(tls, in, file)
  1888  					}
  1889  
  1890  				} else {
  1891  					file_compress(tls, *(*uintptr)(unsafe.Pointer(argv)), bp+24)
  1892  				}
  1893  			}
  1894  		}
  1895  	}
  1896  	return 0
  1897  }
  1898  
  1899  var ts1 = "%s: %s\n\x00fread\x00failed gzclose\x00failed fwrite\x00failed fclose\x00.gz\x00%s: filename too long\n\x00%s%s\x00rb\x00%s: can't gzopen %s\n\x00%s\x00wb\x00wb6 \x00gunzip\x00zcat\x00-c\x00-d\x00-f\x00-h\x00-r\x00can't gzdopen stdin\x00can't gzdopen stdout\x00"
  1900  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data