aboutsummaryrefslogtreecommitdiff
path: root/libbb/syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/syscalls.c')
-rw-r--r--libbb/syscalls.c80
1 files changed, 38 insertions, 42 deletions
diff --git a/libbb/syscalls.c b/libbb/syscalls.c
index 8d8c689f1..2434cb453 100644
--- a/libbb/syscalls.c
+++ b/libbb/syscalls.c
@@ -34,71 +34,67 @@
34#endif 34#endif
35#include "libbb.h" 35#include "libbb.h"
36 36
37#if defined(__ia64__)
38int sysfs( int option, unsigned int fs_index, char * buf) 37int sysfs( int option, unsigned int fs_index, char * buf)
39{ 38{
40 return(syscall(__NR_sysfs, option, fs_index, buf)); 39 return(syscall(__NR_sysfs, option, fs_index, buf));
41} 40}
42#else
43_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
44#endif
45 41
42int pivot_root(const char * new_root,const char * put_old)
43{
46#ifndef __NR_pivot_root 44#ifndef __NR_pivot_root
47#warning This kernel does not support the pivot_root syscall 45#warning This kernel does not support the pivot_root syscall
48#warning -> The pivot_root system call is being stubbed out... 46#warning -> The pivot_root system call is being stubbed out...
49int pivot_root(const char * new_root,const char * put_old) 47 /* BusyBox was compiled against a kernel that did not support
50{ 48 * the pivot_root system call. To make this application work,
51 /* BusyBox was compiled against a kernel that did not support 49 * you will need to recompile with a kernel supporting the
52 * the pivot_root system call. To make this application work, 50 * pivot_root system call.
53 * you will need to recompile with a kernel supporting the 51 */
54 * pivot_root system call. 52 bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
55 */ 53 "BusyBox with a kernel supporting the pivot_root system call.\n");
56 bb_error_msg("\n\nTo make this application work, you will need to recompile\n" 54 errno=ENOSYS;
57 "with a kernel supporting the pivot_root system call. -Erik\n"); 55 return -1;
58 errno=ENOSYS;
59 return -1;
60}
61#else 56#else
62# if defined(__ia64__) 57 return(syscall(__NR_pivot_root, new_root, put_old));
63 int pivot_root(const char * new_root,const char * put_old)
64 {
65 return(syscall(__NR_pivot_root, new_root, put_old));
66 }
67# else
68 _syscall2(int,pivot_root,const char *,new_root,const char *,put_old);
69# endif
70#endif 58#endif
71 59}
72 60
73 61
74 62
75#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) 63#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
64
76/* These syscalls are not included as part of libc5 */ 65/* These syscalls are not included as part of libc5 */
77_syscall2(int, bdflush, int, func, int, data); 66int bdflush(int func, int data)
67{
68 return(syscall(__NR_bdflush, func, data));
69}
78 70
79#ifndef __alpha__ 71#ifndef __alpha__
80# define __NR_klogctl __NR_syslog 72# define __NR_klogctl __NR_syslog
81 _syscall3(int, klogctl, int, type, char *, b, int, len); 73int klogctl(int type, char *b, int len)
74{
75 return(syscall(__NR_klogctl, type, b, len));
76}
82#endif 77#endif
83 78
84#ifndef __NR_umount2 79
85# warning This kernel does not support the umount2 syscall
86# warning -> The umount2 system call is being stubbed out...
87int umount2(const char * special_file, int flags) 80int umount2(const char * special_file, int flags)
88{ 81{
89 /* BusyBox was compiled against a kernel that did not support 82#ifndef __NR_pivot_root
90 * the umount2 system call. To make this application work, 83#warning This kernel does not support the umount2 syscall
91 * you will need to recompile with a kernel supporting the 84#warning -> The umount2 system call is being stubbed out...
92 * umount2 system call. 85 /* BusyBox was compiled against a kernel that did not support
93 */ 86 * the umount2 system call. To make this application work,
94 bb_error_msg("\n\nTo make this application work, you will need to recompile\n" 87 * you will need to recompile with a kernel supporting the
95 "with a kernel supporting the umount2 system call. -Erik\n"); 88 * umount2 system call.
96 errno=ENOSYS; 89 */
97 return -1; 90 bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
98} 91 "BusyBox with a kernel supporting the umount2 system call.\n");
99# else 92 errno=ENOSYS;
100_syscall2(int, umount2, const char *, special_file, int, flags); 93 return -1;
94#else
95 return(syscall(__NR_umount2, special_file, flags));
101#endif 96#endif
97}
102 98
103 99
104#endif /* __GNU_LIBRARY__ < 5 */ 100#endif /* __GNU_LIBRARY__ < 5 */