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