Skip to content

Commit 4b6ffb2

Browse files
committed
tools/nolibc: remove __nolibc_enosys() fallback from *at() functions
All architectures have had one of the real functions available since Linux 2.6.12. The additional fallback to __nolibc_enosys() is superfluous. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250821-nolibc-enosys-v1-2-4b63f2caaa89@weissschuh.net
1 parent e636610 commit 4b6ffb2

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

  • tools/include/nolibc

tools/include/nolibc/sys.h

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,8 @@ int sys_chmod(const char *path, mode_t mode)
142142
{
143143
#if defined(__NR_fchmodat)
144144
return my_syscall4(__NR_fchmodat, AT_FDCWD, path, mode, 0);
145-
#elif defined(__NR_chmod)
146-
return my_syscall2(__NR_chmod, path, mode);
147145
#else
148-
return __nolibc_enosys(__func__, path, mode);
146+
return my_syscall2(__NR_chmod, path, mode);
149147
#endif
150148
}
151149

@@ -165,10 +163,8 @@ int sys_chown(const char *path, uid_t owner, gid_t group)
165163
{
166164
#if defined(__NR_fchownat)
167165
return my_syscall5(__NR_fchownat, AT_FDCWD, path, owner, group, 0);
168-
#elif defined(__NR_chown)
169-
return my_syscall3(__NR_chown, path, owner, group);
170166
#else
171-
return __nolibc_enosys(__func__, path, owner, group);
167+
return my_syscall3(__NR_chown, path, owner, group);
172168
#endif
173169
}
174170

@@ -582,10 +578,8 @@ int sys_link(const char *old, const char *new)
582578
{
583579
#if defined(__NR_linkat)
584580
return my_syscall5(__NR_linkat, AT_FDCWD, old, AT_FDCWD, new, 0);
585-
#elif defined(__NR_link)
586-
return my_syscall2(__NR_link, old, new);
587581
#else
588-
return __nolibc_enosys(__func__, old, new);
582+
return my_syscall2(__NR_link, old, new);
589583
#endif
590584
}
591585

@@ -653,10 +647,8 @@ int sys_mkdir(const char *path, mode_t mode)
653647
{
654648
#if defined(__NR_mkdirat)
655649
return my_syscall3(__NR_mkdirat, AT_FDCWD, path, mode);
656-
#elif defined(__NR_mkdir)
657-
return my_syscall2(__NR_mkdir, path, mode);
658650
#else
659-
return __nolibc_enosys(__func__, path, mode);
651+
return my_syscall2(__NR_mkdir, path, mode);
660652
#endif
661653
}
662654

@@ -675,10 +667,8 @@ int sys_rmdir(const char *path)
675667
{
676668
#if defined(__NR_rmdir)
677669
return my_syscall1(__NR_rmdir, path);
678-
#elif defined(__NR_unlinkat)
679-
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
680670
#else
681-
return __nolibc_enosys(__func__, path);
671+
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
682672
#endif
683673
}
684674

@@ -698,10 +688,8 @@ long sys_mknod(const char *path, mode_t mode, dev_t dev)
698688
{
699689
#if defined(__NR_mknodat)
700690
return my_syscall4(__NR_mknodat, AT_FDCWD, path, mode, dev);
701-
#elif defined(__NR_mknod)
702-
return my_syscall3(__NR_mknod, path, mode, dev);
703691
#else
704-
return __nolibc_enosys(__func__, path, mode, dev);
692+
return my_syscall3(__NR_mknod, path, mode, dev);
705693
#endif
706694
}
707695

@@ -885,10 +873,8 @@ int sys_symlink(const char *old, const char *new)
885873
{
886874
#if defined(__NR_symlinkat)
887875
return my_syscall3(__NR_symlinkat, old, AT_FDCWD, new);
888-
#elif defined(__NR_symlink)
889-
return my_syscall2(__NR_symlink, old, new);
890876
#else
891-
return __nolibc_enosys(__func__, old, new);
877+
return my_syscall2(__NR_symlink, old, new);
892878
#endif
893879
}
894880

@@ -942,10 +928,8 @@ int sys_unlink(const char *path)
942928
{
943929
#if defined(__NR_unlinkat)
944930
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, 0);
945-
#elif defined(__NR_unlink)
946-
return my_syscall1(__NR_unlink, path);
947931
#else
948-
return __nolibc_enosys(__func__, path);
932+
return my_syscall1(__NR_unlink, path);
949933
#endif
950934
}
951935

0 commit comments

Comments
 (0)