summaryrefslogtreecommitdiff
path: root/libbb/syscalls.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-05 06:08:14 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-05 06:08:14 +0000
commita2a978ae23e267c24eb7b11662afdcc9ea47e789 (patch)
treef9927bd24dbc96724b1c0b89327d4c7157ed8eb4 /libbb/syscalls.c
parentfdefbbbe85b852ba6de361c8f53d025b09b9abbe (diff)
downloadbusybox-w32-a2a978ae23e267c24eb7b11662afdcc9ea47e789.tar.gz
busybox-w32-a2a978ae23e267c24eb7b11662afdcc9ea47e789.tar.bz2
busybox-w32-a2a978ae23e267c24eb7b11662afdcc9ea47e789.zip
Some further syscall adjustments. Split the module syscalls out of
insmod and into libbb. Only enable them for libc5. glibc and uClibc don't need them. -Erik
Diffstat (limited to 'libbb/syscalls.c')
-rw-r--r--libbb/syscalls.c61
1 files changed, 25 insertions, 36 deletions
diff --git a/libbb/syscalls.c b/libbb/syscalls.c
index efca39902..4a846eb00 100644
--- a/libbb/syscalls.c
+++ b/libbb/syscalls.c
@@ -1,10 +1,9 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Utility routines. 3 * some system calls possibly missing from libc
4 * 4 *
5 * Copyright (C) tons of folks. Tracking down who wrote what 5 * Copyright (C) 1999,2000,2001 by Lineo, inc.
6 * isn't something I'm going to worry about... If you wrote something 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * here, please feel free to acknowledge your work.
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -20,19 +19,28 @@
20 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * 21 *
23 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
24 * Permission has been granted to redistribute this code under the GPL.
25 *
26 */ 22 */
27 23
28#include <stdio.h> 24#include <stdio.h>
29#include <errno.h> 25#include <errno.h>
30#include <sys/syscall.h> 26#include <unistd.h>
31#include <linux/unistd.h> 27/* Kernel headers before 2.1.mumble need this on the Alpha to get
28 _syscall* defined. */
29#define __LIBRARY__
30
32 31
32#include <sys/syscall.h>
33#include <asm/unistd.h>
33#include "libbb.h" 34#include "libbb.h"
34 35
36#if defined(__ia64__)
37int sysfs( int option, unsigned int fs_index, char * buf)
38{
39 return(syscall(__NR_sysfs, option, fs_index, buf));
40}
41#else
35_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf); 42_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
43#endif
36 44
37#ifndef __NR_pivot_root 45#ifndef __NR_pivot_root
38#warning This kernel does not support the pivot_root syscall 46#warning This kernel does not support the pivot_root syscall
@@ -50,7 +58,14 @@ int pivot_root(const char * new_root,const char * put_old)
50 return -1; 58 return -1;
51} 59}
52#else 60#else
53_syscall2(int,pivot_root,const char *,new_root,const char *,put_old) 61# if defined(__ia64__)
62 int pivot_root(const char * new_root,const char * put_old)
63 {
64 return(syscall(__NR_pivot_root, new_root, put_old));
65 }
66# else
67 _syscall2(int,pivot_root,const char *,new_root,const char *,put_old);
68# endif
54#endif 69#endif
55 70
56 71
@@ -59,27 +74,6 @@ _syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
59#if __GNU_LIBRARY__ < 5 74#if __GNU_LIBRARY__ < 5
60/* These syscalls are not included as part of libc5 */ 75/* These syscalls are not included as part of libc5 */
61_syscall2(int, bdflush, int, func, int, data); 76_syscall2(int, bdflush, int, func, int, data);
62_syscall1(int, delete_module, const char *, name)
63
64#ifndef __NR_query_module
65#warning This kernel does not support the query_module syscall
66#warning -> The query_module system call is being stubbed out...
67int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret)
68{
69 /* BusyBox was compiled against a kernel that did not support
70 * the query_module system call. To make this application work,
71 * you will need to recompile with a kernel supporting the
72 * query_module system call.
73 */
74 fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
75 fprintf(stderr, "with a kernel supporting the query_module system call. -Erik\n\n");
76 errno=ENOSYS;
77 return -1;
78}
79#else
80_syscall5(int, query_module, const char *, name, int, which,
81 void *, buf, size_t, bufsize, size_t*, ret);
82#endif
83 77
84#ifndef __alpha__ 78#ifndef __alpha__
85# define __NR_klogctl __NR_syslog 79# define __NR_klogctl __NR_syslog
@@ -109,11 +103,6 @@ _syscall2(int, umount2, const char *, special_file, int, flags);
109#endif /* __GNU_LIBRARY__ < 5 */ 103#endif /* __GNU_LIBRARY__ < 5 */
110 104
111 105
112#if 0
113_syscall1(int, sysinfo, struct sysinfo *, info);
114#endif
115
116
117/* END CODE */ 106/* END CODE */
118/* 107/*
119Local Variables: 108Local Variables: