Files
ftmemsim-valgrind/memcheck/tests/darwin/pth-undocumented.c
Rhys Kidd a6edce5f4a Fix unhandled syscall: unix:348 (__pthread_chdir) and unhandled syscall: unix:349 (__pthread_fchdir) on OS X
bz#344512
- Support these two undocumented syscalls.
- New regression test case added.

Before:

== 588 tests, 239 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==

After:

== 589 tests, 239 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14987
2015-03-07 08:36:20 +00:00

42 lines
690 B
C

#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;
}