/* vi: set sw=4 ts=4: */
/*
 * some system calls possibly missing from libc
 *
 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
/* Kernel headers before 2.1.mumble need this on the Alpha to get
   _syscall* defined.  */
#define __LIBRARY__
#include <sys/syscall.h>
#include "libbb.h"

int sysfs(int option, unsigned int fs_index, char * buf)
{
#ifndef __NR_pivot_root
#warning This kernel does not support the sysfs syscall
#warning -> The sysfs system call is being stubbed out...
	bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
	             "BusyBox with a kernel supporting the pivot_root system call.\n");
	errno = ENOSYS;
	return -1;
#else
	return(syscall(__NR_sysfs, option, fs_index, buf));
#endif
}

int pivot_root(const char * new_root,const char * put_old)
{
#ifndef __NR_pivot_root
#warning This kernel does not support the pivot_root syscall
#warning -> The pivot_root system call is being stubbed out...
	/* BusyBox was compiled against a kernel that did not support
	 *  the pivot_root system call.  To make this application work,
	 *  you will need to recompile with a kernel supporting the
	 *  pivot_root system call.
	 */
	bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
	             "BusyBox with a kernel supporting the pivot_root system call.\n");
	errno = ENOSYS;
	return -1;
#else
	return(syscall(__NR_pivot_root, new_root, put_old));
#endif /* __NR_pivot_root */
}


/* These syscalls are not included in ancient glibc versions,
   so we have to define them ourselves, whee ! */
#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))

int bdflush(int func, int data)
{
	return(syscall(__NR_bdflush, func, data));
}

#ifndef __alpha__
# define __NR_klogctl __NR_syslog
int klogctl(int type, char *b, int len)
{
	return(syscall(__NR_klogctl, type, b, len));
}
#endif /* __alpha__ */


int umount2(const char * special_file, int flags)
{
#ifndef __NR_umount2
#warning This kernel does not support the umount2 syscall
#warning -> The umount2 system call is being stubbed out...
	/* BusyBox was compiled against a kernel that did not support
	 *  the umount2 system call.  To make this application work,
	 *  you will need to recompile with a kernel supporting the
	 *  umount2 system call.
	 */
	bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
	             "BusyBox with a kernel supporting the umount2 system call.\n");
	errno = ENOSYS;
	return -1;
#else
	return(syscall(__NR_umount2, special_file, flags));
#endif /* __NR_pivot_root */
}

#endif /* old glibc check */


/* END CODE */
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
