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

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