344499 Fix compilation for Linux kernel >= 4. With this, also require
a Linux kernel >= 2.6 as 2.4 is mostly untested and might trigger
obvious and non-obvious issues
+344512 Fix unhandled syscall: unix:348 (__pthread_chdir) and unhandled
+ syscall: unix:349 (__pthread_fchdir) on OS X
344560 Fix stack traces missing penultimate frame on OS X
344621 Fix memcheck/tests/err_disable4 test on OS X
344686 Fix suppression for pthread_rwlock_init on OS X 10.10
DECL_TEMPLATE(darwin, statfs64); // 345
DECL_TEMPLATE(darwin, fstatfs64); // 346
DECL_TEMPLATE(darwin, getfsstat64); // 347
-// NYI __pthread_chdir 348
-// NYI __pthread_fchdir 349
+DECL_TEMPLATE(darwin, __pthread_chdir); // 348
+DECL_TEMPLATE(darwin, __pthread_fchdir); // 349
// NYI audit 350
DECL_TEMPLATE(darwin, auditon); // 351
// 352
}
+PRE(__pthread_chdir)
+{
+ PRINT("__pthread_chdir ( %#lx(%s) )", ARG1, (char*)ARG1);
+ PRE_REG_READ1(long, "__pthread_chdir", const char *, path);
+ PRE_MEM_RASCIIZ( "__pthread_chdir(path)", ARG1 );
+}
+
+
+
+PRE(__pthread_fchdir)
+{
+ PRINT("__pthread_fchdir ( %ld )", ARG1);
+ PRE_REG_READ1(long, "__pthread_fchdir", unsigned int, fd);
+}
+
+
PRE(kdebug_trace)
{
PRINT("kdebug_trace(%ld, %ld, %ld, %ld, %ld, %ld)",
MACXY(__NR_statfs64, statfs64),
MACXY(__NR_fstatfs64, fstatfs64),
MACXY(__NR_getfsstat64, getfsstat64),
-// _____(__NR___pthread_chdir),
-// _____(__NR___pthread_fchdir),
+ MACX_(__NR___pthread_chdir, __pthread_chdir),
+ MACX_(__NR___pthread_fchdir, __pthread_fchdir),
// _____(__NR_audit),
MACXY(__NR_auditon, auditon),
_____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(352)), // ???
deep_badparam.stderr.exp deep_badparam.stdout.exp deep_badparam.vgtest \
env.stderr.exp env.vgtest \
pth-supp.stderr.exp pth-supp.vgtest \
+ pth-undocumented.stderr.exp pth-undocumented.stdout.exp pth-undocumented.vgtest \
scalar.stderr.exp scalar.vgtest \
scalar_fork.stderr.exp scalar_fork.vgtest \
scalar_nocancel.stderr.exp scalar_nocancel.vgtest \
deep_badparam \
env \
pth-supp \
+ pth-undocumented \
scalar \
scalar_fork \
scalar_nocancel \
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#ifndef SYS___pthread_chdir
+# define SYS___pthread_chdir 348
+#endif
+
+#ifndef SYS___pthread_fchdir
+# define SYS___pthread_fchdir 349
+#endif
+
+int __pthread_chdir(const char *path)
+{
+ return syscall(SYS___pthread_chdir, path);
+}
+
+int __pthread_fchdir(int dirfd)
+{
+ return syscall(SYS___pthread_fchdir, dirfd);
+}
+
+int main(void)
+{
+ int dirfd;
+
+ dirfd = open("/", O_RDONLY);
+ if (dirfd == -1)
+ perror("open"), exit(1);
+
+ if (__pthread_chdir("/"))
+ perror("__pthread_chdir");
+
+ if (__pthread_fchdir(dirfd))
+ perror("__pthread_fchdir");
+
+ return 0;
+}
--- /dev/null
+prog: pth-undocumented
+vgopts: -q