普通文本  |  548行  |  15.03 KB

# See ltrace.conf(5) for description of syntax of this file.

# XXX ltrace misses long double and long long support
typedef ldouble = double;
typedef llong = long;
typedef ullong = ulong;

void __libc_start_main(hide(void*), hide(int), array(string, arg2));

# arpa/inet.h
typedef in_addr = struct(hex(uint));
int inet_aton(string, +in_addr*);
hex(uint) inet_addr(string);
hex(uint) inet_network(string);
string inet_ntoa(in_addr);
in_addr inet_makeaddr(hex(int), hex(int));
hex(uint) inet_lnaof(in_addr);
hex(uint) inet_netof(in_addr);

# bfd.h
void bfd_init();
int bfd_set_default_target(string);
addr bfd_scan_vma(string, addr, int);
addr bfd_openr(string,string);
int bfd_check_format(addr,int);

# ctype.h
char tolower(char);
char toupper(char);
addr __ctype_b_loc();
addr __ctype_tolower_loc();
addr __ctype_toupper_loc();
ulong __ctype_get_mb_cur_max();

# curses.h
int waddch(addr, char);
int mvprintw(int, int, format);
int wmove(addr, int, int);
int waddnstr(addr, string, int);
string tgoto(string, int, int);

# dirent.h

# We can't portably rely on DIR internals at all.  Ideally this would
# be implemented in a per-OS config file, but even on Linux, we don't
# know whether there's a lock in the structure or not.  Luckily the
# one interesting datum, file descriptor, we can access reliably.
# Having the structure half-defined like this is potentially
# problematic as structure size influences parameter passing.  But
# POSIX always uses pointer to the structure, so it's fine.

typedef DIR = struct(int);
typedef FILE = addr;

# XXX We can't represent the following portably without having either
# uulong, or directly uint64_t.'

typedef ino_t = ulong;
typedef ino_t64 = ulong;
typedef off_t = ulong;
typedef off_t64 = ulong;

typedef dirent = struct(ino_t, hide(off_t), hide(ushort), hide(char), string(array(char, zero(256))));
typedef dirent64 = struct(ino_t64, hide(off_t64), hide(ushort), hide(char), string(array(char, zero(256))));

dirent *readdir(DIR *);
dirent64 *readdir64(DIR *);
int closedir(DIR *);
DIR *opendir(string);
DIR *fdopendir(int);
int dirfd(DIR *);
void rewinddir(DIR *);
long telldir(DIR *);
void seekdir(DIR *, long);

# dlfcn.h
addr  dlopen(string, int);
string dlerror();
addr  dlsym(addr, string);
int dlclose(addr);

# errno.h
addr __errno_location();

# fcntl.h
int open(string,int,octal);		; WARNING: 3rd argument may not be there
int open64(string,int,octal);		; WARNING: 3rd argument may not be there

# fnmatch.h
int fnmatch(string, string, int);

# getopt.h
int getopt_long(int,addr,string,addr,int*);
int getopt_long_only(int,addr,string,addr,addr);

# grp.h
void endgrent();
addr getgrnam(string);
void setgrent();
addr getgrent();

# libintl.h
string __dcgettext(string,string,int);
string bindtextdomain(string, string);
string textdomain(string);

# libio.h
char _IO_getc(file);
int _IO_putc(char,file);

# locale.h
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);

# mcheck.h
void mtrace();
void muntrace();

# mqueue.h
int mq_open(string, int, octal, addr);  ; WARNING: 3rd and 4th arguments may not be there
int mq_close(int);
int mq_unlink(string);
int mq_getattr(int, addr);
int mq_setattr(int, addr, addr);
int mq_notify(int, addr);
int mq_send(int, string3, ulong, uint);
int mq_timedsend(int, string3, ulong, uint, addr);
long mq_receive(int, +string0, ulong, addr);
long mq_timedreceive(int, +string0, ulong, addr, addr);

