aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2013-09-05 20:20:12 +0200
committerPetr Machata <pmachata@redhat.com>2013-09-05 20:20:12 +0200
commit4394755b0307a24b86f348755eb0443284132378 (patch)
treea8c02c31eb3f7cdc7bc0aa15ce630b6b151181e1 /etc
parent21162294ffcb3238e41749a3f056b54c21cf296c (diff)
downloadltrace-4394755b0307a24b86f348755eb0443284132378.tar.gz
Better formatting of readdir and friends
Diffstat (limited to 'etc')
-rw-r--r--etc/ltrace.conf36
1 files changed, 32 insertions, 4 deletions
diff --git a/etc/ltrace.conf b/etc/ltrace.conf
index a98ec3e..b82df19 100644
--- a/etc/ltrace.conf
+++ b/etc/ltrace.conf
@@ -40,10 +40,37 @@ int waddnstr(addr, string, int);
string tgoto(string, int, int);
; dirent.h
-int closedir(addr);
-addr opendir(string);
-addr readdir(addr);
-addr readdir64(addr);
+
+; 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);
+
+; 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);
@@ -560,3 +587,4 @@ ulong SYS_readv(int,addr,int);
ulong SYS_writev(int,addr,int);
int SYS_mprotect(addr,int,int);
int SYS_access(string,octal);
+int SYS_getdents(uint, void *, uint);