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

     1  // Code generated by 'ccgo -o vfs_freebsd_amd64.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  type ptrdiff_t = int64
    24  
    25  type size_t = uint64
    26  
    27  type wchar_t = int32
    28  
    29  type va_list = uintptr
    30  
    31  type sqlite_int64 = int64
    32  type sqlite_uint64 = uint64
    33  type sqlite3_int64 = sqlite_int64
    34  type sqlite3_uint64 = sqlite_uint64
    35  
    36  type sqlite3_callback = uintptr
    37  
    38  type sqlite3_file1 = struct{ pMethods uintptr }
    39  
    40  type sqlite3_file = sqlite3_file1
    41  type sqlite3_io_methods1 = struct {
    42  	iVersion               int32
    43  	_                      [4]byte
    44  	xClose                 uintptr
    45  	xRead                  uintptr
    46  	xWrite                 uintptr
    47  	xTruncate              uintptr
    48  	xSync                  uintptr
    49  	xFileSize              uintptr
    50  	xLock                  uintptr
    51  	xUnlock                uintptr
    52  	xCheckReservedLock     uintptr
    53  	xFileControl           uintptr
    54  	xSectorSize            uintptr
    55  	xDeviceCharacteristics uintptr
    56  	xShmMap                uintptr
    57  	xShmLock               uintptr
    58  	xShmBarrier            uintptr
    59  	xShmUnmap              uintptr
    60  	xFetch                 uintptr
    61  	xUnfetch               uintptr
    62  }
    63  
    64  type sqlite3_io_methods = sqlite3_io_methods1
    65  
    66  type sqlite3_vfs1 = struct {
    67  	iVersion          int32
    68  	szOsFile          int32
    69  	mxPathname        int32
    70  	_                 [4]byte
    71  	pNext             uintptr
    72  	zName             uintptr
    73  	pAppData          uintptr
    74  	xOpen             uintptr
    75  	xDelete           uintptr
    76  	xAccess           uintptr
    77  	xFullPathname     uintptr
    78  	xDlOpen           uintptr
    79  	xDlError          uintptr
    80  	xDlSym            uintptr
    81  	xDlClose          uintptr
    82  	xRandomness       uintptr
    83  	xSleep            uintptr
    84  	xCurrentTime      uintptr
    85  	xGetLastError     uintptr
    86  	xCurrentTimeInt64 uintptr
    87  	xSetSystemCall    uintptr
    88  	xGetSystemCall    uintptr
    89  	xNextSystemCall   uintptr
    90  }
    91  
    92  type sqlite3_vfs = sqlite3_vfs1
    93  type sqlite3_syscall_ptr = uintptr
    94  
    95  type sqlite3_mem_methods1 = struct {
    96  	xMalloc   uintptr
    97  	xFree     uintptr
    98  	xRealloc  uintptr
    99  	xSize     uintptr
   100  	xRoundup  uintptr
   101  	xInit     uintptr
   102  	xShutdown uintptr
   103  	pAppData  uintptr
   104  }
   105  
   106  type sqlite3_mem_methods = sqlite3_mem_methods1
   107  
   108  type sqlite3_destructor_type = uintptr
   109  
   110  type sqlite3_vtab1 = struct {
   111  	pModule uintptr
   112  	nRef    int32
   113  	_       [4]byte
   114  	zErrMsg uintptr
   115  }
   116  
   117  type sqlite3_vtab = sqlite3_vtab1
   118  type sqlite3_index_info1 = struct {
   119  	nConstraint      int32
   120  	_                [4]byte
   121  	aConstraint      uintptr
   122  	nOrderBy         int32
   123  	_                [4]byte
   124  	aOrderBy         uintptr
   125  	aConstraintUsage uintptr
   126  	idxNum           int32
   127  	_                [4]byte
   128  	idxStr           uintptr
   129  	needToFreeIdxStr int32
   130  	orderByConsumed  int32
   131  	estimatedCost    float64
   132  	estimatedRows    sqlite3_int64
   133  	idxFlags         int32
   134  	_                [4]byte
   135  	colUsed          sqlite3_uint64
   136  }
   137  
   138  type sqlite3_index_info = sqlite3_index_info1
   139  type sqlite3_vtab_cursor1 = struct{ pVtab uintptr }
   140  
   141  type sqlite3_vtab_cursor = sqlite3_vtab_cursor1
   142  type sqlite3_module1 = struct {
   143  	iVersion      int32
   144  	_             [4]byte
   145  	xCreate       uintptr
   146  	xConnect      uintptr
   147  	xBestIndex    uintptr
   148  	xDisconnect   uintptr
   149  	xDestroy      uintptr
   150  	xOpen         uintptr
   151  	xClose        uintptr
   152  	xFilter       uintptr
   153  	xNext         uintptr
   154  	xEof          uintptr
   155  	xColumn       uintptr
   156  	xRowid        uintptr
   157  	xUpdate       uintptr
   158  	xBegin        uintptr
   159  	xSync         uintptr
   160  	xCommit       uintptr
   161  	xRollback     uintptr
   162  	xFindFunction uintptr
   163  	xRename       uintptr
   164  	xSavepoint    uintptr
   165  	xRelease      uintptr
   166  	xRollbackTo   uintptr
   167  	xShadowName   uintptr
   168  }
   169  
   170  type sqlite3_module = sqlite3_module1
   171  
   172  type sqlite3_index_constraint = struct {
   173  	iColumn     int32
   174  	op          uint8
   175  	usable      uint8
   176  	_           [2]byte
   177  	iTermOffset int32
   178  }
   179  
   180  type sqlite3_index_orderby = struct {
   181  	iColumn int32
   182  	desc    uint8
   183  	_       [3]byte
   184  }
   185  
   186  type sqlite3_index_constraint_usage = struct {
   187  	argvIndex int32
   188  	omit      uint8
   189  	_         [3]byte
   190  }
   191  
   192  type sqlite3_mutex_methods1 = struct {
   193  	xMutexInit    uintptr
   194  	xMutexEnd     uintptr
   195  	xMutexAlloc   uintptr
   196  	xMutexFree    uintptr
   197  	xMutexEnter   uintptr
   198  	xMutexTry     uintptr
   199  	xMutexLeave   uintptr
   200  	xMutexHeld    uintptr
   201  	xMutexNotheld uintptr
   202  }
   203  
   204  type sqlite3_mutex_methods = sqlite3_mutex_methods1
   205  
   206  type sqlite3_pcache_page1 = struct {
   207  	pBuf   uintptr
   208  	pExtra uintptr
   209  }
   210  
   211  type sqlite3_pcache_page = sqlite3_pcache_page1
   212  
   213  type sqlite3_pcache_methods21 = struct {
   214  	iVersion   int32
   215  	_          [4]byte
   216  	pArg       uintptr
   217  	xInit      uintptr
   218  	xShutdown  uintptr
   219  	xCreate    uintptr
   220  	xCachesize uintptr
   221  	xPagecount uintptr
   222  	xFetch     uintptr
   223  	xUnpin     uintptr
   224  	xRekey     uintptr
   225  	xTruncate  uintptr
   226  	xDestroy   uintptr
   227  	xShrink    uintptr
   228  }
   229  
   230  type sqlite3_pcache_methods2 = sqlite3_pcache_methods21
   231  
   232  type sqlite3_pcache_methods1 = struct {
   233  	pArg       uintptr
   234  	xInit      uintptr
   235  	xShutdown  uintptr
   236  	xCreate    uintptr
   237  	xCachesize uintptr
   238  	xPagecount uintptr
   239  	xFetch     uintptr
   240  	xUnpin     uintptr
   241  	xRekey     uintptr
   242  	xTruncate  uintptr
   243  	xDestroy   uintptr
   244  }
   245  
   246  type sqlite3_pcache_methods = sqlite3_pcache_methods1
   247  
   248  type sqlite3_snapshot1 = struct{ hidden [48]uint8 }
   249  
   250  type sqlite3_snapshot = sqlite3_snapshot1
   251  
   252  type sqlite3_rtree_geometry1 = struct {
   253  	pContext uintptr
   254  	nParam   int32
   255  	_        [4]byte
   256  	aParam   uintptr
   257  	pUser    uintptr
   258  	xDelUser uintptr
   259  }
   260  
   261  type sqlite3_rtree_geometry = sqlite3_rtree_geometry1
   262  type sqlite3_rtree_query_info1 = struct {
   263  	pContext      uintptr
   264  	nParam        int32
   265  	_             [4]byte
   266  	aParam        uintptr
   267  	pUser         uintptr
   268  	xDelUser      uintptr
   269  	aCoord        uintptr
   270  	anQueue       uintptr
   271  	nCoord        int32
   272  	iLevel        int32
   273  	mxLevel       int32
   274  	_             [4]byte
   275  	iRowid        sqlite3_int64
   276  	rParentScore  sqlite3_rtree_dbl
   277  	eParentWithin int32
   278  	eWithin       int32
   279  	rScore        sqlite3_rtree_dbl
   280  	apSqlParam    uintptr
   281  }
   282  
   283  type sqlite3_rtree_query_info = sqlite3_rtree_query_info1
   284  
   285  type sqlite3_rtree_dbl = float64
   286  
   287  type Fts5ExtensionApi1 = struct {
   288  	iVersion           int32
   289  	_                  [4]byte
   290  	xUserData          uintptr
   291  	xColumnCount       uintptr
   292  	xRowCount          uintptr
   293  	xColumnTotalSize   uintptr
   294  	xTokenize          uintptr
   295  	xPhraseCount       uintptr
   296  	xPhraseSize        uintptr
   297  	xInstCount         uintptr
   298  	xInst              uintptr
   299  	xRowid             uintptr
   300  	xColumnText        uintptr
   301  	xColumnSize        uintptr
   302  	xQueryPhrase       uintptr
   303  	xSetAuxdata        uintptr
   304  	xGetAuxdata        uintptr
   305  	xPhraseFirst       uintptr
   306  	xPhraseNext        uintptr
   307  	xPhraseFirstColumn uintptr
   308  	xPhraseNextColumn  uintptr
   309  }
   310  
   311  type Fts5ExtensionApi = Fts5ExtensionApi1
   312  type Fts5PhraseIter1 = struct {
   313  	a uintptr
   314  	b uintptr
   315  }
   316  
   317  type Fts5PhraseIter = Fts5PhraseIter1
   318  
   319  type fts5_extension_function = uintptr
   320  type fts5_tokenizer1 = struct {
   321  	xCreate   uintptr
   322  	xDelete   uintptr
   323  	xTokenize uintptr
   324  }
   325  
   326  type fts5_tokenizer = fts5_tokenizer1
   327  
   328  type fts5_api1 = struct {
   329  	iVersion         int32
   330  	_                [4]byte
   331  	xCreateTokenizer uintptr
   332  	xFindTokenizer   uintptr
   333  	xCreateFunction  uintptr
   334  }
   335  
   336  type fts5_api = fts5_api1
   337  
   338  type locale_t = uintptr
   339  
   340  type ssize_t = int64
   341  
   342  type rsize_t = size_t
   343  
   344  type errno_t = int32
   345  type pthread_once = struct {
   346  	state int32
   347  	_     [4]byte
   348  	mutex pthread_mutex_t
   349  }
   350  
   351  type pthread_t = uintptr
   352  type pthread_attr_t = uintptr
   353  type pthread_mutex_t = uintptr
   354  type pthread_mutexattr_t = uintptr
   355  type pthread_cond_t = uintptr
   356  type pthread_condattr_t = uintptr
   357  type pthread_key_t = int32
   358  type pthread_once_t = pthread_once
   359  type pthread_rwlock_t = uintptr
   360  type pthread_rwlockattr_t = uintptr
   361  type pthread_barrier_t = uintptr
   362  type pthread_barrierattr_t = uintptr
   363  type pthread_spinlock_t = uintptr
   364  
   365  type pthread_addr_t = uintptr
   366  type pthread_startroutine_t = uintptr
   367  
   368  type u_char = uint8
   369  type u_short = uint16
   370  type u_int = uint32
   371  type u_long = uint64
   372  type ushort = uint16
   373  type uint = uint32
   374  
   375  type int8_t = int8
   376  
   377  type int16_t = int16
   378  
   379  type int32_t = int32
   380  
   381  type int64_t = int64
   382  
   383  type uint8_t = uint8
   384  
   385  type uint16_t = uint16
   386  
   387  type uint32_t = uint32
   388  
   389  type uint64_t = uint64
   390  
   391  type intptr_t = int64
   392  type uintptr_t = uint64
   393  type intmax_t = int64
   394  type uintmax_t = uint64
   395  
   396  type u_int8_t = uint8
   397  type u_int16_t = uint16
   398  type u_int32_t = uint32
   399  type u_int64_t = uint64
   400  
   401  type u_quad_t = uint64
   402  type quad_t = int64
   403  type qaddr_t = uintptr
   404  
   405  type caddr_t = uintptr
   406  type c_caddr_t = uintptr
   407  
   408  type blksize_t = int32
   409  
   410  type cpuwhich_t = int32
   411  type cpulevel_t = int32
   412  type cpusetid_t = int32
   413  
   414  type blkcnt_t = int64
   415  
   416  type clock_t = int32
   417  
   418  type clockid_t = int32
   419  
   420  type critical_t = int64
   421  type daddr_t = int64
   422  
   423  type dev_t = uint64
   424  
   425  type fflags_t = uint32
   426  
   427  type fixpt_t = uint32
   428  
   429  type fsblkcnt_t = uint64
   430  type fsfilcnt_t = uint64
   431  
   432  type gid_t = uint32
   433  
   434  type in_addr_t = uint32
   435  
   436  type in_port_t = uint16
   437  
   438  type id_t = int64
   439  
   440  type ino_t = uint64
   441  
   442  type key_t = int64
   443  
   444  type lwpid_t = int32
   445  
   446  type mode_t = uint16
   447  
   448  type accmode_t = int32
   449  
   450  type nlink_t = uint64
   451  
   452  type off_t = int64
   453  
   454  type off64_t = int64
   455  
   456  type pid_t = int32
   457  
   458  type register_t = int64
   459  
   460  type rlim_t = int64
   461  
   462  type sbintime_t = int64
   463  
   464  type segsz_t = int64
   465  
   466  type suseconds_t = int64
   467  
   468  type time_t = int64
   469  
   470  type timer_t = uintptr
   471  
   472  type mqd_t = uintptr
   473  
   474  type u_register_t = uint64
   475  
   476  type uid_t = uint32
   477  
   478  type useconds_t = uint32
   479  
   480  type cap_ioctl_t = uint64
   481  
   482  type kpaddr_t = uint64
   483  type kvaddr_t = uint64
   484  type ksize_t = uint64
   485  type kssize_t = int64
   486  
   487  type vm_offset_t = uint64
   488  type vm_ooffset_t = uint64
   489  type vm_paddr_t = uint64
   490  type vm_pindex_t = uint64
   491  type vm_size_t = uint64
   492  
   493  type rman_res_t = uint64
   494  
   495  type __sigset = struct{ __bits [4]uint32 }
   496  
   497  type timeval = struct {
   498  	tv_sec  time_t
   499  	tv_usec suseconds_t
   500  }
   501  
   502  type timespec = struct {
   503  	tv_sec  time_t
   504  	tv_nsec int64
   505  }
   506  
   507  type itimerspec = struct {
   508  	it_interval struct {
   509  		tv_sec  time_t
   510  		tv_nsec int64
   511  	}
   512  	it_value struct {
   513  		tv_sec  time_t
   514  		tv_nsec int64
   515  	}
   516  }
   517  
   518  type fd_mask = uint64
   519  
   520  type sigset_t = __sigset
   521  
   522  type fd_set1 = struct{ __fds_bits [16]uint64 }
   523  
   524  type fd_set = fd_set1
   525  
   526  type timezone = struct {
   527  	tz_minuteswest int32
   528  	tz_dsttime     int32
   529  }
   530  
   531  type bintime = struct {
   532  	sec  time_t
   533  	frac uint64_t
   534  }
   535  
   536  func sbttons(tls *libc.TLS, _sbt sbintime_t) int64_t {
   537  	var ns uint64_t
   538  
   539  	ns = uint64_t(_sbt)
   540  	if ns >= uint64(int64(1)<<32) {
   541  		ns = ns >> 32 * uint64(1000000000)
   542  	} else {
   543  		ns = uint64(0)
   544  	}
   545  
   546  	return int64_t(ns + uint64_t(int64(1000000000)*(_sbt&int64(0xffffffff))>>32))
   547  }
   548  
   549  func nstosbt(tls *libc.TLS, _ns int64_t) sbintime_t {
   550  	var sb sbintime_t = int64(0)
   551  
   552  	if _ns >= int64(1000000000) {
   553  		sb = _ns / int64(1000000000) * (int64(1) << 32)
   554  		_ns = _ns % int64(1000000000)
   555  	}
   556  
   557  	sb = sbintime_t(uint64(sb) + (uint64(_ns)*9223372037+uint64(0x7fffffff))>>31)
   558  	return sb
   559  }
   560  
   561  func sbttous(tls *libc.TLS, _sbt sbintime_t) int64_t {
   562  	return int64(1000000) * _sbt >> 32
   563  }
   564  
   565  func ustosbt(tls *libc.TLS, _us int64_t) sbintime_t {
   566  	var sb sbintime_t = int64(0)
   567  
   568  	if _us >= int64(1000000) {
   569  		sb = _us / int64(1000000) * (int64(1) << 32)
   570  		_us = _us % int64(1000000)
   571  	}
   572  
   573  	sb = sbintime_t(uint64(sb) + (uint64(_us)*9223372036855+uint64(0x7fffffff))>>31)
   574  	return sb
   575  }
   576  
   577  type itimerval = struct {
   578  	it_interval struct {
   579  		tv_sec  time_t
   580  		tv_usec suseconds_t
   581  	}
   582  	it_value struct {
   583  		tv_sec  time_t
   584  		tv_usec suseconds_t
   585  	}
   586  }
   587  
   588  type clockinfo = struct {
   589  	hz     int32
   590  	tick   int32
   591  	spare  int32
   592  	stathz int32
   593  	profhz int32
   594  }
   595  
   596  type tm = struct {
   597  	tm_sec    int32
   598  	tm_min    int32
   599  	tm_hour   int32
   600  	tm_mday   int32
   601  	tm_mon    int32
   602  	tm_year   int32
   603  	tm_wday   int32
   604  	tm_yday   int32
   605  	tm_isdst  int32
   606  	_         [4]byte
   607  	tm_gmtoff int64
   608  	tm_zone   uintptr
   609  }
   610  
   611  type sigevent = struct {
   612  	sigev_notify int32
   613  	sigev_signo  int32
   614  	sigev_value  struct {
   615  		_         [0]uint64
   616  		sival_int int32
   617  		_         [4]byte
   618  	}
   619  	_sigev_un struct {
   620  		_         [0]uint64
   621  		_threadid int32
   622  		_         [60]byte
   623  	}
   624  }
   625  
   626  type stat = struct {
   627  	st_dev      dev_t
   628  	st_ino      ino_t
   629  	st_nlink    nlink_t
   630  	st_mode     mode_t
   631  	st_padding0 int16
   632  	st_uid      uid_t
   633  	st_gid      gid_t
   634  	st_padding1 int32
   635  	st_rdev     dev_t
   636  	st_atim     struct {
   637  		tv_sec  time_t
   638  		tv_nsec int64
   639  	}
   640  	st_mtim struct {
   641  		tv_sec  time_t
   642  		tv_nsec int64
   643  	}
   644  	st_ctim struct {
   645  		tv_sec  time_t
   646  		tv_nsec int64
   647  	}
   648  	st_birthtim struct {
   649  		tv_sec  time_t
   650  		tv_nsec int64
   651  	}
   652  	st_size    off_t
   653  	st_blocks  blkcnt_t
   654  	st_blksize blksize_t
   655  	st_flags   fflags_t
   656  	st_gen     uint64
   657  	st_spare   [10]uint64
   658  }
   659  
   660  type flock = struct {
   661  	l_start  off_t
   662  	l_len    off_t
   663  	l_pid    pid_t
   664  	l_type   int16
   665  	l_whence int16
   666  	l_sysid  int32
   667  	_        [4]byte
   668  }
   669  
   670  type __oflock = struct {
   671  	l_start  off_t
   672  	l_len    off_t
   673  	l_pid    pid_t
   674  	l_type   int16
   675  	l_whence int16
   676  }
   677  
   678  type xfile = struct {
   679  	xf_size        ksize_t
   680  	xf_pid         pid_t
   681  	xf_uid         uid_t
   682  	xf_fd          int32
   683  	_xf_int_pad1   int32
   684  	xf_file        kvaddr_t
   685  	xf_type        int16
   686  	_xf_short_pad1 int16
   687  	xf_count       int32
   688  	xf_msgcount    int32
   689  	_xf_int_pad2   int32
   690  	xf_offset      off_t
   691  	xf_data        kvaddr_t
   692  	xf_vnode       kvaddr_t
   693  	xf_flag        u_int
   694  	_xf_int_pad3   int32
   695  	_xf_int64_pad  [6]int64_t
   696  }
   697  
   698  type sig_atomic_t = int64
   699  
   700  type sigcontext = struct {
   701  	sc_mask          struct{ __bits [4]uint32 }
   702  	sc_onstack       int64
   703  	sc_rdi           int64
   704  	sc_rsi           int64
   705  	sc_rdx           int64
   706  	sc_rcx           int64
   707  	sc_r8            int64
   708  	sc_r9            int64
   709  	sc_rax           int64
   710  	sc_rbx           int64
   711  	sc_rbp           int64
   712  	sc_r10           int64
   713  	sc_r11           int64
   714  	sc_r12           int64
   715  	sc_r13           int64
   716  	sc_r14           int64
   717  	sc_r15           int64
   718  	sc_trapno        int32
   719  	sc_fs            int16
   720  	sc_gs            int16
   721  	sc_addr          int64
   722  	sc_flags         int32
   723  	sc_es            int16
   724  	sc_ds            int16
   725  	sc_err           int64
   726  	sc_rip           int64
   727  	sc_cs            int64
   728  	sc_rflags        int64
   729  	sc_rsp           int64
   730  	sc_ss            int64
   731  	sc_len           int64
   732  	sc_fpformat      int64
   733  	sc_ownedfp       int64
   734  	sc_fpstate       [64]int64
   735  	sc_fsbase        int64
   736  	sc_gsbase        int64
   737  	sc_xfpustate     int64
   738  	sc_xfpustate_len int64
   739  	sc_spare         [4]int64
   740  }
   741  
   742  type sigval = struct {
   743  	_         [0]uint64
   744  	sival_int int32
   745  	_         [4]byte
   746  }
   747  
   748  type __siginfo = struct {
   749  	si_signo  int32
   750  	si_errno  int32
   751  	si_code   int32
   752  	si_pid    int32
   753  	si_uid    uint32
   754  	si_status int32
   755  	si_addr   uintptr
   756  	si_value  struct {
   757  		_         [0]uint64
   758  		sival_int int32
   759  		_         [4]byte
   760  	}
   761  	_reason struct {
   762  		_      [0]uint64
   763  		_fault struct{ _trapno int32 }
   764  		_      [36]byte
   765  	}
   766  }
   767  
   768  type siginfo_t = __siginfo
   769  
   770  type sigaction = struct {
   771  	__sigaction_u struct{ __sa_handler uintptr }
   772  	sa_flags      int32
   773  	sa_mask       sigset_t
   774  	_             [4]byte
   775  }
   776  
   777  type sig_t = uintptr
   778  
   779  type sigaltstack = struct {
   780  	ss_sp    uintptr
   781  	ss_size  uint64
   782  	ss_flags int32
   783  	_        [4]byte
   784  }
   785  
   786  type stack_t = sigaltstack
   787  
   788  type sigvec = struct {
   789  	sv_handler uintptr
   790  	sv_mask    int32
   791  	sv_flags   int32
   792  }
   793  
   794  type sigstack = struct {
   795  	ss_sp      uintptr
   796  	ss_onstack int32
   797  	_          [4]byte
   798  }
   799  
   800  type crypt_data = struct {
   801  	initialized int32
   802  	__buf       [256]int8
   803  }
   804  
   805  type VFSFile1 = struct {
   806  	base        sqlite3_file
   807  	fsFile      uintptr
   808  	fd          int32
   809  	_           [4]byte
   810  	aBuffer     uintptr
   811  	nBuffer     int32
   812  	_           [4]byte
   813  	iBufferOfst sqlite3_int64
   814  }
   815  
   816  type VFSFile = VFSFile1
   817  
   818  func vfsDirectWrite(tls *libc.TLS, p uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 {
   819  	bp := tls.Alloc(16)
   820  	defer tls.Free(16)
   821  
   822  	var ofst off_t
   823  	var nWrite size_t
   824  
   825  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__)), 178))
   826  	libc.X__builtin_abort(tls)
   827  	ofst = libc.Xlseek(tls, (*VFSFile)(unsafe.Pointer(p)).fd, iOfst, 0)
   828  	if ofst != iOfst {
   829  		return 10 | int32(3)<<8
   830  	}
   831  
   832  	nWrite = size_t(libc.Xwrite(tls, (*VFSFile)(unsafe.Pointer(p)).fd, zBuf, uint64(iAmt)))
   833  	if nWrite != size_t(iAmt) {
   834  		return 10 | int32(3)<<8
   835  	}
   836  
   837  	return 0
   838  }
   839  
   840  var __func__ = *(*[15]int8)(unsafe.Pointer(ts + 13))
   841  
   842  func vfsFlushBuffer(tls *libc.TLS, p uintptr) int32 {
   843  	bp := tls.Alloc(16)
   844  	defer tls.Free(16)
   845  
   846  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__1)), 198))
   847  	libc.X__builtin_abort(tls)
   848  	var rc int32 = 0
   849  	if (*VFSFile)(unsafe.Pointer(p)).nBuffer != 0 {
   850  		rc = vfsDirectWrite(tls, p, (*VFSFile)(unsafe.Pointer(p)).aBuffer, (*VFSFile)(unsafe.Pointer(p)).nBuffer, (*VFSFile)(unsafe.Pointer(p)).iBufferOfst)
   851  		(*VFSFile)(unsafe.Pointer(p)).nBuffer = 0
   852  	}
   853  	return rc
   854  }
   855  
   856  var __func__1 = *(*[15]int8)(unsafe.Pointer(ts + 28))
   857  
   858  func vfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 {
   859  	bp := tls.Alloc(16)
   860  	defer tls.Free(16)
   861  
   862  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__4)), 273))
   863  	libc.X__builtin_abort(tls)
   864  	var p uintptr = pFile
   865  
   866  	if (*VFSFile)(unsafe.Pointer(p)).aBuffer != 0 {
   867  		var z uintptr = zBuf
   868  		var n int32 = iAmt
   869  		var i sqlite3_int64 = iOfst
   870  
   871  		for n > 0 {
   872  			var nCopy int32
   873  
   874  			if (*VFSFile)(unsafe.Pointer(p)).nBuffer == 8192 || (*VFSFile)(unsafe.Pointer(p)).iBufferOfst+sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer) != i {
   875  				var rc int32 = vfsFlushBuffer(tls, p)
   876  				if rc != 0 {
   877  					return rc
   878  				}
   879  			}
   880  			if !((*VFSFile)(unsafe.Pointer(p)).nBuffer == 0 || (*VFSFile)(unsafe.Pointer(p)).iBufferOfst+sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer) == i) {
   881  				libc.X__assert(tls, uintptr(unsafe.Pointer(&__func__4)), ts+43, 294, ts+51)
   882  			}
   883  			(*VFSFile)(unsafe.Pointer(p)).iBufferOfst = i - sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer)
   884  
   885  			nCopy = 8192 - (*VFSFile)(unsafe.Pointer(p)).nBuffer
   886  			if nCopy > n {
   887  				nCopy = n
   888  			}
   889  			libc.Xmemcpy(tls, (*VFSFile)(unsafe.Pointer(p)).aBuffer+uintptr((*VFSFile)(unsafe.Pointer(p)).nBuffer), z, uint64(nCopy))
   890  			*(*int32)(unsafe.Pointer(p + 32)) += nCopy
   891  
   892  			n = n - nCopy
   893  			i = i + sqlite3_int64(nCopy)
   894  			z += uintptr(nCopy)
   895  		}
   896  	} else {
   897  		return vfsDirectWrite(tls, p, zBuf, iAmt, iOfst)
   898  	}
   899  
   900  	return 0
   901  }
   902  
   903  var __func__4 = *(*[9]int8)(unsafe.Pointer(ts + 97))
   904  
   905  func vfsTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 {
   906  	return 0
   907  }
   908  
   909  func vfsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 {
   910  	bp := tls.Alloc(16)
   911  	defer tls.Free(16)
   912  
   913  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__5)), 331))
   914  	libc.X__builtin_abort(tls)
   915  	var p uintptr = pFile
   916  	var rc int32
   917  
   918  	rc = vfsFlushBuffer(tls, p)
   919  	if rc != 0 {
   920  		return rc
   921  	}
   922  
   923  	rc = libc.Xfsync(tls, (*VFSFile)(unsafe.Pointer(p)).fd)
   924  	return func() int32 {
   925  		if rc == 0 {
   926  			return 0
   927  		}
   928  		return 10 | int32(4)<<8
   929  	}()
   930  }
   931  
   932  var __func__5 = *(*[8]int8)(unsafe.Pointer(ts + 106))
   933  
   934  func vfsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 {
   935  	return 0
   936  }
   937  
   938  func vfsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 {
   939  	return 0
   940  }
   941  
   942  func vfsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 {
   943  	*(*int32)(unsafe.Pointer(pResOut)) = 0
   944  	return 0
   945  }
   946  
   947  func vfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 {
   948  	return 12
   949  }
   950  
   951  func vfsSectorSize(tls *libc.TLS, pFile uintptr) int32 {
   952  	return 0
   953  }
   954  
   955  func vfsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 {
   956  	return 0
   957  }
   958  
   959  func vfsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 {
   960  	bp := tls.Alloc(4129)
   961  	defer tls.Free(4129)
   962  
   963  	libc.X__builtin_printf(tls, ts, libc.VaList(bp, uintptr(unsafe.Pointer(&__func__8)), 473))
   964  	libc.X__builtin_abort(tls)
   965  	var rc int32
   966  
   967  	rc = libc.Xunlink(tls, zPath)
   968  	if rc != 0 && *(*int32)(unsafe.Pointer(libc.X__error(tls))) == 2 {
   969  		return 0
   970  	}
   971  
   972  	if rc == 0 && dirSync != 0 {
   973  		var dfd int32
   974  		var i int32
   975  
   976  		sqlite3.Xsqlite3_snprintf(tls, 4096, bp+32, ts+114, libc.VaList(bp+16, zPath))
   977  		*(*int8)(unsafe.Pointer(bp + 32 + 4096)) = int8(0)
   978  		for i = int32(libc.Xstrlen(tls, bp+32)); i > 1 && int32(*(*int8)(unsafe.Pointer(bp + 32 + uintptr(i)))) != '/'; i++ {
   979  		}
   980  		*(*int8)(unsafe.Pointer(bp + 32 + uintptr(i))) = int8(0)
   981  
   982  		dfd = libc.Xopen(tls, bp+32, 0x0000, libc.VaList(bp+24, 0))
   983  		if dfd < 0 {
   984  			rc = -1
   985  		} else {
   986  			rc = libc.Xfsync(tls, dfd)
   987  			libc.Xclose(tls, dfd)
   988  		}
   989  	}
   990  	return func() int32 {
   991  		if rc == 0 {
   992  			return 0
   993  		}
   994  		return 10 | int32(10)<<8
   995  	}()
   996  }
   997  
   998  var __func__8 = *(*[10]int8)(unsafe.Pointer(ts + 117))
   999  
  1000  func vfsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr {
  1001  	return uintptr(0)
  1002  }
  1003  
  1004  func vfsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) {
  1005  	sqlite3.Xsqlite3_snprintf(tls, nByte, zErrMsg, ts+127, 0)
  1006  	*(*int8)(unsafe.Pointer(zErrMsg + uintptr(nByte-1))) = int8(0)
  1007  }
  1008  
  1009  func vfsDlSym(tls *libc.TLS, pVfs uintptr, pH uintptr, z uintptr) uintptr {
  1010  	return uintptr(0)
  1011  }
  1012  
  1013  func vfsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) {
  1014  	return
  1015  }
  1016  
  1017  func vfsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zByte uintptr) int32 {
  1018  	return 0
  1019  }
  1020  
  1021  func vfsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 {
  1022  	libc.Xsleep(tls, uint32(nMicro/1000000))
  1023  	libc.Xusleep(tls, uint32(nMicro%1000000))
  1024  	return nMicro
  1025  }
  1026  
  1027  func vfsCurrentTime(tls *libc.TLS, pVfs uintptr, pTime uintptr) int32 {
  1028  	var t time_t = libc.Xtime(tls, uintptr(0))
  1029  	*(*float64)(unsafe.Pointer(pTime)) = float64(t)/86400.0 + 2440587.5
  1030  	return 0
  1031  }
  1032  
  1033  func Xsqlite3_fsFS(tls *libc.TLS, zName uintptr, pAppData uintptr) uintptr {
  1034  	var p uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vfs{})))
  1035  	if !(p != 0) {
  1036  		return uintptr(0)
  1037  	}
  1038  
  1039  	*(*sqlite3_vfs)(unsafe.Pointer(p)) = sqlite3_vfs{
  1040  		iVersion:   1,
  1041  		szOsFile:   int32(unsafe.Sizeof(VFSFile{})),
  1042  		mxPathname: 4096,
  1043  		zName:      zName,
  1044  		pAppData:   pAppData,
  1045  		xOpen: *(*uintptr)(unsafe.Pointer(&struct {
  1046  			f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
  1047  		}{vfsOpen})),
  1048  		xDelete: *(*uintptr)(unsafe.Pointer(&struct {
  1049  			f func(*libc.TLS, uintptr, uintptr, int32) int32
  1050  		}{vfsDelete})),
  1051  		xAccess: *(*uintptr)(unsafe.Pointer(&struct {
  1052  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
  1053  		}{vfsAccess})),
  1054  		xFullPathname: *(*uintptr)(unsafe.Pointer(&struct {
  1055  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
  1056  		}{vfsFullPathname})),
  1057  		xDlOpen: *(*uintptr)(unsafe.Pointer(&struct {
  1058  			f func(*libc.TLS, uintptr, uintptr) uintptr
  1059  		}{vfsDlOpen})),
  1060  		xDlError: *(*uintptr)(unsafe.Pointer(&struct {
  1061  			f func(*libc.TLS, uintptr, int32, uintptr)
  1062  		}{vfsDlError})),
  1063  		xDlSym: *(*uintptr)(unsafe.Pointer(&struct {
  1064  			f func(*libc.TLS, uintptr, uintptr, uintptr) uintptr
  1065  		}{vfsDlSym})),
  1066  		xDlClose: *(*uintptr)(unsafe.Pointer(&struct {
  1067  			f func(*libc.TLS, uintptr, uintptr)
  1068  		}{vfsDlClose})),
  1069  		xRandomness: *(*uintptr)(unsafe.Pointer(&struct {
  1070  			f func(*libc.TLS, uintptr, int32, uintptr) int32
  1071  		}{vfsRandomness})),
  1072  		xSleep: *(*uintptr)(unsafe.Pointer(&struct {
  1073  			f func(*libc.TLS, uintptr, int32) int32
  1074  		}{vfsSleep})),
  1075  		xCurrentTime: *(*uintptr)(unsafe.Pointer(&struct {
  1076  			f func(*libc.TLS, uintptr, uintptr) int32
  1077  		}{vfsCurrentTime}))}
  1078  	return p
  1079  }
  1080  
  1081  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"
  1082  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data