Linux: consolidate link implementation

Use link syscall if defined, otherwise use linkat.

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella Netto 2022-10-19 19:14:12 -03:00 committed by Adhemerval Zanella
parent 25ca6175ba
commit f178e5173f

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
/* Make a new name for a file. Linux version.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -23,7 +24,11 @@
int
__link (const char *from, const char *to)
{
return INLINE_SYSCALL (linkat, 5, AT_FDCWD, from, AT_FDCWD, to, 0);
#ifdef __NR_link
return INLINE_SYSCALL_CALL (link, from, to);
#else
return INLINE_SYSCALL_CALL (linkat, AT_FDCWD, from, AT_FDCWD, to, 0);
#endif
}
weak_alias (__link, link)