Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/nolibc: Replace ifdef with if defined() in sys.h

Thomas has requested that if defined() be used in place of ifdef but
currently ifdef is used consistently in sys.h. Update all the instances of
ifdef to if defined().

Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250703-arm64-gcs-vfork-exit-v3-1-1e9a9d2ddbbe@kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

authored by

Mark Brown and committed by
Thomas Weißschuh
8c11625a 02217ad4

+15 -15
+15 -15
tools/include/nolibc/sys.h
··· 139 139 static __attribute__((unused)) 140 140 int sys_chmod(const char *path, mode_t mode) 141 141 { 142 - #ifdef __NR_fchmodat 142 + #if defined(__NR_fchmodat) 143 143 return my_syscall4(__NR_fchmodat, AT_FDCWD, path, mode, 0); 144 144 #elif defined(__NR_chmod) 145 145 return my_syscall2(__NR_chmod, path, mode); ··· 162 162 static __attribute__((unused)) 163 163 int sys_chown(const char *path, uid_t owner, gid_t group) 164 164 { 165 - #ifdef __NR_fchownat 165 + #if defined(__NR_fchownat) 166 166 return my_syscall5(__NR_fchownat, AT_FDCWD, path, owner, group, 0); 167 167 #elif defined(__NR_chown) 168 168 return my_syscall3(__NR_chown, path, owner, group); ··· 236 236 static __attribute__((unused)) 237 237 int sys_dup2(int old, int new) 238 238 { 239 - #ifdef __NR_dup3 239 + #if defined(__NR_dup3) 240 240 return my_syscall3(__NR_dup3, old, new, 0); 241 241 #elif defined(__NR_dup2) 242 242 return my_syscall2(__NR_dup2, old, new); ··· 256 256 * int dup3(int old, int new, int flags); 257 257 */ 258 258 259 - #ifdef __NR_dup3 259 + #if defined(__NR_dup3) 260 260 static __attribute__((unused)) 261 261 int sys_dup3(int old, int new, int flags) 262 262 { ··· 320 320 static __attribute__((unused)) 321 321 pid_t sys_fork(void) 322 322 { 323 - #ifdef __NR_clone 323 + #if defined(__NR_clone) 324 324 /* note: some archs only have clone() and not fork(). Different archs 325 325 * have a different API, but most archs have the flags on first arg and 326 326 * will not use the rest with no other flag. ··· 382 382 static __attribute__((unused)) 383 383 uid_t sys_geteuid(void) 384 384 { 385 - #ifdef __NR_geteuid32 385 + #if defined(__NR_geteuid32) 386 386 return my_syscall0(__NR_geteuid32); 387 387 #else 388 388 return my_syscall0(__NR_geteuid); ··· 500 500 static __attribute__((unused)) 501 501 uid_t sys_getuid(void) 502 502 { 503 - #ifdef __NR_getuid32 503 + #if defined(__NR_getuid32) 504 504 return my_syscall0(__NR_getuid32); 505 505 #else 506 506 return my_syscall0(__NR_getuid); ··· 538 538 static __attribute__((unused)) 539 539 int sys_link(const char *old, const char *new) 540 540 { 541 - #ifdef __NR_linkat 541 + #if defined(__NR_linkat) 542 542 return my_syscall5(__NR_linkat, AT_FDCWD, old, AT_FDCWD, new, 0); 543 543 #elif defined(__NR_link) 544 544 return my_syscall2(__NR_link, old, new); ··· 561 561 static __attribute__((unused)) 562 562 off_t sys_lseek(int fd, off_t offset, int whence) 563 563 { 564 - #ifdef __NR_lseek 564 + #if defined(__NR_lseek) 565 565 return my_syscall3(__NR_lseek, fd, offset, whence); 566 566 #else 567 567 return __nolibc_enosys(__func__, fd, offset, whence); ··· 572 572 int sys_llseek(int fd, unsigned long offset_high, unsigned long offset_low, 573 573 __kernel_loff_t *result, int whence) 574 574 { 575 - #ifdef __NR_llseek 575 + #if defined(__NR_llseek) 576 576 return my_syscall5(__NR_llseek, fd, offset_high, offset_low, result, whence); 577 577 #else 578 578 return __nolibc_enosys(__func__, fd, offset_high, offset_low, result, whence); ··· 609 609 static __attribute__((unused)) 610 610 int sys_mkdir(const char *path, mode_t mode) 611 611 { 612 - #ifdef __NR_mkdirat 612 + #if defined(__NR_mkdirat) 613 613 return my_syscall3(__NR_mkdirat, AT_FDCWD, path, mode); 614 614 #elif defined(__NR_mkdir) 615 615 return my_syscall2(__NR_mkdir, path, mode); ··· 631 631 static __attribute__((unused)) 632 632 int sys_rmdir(const char *path) 633 633 { 634 - #ifdef __NR_rmdir 634 + #if defined(__NR_rmdir) 635 635 return my_syscall1(__NR_rmdir, path); 636 636 #elif defined(__NR_unlinkat) 637 637 return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); ··· 654 654 static __attribute__((unused)) 655 655 long sys_mknod(const char *path, mode_t mode, dev_t dev) 656 656 { 657 - #ifdef __NR_mknodat 657 + #if defined(__NR_mknodat) 658 658 return my_syscall4(__NR_mknodat, AT_FDCWD, path, mode, dev); 659 659 #elif defined(__NR_mknod) 660 660 return my_syscall3(__NR_mknod, path, mode, dev); ··· 843 843 static __attribute__((unused)) 844 844 int sys_symlink(const char *old, const char *new) 845 845 { 846 - #ifdef __NR_symlinkat 846 + #if defined(__NR_symlinkat) 847 847 return my_syscall3(__NR_symlinkat, old, AT_FDCWD, new); 848 848 #elif defined(__NR_symlink) 849 849 return my_syscall2(__NR_symlink, old, new); ··· 900 900 static __attribute__((unused)) 901 901 int sys_unlink(const char *path) 902 902 { 903 - #ifdef __NR_unlinkat 903 + #if defined(__NR_unlinkat) 904 904 return my_syscall3(__NR_unlinkat, AT_FDCWD, path, 0); 905 905 #elif defined(__NR_unlink) 906 906 return my_syscall1(__NR_unlink, path);