Skip to content

Commit

Permalink
vfs: add minimal implementation of unlinkat
Browse files Browse the repository at this point in the history
The aarch64 version of Linux does not implement SYS_unlink.
The musl stdio/tmpfile.c in such case falls back to SYS_unlinkat.

This patch adds minimal implementation of unlinkat just enough
to make tmpfile() functional. The tmpfile() calls unlinkat()
with dirfd = AT_FDCWD and flags = 0 which is what our version
of unlinkat() implements for now.

Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
Message-Id: <20201219210335.3003-1-jwkozaczuk@gmail.com>
  • Loading branch information
wkozaczuk authored and nyh committed Dec 20, 2020
1 parent 5e86572 commit 4499f2c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/vfs/main.cc
Expand Up @@ -1109,6 +1109,15 @@ int unlink(const char *pathname)
return -1;
}

int unlinkat(int dirfd, const char *pathname, int flags)
{
//TODO: Really implement it
if (dirfd != AT_FDCWD || flags) {
UNIMPLEMENTED("unlinkat() with non-zero flags or dirfd != AT_FDCWD");
}
return unlink(pathname);
}

TRACEPOINT(trace_vfs_stat, "\"%s\" %p", const char*, struct stat*);
TRACEPOINT(trace_vfs_stat_ret, "");
TRACEPOINT(trace_vfs_stat_err, "%d", int);
Expand Down

0 comments on commit 4499f2c

Please sign in to comment.