mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-17 16:21:47 +00:00
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
42 lines
690 B
C
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;
|
|
}
|