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

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