1 # See ltrace.conf(5) for description of syntax of this file. 2 3 # XXX ltrace misses long double and long long support 4 typedef ldouble = double; 5 typedef llong = long; 6 typedef ullong = ulong; 7 8 void __libc_start_main(hide(void*), hide(int), array(string, arg2)); 9 10 # arpa/inet.h 11 typedef in_addr = struct(hex(uint)); 12 int inet_aton(string, +in_addr*); 13 hex(uint) inet_addr(string); 14 hex(uint) inet_network(string); 15 string inet_ntoa(in_addr); 16 in_addr inet_makeaddr(hex(int), hex(int)); 17 hex(uint) inet_lnaof(in_addr); 18 hex(uint) inet_netof(in_addr); 19 20 # bfd.h 21 void bfd_init(); 22 int bfd_set_default_target(string); 23 addr bfd_scan_vma(string, addr, int); 24 addr bfd_openr(string,string); 25 int bfd_check_format(addr,int); 26 27 # ctype.h 28 char tolower(char); 29 char toupper(char); 30 addr __ctype_b_loc(); 31 addr __ctype_tolower_loc(); 32 addr __ctype_toupper_loc(); 33 ulong __ctype_get_mb_cur_max(); 34 35 # curses.h 36 int waddch(addr, char); 37 int mvprintw(int, int, format); 38 int wmove(addr, int, int); 39 int waddnstr(addr, string, int); 40 string tgoto(string, int, int); 41 42 # dirent.h 43 44 # We can't portably rely on DIR internals at all. Ideally this would 45 # be implemented in a per-OS config file, but even on Linux, we don't 46 # know whether there's a lock in the structure or not. Luckily the 47 # one interesting datum, file descriptor, we can access reliably. 48 # Having the structure half-defined like this is potentially 49 # problematic as structure size influences parameter passing. But 50 # POSIX always uses pointer to the structure, so it's fine. 51 52 typedef DIR = struct(int); 53 typedef FILE = addr; 54 55 # XXX We can't represent the following portably without having either 56 # uulong, or directly uint64_t.' 57 58 typedef ino_t = ulong; 59 typedef ino_t64 = ulong; 60 typedef off_t = ulong; 61 typedef off_t64 = ulong; 62 63 typedef dirent = struct(ino_t, hide(off_t), hide(ushort), hide(char), string(array(char, zero(256)))); 64 typedef dirent64 = struct(ino_t64, hide(off_t64), hide(ushort), hide(char), string(array(char, zero(256)))); 65 66 dirent *readdir(DIR *); 67 dirent64 *readdir64(DIR *); 68 int closedir(DIR *); 69 DIR *opendir(string); 70 DIR *fdopendir(int); 71 int dirfd(DIR *); 72 void rewinddir(DIR *); 73 long telldir(DIR *); 74 void seekdir(DIR *, long); 75 76 # dlfcn.h 77 addr dlopen(string, int); 78 string dlerror(); 79 addr dlsym(addr, string); 80 int dlclose(addr); 81 82 # errno.h 83 addr __errno_location(); 84 85 # fcntl.h 86 int open(string,int,octal); ; WARNING: 3rd argument may not be there 87 int open64(string,int,octal); ; WARNING: 3rd argument may not be there 88 89 # fnmatch.h 90 int fnmatch(string, string, int); 91 92 # getopt.h 93 int getopt_long(int,addr,string,addr,int*); 94 int getopt_long_only(int,addr,string,addr,addr); 95 96 # grp.h 97 void endgrent(); 98 addr getgrnam(string); 99 void setgrent(); 100 addr getgrent(); 101 102 # libintl.h 103 string __dcgettext(string,string,int); 104 string bindtextdomain(string, string); 105 string textdomain(string); 106 107 # libio.h 108 char _IO_getc(file); 109 int _IO_putc(char,file); 110 111 # locale.h 112 string setlocale(enum(LC_CTYPE=0, LC_NUMERIC=1, LC_TIME=2, LC_COLLATE=3, LC_MONETARY=4, LC_MESSAGES=5, LC_ALL=6, LC_PAPER=7, LC_NAME=8, LC_ADDRESS=9, LC_TELEPHONE=10, LC_MEASUREMENT=11, LC_IDENTIFICATION=12), string); 113 114 # mcheck.h 115 void mtrace(); 116 void muntrace(); 117 118 # mqueue.h 119 int mq_open(string, int, octal, addr); ; WARNING: 3rd and 4th arguments may not be there 120 int mq_close(int); 121 int mq_unlink(string); 122 int mq_getattr(int, addr); 123 int mq_setattr(int, addr, addr); 124 int mq_notify(int, addr); 125 int mq_send(int, string3, ulong, uint); 126 int mq_timedsend(int, string3, ulong, uint, addr); 127 long mq_receive(int, +string0, ulong, addr); 128 long mq_timedreceive(int, +string0, ulong, addr, addr); 129 130 # netdb.h 131 void endhostent(); 132 void endnetent(); 133 void endnetgrent(); 134 void endprotoent(); 135 void endservent(); 136 void freeaddrinfo(addr); 137 string gai_strerror(int); 138 int getaddrinfo(string, string, addr, addr); 139 addr gethostbyaddr(string, uint, int); 140 addr gethostbyname(string); 141 addr gethostent(); 142 int getnameinfo(addr, uint, string, uint, string, uint, uint); 143 addr getnetbyaddr(uint, int); 144 addr getnetbyname(string); 145 addr getnetent(); 146 int getnetgrent(addr, addr, addr); 147 addr getprotobyname(string); 148 addr getprotobynumber(int); 149 addr getprotoent(); 150 addr getservbyname(string, string); 151 addr getservbyport(int, string); 152 addr getservent(); 153 void herror(string); 154 string hstrerror(int); 155 int rcmd(addr, ushort, string, string, string, addr); 156 int rcmd_af(addr, ushort, string, string, string, addr, int); 157 int rexec(addr, int, string, string, string, addr); 158 int rexec_af(addr, int, string, string, string, addr, int); 159 int rresvport (addr); 160 int rresvport_af (addr, int); 161 int ruserok(string, int, string, string); 162 int ruserok_af(string, int, string, string, int); 163 void sethostent(int); 164 void setnetent(int); 165 int setnetgrent(string); 166 void setprotoent(int); 167 void setservent(int); 168 169 # netinet/in.h 170 uint ntohs(uint); 171 172 # pcap.h 173 string pcap_lookupdev(addr); 174 addr pcap_open_live(string, int, int, int, addr); 175 int pcap_snapshot(addr); 176 int pcap_lookupnet(string, addr, addr, addr); 177 int pcap_compile(addr, addr, string, int, addr); 178 179 # pwd.h 180 string getpass(string); 181 void endpwent(); 182 addr getpwnam(string); 183 void setpwent(); 184 185 # readline/readline.h 186 string readline(string); 187 188 # signal.h 189 typedef signum = enum(SIGHUP=1, SIGINT=2, SIGQUIT=3, SIGILL=4, SIGTRAP=5, SIGABRT=6, SIGBUS=7, SIGFPE=8, SIGKILL=9, SIGUSR1=10, SIGSEGV=11, SIGUSR2=12, SIGPIPE=13, SIGALRM=14, SIGTERM=15, SIGSTKFLT=16, SIGCHLD=17, SIGCONT=18, SIGSTOP=19, SIGTSTP=20, SIGTTIN=21, SIGTTOU=22, SIGURG=23, SIGXCPU=24, SIGXFSZ=25, SIGVTALRM=26, SIGPROF=27, SIGWINCH=28, SIGIO=29, SIGPWR=30, SIGSYS=31, SIGRTMIN_0=32, SIGRTMIN_1=33, SIGRTMIN_2=34, SIGRTMIN_3=35, SIGRTMIN_4=36, SIGRTMIN_5=37, SIGRTMIN_6=38, SIGRTMIN_7=39, SIGRTMIN_8=40, SIGRTMIN_9=41, SIGRTMIN_10=42, SIGRTMIN_11=43, SIGRTMIN_12=44, SIGRTMIN_13=45, SIGRTMIN_14=46, SIGRTMIN_15=47, SIGRTMIN_16=48, SIGRTMIN_17=49, SIGRTMIN_18=50, SIGRTMIN_19=51, SIGRTMIN_20=52, SIGRTMIN_21=53, SIGRTMIN_22=54, SIGRTMIN_23=55, SIGRTMIN_24=56, SIGRTMIN_25=57, SIGRTMIN_26=58, SIGRTMIN_27=59, SIGRTMIN_28=60, SIGRTMIN_29=61, SIGRTMIN_30=62, SIGRTMIN_31=63); 190 typedef sigset_t = bitvec(ulong); 191 # elm3 should be flags 192 typedef sigaction = struct(addr, sigset_t, hex(int), addr); 193 int kill(int, signum); 194 int sigemptyset(+sigset_t*); 195 int sigaddset(+sigset_t*, signum); 196 int sigdelset(+sigset_t*, signum); 197 int sigfillset(+sigset_t*); 198 int sigismember(sigset_t*, signum); 199 addr signal(signum,addr); 200 int sigaction(signum, sigaction*, +sigaction*); 201 int sigprocmask(enum(SIG_BLOCK=1, SIG_UNBLOCK=2, SIG_SETMASK=3), sigset_t*, +sigset_t*); 202 int sigpending(+sigset_t*); 203 int sigsuspend(sigset_t*); 204 int sigisemptyset(sigset_t*); 205 int sigorset(+sigset_t*, sigset_t*, sigset_t*); 206 int sigandset(+sigset_t*, sigset_t*, sigset_t*); 207 208 # stdio.h 209 int fclose(file); 210 int feof(file); 211 int ferror(file); 212 int fflush(file); 213 char fgetc(file); 214 addr fgets(+string, int, file); 215 int fileno(file); 216 file fopen(string,string); 217 file fopen64(string,string); 218 file fdopen(int, string); 219 int fprintf(file,format); 220 int fputc(char,file); 221 int fputs(string,file); 222 ulong fread(addr,ulong,ulong,file); 223 ulong fread_unlocked(addr,ulong,ulong,file); 224 ulong fwrite(string,ulong,ulong,file); 225 ulong fwrite_unlocked(string,ulong,ulong,file); 226 int pclose(addr); 227 void perror(string); 228 addr popen(string, string); 229 int printf(format); 230 int puts(string); 231 int remove(string); 232 int snprintf(+string2,ulong,format); 233 int sprintf(+string,format); 234 string tempnam(string,string); 235 int vfprintf(file,string,addr); 236 int vsnprintf(+string2,ulong,string,addr); 237 int setvbuf(file,addr,int,ulong); 238 void setbuf(file,addr); 239 void setbuffer(file,addr,ulong); 240 void setlinebuf(file); 241 int rename(string,string); 242 243 # xlocale.h 244 typedef locale_t = void*; 245 locale_t newlocale(hex(int), string, locale_t); 246 247 # stdlib.h 248 long __strtol_internal(string, +string*, int); 249 ulong __strtoul_internal(string, +string*, int); 250 251 double strtod(string, +string*); 252 float strtof(string, +string*); 253 ldouble strtold(string, +string*); 254 255 double strtod_l(string, +string*, locale_t); 256 float strtof_l(string, +string*, locale_t); 257 ldouble strtold_l(string, +string*, locale_t); 258 259 int atexit(addr); 260 addr bsearch(string, addr, ulong, ulong, addr); 261 addr calloc(ulong, ulong); 262 void exit(int); 263 void free(addr); 264 string getenv(string); 265 int putenv(string); 266 int setenv(string,string,int); 267 void unsetenv(string); 268 addr malloc(ulong); 269 void qsort(addr,ulong,ulong,addr); 270 addr realloc(addr,ulong); 271 int system(string); 272 273 int rand(); 274 int rand_r(uint*); 275 void srand(uint); 276 long random(); 277 void srandom(uint); 278 void* initstate(uint, void*, ulong); 279 void* setstate(void*); 280 int random_r(void*, +int*); 281 int srandom_r(uint, void*); 282 int initstate_r(uint, void*, ulong, void*); 283 int setstate_r(void*, void*); 284 double drand48(); 285 double erand48(+array(ushort,3)*); 286 long lrand48(); 287 long nrand48(+array(ushort,3)*); 288 long mrand48(); 289 long jrand48(+array(ushort,3)*); 290 void srand48(long); 291 array(ushort,3)* seed48(array(ushort,3)*); 292 void lcong48(array(ushort,7)*); 293 294 # string.h 295 void bcopy(addr,addr,ulong); 296 void bzero(addr,ulong); 297 string basename(string); 298 string index(string,char); 299 addr memchr(string,char,ulong); 300 addr memcpy(addr,string(array(char, arg3)*),ulong); 301 addr memmove(addr,string(array(char, arg3)*),ulong); 302 addr memset(addr,char,long); 303 string rindex(string,char); 304 addr stpcpy(addr,string); 305 int strcasecmp(string, string); 306 string strcat(string, string); 307 string strchr(string,char); 308 int strcoll(string,string); 309 ulong strlen(string); 310 int strcmp(string,string); 311 addr strcpy(addr,string); 312 addr strdup(string); 313 string strerror(int); 314 int strncmp(string,string,ulong); 315 addr strncpy(addr,string3,ulong); 316 string strrchr(string,char); 317 string strsep(addr,string); 318 ulong strspn(string,string); 319 ulong strcspn(string,string); 320 string strstr(string,string); 321 string strtok(string, string); 322 323 # sys/ioctl.h 324 int ioctl(int, int, addr); 325 326 # sys/socket.h 327 int socket(int,int,int); 328 329 # sys/stat.h 330 int __fxstat(int,int,addr); 331 int __xstat(int,string,addr); 332 int __lxstat(int,string,addr); 333 int __fxstat64(int,int,addr); 334 int __xstat64(int,string,addr); 335 int __lxstat64(int,string,addr); 336 int chmod(string,octal); 337 int fchmod(int,octal); 338 int mkfifo(string,octal); 339 octal umask(octal); 340 341 # sys/utsname.h 342 int uname(addr); 343 344 # sys/vfs.h 345 int statfs(string,addr); 346 347 # syslog.h 348 void closelog(); 349 void openlog(string,int,int); 350 void syslog(int,format); 351 352 # term.h 353 int tputs(string, int, addr); 354 355 # termios.h 356 int tcgetattr(int,addr); 357 int tcsetattr(int,int,addr); 358 359 # time.h 360 string ctime(addr); 361 int gettimeofday(addr, addr); 362 addr gmtime(addr); 363 addr localtime(addr); 364 ulong strftime(+string2,ulong,string,addr); 365 long time(addr); 366 # XXX in fact (time_t, long), which may be (llong, long) on 32-bit 367 # arches. We don't have llong as of this writing. 368 typedef timespec = struct(long, long); 369 int nanosleep(timespec*, timespec*); 370 371 # unistd.h 372 void _exit(int); 373 int access(string, int); 374 uint alarm(uint); 375 int chdir(string); 376 int chown(string,int,int); 377 int close(int); 378 string crypt(string,string); 379 int dup2(int,int); 380 int execlp(string,string,addr,addr,addr); 381 int execv(string,addr); 382 int fchdir(int); 383 int fork(); 384 int ftruncate(int,ulong); 385 string2 getcwd(addr,ulong); 386 int getdomainname(+string2,ulong); 387 int geteuid(); 388 int getegid(); 389 int getgid(); 390 int gethostname(+string2,ulong); 391 string getlogin(); 392 int getopt(int,addr,string); 393 int getpid(); 394 int getppid(); 395 int getuid(); 396 int getpgrp(); 397 int setpgrp(); 398 int getpgid(int); 399 int isatty(int); 400 int link(string,string); 401 int mkdir(string,octal); 402 long read(int, +string[retval], ulong); 403 int rmdir(string); 404 int seteuid(uint); 405 int setgid(int); 406 int sethostname(+string2,ulong); 407 int setpgid(int,int); 408 int setreuid(uint, uint); 409 int setuid(int); 410 uint sleep(uint); 411 int symlink(string,string); 412 int sync(); 413 int truncate(string,ulong); 414 string ttyname(int); 415 int unlink(string); 416 void usleep(uint); 417 long write(int, string3, ulong); 418 addr sbrk(long); 419 int getpagesize(); 420 long lseek(int,long,int); 421 int pipe(addr); 422 423 # utmp.h 424 void endutent(); 425 addr getutent(); 426 void setutent(); 427 428 # wchar.h 429 typedef wchar_t = string(uint); 430 typedef wint_t = string(int); 431 typedef wstring_t = string(array(uint, zero)*); 432 typedef wstring2_t = string(array(uint, zero(arg2))*); 433 typedef wstring3_t = string(array(uint, zero(arg3))*); 434 435 int fwide(FILE*, int); 436 wint_t btowc(int); 437 438 wint_t getwc(FILE *); 439 wint_t getwchar(); 440 wint_t fgetwc(FILE*); 441 wstring_t fgetws(+wstring2_t, int, FILE*); 442 wint_t ungetwc(wint_t, FILE*); 443 444 wint_t fputwc(wchar_t, FILE*); 445 int fputws(wstring_t, FILE*); 446 wint_t putwc(wchar_t, FILE*); 447 wint_t putwchar(wchar_t); 448 449 int wprintf(format(wstring_t)); 450 int fwprintf(FILE*, format(wstring_t)); 451 int swprintf(+wstring2_t, ulong, format(wstring_t)); 452 int vfwprintf(FILE*, wstring_t, addr); 453 int vwprintf(wstring_t, addr); 454 int vswprintf(+wstring2_t, ulong, wstring_t, addr); 455 456 ; int wscanf(const wchar_t *restrict, ...); 457 ; int fwscanf(FILE *restrict, const wchar_t *restrict, ...); 458 ; int swscanf(const wchar_t *restrict, const wchar_t *restrict, ...); 459 ; int vfwscanf(FILE *restrict, const wchar_t *restrict, va_list); 460 ; int vswscanf(const wchar_t *restrict, const wchar_t *restrict, va_list); 461 ; int vwscanf(const wchar_t *restrict, va_list); 462 463 int iswalnum(wint_t); 464 int iswalpha(wint_t); 465 int iswcntrl(wint_t); 466 int iswdigit(wint_t); 467 int iswgraph(wint_t); 468 int iswlower(wint_t); 469 int iswprint(wint_t); 470 int iswpunct(wint_t); 471 int iswspace(wint_t); 472 int iswupper(wint_t); 473 int iswxdigit(wint_t); 474 uint wctype(string); 475 int iswctype(wint_t, uint); 476 477 ulong mbrlen(string, ulong, addr); 478 ulong mbrtowc(+wchar_t*, string[arg3], ulong, addr); 479 ulong mbsrtowcs(+wstring3_t, string*, ulong, addr); 480 ulong wctomb(+string0, wchar_t); 481 ulong wcrtomb(+string0, wchar_t, addr); 482 ulong wcsrtombs(+string3, wstring_t*, ulong, addr); 483 int mbsinit(addr); 484 485 wint_t towlower(wint_t); 486 wint_t towupper(wint_t); 487 488 wstring_t wcscat(wstring_t, wstring_t); 489 wstring_t wcsncat(wstring3_t, wstring_t, ulong); 490 wstring_t wcschr(wstring_t, wchar_t); 491 wstring_t wcsrchr(wstring_t, wchar_t); 492 int wcscmp(wstring_t, wstring_t); 493 int wcsncmp(wstring3_t, wstring3_t, ulong); 494 int wcscoll(wstring_t, wstring_t); 495 addr wcscpy(addr, wstring_t); 496 addr wcsncpy(addr, wstring_t, ulong); 497 ulong wcslen(wstring_t); 498 499 wstring_t wcsstr(wstring_t, wstring_t); 500 wstring_t wcswcs(wstring_t, wstring_t); 501 502 ulong wcscspn(wstring_t, wstring_t); 503 ulong wcsspn(wstring_t, wstring_t); 504 wstring_t wcspbrk(wstring_t, wstring_t); 505 wstring_t wcstok(wstring_t, wstring_t, +wstring_t*); 506 507 ulong wcsftime(+wstring2_t, ulong, wstring_t, addr); 508 509 double wcstod(wstring_t, +wstring_t*); 510 float wcstof(wstring_t, +wstring_t*); 511 ldouble wcstold(wstring_t, +wstring_t*); 512 long wcstol(wstring_t, +wstring_t*, int); 513 llong wcstoll(wstring_t, +wstring_t*, int); 514 ulong wcstoul(wstring_t, +wstring_t*, int); 515 ullong wcstoull(wstring_t, +wstring_t*, int); 516 517 int wcwidth(wchar_t); 518 int wcswidth(wstring2_t, ulong); 519 520 wstring_t wmemchr(wstring3_t, wchar_t, ulong); 521 int wmemcmp(wstring3_t, wstring3_t, ulong); 522 int wctob(wint_t); 523 wstring3_t wmemcpy(addr, wstring3_t, ulong); 524 wstring3_t wmemmove(addr, wstring3_t, ulong); 525 wstring3_t wmemset(addr, wchar_t, ulong); 526 527 # sys/wait.h 528 int wait(addr); 529 int waitpid(int,addr,int); 530 531 # other symbols not included above 532 long a64l(string); 533 string l64a(long); 534 void abort(); 535 int abs(int); 536 long labs(long); 537 538 typedef mntent = struct(string, string, string, string, int, int); 539 int addmntent(file, mntent*); 540 int endmntent(file); 541 int __endmntent(file); 542 file setmntent(string,string); 543 file __setmntent(string,string); 544 mntent *getmntent(addr); 545 mntent *getmntent_r(file, +mntent*, string, int); 546 mntent *__getmntent_r(file, +mntent*, string, int); 547 string hasmntopt(mntent*, string); 548