# netdb.h
void endhostent();
void endnetent();
void endnetgrent();
void endprotoent();
void endservent();
void freeaddrinfo(addr);
string gai_strerror(int);
int getaddrinfo(string, string, addr, addr);
addr gethostbyaddr(string, uint, int);
addr gethostbyname(string);
addr gethostent();
int getnameinfo(addr, uint, string, uint, string, uint, uint);
addr getnetbyaddr(uint, int);
addr getnetbyname(string);
addr getnetent();
int getnetgrent(addr, addr, addr);
addr getprotobyname(string);
addr getprotobynumber(int);
addr getprotoent();
addr getservbyname(string, string);
addr getservbyport(int, string);
addr getservent();
void herror(string);
string hstrerror(int);
int rcmd(addr, ushort, string, string, string, addr);
int rcmd_af(addr, ushort, string, string, string, addr, int);
int rexec(addr, int, string, string, string, addr);
int rexec_af(addr, int, string, string, string, addr, int);
int rresvport (addr);
int rresvport_af (addr, int);
int ruserok(string, int, string, string);
int ruserok_af(string, int, string, string, int);
void sethostent(int);
void setnetent(int);
int setnetgrent(string);
void setprotoent(int);
void setservent(int);

# netinet/in.h
uint ntohs(uint);

# pcap.h
string pcap_lookupdev(addr);
addr pcap_open_live(string, int, int, int, addr);
int pcap_snapshot(addr);
int pcap_lookupnet(string, addr, addr, addr);
int pcap_compile(addr, addr, string, int, addr);

# pwd.h
string getpass(string);
void endpwent();
addr getpwnam(string);
void setpwent();

# readline/readline.h
string readline(string);

# signal.h
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);
typedef sigset_t = bitvec(ulong);
# elm3 should be flags
typedef sigaction = struct(addr, sigset_t, hex(int), addr);
int kill(int, signum);
int sigemptyset(+sigset_t*);
int sigaddset(+sigset_t*, signum);
int sigdelset(+sigset_t*, signum);
int sigfillset(+sigset_t*);
int sigismember(sigset_t*, signum);
addr signal(signum,addr);
int sigaction(signum, sigaction*, +sigaction*);
int sigprocmask(enum(SIG_BLOCK=1, SIG_UNBLOCK=2, SIG_SETMASK=3), sigset_t*, +sigset_t*);
int sigpending(+sigset_t*);
int sigsuspend(sigset_t*);
int sigisemptyset(sigset_t*);
int sigorset(+sigset_t*, sigset_t*, sigset_t*);
int sigandset(+sigset_t*, sigset_t*, sigset_t*);

# stdio.h
int fclose(file);
int feof(file);
int ferror(file);
int fflush(file);
char fgetc(file);
addr fgets(+string, int, file);
int fileno(file);
file fopen(string,string);
file fopen64(string,string);
file fdopen(int, string);
int fprintf(file,format);
int fputc(char,file);
int fputs(string,file);
ulong fread(addr,ulong,ulong,file);
ulong fread_unlocked(addr,ulong,ulong,file);
ulong fwrite(string,ulong,ulong,file);
ulong fwrite_unlocked(string,ulong,ulong,file);
int pclose(addr);
void perror(string);
addr popen(string, string);
int printf(format);
int puts(string);
int remove(string);
int snprintf(+string2,ulong,format);
int sprintf(+string,format);
string tempnam(string,string);
int vfprintf(file,string,addr);
int vsnprintf(+string2,ulong,string,addr);
int setvbuf(file,addr,int,ulong);
void setbuf(file,addr);
void setbuffer(file,addr,ulong);
void setlinebuf(file);
int rename(string,string);

# xlocale.h
typedef locale_t = void*;
locale_t newlocale(hex(int), string, locale_t);

# stdlib.h
long __strtol_internal(string, +string*, int);
ulong __strtoul_internal(string, +string*, int);

double strtod(string, +string*);
float strtof(string, +string*);
ldouble strtold(string, +string*);

double strtod_l(string, +string*, locale_t);
float strtof_l(string, +string*, locale_t);
ldouble strtold_l(string, +string*, locale_t);

int atexit(addr);
addr bsearch(string, addr, ulong, ulong, addr);
addr calloc(ulong, ulong);
void exit(int);
void free(addr);
string getenv(string);
int putenv(string);
int setenv(string,string,int);
void unsetenv(string);
addr malloc(ulong);
void qsort(addr,ulong,ulong,addr);
addr realloc(addr,ulong);
int system(string);

