1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
|
// Copyright 2020 The Libc Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package libc // import "modernc.org/libc"
import (
"os"
"strings"
gotime "time"
"unicode"
"unsafe"
"golang.org/x/sys/unix"
"modernc.org/libc/errno"
"modernc.org/libc/fcntl"
"modernc.org/libc/signal"
"modernc.org/libc/stdio"
"modernc.org/libc/sys/types"
"modernc.org/libc/time"
"modernc.org/libc/utime"
"modernc.org/libc/wctype"
)
var (
startTime = gotime.Now() // For clock(3)
)
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
if __ccgo_strace {
trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
}
// musl/arch/x86_64/ksigaction.h
//
// struct k_sigaction {
// void (*handler)(int);
// unsigned long flags;
// void (*restorer)(void);
// unsigned mask[2];
// };
type k_sigaction struct {
handler uintptr
flags ulong
restorer uintptr
mask [2]uint32
}
var kact, koldact uintptr
if act != 0 {
sz := int(unsafe.Sizeof(k_sigaction{}))
kact = t.Alloc(sz)
defer t.Free(sz)
*(*k_sigaction)(unsafe.Pointer(kact)) = k_sigaction{
handler: (*signal.Sigaction)(unsafe.Pointer(act)).F__sigaction_handler.Fsa_handler,
flags: ulong((*signal.Sigaction)(unsafe.Pointer(act)).Fsa_flags),
restorer: (*signal.Sigaction)(unsafe.Pointer(act)).Fsa_restorer,
}
Xmemcpy(t, kact+unsafe.Offsetof(k_sigaction{}.mask), act+unsafe.Offsetof(signal.Sigaction{}.Fsa_mask), types.Size_t(unsafe.Sizeof(k_sigaction{}.mask)))
}
if oldact != 0 {
panic(todo(""))
}
if _, _, err := unix.Syscall6(unix.SYS_RT_SIGACTION, uintptr(signum), kact, koldact, unsafe.Sizeof(k_sigaction{}.mask), 0, 0); err != 0 {
t.setErrno(err)
return -1
}
if oldact != 0 {
panic(todo(""))
}
return 0
}
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
if __ccgo_strace {
trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
}
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
}
if cmd == fcntl.F_SETFL {
arg |= unix.O_LARGEFILE
}
n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg)
if err != 0 {
// if dmesgs {
// dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n)
// }
return int32(n)
}
// int fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags);
func Xfstatat(t *TLS, dirfd int32, pathname, statbuf uintptr, flags int32) int32 {
if __ccgo_strace {
trc("t=%v dirfd=%v statbuf=%v flags=%v, (%v:)", t, dirfd, statbuf, flags, origin(2))
}
// From golang.org/x/sys/unix/zsyscall_linux_riscv64.go
if _, _, err := unix.Syscall6(unix.SYS_FSTATAT, uintptr(dirfd), pathname, statbuf, uintptr(flags), 0, 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
if __ccgo_strace {
trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xfstatat(t, unix.AT_FDCWD, pathname, statbuf, unix.AT_SYMLINK_NOFOLLOW)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
if __ccgo_strace {
trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xfstatat(t, unix.AT_FDCWD, pathname, statbuf, 0)
}
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
if __ccgo_strace {
trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
}
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: %d size %#x: ok\n%+v", origin(1), fd, (*stat.Stat)(unsafe.Pointer(statbuf)).Fst_size, (*stat.Stat)(unsafe.Pointer(statbuf)))
// }
return 0
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
if __ccgo_strace {
trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
}
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
if __ccgo_strace {
trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
}
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
// if dmesgs {
// dmesg("%v: %v", origin(1), err)
// }
t.setErrno(err)
return ^uintptr(0) // (void*)-1
}
// if dmesgs {
// dmesg("%v: %#x", origin(1), data)
// }
return data
}
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
if __ccgo_strace {
trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
}
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
}
data, _, err := unix.Syscall6(unix.SYS_MREMAP, old_address, uintptr(old_size), uintptr(new_size), uintptr(flags), arg, 0)
if err != 0 {
// if dmesgs {
// dmesg("%v: %v", origin(1), err)
// }
t.setErrno(err)
return ^uintptr(0) // (void*)-1
}
// if dmesgs {
// dmesg("%v: %#x", origin(1), data)
// }
return data
}
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
if __ccgo_strace {
trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
}
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: %d %#x: ok", origin(1), fd, length)
// }
return 0
}
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
if __ccgo_strace {
trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
}
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), n)
// }
return types.Off_t(n)
}
// From man utime executed on linux/riscv64:
//
// The utimbuf structure is:
//
// struct utimbuf {
// time_t actime; /* access time */
// time_t modtime; /* modification time */
// };
type utimbuf struct {
actime utime.Time_t
modtime utime.Time_t
}
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
if __ccgo_strace {
trc("t=%v times=%v, (%v:)", t, times, origin(2))
}
if times == 0 {
return Xutimes(t, filename, 0)
}
n := int(unsafe.Sizeof([2]types.Timeval{}))
p := t.Alloc(n)
defer t.Free(n)
*(*[2]types.Timeval)(unsafe.Pointer(p)) = [2]types.Timeval{
{Ftv_sec: (*utimbuf)(unsafe.Pointer(times)).actime},
{Ftv_sec: (*utimbuf)(unsafe.Pointer(times)).modtime},
}
return Xutimes(t, filename, p)
}
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
if __ccgo_strace {
trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
}
panic(todo(""))
// No alarm syscall on linux/riscv64. And cannot implement with setitimer as in musl,
// because of missing defination to constant ITIMER_REAL in types_linux_riscv64.go.
}
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
if __ccgo_strace {
trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
var tv types.Timeval
if err := Xgettimeofday(t, uintptr(unsafe.Pointer(&tv)), 0); err != 0 {
t.setErrno(err)
return -1
}
if tloc != 0 {
*(*types.Time_t)(unsafe.Pointer(tloc)) = tv.Ftv_sec
}
return tv.Ftv_sec
}
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
if __ccgo_strace {
trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
}
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
if __ccgo_strace {
trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xmkdirat(t, unix.AT_FDCWD, path, mode)
}
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
if __ccgo_strace {
trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xsymlinkat(t, target, unix.AT_FDCWD, linkpath)
}
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
if __ccgo_strace {
trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xfchmodat(t, unix.AT_FDCWD, pathname, mode, 0)
}
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
if __ccgo_strace {
trc("t=%v times=%v, (%v:)", t, times, origin(2))
}
return Xutimensat(t, unix.AT_FDCWD, filename, times, 0)
}
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
if __ccgo_strace {
trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xunlinkat(t, unix.AT_FDCWD, pathname, 0)
}
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
if __ccgo_strace {
trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xfaccessat(t, unix.AT_FDCWD, pathname, mode, 0)
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
if __ccgo_strace {
trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xunlinkat(t, unix.AT_FDCWD, pathname, unix.AT_REMOVEDIR)
}
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
if __ccgo_strace {
trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xrenameat(t, unix.AT_FDCWD, oldpath, unix.AT_FDCWD, newpath)
}
// int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
func Xrenameat(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr) int32 {
if __ccgo_strace {
trc("t=%v olddirfd=%v oldpath=%v newdirfd=%v newpath=%v, (%v:)", t, olddirfd, oldpath, newdirfd, newpath, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xrenameat2(t, olddirfd, oldpath, newdirfd, newpath, 0)
}
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
if __ccgo_strace {
trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xmknodat(t, unix.AT_FDCWD, pathname, mode, dev)
}
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
if __ccgo_strace {
trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xfchownat(t, unix.AT_FDCWD, pathname, owner, group, 0)
}
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
if __ccgo_strace {
trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xlinkat(t, unix.AT_FDCWD, oldpath, unix.AT_FDCWD, newpath, 0)
}
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
if __ccgo_strace {
trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xpipe2(t, pipefd, 0)
}
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
if __ccgo_strace {
trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xdup3(t, oldfd, newfd, 0)
}
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
if __ccgo_strace {
trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
}
// From golang.org/x/sys/unix/syscall_linux.go
return Xreadlinkat(t, unix.AT_FDCWD, path, buf, bufsize)
}
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
if __ccgo_strace {
trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
}
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
case "r":
flags = os.O_RDONLY
case "r+":
flags = os.O_RDWR
case "w":
flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
case "w+":
flags = os.O_RDWR | os.O_CREATE | os.O_TRUNC
case "a":
flags = os.O_WRONLY | os.O_CREATE | os.O_APPEND
case "a+":
flags = os.O_RDWR | os.O_CREATE | os.O_APPEND
default:
panic(m)
}
//TODO- flags |= fcntl.O_LARGEFILE
// From golang.org/x/sys/unix/syscall_linux.go
fd := Xopenat(t, unix.AT_FDCWD, pathname, int32(flags|unix.O_LARGEFILE), 0666)
if fd == -1 {
return 0
}
if p := newFile(t, fd); p != 0 {
return p
}
Xclose(t, fd)
t.setErrno(errno.ENOMEM)
return 0
}
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
if __ccgo_strace {
trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
}
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
if __ccgo_strace {
trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
}
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
func __syscall1(t *TLS, trap, p1 long) long {
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0))
}
func __syscall3(t *TLS, trap, p1, p2, p3 long) long {
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3)))
}
func __syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0))
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
if __ccgo_strace {
trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
}
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
return byte(a_load_8(ptr))
}
var _table1 = [384]int32{
129: int32(1),
130: int32(2),
131: int32(3),
132: int32(4),
133: int32(5),
134: int32(6),
135: int32(7),
136: int32(8),
137: int32(9),
138: int32(10),
139: int32(11),
140: int32(12),
141: int32(13),
142: int32(14),
143: int32(15),
144: int32(16),
145: int32(17),
146: int32(18),
147: int32(19),
148: int32(20),
149: int32(21),
150: int32(22),
151: int32(23),
152: int32(24),
153: int32(25),
154: int32(26),
155: int32(27),
156: int32(28),
157: int32(29),
158: int32(30),
159: int32(31),
160: int32(32),
161: int32(33),
162: int32(34),
163: int32(35),
164: int32(36),
165: int32(37),
166: int32(38),
167: int32(39),
168: int32(40),
169: int32(41),
170: int32(42),
171: int32(43),
172: int32(44),
173: int32(45),
174: int32(46),
175: int32(47),
176: int32(48),
177: int32(49),
178: int32(50),
179: int32(51),
180: int32(52),
181: int32(53),
182: int32(54),
183: int32(55),
184: int32(56),
185: int32(57),
186: int32(58),
187: int32(59),
188: int32(60),
189: int32(61),
190: int32(62),
191: int32(63),
192: int32(64),
193: int32('a'),
194: int32('b'),
195: int32('c'),
196: int32('d'),
197: int32('e'),
198: int32('f'),
199: int32('g'),
200: int32('h'),
201: int32('i'),
202: int32('j'),
203: int32('k'),
204: int32('l'),
205: int32('m'),
206: int32('n'),
207: int32('o'),
208: int32('p'),
209: int32('q'),
210: int32('r'),
211: int32('s'),
212: int32('t'),
213: int32('u'),
214: int32('v'),
215: int32('w'),
216: int32('x'),
217: int32('y'),
218: int32('z'),
219: int32(91),
220: int32(92),
221: int32(93),
222: int32(94),
223: int32(95),
224: int32(96),
225: int32('a'),
226: int32('b'),
227: int32('c'),
228: int32('d'),
229: int32('e'),
230: int32('f'),
231: int32('g'),
232: int32('h'),
233: int32('i'),
234: int32('j'),
235: int32('k'),
236: int32('l'),
237: int32('m'),
238: int32('n'),
239: int32('o'),
240: int32('p'),
241: int32('q'),
242: int32('r'),
243: int32('s'),
244: int32('t'),
245: int32('u'),
246: int32('v'),
247: int32('w'),
248: int32('x'),
249: int32('y'),
250: int32('z'),
251: int32(123),
252: int32(124),
253: int32(125),
254: int32(126),
255: int32(127),
}
var _ptable1 = uintptr(unsafe.Pointer(&_table1)) + uintptr(128)*4
func X__ctype_tolower_loc(tls *TLS) (r uintptr) {
if __ccgo_strace {
trc("tls=%v, (%v:)", tls, origin(2))
defer func() { trc("-> %v", r) }()
}
return uintptr(unsafe.Pointer(&_ptable1))
}
type Tin6_addr = struct {
F__in6_union struct {
F__s6_addr16 [0][8]uint16
F__s6_addr32 [0][4]uint32
F__s6_addr [16]uint8
}
}
var Xin6addr_any = Tin6_addr{}
func Xrewinddir(tls *TLS, f uintptr) {
if __ccgo_strace {
trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
}
Xfseek(tls, f, 0, stdio.SEEK_SET)
}
// clock_t clock(void);
func Xclock(t *TLS) time.Clock_t {
if __ccgo_strace {
trc("t=%v, (%v:)", t, origin(2))
}
return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second)
}
const __NFDBITS = 64
func X__fdelt_chk(tls *TLS, d int64) (r int64) {
if __ccgo_strace {
trc("tls=%v d=%v, (%v:)", tls, d, origin(2))
defer func() { trc("-> %v", r) }()
}
return d / __NFDBITS
}
|