tools/nolibc: Add the definition for dup()

This commit adds the dup() function, which was omitted when sys_dup()
was defined.  This is a port of nolibc's upstream commit 47cc42a79c92
to the Linux kernel.

Fixes: 66b6f755ad ("rcutorture: Import a copy of nolibc")
Tested-by: Valentin Schneider <valentin.schneider@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com> [arm64]
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Willy Tarreau 2021-01-21 08:20:23 +01:00 committed by Paul E. McKenney
parent 7c53f6b671
commit c261145abd

View File

@ -1852,6 +1852,18 @@ int close(int fd)
return ret; return ret;
} }
static __attribute__((unused))
int dup(int fd)
{
int ret = sys_dup(fd);
if (ret < 0) {
SET_ERRNO(-ret);
ret = -1;
}
return ret;
}
static __attribute__((unused)) static __attribute__((unused))
int dup2(int old, int new) int dup2(int old, int new)
{ {