int rand();
int rand_r(uint*);
void srand(uint);
long random();
void srandom(uint);
void* initstate(uint, void*, ulong);
void* setstate(void*);
int random_r(void*, +int*);
int srandom_r(uint, void*);
int initstate_r(uint, void*, ulong, void*);
int setstate_r(void*, void*);
double drand48();
double erand48(+array(ushort,3)*);
long lrand48();
long nrand48(+array(ushort,3)*);
long mrand48();
long jrand48(+array(ushort,3)*);
void srand48(long);
array(ushort,3)* seed48(array(ushort,3)*);
void lcong48(array(ushort,7)*);

# string.h
void bcopy(addr,addr,ulong);
void bzero(addr,ulong);
string basename(string);
string index(string,char);
addr memchr(string,char,ulong);
addr memcpy(addr,string(array(char, arg3)*),ulong);
addr memmove(addr,string(array(char, arg3)*),ulong);
addr memset(addr,char,long);
string rindex(string,char);
addr stpcpy(addr,string);
int strcasecmp(string, string);
string strcat(string, string);
string strchr(string,char);
int strcoll(string,string);
ulong strlen(string);
int strcmp(string,string);
addr strcpy(addr,string);
addr strdup(string);
string strerror(int);
int strncmp(string,string,ulong);
addr strncpy(addr,string3,ulong);
string strrchr(string,char);
string strsep(addr,string);
ulong strspn(string,string);
ulong strcspn(string,string);
string strstr(string,string);
string strtok(string, string);

# sys/ioctl.h
int ioctl(int, int, addr);

# sys/socket.h
int socket(int,int,int);

# sys/stat.h
int __fxstat(int,int,addr);
int __xstat(int,string,addr);
int __lxstat(int,string,addr);
int __fxstat64(int,int,addr);
int __xstat64(int,string,addr);
int __lxstat64(int,string,addr);
int chmod(string,octal);
int fchmod(int,octal);
int mkfifo(string,octal);
octal umask(octal);

# sys/utsname.h
int uname(addr);

# sys/vfs.h
int statfs(string,addr);

# syslog.h
void closelog();
void openlog(string,int,int);
void syslog(int,format);

# term.h
int tputs(string, int, addr);

# termios.h
int tcgetattr(int,addr);
int tcsetattr(int,int,addr);

# time.h
string ctime(addr);
int gettimeofday(addr, addr);
addr gmtime(addr);
addr localtime(addr);
ulong strftime(+string2,ulong,string,addr);
long time(addr);
# XXX in fact (time_t, long), which may be (llong, long) on 32-bit
# arches.  We don't have llong as of this writing.
typedef timespec = struct(long, long);
int nanosleep(timespec*, timespec*);

# unistd.h
void _exit(int);
int access(string, int);
uint alarm(uint);
int chdir(string);
int chown(string,int,int);
int close(int);
string crypt(string,string);
int dup2(int,int);
int execlp(string,string,addr,addr,addr);
int execv(string,addr);
int fchdir(int);
int fork();
int ftruncate(int,ulong);
string2 getcwd(addr,ulong);
int getdomainname(+string2,ulong);
int geteuid();
int getegid();
int getgid();
int gethostname(+string2,ulong);
string getlogin();
int getopt(int,addr,string);
int getpid();
int getppid();
int getuid();
int getpgrp();
int setpgrp();
int getpgid(int);
int isatty(int);
int link(string,string);
int mkdir(string,octal);
long read(int, +string[retval], ulong);
int rmdir(string);
int seteuid(uint);
int setgid(int);
int sethostname(+string2,ulong);
int setpgid(int,int);
int setreuid(uint, uint);
int setuid(int);
uint sleep(uint);
int symlink(string,string);
int sync();
int truncate(string,ulong);
string ttyname(int);
int unlink(string);
void usleep(uint);
long write(int, string3, ulong);
addr sbrk(long);
int getpagesize();
long lseek(int,long,int);
int pipe(addr);

# utmp.h
void endutent();
addr getutent();
void setutent();

# wchar.h
typedef wchar_t = string(uint);
typedef wint_t = string(int);
typedef wstring_t = string(array(uint, zero)*);
typedef wstring2_t = string(array(uint, zero(arg2))*);
typedef wstring3_t = string(array(uint, zero(arg3))*);

int fwide(FILE*, int);
wint_t btowc(int);

wint_t getwc(FILE *);
wint_t getwchar();
wint_t fgetwc(FILE*);
wstring_t fgetws(+wstring2_t, int, FILE*);
wint_t ungetwc(wint_t, FILE*);

