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