--- etc/libc.so-types.conf | 71 ++++++++++++++++++++++++++++++++++++++++++++ etc/libc.so.conf | 46 +--------------------------- etc/libm.so.conf | 11 +------ etc/libpthread.so-types.conf | 23 ++++++++++++++ etc/libpthread.so.conf | 34 ++------------------- 5 files changed, 98 insertions(+), 87 deletions(-) create mode 100644 etc/libc.so-types.conf create mode 100644 etc/libpthread.so-types.conf
diff --git a/etc/libc.so-types.conf b/etc/libc.so-types.conf new file mode 100644 index 0000000..ef99565 --- /dev/null +++ b/etc/libc.so-types.conf @@ -0,0 +1,71 @@ +# XXX ltrace misses long double and long long support +typedef ldouble = double; +typedef llong = long; +typedef ullong = ulong; + +# This should generally work, I'm not aware of any arch, where the +# parameter passing of complex arguments differs from that for +# structure of two floats. +typedef double_complex = struct(double, double); +typedef float_complex = struct(float, float); +typedef ldouble_complex = struct(ldouble, ldouble); + +# arpa/inet.h +typedef in_addr = struct(hex(uint)); + +# 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 size_t = ulong; +typedef ssize_t = long; + +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)))); + +# mntent.h +typedef mntent = struct(string, string, string, string, int, int); + +# sched.h +typedef sched_param = struct(int); +typedef sched_policy_e = enum[int](SCHED_FIFO=1, SCHED_RR=2, SCHED_OTHER=0); + +# 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); + +# sys/mman.h +typedef mmap_flags_t = enum(MAP_SHARED=1, MAP_PRIVATE=2); + +# time.h +typedef clockid_t = int; +# 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); + +# 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))*); + +# xlocale.h +typedef locale_t = void*; diff --git a/etc/libc.so.conf b/etc/libc.so.conf index 8a209b4..4e9db60 100644 --- a/etc/libc.so.conf +++ b/etc/libc.so.conf @@ -1,14 +1,10 @@ # 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; +import "libc.so-types"; 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); @@ -40,30 +36,6 @@ 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 size_t = ulong; -typedef ssize_t = long; - -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 *); @@ -187,10 +159,6 @@ void setpwent(); 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); @@ -242,7 +210,6 @@ void setlinebuf(file); int rename(string,string); # xlocale.h -typedef locale_t = void*; locale_t newlocale(hex(int), string, locale_t); # stdlib.h @@ -364,9 +331,6 @@ 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 @@ -427,12 +391,6 @@ 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); @@ -536,7 +494,6 @@ 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); @@ -548,7 +505,6 @@ mntent *__getmntent_r(file, +mntent*, string, int); string hasmntopt(mntent*, string); # XXX the third argument is a bitfield -typedef mmap_flags_t = enum(MAP_SHARED=1, MAP_PRIVATE=2); addr mmap(addr, size_t, hex(int), mmap_flags_t, int, off_t); addr mmap64(addr, size_t, hex(int), mmap_flags_t, int, off_t64); void munmap(addr, size_t); diff --git a/etc/libm.so.conf b/etc/libm.so.conf index 8159221..ba2db07 100644 --- a/etc/libm.so.conf +++ b/etc/libm.so.conf @@ -1,13 +1,4 @@ -# XXX ltrace misses long double and long long support -typedef ldouble = double; -typedef llong = long; - -# This should generally work, I'm not aware of any arch, where the -# parameter passing of complex arguments differs from that for -# structure of two floats. -typedef double_complex = struct(double, double); -typedef float_complex = struct(float, float); -typedef ldouble_complex = struct(ldouble, ldouble); +#include "libc.so-types.conf"; double sin(double); float sinf(float); diff --git a/etc/libpthread.so-types.conf b/etc/libpthread.so-types.conf new file mode 100644 index 0000000..341abc3 --- /dev/null +++ b/etc/libpthread.so-types.conf @@ -0,0 +1,23 @@ +typedef pthread_t = ulong; +typedef pthread_attr_t = void; +typedef pthread_barrier_t = void; +typedef pthread_barrierattr_t = void; +typedef pthread_cond_t = void; +typedef pthread_condattr_t = void; +typedef pthread_key_t = uint; +typedef pthread_mutex_t = void; +typedef pthread_mutexattr_t = void; +typedef pthread_once_t = void; +typedef pthread_rwlock_t = void; +typedef pthread_rwlockattr_t = void; +typedef pthread_spinlock_t = void; + +typedef pthread_cancel_state_e = enum[int](PTHREAD_CANCEL_DISABLE=1, PTHREAD_CANCEL_ENABLE=0); +typedef pthread_cancel_type_e = enum[int](PTHREAD_CANCEL_ASYNCHRONOUS=1, PTHREAD_CANCEL_DEFERRED=0); +typedef pthread_detach_state_e = enum[int](PTHREAD_CREATE_DETACHED=1, PTHREAD_CREATE_JOINABLE=0); +typedef pthread_inherit_sched_e = enum[int](PTHREAD_EXPLICIT_SCHED=1, PTHREAD_INHERIT_SCHED=0); +typedef pthread_mutex_protocol_e = enum[int](PTHREAD_PRIO_INHERIT=1, PTHREAD_PRIO_NONE=0, PTHREAD_PRIO_PROTECT=2); +typedef pthread_mutex_robust_e = enum[int](PTHREAD_MUTEX_ROBUST=1, PTHREAD_MUTEX_STALLED=0); +typedef pthread_mutex_type_e = enum[int](PTHREAD_MUTEX_ERRORCHECK=2, PTHREAD_MUTEX_NORMAL=0, PTHREAD_MUTEX_RECURSIVE=1); +typedef pthread_pshared_e = enum[int](PTHREAD_PROCESS_SHARED=1, PTHREAD_PROCESS_PRIVATE=0); +typedef pthread_scope_e = enum[int](PTHREAD_SCOPE_PROCESS=1, PTHREAD_SCOPE_SYSTEM=0); diff --git a/etc/libpthread.so.conf b/etc/libpthread.so.conf index 1cd8876..7cb8f45 100644 --- a/etc/libpthread.so.conf +++ b/etc/libpthread.so.conf @@ -1,35 +1,5 @@ -typedef clockid_t = int; -typedef size_t = ulong; - -typedef sched_param = struct(int); -typedef sigset_t = bitvec(ulong); -typedef timespec = struct(long, long); - -typedef sched_policy_e = enum[int](SCHED_FIFO=1, SCHED_RR=2, SCHED_OTHER=0); - -typedef pthread_t = ulong; -typedef pthread_attr_t = void; -typedef pthread_barrier_t = void; -typedef pthread_barrierattr_t = void; -typedef pthread_cond_t = void; -typedef pthread_condattr_t = void; -typedef pthread_key_t = uint; -typedef pthread_mutex_t = void; -typedef pthread_mutexattr_t = void; -typedef pthread_once_t = void; -typedef pthread_rwlock_t = void; -typedef pthread_rwlockattr_t = void; -typedef pthread_spinlock_t = void; - -typedef pthread_cancel_state_e = enum[int](PTHREAD_CANCEL_DISABLE=1, PTHREAD_CANCEL_ENABLE=0); -typedef pthread_cancel_type_e = enum[int](PTHREAD_CANCEL_ASYNCHRONOUS=1, PTHREAD_CANCEL_DEFERRED=0); -typedef pthread_detach_state_e = enum[int](PTHREAD_CREATE_DETACHED=1, PTHREAD_CREATE_JOINABLE=0); -typedef pthread_inherit_sched_e = enum[int](PTHREAD_EXPLICIT_SCHED=1, PTHREAD_INHERIT_SCHED=0); -typedef pthread_mutex_protocol_e = enum[int](PTHREAD_PRIO_INHERIT=1, PTHREAD_PRIO_NONE=0, PTHREAD_PRIO_PROTECT=2); -typedef pthread_mutex_robust_e = enum[int](PTHREAD_MUTEX_ROBUST=1, PTHREAD_MUTEX_STALLED=0); -typedef pthread_mutex_type_e = enum[int](PTHREAD_MUTEX_ERRORCHECK=2, PTHREAD_MUTEX_NORMAL=0, PTHREAD_MUTEX_RECURSIVE=1); -typedef pthread_pshared_e = enum[int](PTHREAD_PROCESS_SHARED=1, PTHREAD_PROCESS_PRIVATE=0); -typedef pthread_scope_e = enum[int](PTHREAD_SCOPE_PROCESS=1, PTHREAD_SCOPE_SYSTEM=0); +import "libc.so-types"; +import "libpthread.so-types"; # <pthread.h> -- 1.8.5.6 _______________________________________________ Ltrace-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/ltrace-devel