wint_t fputwc(wchar_t, FILE*);
int fputws(wstring_t, FILE*);
wint_t putwc(wchar_t, FILE*);
wint_t putwchar(wchar_t);

int wprintf(format(wstring_t));
int fwprintf(FILE*, format(wstring_t));
int swprintf(+wstring2_t, ulong, format(wstring_t));
int vfwprintf(FILE*, wstring_t, addr);
int vwprintf(wstring_t, addr);
int vswprintf(+wstring2_t, ulong, wstring_t, addr);

; int wscanf(const wchar_t *restrict, ...);
; int fwscanf(FILE *restrict, const wchar_t *restrict, ...);
; int swscanf(const wchar_t *restrict, const wchar_t *restrict, ...);
; int vfwscanf(FILE *restrict, const wchar_t *restrict, va_list);
; int vswscanf(const wchar_t *restrict, const wchar_t *restrict, va_list);
; int vwscanf(const wchar_t *restrict, va_list);

int iswalnum(wint_t);
int iswalpha(wint_t);
int iswcntrl(wint_t);
int iswdigit(wint_t);
int iswgraph(wint_t);
int iswlower(wint_t);
int iswprint(wint_t);
int iswpunct(wint_t);
int iswspace(wint_t);
int iswupper(wint_t);
int iswxdigit(wint_t);
uint wctype(string);
int iswctype(wint_t, uint);

ulong mbrlen(string, ulong, addr);
ulong mbrtowc(+wchar_t*, string[arg3], ulong, addr);
ulong mbsrtowcs(+wstring3_t, string*, ulong, addr);
ulong wctomb(+string0, wchar_t);
ulong wcrtomb(+string0, wchar_t, addr);
ulong wcsrtombs(+string3, wstring_t*, ulong, addr);
int mbsinit(addr);

wint_t towlower(wint_t);
wint_t towupper(wint_t);

wstring_t wcscat(wstring_t, wstring_t);
wstring_t wcsncat(wstring3_t, wstring_t, ulong);
wstring_t wcschr(wstring_t, wchar_t);
wstring_t wcsrchr(wstring_t, wchar_t);
int wcscmp(wstring_t, wstring_t);
int wcsncmp(wstring3_t, wstring3_t, ulong);
int wcscoll(wstring_t, wstring_t);
addr wcscpy(addr, wstring_t);
addr wcsncpy(addr, wstring_t, ulong);
ulong wcslen(wstring_t);

wstring_t wcsstr(wstring_t, wstring_t);
wstring_t wcswcs(wstring_t, wstring_t);

ulong wcscspn(wstring_t, wstring_t);
ulong wcsspn(wstring_t, wstring_t);
wstring_t wcspbrk(wstring_t, wstring_t);
wstring_t wcstok(wstring_t, wstring_t, +wstring_t*);

ulong wcsftime(+wstring2_t, ulong, wstring_t, addr);

double wcstod(wstring_t, +wstring_t*);
float wcstof(wstring_t, +wstring_t*);
ldouble wcstold(wstring_t, +wstring_t*);
long wcstol(wstring_t, +wstring_t*, int);
llong wcstoll(wstring_t, +wstring_t*, int);
ulong wcstoul(wstring_t, +wstring_t*, int);
ullong wcstoull(wstring_t, +wstring_t*, int);

int wcwidth(wchar_t);
int wcswidth(wstring2_t, ulong);

wstring_t wmemchr(wstring3_t, wchar_t, ulong);
int wmemcmp(wstring3_t, wstring3_t, ulong);
int wctob(wint_t);
wstring3_t wmemcpy(addr, wstring3_t, ulong);
wstring3_t wmemmove(addr, wstring3_t, ulong);
wstring3_t wmemset(addr, wchar_t, ulong);

# sys/wait.h
int wait(addr);
int waitpid(int,addr,int);

# other symbols not included above
long a64l(string);
string l64a(long);
void abort();
int abs(int);
long labs(long);

typedef mntent = struct(string, string, string, string, int, int);
int addmntent(file, mntent*);
int endmntent(file);
int __endmntent(file);
file setmntent(string,string);
file __setmntent(string,string);
mntent *getmntent(addr);
mntent *getmntent_r(file, +mntent*, string, int);
mntent *__getmntent_r(file, +mntent*, string, int);
string hasmntopt(mntent*, string);