gitlab.com/CoiaPrant/sqlite3@v1.19.1/vfs/vfs_darwin_arm64.go (about)

     1  // Code generated by 'ccgo -o vfs_darwin_arm64.go c/vfs.c -I../testdata/sqlite-amalgamation-3380500 -lgitlab.com/CoiaPrant/sqlite3/lib -pkgname vfs -nocapi -export-externs X -D SQLITE_OS_UNIX -hide=vfsFullPathname -hide=vfsOpen -hide=vfsRead -hide=vfsAccess -hide=vfsFileSize -hide=vfsClose', DO NOT EDIT.
     2  
     3  package vfs
     4  
     5  import (
     6  	"math"
     7  	"reflect"
     8  	"sync/atomic"
     9  	"unsafe"
    10  
    11  	"modernc.org/libc"
    12  	"modernc.org/libc/sys/types"
    13  	"gitlab.com/CoiaPrant/sqlite3/lib"
    14  )
    15  
    16  var _ = math.Pi
    17  var _ reflect.Kind
    18  var _ atomic.Value
    19  var _ unsafe.Pointer
    20  var _ *libc.TLS
    21  var _ types.Size_t
    22  
    23  const (
    24  	FILESEC_OWNER   = 1
    25  	FILESEC_GROUP   = 2
    26  	FILESEC_UUID    = 3
    27  	FILESEC_MODE    = 4
    28  	FILESEC_ACL     = 5
    29  	FILESEC_GRPUUID = 6
    30  
    31  	FILESEC_ACL_RAW       = 100
    32  	FILESEC_ACL_ALLOCSIZE = 101
    33  )
    34  
    35  const (
    36  	_CLOCK_REALTIME             = 0
    37  	_CLOCK_MONOTONIC            = 6
    38  	_CLOCK_MONOTONIC_RAW        = 4
    39  	_CLOCK_MONOTONIC_RAW_APPROX = 5
    40  	_CLOCK_UPTIME_RAW           = 8
    41  	_CLOCK_UPTIME_RAW_APPROX    = 9
    42  	_CLOCK_PROCESS_CPUTIME_ID   = 12
    43  	_CLOCK_THREAD_CPUTIME_ID    = 16
    44  )
    45  
    46  type ptrdiff_t = int64
    47  
    48  type size_t = uint64
    49  
    50  type wchar_t = int32
    51  
    52  var X__darwin_check_fd_set_overflow uintptr
    53  
    54  type va_list = uintptr
    55  
    56  type sqlite_int64 = int64
    57  type sqlite_uint64 = uint64
    58  type sqlite3_int64 = sqlite_int64
    59  type sqlite3_uint64 = sqlite_uint64
    60  
    61  type sqlite3_callback = uintptr
    62  
    63  type sqlite3_file1 = struct{ pMethods uintptr }
    64  
    65  type sqlite3_file = sqlite3_file1
    66  type sqlite3_io_methods1 = struct {
    67  	iVersion               int32
    68  	_                      [4]byte
    69  	xClose                 uintptr
    70  	xRead                  uintptr
    71  	xWrite                 uintptr
    72  	xTruncate              uintptr
    73  	xSync                  uintptr
    74  	xFileSize              uintptr
    75  	xLock                  uintptr
    76  	xUnlock                uintptr
    77  	xCheckReservedLock     uintptr
    78  	xFileControl           uintptr
    79  	xSectorSize            uintptr
    80  	xDeviceCharacteristics uintptr
    81  	xShmMap                uintptr
    82  	xShmLock               uintptr
    83  	xShmBarrier            uintptr
    84  	xShmUnmap              uintptr
    85  	xFetch                 uintptr
    86  	xUnfetch               uintptr
    87  }
    88  
    89  type sqlite3_io_methods = sqlite3_io_methods1
    90  
    91  type sqlite3_vfs1 = struct {
    92  	iVersion          int32
    93  	szOsFile          int32
    94  	mxPathname        int32
    95  	_                 [4]byte
    96  	pNext             uintptr
    97  	zName             uintptr
    98  	pAppData          uintptr
    99  	xOpen             uintptr
   100  	xDelete           uintptr
   101  	xAccess           uintptr
   102  	xFullPathname     uintptr
   103  	xDlOpen           uintptr
   104  	xDlError          uintptr
   105  	xDlSym            uintptr
   106  	xDlClose          uintptr
   107  	xRandomness       uintptr
   108  	xSleep            uintptr
   109  	xCurrentTime      uintptr
   110  	xGetLastError     uintptr
   111  	xCurrentTimeInt64 uintptr
   112  	xSetSystemCall    uintptr
   113  	xGetSystemCall    uintptr
   114  	xNextSystemCall   uintptr
   115  }
   116  
   117  type sqlite3_vfs = sqlite3_vfs1
   118  type sqlite3_syscall_ptr = uintptr
   119  
   120  type sqlite3_mem_methods1 = struct {
   121  	xMalloc   uintptr
   122  	xFree     uintptr
   123  	xRealloc  uintptr
   124  	xSize     uintptr
   125  	xRoundup  uintptr
   126  	xInit     uintptr
   127  	xShutdown uintptr
   128  	pAppData  uintptr
   129  }
   130  
   131  type sqlite3_mem_methods = sqlite3_mem_methods1
   132  
   133  type sqlite3_destructor_type = uintptr
   134  
   135  type sqlite3_vtab1 = struct {
   136  	pModule uintptr
   137  	nRef    int32
   138  	_       [4]byte
   139  	zErrMsg uintptr
   140  }
   141  
   142  type sqlite3_vtab = sqlite3_vtab1
   143  type sqlite3_index_info1 = struct {
   144  	nConstraint      int32
   145  	_                [4]byte
   146  	aConstraint      uintptr
   147  	nOrderBy         int32
   148  	_                [4]byte
   149  	aOrderBy         uintptr
   150  	aConstraintUsage uintptr
   151  	idxNum           int32
   152  	_                [4]byte
   153  	idxStr           uintptr
   154  	needToFreeIdxStr int32
   155  	orderByConsumed  int32
   156  	estimatedCost    float64
   157  	estimatedRows    sqlite3_int64
   158  	idxFlags         int32
   159  	_                [4]byte
   160  	colUsed          sqlite3_uint64
   161  }
   162  
   163  type sqlite3_index_info = sqlite3_index_info1
   164  type sqlite3_vtab_cursor1 = struct{ pVtab uintptr }
   165  
   166  type sqlite3_vtab_cursor = sqlite3_vtab_cursor1
   167  type sqlite3_module1 = struct {
   168  	iVersion      int32
   169  	_             [4]byte
   170  	xCreate       uintptr
   171  	xConnect      uintptr
   172  	xBestIndex    uintptr
   173  	xDisconnect   uintptr
   174  	xDestroy      uintptr
   175  	xOpen         uintptr
   176  	xClose        uintptr
   177  	xFilter       uintptr
   178  	xNext         uintptr
   179  	xEof          uintptr
   180  	xColumn       uintptr
   181  	xRowid        uintptr
   182  	xUpdate       uintptr
   183  	xBegin        uintptr
   184  	xSync         uintptr
   185  	xCommit       uintptr
   186  	xRollback     uintptr
   187  	xFindFunction uintptr
   188  	xRename       uintptr
   189  	xSavepoint    uintptr
   190  	xRelease      uintptr
   191  	xRollbackTo   uintptr
   192  	xShadowName   uintptr
   193  }
   194  
   195  type sqlite3_module = sqlite3_module1
   196  
   197  type sqlite3_index_constraint = struct {
   198  	iColumn     int32
   199  	op          uint8
   200  	usable      uint8
   201  	_           [2]byte
   202  	iTermOffset int32
   203  }
   204  
   205  type sqlite3_index_orderby = struct {
   206  	iColumn int32
   207  	desc    uint8
   208  	_       [3]byte
   209  }
   210  
   211  type sqlite3_index_constraint_usage = struct {
   212  	argvIndex int32
   213  	omit      uint8
   214  	_         [3]byte
   215  }
   216  
   217  type sqlite3_mutex_methods1 = struct {
   218  	xMutexInit    uintptr
   219  	xMutexEnd     uintptr
   220  	xMutexAlloc   uintptr
   221  	xMutexFree    uintptr
   222  	xMutexEnter   uintptr
   223  	xMutexTry     uintptr
   224  	xMutexLeave   uintptr
   225  	xMutexHeld    uintptr
   226  	xMutexNotheld uintptr
   227  }
   228  
   229  type sqlite3_mutex_methods = sqlite3_mutex_methods1
   230  
   231  type sqlite3_pcache_page1 = struct {
   232  	pBuf   uintptr
   233  	pExtra uintptr
   234  }
   235  
   236  type sqlite3_pcache_page = sqlite3_pcache_page1
   237  
   238  type sqlite3_pcache_methods21 = struct {
   239  	iVersion   int32
   240  	_          [4]byte
   241  	pArg       uintptr
   242  	xInit      uintptr
   243  	xShutdown  uintptr
   244  	xCreate    uintptr
   245  	xCachesize uintptr
   246  	xPagecount uintptr
   247  	xFetch     uintptr
   248  	xUnpin     uintptr
   249  	xRekey     uintptr
   250  	xTruncate  uintptr
   251  	xDestroy   uintptr
   252  	xShrink    uintptr
   253  }
   254  
   255  type sqlite3_pcache_methods2 = sqlite3_pcache_methods21
   256  
   257  type sqlite3_pcache_methods1 = struct {
   258  	pArg       uintptr
   259  	xInit      uintptr
   260  	xShutdown  uintptr
   261  	xCreate    uintptr
   262  	xCachesize uintptr
   263  	xPagecount uintptr
   264  	xFetch     uintptr
   265  	xUnpin     uintptr
   266  	xRekey     uintptr
   267  	xTruncate  uintptr
   268  	xDestroy   uintptr
   269  }
   270  
   271  type sqlite3_pcache_methods = sqlite3_pcache_methods1
   272  
   273  type sqlite3_snapshot1 = struct{ hidden [48]uint8 }
   274  
   275  type sqlite3_snapshot = sqlite3_snapshot1
   276  
   277  type sqlite3_rtree_geometry1 = struct {
   278  	pContext uintptr
   279  	nParam   int32
   280  	_        [4]byte
   281  	aParam   uintptr
   282  	pUser    uintptr
   283  	xDelUser uintptr
   284  }
   285  
   286  type sqlite3_rtree_geometry = sqlite3_rtree_geometry1
   287  type sqlite3_rtree_query_info1 = struct {
   288  	pContext      uintptr
   289  	nParam        int32
   290  	_             [4]byte
   291  	aParam        uintptr
   292  	pUser         uintptr
   293  	xDelUser      uintptr
   294  	aCoord        uintptr
   295  	anQueue       uintptr
   296  	nCoord        int32
   297  	iLevel        int32
   298  	mxLevel       int32
   299  	_             [4]byte
   300  	iRowid        sqlite3_int64
   301  	rParentScore  sqlite3_rtree_dbl
   302  	eParentWithin int32
   303  	eWithin       int32
   304  	rScore        sqlite3_rtree_dbl
   305  	apSqlParam    uintptr
   306  }
   307  
   308  type sqlite3_rtree_query_info = sqlite3_rtree_query_info1
   309  
   310  type sqlite3_rtree_dbl = float64
   311  
   312  type Fts5ExtensionApi1 = struct {
   313  	iVersion           int32
   314  	_                  [4]byte
   315  	xUserData          uintptr
   316  	xColumnCount       uintptr
   317  	xRowCount          uintptr
   318  	xColumnTotalSize   uintptr
   319  	xTokenize          uintptr
   320  	xPhraseCount       uintptr
   321  	xPhraseSize        uintptr
   322  	xInstCount         uintptr
   323  	xInst              uintptr
   324  	xRowid             uintptr
   325  	xColumnText        uintptr
   326  	xColumnSize        uintptr
   327  	xQueryPhrase       uintptr
   328  	xSetAuxdata        uintptr
   329  	xGetAuxdata        uintptr
   330  	xPhraseFirst       uintptr
   331  	xPhraseNext        uintptr
   332  	xPhraseFirstColumn uintptr
   333  	xPhraseNextColumn  uintptr
   334  }
   335  
   336  type Fts5ExtensionApi = Fts5ExtensionApi1
   337  type Fts5PhraseIter1 = struct {
   338  	a uintptr
   339  	b uintptr
   340  }
   341  
   342  type Fts5PhraseIter = Fts5PhraseIter1
   343  
   344  type fts5_extension_function = uintptr
   345  type fts5_tokenizer1 = struct {
   346  	xCreate   uintptr
   347  	xDelete   uintptr
   348  	xTokenize uintptr
   349  }
   350  
   351  type fts5_tokenizer = fts5_tokenizer1
   352  
   353  type fts5_api1 = struct {
   354  	iVersion         int32
   355  	_                [4]byte
   356  	xCreateTokenizer uintptr
   357  	xFindTokenizer   uintptr
   358  	xCreateFunction  uintptr
   359  }
   360  
   361  type fts5_api = fts5_api1
   362  
   363  type __darwin_pthread_handler_rec = struct {
   364  	__routine uintptr
   365  	__arg     uintptr
   366  	__next    uintptr
   367  }
   368  
   369  type _opaque_pthread_attr_t = struct {
   370  	__sig    int64
   371  	__opaque [56]int8
   372  }
   373  
   374  type _opaque_pthread_cond_t = struct {
   375  	__sig    int64
   376  	__opaque [40]int8
   377  }
   378  
   379  type _opaque_pthread_condattr_t = struct {
   380  	__sig    int64
   381  	__opaque [8]int8
   382  }
   383  
   384  type _opaque_pthread_mutex_t = struct {
   385  	__sig    int64
   386  	__opaque [56]int8
   387  }
   388  
   389  type _opaque_pthread_mutexattr_t = struct {
   390  	__sig    int64
   391  	__opaque [8]int8
   392  }
   393  
   394  type _opaque_pthread_once_t = struct {
   395  	__sig    int64
   396  	__opaque [8]int8
   397  }
   398  
   399  type _opaque_pthread_rwlock_t = struct {
   400  	__sig    int64
   401  	__opaque [192]int8
   402  }
   403  
   404  type _opaque_pthread_rwlockattr_t = struct {
   405  	__sig    int64
   406  	__opaque [16]int8
   407  }
   408  
   409  type _opaque_pthread_t = struct {
   410  	__sig           int64
   411  	__cleanup_stack uintptr
   412  	__opaque        [8176]int8
   413  }
   414  
   415  type int8_t = int8
   416  
   417  type int16_t = int16
   418  
   419  type int32_t = int32
   420  
   421  type int64_t = int64
   422  
   423  type u_int8_t = uint8
   424  
   425  type u_int16_t = uint16
   426  
   427  type u_int32_t = uint32
   428  
   429  type u_int64_t = uint64
   430  
   431  type register_t = int64_t
   432  
   433  type intptr_t = int64
   434  
   435  type uintptr_t = uint64
   436  
   437  type user_addr_t = u_int64_t
   438  type user_size_t = u_int64_t
   439  type user_ssize_t = int64_t
   440  type user_long_t = int64_t
   441  type user_ulong_t = u_int64_t
   442  type user_time_t = int64_t
   443  type user_off_t = int64_t
   444  
   445  type syscall_arg_t = u_int64_t
   446  
   447  type rsize_t = uint64
   448  
   449  type errno_t = int32
   450  
   451  type ssize_t = int64
   452  type uint64_t = uint64
   453  
   454  type int_least64_t = int64_t
   455  type uint_least64_t = uint64_t
   456  type int_fast64_t = int64_t
   457  type uint_fast64_t = uint64_t
   458  
   459  type uint32_t = uint32
   460  
   461  type int_least32_t = int32_t
   462  type uint_least32_t = uint32_t
   463  type int_fast32_t = int32_t
   464  type uint_fast32_t = uint32_t
   465  type uint16_t = uint16
   466  
   467  type int_least16_t = int16_t
   468  type uint_least16_t = uint16_t
   469  type int_fast16_t = int16_t
   470  type uint_fast16_t = uint16_t
   471  type uint8_t = uint8
   472  
   473  type int_least8_t = int8_t
   474  type uint_least8_t = uint8_t
   475  type int_fast8_t = int8_t
   476  type uint_fast8_t = uint8_t
   477  
   478  type intmax_t = int64
   479  type uintmax_t = uint64
   480  
   481  func _OSSwapInt16(tls *libc.TLS, _data uint16_t) uint16_t {
   482  	return uint16_t(int32(_data)<<8 | int32(_data)>>8)
   483  }
   484  
   485  func _OSSwapInt32(tls *libc.TLS, _data uint32_t) uint32_t {
   486  	_data = libc.X__builtin_bswap32(tls, _data)
   487  
   488  	return _data
   489  }
   490  
   491  func _OSSwapInt64(tls *libc.TLS, _data uint64_t) uint64_t {
   492  	return libc.X__builtin_bswap64(tls, _data)
   493  }
   494  
   495  type _OSUnalignedU16 = struct{ __val uint16_t }
   496  
   497  type _OSUnalignedU32 = struct{ __val uint32_t }
   498  
   499  type _OSUnalignedU64 = struct{ __val uint64_t }
   500  
   501  type u_char = uint8
   502  
   503  type u_short = uint16
   504  
   505  type u_int = uint32
   506  type u_long = uint64
   507  type ushort = uint16
   508  type uint = uint32
   509  
   510  type u_quad_t = u_int64_t
   511  type quad_t = int64_t
   512  type qaddr_t = uintptr
   513  
   514  type caddr_t = uintptr
   515  
   516  type daddr_t = int32_t
   517  
   518  type dev_t = int32
   519  
   520  type fixpt_t = u_int32_t
   521  
   522  type blkcnt_t = int64
   523  
   524  type blksize_t = int32
   525  
   526  type gid_t = uint32
   527  
   528  type in_addr_t = uint32
   529  
   530  type in_port_t = uint16
   531  
   532  type ino_t = uint64
   533  
   534  type ino64_t = uint64
   535  
   536  type key_t = int32
   537  
   538  type mode_t = uint16
   539  
   540  type nlink_t = uint16
   541  
   542  type id_t = uint32
   543  
   544  type pid_t = int32
   545  
   546  type off_t = int64
   547  
   548  type segsz_t = int32_t
   549  type swblk_t = int32_t
   550  
   551  type uid_t = uint32
   552  
   553  type clock_t = uint64
   554  
   555  type time_t = int64
   556  
   557  type useconds_t = uint32
   558  
   559  type suseconds_t = int32
   560  
   561  type fd_set1 = struct{ fds_bits [32]int32 }
   562  
   563  type fd_set = fd_set1
   564  
   565  func X__darwin_check_fd_set(tls *libc.TLS, _a int32, _b uintptr) int32 {
   566  	if uintptr_t(uintptr(unsafe.Pointer(&X__darwin_check_fd_set_overflow))) != uint64(0) {
   567  		return (*struct {
   568  			f func(*libc.TLS, int32, uintptr, int32) int32
   569  		})(unsafe.Pointer(&struct{ uintptr }{X__darwin_check_fd_set_overflow})).f(tls, _a, _b, 0)
   570  	} else {
   571  		return 1
   572  	}
   573  	return int32(0)
   574  }
   575  
   576  func X__darwin_fd_isset(tls *libc.TLS, _fd int32, _p uintptr) int32 {
   577  	if X__darwin_check_fd_set(tls, _fd, _p) != 0 {
   578  		return *(*int32)(unsafe.Pointer(_p + uintptr(uint64(_fd)/(uint64(unsafe.Sizeof(int32(0)))*uint64(8)))*4)) & int32(uint64(1)<<(uint64(_fd)%(uint64(unsafe.Sizeof(int32(0)))*uint64(8))))
   579  	}
   580  
   581  	return 0
   582  }
   583  
   584  func X__darwin_fd_set(tls *libc.TLS, _fd int32, _p uintptr) {
   585  	if X__darwin_check_fd_set(tls, _fd, _p) != 0 {
   586  		*(*int32)(unsafe.Pointer(_p + uintptr(uint64(_fd)/(uint64(unsafe.Sizeof(int32(0)))*uint64(8)))*4)) |= int32(uint64(1) << (uint64(_fd) % (uint64(unsafe.Sizeof(int32(0))) * uint64(8))))
   587  	}
   588  }
   589  
   590  func X__darwin_fd_clr(tls *libc.TLS, _fd int32, _p uintptr) {
   591  	if X__darwin_check_fd_set(tls, _fd, _p) != 0 {
   592  		*(*int32)(unsafe.Pointer(_p + uintptr(uint64(_fd)/(uint64(unsafe.Sizeof(int32(0)))*uint64(8)))*4)) &= ^int32(uint64(1) << (uint64(_fd) % (uint64(unsafe.Sizeof(int32(0))) * uint64(8))))
   593  	}
   594  }
   595  
   596  type fd_mask = int32
   597  
   598  type pthread_attr_t = _opaque_pthread_attr_t
   599  
   600  type pthread_cond_t = _opaque_pthread_cond_t
   601  
   602  type pthread_condattr_t = _opaque_pthread_condattr_t
   603  
   604  type pthread_mutex_t = _opaque_pthread_mutex_t
   605  
   606  type pthread_mutexattr_t = _opaque_pthread_mutexattr_t
   607  
   608  type pthread_once_t = _opaque_pthread_once_t
   609  
   610  type pthread_rwlock_t = _opaque_pthread_rwlock_t
   611  
   612  type pthread_rwlockattr_t = _opaque_pthread_rwlockattr_t
   613  
   614  type pthread_t = uintptr
   615  
   616  type pthread_key_t = uint64
   617  
   618  type fsblkcnt_t = uint32
   619  
   620  type fsfilcnt_t = uint32
   621  
   622  type timespec = struct {
   623  	tv_sec  int64
   624  	tv_nsec int64
   625  }
   626  
   627  type ostat = struct {
   628  	st_dev       uint16
   629  	_            [6]byte
   630  	st_ino       ino_t
   631  	st_mode      mode_t
   632  	st_nlink     nlink_t
   633  	st_uid       uint16
   634  	st_gid       uint16
   635  	st_rdev      uint16
   636  	_            [2]byte
   637  	st_size      int32
   638  	st_atimespec struct {
   639  		tv_sec  int64
   640  		tv_nsec int64
   641  	}
   642  	st_mtimespec struct {
   643  		tv_sec  int64
   644  		tv_nsec int64
   645  	}
   646  	st_ctimespec struct {
   647  		tv_sec  int64
   648  		tv_nsec int64
   649  	}
   650  	st_blksize int32
   651  	st_blocks  int32
   652  	st_flags   uint32
   653  	st_gen     uint32
   654  }
   655  
   656  type stat = struct {
   657  	st_dev       dev_t
   658  	st_mode      mode_t
   659  	st_nlink     nlink_t
   660  	st_ino       uint64
   661  	st_uid       uid_t
   662  	st_gid       gid_t
   663  	st_rdev      dev_t
   664  	_            [4]byte
   665  	st_atimespec struct {
   666  		tv_sec  int64
   667  		tv_nsec int64
   668  	}
   669  	st_mtimespec struct {
   670  		tv_sec  int64
   671  		tv_nsec int64
   672  	}
   673  	st_ctimespec struct {
   674  		tv_sec  int64
   675  		tv_nsec int64
   676  	}
   677  	st_birthtimespec struct {
   678  		tv_sec  int64
   679  		tv_nsec int64
   680  	}
   681  	st_size    off_t
   682  	st_blocks  blkcnt_t
   683  	st_blksize blksize_t
   684  	st_flags   uint32
   685  	st_gen     uint32
   686  	st_lspare  int32
   687  	st_qspare  [2]int64
   688  }
   689  
   690  type filesec_t = uintptr
   691  
   692  type flock = struct {
   693  	l_start  off_t
   694  	l_len    off_t
   695  	l_pid    pid_t
   696  	l_type   int16
   697  	l_whence int16
   698  }
   699  
   700  type flocktimeout = struct {
   701  	fl struct {
   702  		l_start  off_t
   703  		l_len    off_t
   704  		l_pid    pid_t
   705  		l_type   int16
   706  		l_whence int16
   707  	}
   708  	timeout struct {
   709  		tv_sec  int64
   710  		tv_nsec int64
   711  	}
   712  }
   713  
   714  type radvisory = struct {
   715  	ra_offset off_t
   716  	ra_count  int32
   717  	_         [4]byte
   718  }
   719  
   720  type fsignatures = struct {
   721  	fs_file_start       off_t
   722  	fs_blob_start       uintptr
   723  	fs_blob_size        size_t
   724  	fs_fsignatures_size size_t
   725  	fs_cdhash           [20]int8
   726  	fs_hash_type        int32
   727  }
   728  
   729  type fsignatures_t = fsignatures
   730  
   731  type fsupplement = struct {
   732  	fs_file_start off_t
   733  	fs_blob_start off_t
   734  	fs_blob_size  size_t
   735  	fs_orig_fd    int32
   736  	_             [4]byte
   737  }
   738  
   739  type fsupplement_t = fsupplement
   740  
   741  type fchecklv = struct {
   742  	lv_file_start         off_t
   743  	lv_error_message_size size_t
   744  	lv_error_message      uintptr
   745  }
   746  
   747  type fchecklv_t = fchecklv
   748  
   749  type fgetsigsinfo = struct {
   750  	fg_file_start      off_t
   751  	fg_info_request    int32
   752  	fg_sig_is_platform int32
   753  }
   754  
   755  type fgetsigsinfo_t = fgetsigsinfo
   756  
   757  type fstore = struct {
   758  	fst_flags      uint32
   759  	fst_posmode    int32
   760  	fst_offset     off_t
   761  	fst_length     off_t
   762  	fst_bytesalloc off_t
   763  }
   764  
   765  type fstore_t = fstore
   766  
   767  type fpunchhole = struct {
   768  	fp_flags  uint32
   769  	reserved  uint32
   770  	fp_offset off_t
   771  	fp_length off_t
   772  }
   773  
   774  type fpunchhole_t = fpunchhole
   775  
   776  type ftrimactivefile = struct {
   777  	fta_offset off_t
   778  	fta_length off_t
   779  }
   780  
   781  type ftrimactivefile_t = ftrimactivefile
   782  
   783  type fspecread = struct {
   784  	fsr_flags  uint32
   785  	reserved   uint32
   786  	fsr_offset off_t
   787  	fsr_length off_t
   788  }
   789  
   790  type fspecread_t = fspecread
   791  
   792  type fbootstraptransfer = struct {
   793  	fbt_offset off_t
   794  	fbt_length size_t
   795  	fbt_buffer uintptr
   796  }
   797  
   798  type fbootstraptransfer_t = fbootstraptransfer
   799  
   800  type log2phys = struct {
   801  	l2p_flags       uint32
   802  	_               [4]byte
   803  	l2p_contigbytes off_t
   804  	l2p_devoffset   off_t
   805  }
   806  
   807  type filesec_property_t = uint32
   808  
   809  type accessx_descriptor = struct {
   810  	ad_name_offset uint32
   811  	ad_flags       int32
   812  	ad_pad         [2]int32
   813  }
   814  
   815  type kauth_cred_t = uintptr
   816  type posix_cred_t = uintptr
   817  
   818  type sig_atomic_t = int32
   819  
   820  type __darwin_arm_exception_state = struct {
   821  	__exception uint32
   822  	__fsr       uint32
   823  	__far       uint32
   824  }
   825  
   826  type __darwin_arm_exception_state64 = struct {
   827  	__far       uint64
   828  	__esr       uint32
   829  	__exception uint32
   830  }
   831  
   832  type __darwin_arm_thread_state = struct {
   833  	__r    [13]uint32
   834  	__sp   uint32
   835  	__lr   uint32
   836  	__pc   uint32
   837  	__cpsr uint32
   838  }
   839  
   840  type __darwin_arm_thread_state64 = struct {
   841  	__x    [29]uint64
   842  	__fp   uint64
   843  	__lr   uint64
   844  	__sp   uint64
   845  	__pc   uint64
   846  	__cpsr uint32
   847  	__pad  uint32
   848  }
   849  
   850  type __darwin_arm_vfp_state = struct {
   851  	__r     [64]uint32
   852  	__fpscr uint32
   853  }
   854  
   855  type __darwin_arm_neon_state64 = struct {
   856  	__v [32]struct {
   857  		lo uint64
   858  		hi uint64
   859  	}
   860  	__fpsr uint32
   861  	__fpcr uint32
   862  }
   863  
   864  type __darwin_arm_neon_state = struct {
   865  	__v [16]struct {
   866  		lo uint64
   867  		hi uint64
   868  	}
   869  	__fpsr uint32
   870  	__fpcr uint32
   871  }
   872  
   873  type __arm_pagein_state = struct{ __pagein_error int32 }
   874  
   875  type __arm_legacy_debug_state = struct {
   876  	__bvr [16]uint32
   877  	__bcr [16]uint32
   878  	__wvr [16]uint32
   879  	__wcr [16]uint32
   880  }
   881  
   882  type __darwin_arm_debug_state32 = struct {
   883  	__bvr       [16]uint32
   884  	__bcr       [16]uint32
   885  	__wvr       [16]uint32
   886  	__wcr       [16]uint32
   887  	__mdscr_el1 uint64
   888  }
   889  
   890  type __darwin_arm_debug_state64 = struct {
   891  	__bvr       [16]uint64
   892  	__bcr       [16]uint64
   893  	__wvr       [16]uint64
   894  	__wcr       [16]uint64
   895  	__mdscr_el1 uint64
   896  }
   897  
   898  type __darwin_arm_cpmu_state64 = struct{ __ctrs [16]uint64 }
   899  
   900  type __darwin_mcontext32 = struct {
   901  	__es struct {
   902  		__exception uint32
   903  		__fsr       uint32
   904  		__far       uint32
   905  	}
   906  	__ss struct {
   907  		__r    [13]uint32
   908  		__sp   uint32
   909  		__lr   uint32
   910  		__pc   uint32
   911  		__cpsr uint32
   912  	}
   913  	__fs struct {
   914  		__r     [64]uint32
   915  		__fpscr uint32
   916  	}
   917  }
   918  
   919  type __darwin_mcontext64 = struct {
   920  	__es struct {
   921  		__far       uint64
   922  		__esr       uint32
   923  		__exception uint32
   924  	}
   925  	__ss struct {
   926  		__x    [29]uint64
   927  		__fp   uint64
   928  		__lr   uint64
   929  		__sp   uint64
   930  		__pc   uint64
   931  		__cpsr uint32
   932  		__pad  uint32
   933  	}
   934  	__ns struct {
   935  		__v [32]struct {
   936  			lo uint64
   937  			hi uint64
   938  		}
   939  		__fpsr uint32
   940  		__fpcr uint32
   941  	}
   942  }
   943  
   944  type mcontext_t = uintptr
   945  
   946  type __darwin_sigaltstack = struct {
   947  	ss_sp    uintptr
   948  	ss_size  uint64
   949  	ss_flags int32
   950  	_        [4]byte
   951  }
   952  
   953  type stack_t = __darwin_sigaltstack
   954  
   955  type __darwin_ucontext = struct {
   956  	uc_onstack int32
   957  	uc_sigmask uint32
   958  	uc_stack   struct {
   959  		ss_sp    uintptr
   960  		ss_size  uint64
   961  		ss_flags int32
   962  		_        [4]byte
   963  	}
   964  	uc_link     uintptr
   965  	uc_mcsize   uint64
   966  	uc_mcontext uintptr
   967  }
   968  
   969  type ucontext_t = __darwin_ucontext
   970  
   971  type sigset_t = uint32
   972  
   973  type sigval = struct {
   974  	_         [0]uint64
   975  	sival_int int32
   976  	_         [4]byte
   977  }
   978  
   979  type sigevent = struct {
   980  	sigev_notify int32
   981  	sigev_signo  int32
   982  	sigev_value  struct {
   983  		_         [0]uint64
   984  		sival_int int32
   985  		_         [4]byte
   986  	}
   987  	sigev_notify_function   uintptr
   988  	sigev_notify_attributes uintptr
   989  }
   990  
   991  type __siginfo = struct {
   992  	si_signo  int32
   993  	si_errno  int32
   994  	si_code   int32
   995  	si_pid    pid_t
   996  	si_uid    uid_t
   997  	si_status int32
   998  	si_addr   uintptr
   999  	si_value  struct {
  1000  		_         [0]uint64
  1001  		sival_int int32
  1002  		_         [4]byte
  1003  	}
  1004  	si_band int64
  1005  	__pad   [7]uint64
  1006  }
  1007  
  1008  type siginfo_t = __siginfo
  1009  
  1010  type __sigaction_u = struct{ __sa_handler uintptr }
  1011  
  1012  type __sigaction = struct {
  1013  	__sigaction_u struct{ __sa_handler uintptr }
  1014  	sa_tramp      uintptr
  1015  	sa_mask       sigset_t
  1016  	sa_flags      int32
  1017  }
  1018  
  1019  type sigaction = struct {
  1020  	__sigaction_u struct{ __sa_handler uintptr }
  1021  	sa_mask       sigset_t
  1022  	sa_flags      int32
  1023  }
  1024  
  1025  type sig_t = uintptr
  1026  
  1027  type sigvec = struct {
  1028  	sv_handler uintptr
  1029  	sv_mask    int32
  1030  	sv_flags   int32
  1031  }
  1032  
  1033  type sigstack = struct {
  1034  	ss_sp      uintptr
  1035  	ss_onstack int32
  1036  	_          [4]byte
  1037  }
  1038  
  1039  type timeval = struct {
  1040  	tv_sec  int64
  1041  	tv_usec int32
  1042  	_       [4]byte
  1043  }
  1044  
  1045  type uuid_t = [16]uint8
  1046  
  1047  type tm = struct {
  1048  	tm_sec    int32
  1049  	tm_min    int32
  1050  	tm_hour   int32
  1051  	tm_mday   int32
  1052  	tm_mon    int32
  1053  	tm_year   int32
  1054  	tm_wday   int32
  1055  	tm_yday   int32
  1056  	tm_isdst  int32
  1057  	_         [4]byte
  1058  	tm_gmtoff int64
  1059  	tm_zone   uintptr
  1060  }
  1061  
  1062  type clockid_t = uint32
  1063  
  1064  type VFSFile1 = struct {
  1065  	base        sqlite3_file
  1066  	fsFile      uintptr
  1067  	fd          int32
  1068  	_           [4]byte
  1069  	aBuffer     uintptr
  1070  	nBuffer     int32
  1071  	_           [4]byte
  1072  	iBufferOfst sqlite3_int64
  1073  }
  1074  
  1075  type VFSFile = VFSFile1
  1076  
  1077  func vfsDirectWrite(tls *libc.TLS, p uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 {
  1078  	bp := tls.Alloc(16)
  1079  	defer tls.Free(16)
  1080  
  1081  	var ofst off_t
  1082  	var nWrite size_t
  1083  
  1084  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__)), 178))
  1085  	libc.X__builtin_abort(tls)
  1086  	ofst = libc.Xlseek(tls, (*VFSFile)(unsafe.Pointer(p)).fd, iOfst, 0)
  1087  	if ofst != iOfst {
  1088  		return 10 | int32(3)<<8
  1089  	}
  1090  
  1091  	nWrite = size_t(libc.Xwrite(tls, (*VFSFile)(unsafe.Pointer(p)).fd, zBuf, uint64(iAmt)))
  1092  	if nWrite != size_t(iAmt) {
  1093  		return 10 | int32(3)<<8
  1094  	}
  1095  
  1096  	return 0
  1097  }
  1098  
  1099  var __func__ = *(*[15]int8)(unsafe.Pointer(ts + 13))
  1100  
  1101  func vfsFlushBuffer(tls *libc.TLS, p uintptr) int32 {
  1102  	bp := tls.Alloc(16)
  1103  	defer tls.Free(16)
  1104  
  1105  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__1)), 198))
  1106  	libc.X__builtin_abort(tls)
  1107  	var rc int32 = 0
  1108  	if (*VFSFile)(unsafe.Pointer(p)).nBuffer != 0 {
  1109  		rc = vfsDirectWrite(tls, p, (*VFSFile)(unsafe.Pointer(p)).aBuffer, (*VFSFile)(unsafe.Pointer(p)).nBuffer, (*VFSFile)(unsafe.Pointer(p)).iBufferOfst)
  1110  		(*VFSFile)(unsafe.Pointer(p)).nBuffer = 0
  1111  	}
  1112  	return rc
  1113  }
  1114  
  1115  var __func__1 = *(*[15]int8)(unsafe.Pointer(ts + 28))
  1116  
  1117  func vfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 {
  1118  	bp := tls.Alloc(16)
  1119  	defer tls.Free(16)
  1120  
  1121  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__4)), 273))
  1122  	libc.X__builtin_abort(tls)
  1123  	var p uintptr = pFile
  1124  
  1125  	if (*VFSFile)(unsafe.Pointer(p)).aBuffer != 0 {
  1126  		var z uintptr = zBuf
  1127  		var n int32 = iAmt
  1128  		var i sqlite3_int64 = iOfst
  1129  
  1130  		for n > 0 {
  1131  			var nCopy int32
  1132  
  1133  			if (*VFSFile)(unsafe.Pointer(p)).nBuffer == 8192 || (*VFSFile)(unsafe.Pointer(p)).iBufferOfst+sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer) != i {
  1134  				var rc int32 = vfsFlushBuffer(tls, p)
  1135  				if rc != 0 {
  1136  					return rc
  1137  				}
  1138  			}
  1139  			if libc.X__builtin_expect(tls, libc.BoolInt64(!((*VFSFile)(unsafe.Pointer(p)).nBuffer == 0 || (*VFSFile)(unsafe.Pointer(p)).iBufferOfst+sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer) == i)), int64(0)) != 0 {
  1140  				libc.X__assert_rtn(tls, uintptr(unsafe.Pointer(&__func__4)), ts+43, 294, ts+51)
  1141  			} else {
  1142  			}
  1143  			(*VFSFile)(unsafe.Pointer(p)).iBufferOfst = i - sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer)
  1144  
  1145  			nCopy = 8192 - (*VFSFile)(unsafe.Pointer(p)).nBuffer
  1146  			if nCopy > n {
  1147  				nCopy = n
  1148  			}
  1149  			libc.X__builtin___memcpy_chk(tls, (*VFSFile)(unsafe.Pointer(p)).aBuffer+uintptr((*VFSFile)(unsafe.Pointer(p)).nBuffer), z, uint64(nCopy), libc.X__builtin_object_size(tls, (*VFSFile)(unsafe.Pointer(p)).aBuffer+uintptr((*VFSFile)(unsafe.Pointer(p)).nBuffer), 0))
  1150  			*(*int32)(unsafe.Pointer(p + 32)) += nCopy
  1151  
  1152  			n = n - nCopy
  1153  			i = i + sqlite3_int64(nCopy)
  1154  			z += uintptr(nCopy)
  1155  		}
  1156  	} else {
  1157  		return vfsDirectWrite(tls, p, zBuf, iAmt, iOfst)
  1158  	}
  1159  
  1160  	return 0
  1161  }
  1162  
  1163  var __func__4 = *(*[9]int8)(unsafe.Pointer(ts + 97))
  1164  
  1165  func vfsTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 {
  1166  	return 0
  1167  }
  1168  
  1169  func vfsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 {
  1170  	bp := tls.Alloc(16)
  1171  	defer tls.Free(16)
  1172  
  1173  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__5)), 331))
  1174  	libc.X__builtin_abort(tls)
  1175  	var p uintptr = pFile
  1176  	var rc int32
  1177  
  1178  	rc = vfsFlushBuffer(tls, p)
  1179  	if rc != 0 {
  1180  		return rc
  1181  	}
  1182  
  1183  	rc = libc.Xfsync(tls, (*VFSFile)(unsafe.Pointer(p)).fd)
  1184  	return func() int32 {
  1185  		if rc == 0 {
  1186  			return 0
  1187  		}
  1188  		return 10 | int32(4)<<8
  1189  	}()
  1190  }
  1191  
  1192  var __func__5 = *(*[8]int8)(unsafe.Pointer(ts + 106))
  1193  
  1194  func vfsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 {
  1195  	return 0
  1196  }
  1197  
  1198  func vfsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 {
  1199  	return 0
  1200  }
  1201  
  1202  func vfsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 {
  1203  	*(*int32)(unsafe.Pointer(pResOut)) = 0
  1204  	return 0
  1205  }
  1206  
  1207  func vfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 {
  1208  	return 12
  1209  }
  1210  
  1211  func vfsSectorSize(tls *libc.TLS, pFile uintptr) int32 {
  1212  	return 0
  1213  }
  1214  
  1215  func vfsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 {
  1216  	return 0
  1217  }
  1218  
  1219  func vfsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 {
  1220  	bp := tls.Alloc(4129)
  1221  	defer tls.Free(4129)
  1222  
  1223  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__8)), 473))
  1224  	libc.X__builtin_abort(tls)
  1225  	var rc int32
  1226  
  1227  	rc = libc.Xunlink(tls, zPath)
  1228  	if rc != 0 && *(*int32)(unsafe.Pointer(libc.X__error(tls))) == 2 {
  1229  		return 0
  1230  	}
  1231  
  1232  	if rc == 0 && dirSync != 0 {
  1233  		var dfd int32
  1234  		var i int32
  1235  
  1236  		sqlite3.Xsqlite3_snprintf(tls, 4096, bp+32, ts+114, libc.VaList(bp+16, zPath))
  1237  		*(*int8)(unsafe.Pointer(bp + 32 + 4096)) = int8(0)
  1238  		for i = int32(libc.Xstrlen(tls, bp+32)); i > 1 && int32(*(*int8)(unsafe.Pointer(bp + 32 + uintptr(i)))) != '/'; i++ {
  1239  		}
  1240  		*(*int8)(unsafe.Pointer(bp + 32 + uintptr(i))) = int8(0)
  1241  
  1242  		dfd = libc.Xopen(tls, bp+32, 0x0000, libc.VaList(bp+24, 0))
  1243  		if dfd < 0 {
  1244  			rc = -1
  1245  		} else {
  1246  			rc = libc.Xfsync(tls, dfd)
  1247  			libc.Xclose(tls, dfd)
  1248  		}
  1249  	}
  1250  	return func() int32 {
  1251  		if rc == 0 {
  1252  			return 0
  1253  		}
  1254  		return 10 | int32(10)<<8
  1255  	}()
  1256  }
  1257  
  1258  var __func__8 = *(*[10]int8)(unsafe.Pointer(ts + 117))
  1259  
  1260  func vfsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr {
  1261  	return uintptr(0)
  1262  }
  1263  
  1264  func vfsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) {
  1265  	sqlite3.Xsqlite3_snprintf(tls, nByte, zErrMsg, ts+127, 0)
  1266  	*(*int8)(unsafe.Pointer(zErrMsg + uintptr(nByte-1))) = int8(0)
  1267  }
  1268  
  1269  func vfsDlSym(tls *libc.TLS, pVfs uintptr, pH uintptr, z uintptr) uintptr {
  1270  	return uintptr(0)
  1271  }
  1272  
  1273  func vfsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) {
  1274  	return
  1275  }
  1276  
  1277  func vfsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zByte uintptr) int32 {
  1278  	return 0
  1279  }
  1280  
  1281  func vfsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 {
  1282  	libc.Xsleep(tls, uint32(nMicro/1000000))
  1283  	libc.Xusleep(tls, uint32(nMicro%1000000))
  1284  	return nMicro
  1285  }
  1286  
  1287  func vfsCurrentTime(tls *libc.TLS, pVfs uintptr, pTime uintptr) int32 {
  1288  	var t time_t = libc.Xtime(tls, uintptr(0))
  1289  	*(*float64)(unsafe.Pointer(pTime)) = float64(t)/86400.0 + 2440587.5
  1290  	return 0
  1291  }
  1292  
  1293  func Xsqlite3_fsFS(tls *libc.TLS, zName uintptr, pAppData uintptr) uintptr {
  1294  	var p uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vfs{})))
  1295  	if !(p != 0) {
  1296  		return uintptr(0)
  1297  	}
  1298  
  1299  	*(*sqlite3_vfs)(unsafe.Pointer(p)) = sqlite3_vfs{
  1300  		iVersion:   1,
  1301  		szOsFile:   int32(unsafe.Sizeof(VFSFile{})),
  1302  		mxPathname: 4096,
  1303  		zName:      zName,
  1304  		pAppData:   pAppData,
  1305  		xOpen: *(*uintptr)(unsafe.Pointer(&struct {
  1306  			f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
  1307  		}{vfsOpen})),
  1308  		xDelete: *(*uintptr)(unsafe.Pointer(&struct {
  1309  			f func(*libc.TLS, uintptr, uintptr, int32) int32
  1310  		}{vfsDelete})),
  1311  		xAccess: *(*uintptr)(unsafe.Pointer(&struct {
  1312  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
  1313  		}{vfsAccess})),
  1314  		xFullPathname: *(*uintptr)(unsafe.Pointer(&struct {
  1315  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
  1316  		}{vfsFullPathname})),
  1317  		xDlOpen: *(*uintptr)(unsafe.Pointer(&struct {
  1318  			f func(*libc.TLS, uintptr, uintptr) uintptr
  1319  		}{vfsDlOpen})),
  1320  		xDlError: *(*uintptr)(unsafe.Pointer(&struct {
  1321  			f func(*libc.TLS, uintptr, int32, uintptr)
  1322  		}{vfsDlError})),
  1323  		xDlSym: *(*uintptr)(unsafe.Pointer(&struct {
  1324  			f func(*libc.TLS, uintptr, uintptr, uintptr) uintptr
  1325  		}{vfsDlSym})),
  1326  		xDlClose: *(*uintptr)(unsafe.Pointer(&struct {
  1327  			f func(*libc.TLS, uintptr, uintptr)
  1328  		}{vfsDlClose})),
  1329  		xRandomness: *(*uintptr)(unsafe.Pointer(&struct {
  1330  			f func(*libc.TLS, uintptr, int32, uintptr) int32
  1331  		}{vfsRandomness})),
  1332  		xSleep: *(*uintptr)(unsafe.Pointer(&struct {
  1333  			f func(*libc.TLS, uintptr, int32) int32
  1334  		}{vfsSleep})),
  1335  		xCurrentTime: *(*uintptr)(unsafe.Pointer(&struct {
  1336  			f func(*libc.TLS, uintptr, uintptr) int32
  1337  		}{vfsCurrentTime}))}
  1338  	return p
  1339  }
  1340  
  1341  var ts1 = "TODO %s:%i:\n\x00vfsDirectWrite\x00vfsFlushBuffer\x00c/vfs.c\x00p->nBuffer==0 || p->iBufferOfst+p->nBuffer==i\x00vfsWrite\x00vfsSync\x00%s\x00vfsDelete\x00Loadable extensions are not supported\x00"
  1342  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data