Skip to content

Commit 8c11625

Browse files
brooniet-8ch
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
1 parent 02217ad commit 8c11625

File tree

1 file changed

+15
-15
lines changed
  • tools/include/nolibc

1 file changed

+15
-15
lines changed

tools/include/nolibc/sys.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int chdir(const char *path)
139139
static __attribute__((unused))
140140
int sys_chmod(const char *path, mode_t mode)
141141
{
142-
#ifdef __NR_fchmodat
142+
#if defined(__NR_fchmodat)
143143
return my_syscall4(__NR_fchmodat, AT_FDCWD, path, mode, 0);
144144
#elif defined(__NR_chmod)
145145
return my_syscall2(__NR_chmod, path, mode);
@@ -162,7 +162,7 @@ int chmod(const char *path, mode_t mode)
162162
static __attribute__((unused))
163163
int sys_chown(const char *path, uid_t owner, gid_t group)
164164
{
165-
#ifdef __NR_fchownat
165+
#if defined(__NR_fchownat)
166166
return my_syscall5(__NR_fchownat, AT_FDCWD, path, owner, group, 0);
167167
#elif defined(__NR_chown)
168168
return my_syscall3(__NR_chown, path, owner, group);
@@ -236,7 +236,7 @@ int dup(int fd)
236236
static __attribute__((unused))
237237
int sys_dup2(int old, int new)
238238
{
239-
#ifdef __NR_dup3
239+
#if defined(__NR_dup3)
240240
return my_syscall3(__NR_dup3, old, new, 0);
241241
#elif defined(__NR_dup2)
242242
return my_syscall2(__NR_dup2, old, new);
@@ -256,7 +256,7 @@ int dup2(int old, int new)
256256
* int dup3(int old, int new, int flags);
257257
*/
258258

259-
#ifdef __NR_dup3
259+
#if defined(__NR_dup3)
260260
static __attribute__((unused))
261261
int sys_dup3(int old, int new, int flags)
262262
{
@@ -320,7 +320,7 @@ void exit(int status)
320320
static __attribute__((unused))
321321
pid_t sys_fork(void)
322322
{
323-
#ifdef __NR_clone
323+
#if defined(__NR_clone)
324324
/* note: some archs only have clone() and not fork(). Different archs
325325
* have a different API, but most archs have the flags on first arg and
326326
* will not use the rest with no other flag.
@@ -382,7 +382,7 @@ int getdents64(int fd, struct linux_dirent64 *dirp, int count)
382382
static __attribute__((unused))
383383
uid_t sys_geteuid(void)
384384
{
385-
#ifdef __NR_geteuid32
385+
#if defined(__NR_geteuid32)
386386
return my_syscall0(__NR_geteuid32);
387387
#else
388388
return my_syscall0(__NR_geteuid);
@@ -500,7 +500,7 @@ int getpagesize(void)
500500
static __attribute__((unused))
501501
uid_t sys_getuid(void)
502502
{
503-
#ifdef __NR_getuid32
503+
#if defined(__NR_getuid32)
504504
return my_syscall0(__NR_getuid32);
505505
#else
506506
return my_syscall0(__NR_getuid);
@@ -538,7 +538,7 @@ int kill(pid_t pid, int signal)
538538
static __attribute__((unused))
539539
int sys_link(const char *old, const char *new)
540540
{
541-
#ifdef __NR_linkat
541+
#if defined(__NR_linkat)
542542
return my_syscall5(__NR_linkat, AT_FDCWD, old, AT_FDCWD, new, 0);
543543
#elif defined(__NR_link)
544544
return my_syscall2(__NR_link, old, new);
@@ -561,7 +561,7 @@ int link(const char *old, const char *new)
561561
static __attribute__((unused))
562562
off_t sys_lseek(int fd, off_t offset, int whence)
563563
{
564-
#ifdef __NR_lseek
564+
#if defined(__NR_lseek)
565565
return my_syscall3(__NR_lseek, fd, offset, whence);
566566
#else
567567
return __nolibc_enosys(__func__, fd, offset, whence);
@@ -572,7 +572,7 @@ static __attribute__((unused))
572572
int sys_llseek(int fd, unsigned long offset_high, unsigned long offset_low,
573573
__kernel_loff_t *result, int whence)
574574
{
575-
#ifdef __NR_llseek
575+
#if defined(__NR_llseek)
576576
return my_syscall5(__NR_llseek, fd, offset_high, offset_low, result, whence);
577577
#else
578578
return __nolibc_enosys(__func__, fd, offset_high, offset_low, result, whence);
@@ -609,7 +609,7 @@ off_t lseek(int fd, off_t offset, int whence)
609609
static __attribute__((unused))
610610
int sys_mkdir(const char *path, mode_t mode)
611611
{
612-
#ifdef __NR_mkdirat
612+
#if defined(__NR_mkdirat)
613613
return my_syscall3(__NR_mkdirat, AT_FDCWD, path, mode);
614614
#elif defined(__NR_mkdir)
615615
return my_syscall2(__NR_mkdir, path, mode);
@@ -631,7 +631,7 @@ int mkdir(const char *path, mode_t mode)
631631
static __attribute__((unused))
632632
int sys_rmdir(const char *path)
633633
{
634-
#ifdef __NR_rmdir
634+
#if defined(__NR_rmdir)
635635
return my_syscall1(__NR_rmdir, path);
636636
#elif defined(__NR_unlinkat)
637637
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
@@ -654,7 +654,7 @@ int rmdir(const char *path)
654654
static __attribute__((unused))
655655
long sys_mknod(const char *path, mode_t mode, dev_t dev)
656656
{
657-
#ifdef __NR_mknodat
657+
#if defined(__NR_mknodat)
658658
return my_syscall4(__NR_mknodat, AT_FDCWD, path, mode, dev);
659659
#elif defined(__NR_mknod)
660660
return my_syscall3(__NR_mknod, path, mode, dev);
@@ -843,7 +843,7 @@ pid_t setsid(void)
843843
static __attribute__((unused))
844844
int sys_symlink(const char *old, const char *new)
845845
{
846-
#ifdef __NR_symlinkat
846+
#if defined(__NR_symlinkat)
847847
return my_syscall3(__NR_symlinkat, old, AT_FDCWD, new);
848848
#elif defined(__NR_symlink)
849849
return my_syscall2(__NR_symlink, old, new);
@@ -900,7 +900,7 @@ int umount2(const char *path, int flags)
900900
static __attribute__((unused))
901901
int sys_unlink(const char *path)
902902
{
903-
#ifdef __NR_unlinkat
903+
#if defined(__NR_unlinkat)
904904
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, 0);
905905
#elif defined(__NR_unlink)
906906
return my_syscall1(__NR_unlink, path);

0 commit comments

Comments
 (0)