提交 161dec53 编写于 作者: W wcc0

fix: add fchdir

add fchdir and testcases

Change-Id: Idb62087ddc46b3b7db4ceaef478d7b9192115628
Signed-off-by: Nwcc0 <917033401@qq.com>
上级 42b36311
#include <unsupported_api.h>
#include "stdio_impl.h"
#include "pthread_impl.h"
void flockfile(FILE *f)
{
unsupported_api(__FUNCTION__);
if (!ftrylockfile(f)) return;
__lockfile(f);
__register_locked_file(f, __pthread_self());
}
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <unsupported_api.h>
#include "syscall.h"
int fchdir(int fd)
{
unsupported_api(__FUNCTION__);
int ret = __syscall(SYS_fchdir, fd);
if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0)
return __syscall_ret(ret);
char buf[15+3*sizeof(int)];
__procfdname(buf, fd);
return syscall(SYS_chdir, buf);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册