+#if _LFS64_LARGEFILE
+int
+sys_getdents64(tcp)
+struct tcb *tcp;
+{
+ int i, len, dents = 0;
+ char *buf;
+
+ if (entering(tcp)) {
+ tprintf("%lu, ", tcp->u_arg[0]);
+ return 0;
+ }
+ if (syserror(tcp) || !verbose(tcp)) {
+ tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
+ return 0;
+ }
+ len = tcp->u_rval;
+ if ((buf = malloc(len)) == NULL) {
+ tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
+ fprintf(stderr, "out of memory\n");
+ return 0;
+ }
+ if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
+ tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
+ free(buf);
+ return 0;
+ }
+ if (!abbrev(tcp))
+ tprintf("{");
+ for (i = 0; i < len;) {
+ struct dirent64 *d = (struct dirent64 *) &buf[i];
+#if defined(LINUX) || defined(SVR4)
+ if (!abbrev(tcp)) {
+ tprintf("%s{d_ino=%llu, d_off=%llu, ",
+ i ? " " : "",
+ d->d_ino,
+ d->d_off);
+#ifdef LINUX
+ tprintf("d_type=");
+ printxval(direnttypes, d->d_type, "DT_???");
+ tprintf(", ");
+#endif
+ tprintf("d_reclen=%u, d_name=\"%s\"}",
+ d->d_reclen, d->d_name);
+ }
+#endif /* LINUX || SVR4 */
+#ifdef SUNOS4
+ if (!abbrev(tcp)) {
+ tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
+ i ? " " : "", d->d_off, d->d_fileno,
+ d->d_reclen);
+ tprintf("d_namlen=%u, d_name=\"%.*s\"}",
+ d->d_namlen, d->d_namlen, d->d_name);
+ }
+#endif /* SUNOS4 */
+ i += d->d_reclen;
+ dents++;
+ }
+ if (!abbrev(tcp))
+ tprintf("}");
+ else
+ tprintf("/* %u entries */", dents);
+ tprintf(", %lu", tcp->u_arg[2]);
+ free(buf);
+ return 0;
+}
+#endif
+
+#ifdef FREEBSD
+int
+sys_getdirentries(tcp)
+struct tcb * tcp;
+{
+ int i, len, dents = 0;
+ long basep;
+ char *buf;
+
+ if (entering(tcp)) {
+ tprintf("%lu, ", tcp->u_arg[0]);
+ return 0;
+ }
+ if (syserror(tcp) || !verbose(tcp)) {
+ tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
+ return 0;
+ }
+ len = tcp->u_rval;
+ if ((buf = malloc(len)) == NULL) {
+ tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
+ fprintf(stderr, "out of memory\n");
+ return 0;
+ }
+ if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
+ tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
+ free(buf);
+ return 0;
+ }
+ if (!abbrev(tcp))
+ tprintf("{");
+ for (i = 0; i < len;) {
+ struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
+ if (!abbrev(tcp)) {
+ tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
+ i ? " " : "", d->d_fileno, d->d_reclen);
+ printxval(direnttypes, d->d_type, "DT_???");
+ tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
+ d->d_namlen, d->d_namlen, d->d_name);
+ }
+ i += d->d_reclen;
+ dents++;
+ }
+ if (!abbrev(tcp))
+ tprintf("}");
+ else
+ tprintf("/* %u entries */", dents);
+ free(buf);
+ tprintf(", %lu", tcp->u_arg[2]);
+ if (umove(tcp, tcp->u_arg[3], &basep) < 0)
+ tprintf(", %#lx", tcp->u_arg[3]);
+ else
+ tprintf(", [%lu]", basep);
+ return 0;
+}
+#endif
+
+#ifdef LINUX