43
43
: __sysret_arg ; /* return original value */ \
44
44
})
45
45
46
+ /* Syscall ENOSYS helper: Avoids unused-parameter warnings and provides a
47
+ * debugging hook.
48
+ */
49
+
50
+ static __inline__ int __nolibc_enosys (const char * syscall , ...)
51
+ {
52
+ (void )syscall ;
53
+ return - ENOSYS ;
54
+ }
55
+
46
56
47
57
/* Functions in this file only describe syscalls. They're declared static so
48
58
* that the compiler usually decides to inline them while still being allowed
@@ -133,7 +143,7 @@ int sys_chmod(const char *path, mode_t mode)
133
143
#elif defined(__NR_chmod )
134
144
return my_syscall2 (__NR_chmod , path , mode );
135
145
#else
136
- return - ENOSYS ;
146
+ return __nolibc_enosys ( __func__ , path , mode ) ;
137
147
#endif
138
148
}
139
149
@@ -156,7 +166,7 @@ int sys_chown(const char *path, uid_t owner, gid_t group)
156
166
#elif defined(__NR_chown )
157
167
return my_syscall3 (__NR_chown , path , owner , group );
158
168
#else
159
- return - ENOSYS ;
169
+ return __nolibc_enosys ( __func__ , path , owner , group ) ;
160
170
#endif
161
171
}
162
172
@@ -230,7 +240,7 @@ int sys_dup2(int old, int new)
230
240
#elif defined(__NR_dup2 )
231
241
return my_syscall2 (__NR_dup2 , old , new );
232
242
#else
233
- return - ENOSYS ;
243
+ return __nolibc_enosys ( __func__ , old , new ) ;
234
244
#endif
235
245
}
236
246
@@ -312,7 +322,7 @@ pid_t sys_fork(void)
312
322
#elif defined(__NR_fork )
313
323
return my_syscall0 (__NR_fork );
314
324
#else
315
- return - ENOSYS ;
325
+ return __nolibc_enosys ( __func__ ) ;
316
326
#endif
317
327
}
318
328
#endif
@@ -486,7 +496,7 @@ int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
486
496
#ifdef __NR_gettimeofday
487
497
return my_syscall2 (__NR_gettimeofday , tv , tz );
488
498
#else
489
- return - ENOSYS ;
499
+ return __nolibc_enosys ( __func__ , tv , tz ) ;
490
500
#endif
491
501
}
492
502
@@ -563,7 +573,7 @@ int sys_link(const char *old, const char *new)
563
573
#elif defined(__NR_link )
564
574
return my_syscall2 (__NR_link , old , new );
565
575
#else
566
- return - ENOSYS ;
576
+ return __nolibc_enosys ( __func__ , old , new ) ;
567
577
#endif
568
578
}
569
579
@@ -584,7 +594,7 @@ off_t sys_lseek(int fd, off_t offset, int whence)
584
594
#ifdef __NR_lseek
585
595
return my_syscall3 (__NR_lseek , fd , offset , whence );
586
596
#else
587
- return - ENOSYS ;
597
+ return __nolibc_enosys ( __func__ , fd , offset , whence ) ;
588
598
#endif
589
599
}
590
600
@@ -607,7 +617,7 @@ int sys_mkdir(const char *path, mode_t mode)
607
617
#elif defined(__NR_mkdir )
608
618
return my_syscall2 (__NR_mkdir , path , mode );
609
619
#else
610
- return - ENOSYS ;
620
+ return __nolibc_enosys ( __func__ , path , mode ) ;
611
621
#endif
612
622
}
613
623
@@ -629,7 +639,7 @@ int sys_rmdir(const char *path)
629
639
#elif defined(__NR_unlinkat )
630
640
return my_syscall3 (__NR_unlinkat , AT_FDCWD , path , AT_REMOVEDIR );
631
641
#else
632
- return - ENOSYS ;
642
+ return __nolibc_enosys ( __func__ , path ) ;
633
643
#endif
634
644
}
635
645
@@ -652,7 +662,7 @@ long sys_mknod(const char *path, mode_t mode, dev_t dev)
652
662
#elif defined(__NR_mknod )
653
663
return my_syscall3 (__NR_mknod , path , mode , dev );
654
664
#else
655
- return - ENOSYS ;
665
+ return __nolibc_enosys ( __func__ , path , mode , dev ) ;
656
666
#endif
657
667
}
658
668
@@ -742,7 +752,7 @@ int sys_open(const char *path, int flags, mode_t mode)
742
752
#elif defined(__NR_open )
743
753
return my_syscall3 (__NR_open , path , flags , mode );
744
754
#else
745
- return - ENOSYS ;
755
+ return __nolibc_enosys ( __func__ , path , flags , mode ) ;
746
756
#endif
747
757
}
748
758
@@ -842,7 +852,7 @@ int sys_poll(struct pollfd *fds, int nfds, int timeout)
842
852
#elif defined(__NR_poll )
843
853
return my_syscall3 (__NR_poll , fds , nfds , timeout );
844
854
#else
845
- return - ENOSYS ;
855
+ return __nolibc_enosys ( __func__ , fds , nfds , timeout ) ;
846
856
#endif
847
857
}
848
858
@@ -934,7 +944,7 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva
934
944
#endif
935
945
return my_syscall5 (__NR__newselect , nfds , rfds , wfds , efds , timeout );
936
946
#else
937
- return - ENOSYS ;
947
+ return __nolibc_enosys ( __func__ , nfds , rfds , wfds , efds , timeout ) ;
938
948
#endif
939
949
}
940
950
@@ -989,7 +999,7 @@ int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct sta
989
999
#ifdef __NR_statx
990
1000
return my_syscall5 (__NR_statx , fd , path , flags , mask , buf );
991
1001
#else
992
- return - ENOSYS ;
1002
+ return __nolibc_enosys ( __func__ , fd , path , flags , mask , buf ) ;
993
1003
#endif
994
1004
}
995
1005
@@ -1047,7 +1057,7 @@ int sys_symlink(const char *old, const char *new)
1047
1057
#elif defined(__NR_symlink )
1048
1058
return my_syscall2 (__NR_symlink , old , new );
1049
1059
#else
1050
- return - ENOSYS ;
1060
+ return __nolibc_enosys ( __func__ , old , new ) ;
1051
1061
#endif
1052
1062
}
1053
1063
@@ -1104,7 +1114,7 @@ int sys_unlink(const char *path)
1104
1114
#elif defined(__NR_unlink )
1105
1115
return my_syscall1 (__NR_unlink , path );
1106
1116
#else
1107
- return - ENOSYS ;
1117
+ return __nolibc_enosys ( __func__ , path ) ;
1108
1118
#endif
1109
1119
}
1110
1120
@@ -1127,7 +1137,7 @@ pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage)
1127
1137
#ifdef __NR_wait4
1128
1138
return my_syscall4 (__NR_wait4 , pid , status , options , rusage );
1129
1139
#else
1130
- return - ENOSYS ;
1140
+ return __nolibc_enosys ( __func__ , pid , status , options , rusage ) ;
1131
1141
#endif
1132
1142
}
1133
1143
0 commit comments