Major rewrite.

The first reason for this rewrite is KNF conformance.

The second reason is to avoid redundancy. Each function printed the same
string, with only the syscall name being different. The actual printing is now
performed by a single function, which gets the syscall name as an argument.

The third reason is that of convenience. It's now very easy to add a new
dummy implementation. Just add ``DUMMY(foo);'' to the file. It's also a lot
easier now to see if a syscall has a dummy implementation or not.

The dummies are ordered on syscall number. Please maintain this when adding
new dummies (there're 32 candidates at the time of writing :-)

Reviewed by: bde
This commit is contained in:
marcel 1999-08-15 18:59:44 +00:00
parent bf7eaf6a36
commit 9fea2bf0cd
2 changed files with 94 additions and 472 deletions

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_dummy.c,v 1.8 1997/11/06 19:28:52 phk Exp $
* $Id: linux_dummy.c,v 1.9 1998/12/19 02:55:33 julian Exp $
*/
#include <sys/param.h>
@ -35,241 +35,52 @@
#include <i386/linux/linux.h>
#include <i386/linux/linux_proto.h>
int
linux_setup(struct proc *p, struct linux_setup_args *args)
#define DUMMY(s) \
int \
linux_ ## s(struct proc *p, struct linux_ ## s ## _args *args) \
{ \
return (unsupported_msg(p, #s)); \
} \
struct __hack
static int
unsupported_msg(struct proc *p, const char *fname)
{
printf("Linux-emul(%d): setup() not supported\n", p->p_pid);
return ENOSYS;
printf("Linux-emul(%ld): %s() not supported\n", (long)p->p_pid, fname);
return (ENOSYS);
}
int
linux_break(struct proc *p, struct linux_break_args *args)
{
printf("Linux-emul(%d): break() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_stat(struct proc *p, struct linux_stat_args *args)
{
printf("Linux-emul(%d): stat() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_fstat(struct proc *p, struct linux_fstat_args *args)
{
printf("Linux-emul(%d): fstat() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_mount(struct proc *p, struct linux_mount_args *args)
{
printf("Linux-emul(%d): mount() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_umount(struct proc *p, struct linux_umount_args *args)
{
printf("Linux-emul(%d): umount() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_stime(struct proc *p, struct linux_stime_args *args)
{
printf("Linux-emul(%d): stime() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ptrace(struct proc *p, struct linux_ptrace_args *args)
{
printf("Linux-emul(%d): ptrace() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_stty(struct proc *p, struct linux_stty_args *args)
{
printf("Linux-emul(%d): stty() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_gtty(struct proc *p, struct linux_gtty_args *args)
{
printf("Linux-emul(%d): gtty() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ftime(struct proc *p, struct linux_ftime_args *args)
{
printf("Linux-emul(%d): ftime() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_prof(struct proc *p, struct linux_prof_args *args)
{
printf("Linux-emul(%d): prof() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_phys(struct proc *p, struct linux_phys_args *args)
{
printf("Linux-emul(%d): phys() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_lock(struct proc *p, struct linux_lock_args *args)
{
printf("Linux-emul(%d): lock() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_mpx(struct proc *p, struct linux_mpx_args *args)
{
printf("Linux-emul(%d): mpx() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ulimit(struct proc *p, struct linux_ulimit_args *args)
{
printf("Linux-emul(%d): ulimit() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_olduname(struct proc *p, struct linux_olduname_args *args)
{
printf("Linux-emul(%d): olduname() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ustat(struct proc *p, struct linux_ustat_args *args)
{
printf("Linux-emul(%d): ustat() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ioperm(struct proc *p, struct linux_ioperm_args *args)
{
printf("Linux-emul(%d): ioperm() not supported\n", p->p_pid);
return 0; /* EINVAL SOS XXX */
}
int
linux_ksyslog(struct proc *p, struct linux_ksyslog_args *args)
{
printf("Linux-emul(%d): ksyslog(%x) not supported\n",
p->p_pid, args->what);
return ENOSYS; /* EPERM - Peter - it's a root-only thing */
}
int
linux_vhangup(struct proc *p, struct linux_vhangup_args *args)
{
printf("Linux-emul(%d): vhangup() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_idle(struct proc *p, struct linux_idle_args *args)
{
printf("Linux-emul(%d): idle() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_vm86(struct proc *p, struct linux_vm86_args *args)
{
printf("Linux-emul(%d): vm86() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_swapoff(struct proc *p, struct linux_swapoff_args *args)
{
printf("Linux-emul(%d): swapoff() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args)
{
printf("Linux-emul(%d): sysinfo() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_uname(struct proc *p, struct linux_uname_args *args)
{
printf("Linux-emul(%d): uname() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_modify_ldt(struct proc *p, struct linux_modify_ldt_args *args)
{
printf("Linux-emul(%d): modify_ldt() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_adjtimex(struct proc *p, struct linux_adjtimex_args *args)
{
printf("Linux-emul(%d): adjtimex() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_create_module(struct proc *p, struct linux_create_module_args *args)
{
printf("Linux-emul(%d): create_module() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_init_module(struct proc *p, struct linux_init_module_args *args)
{
printf("Linux-emul(%d): init_module() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_delete_module(struct proc *p, struct linux_delete_module_args *args)
{
printf("Linux-emul(%d): delete_module() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_get_kernel_syms(struct proc *p, struct linux_get_kernel_syms_args *args)
{
printf("Linux-emul(%d): get_kernel_syms() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_quotactl(struct proc *p, struct linux_quotactl_args *args)
{
printf("Linux-emul(%d): quotactl() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_bdflush(struct proc *p, struct linux_bdflush_args *args)
{
printf("Linux-emul(%d): bdflush() not supported\n", p->p_pid);
return ENOSYS;
}
DUMMY(setup);
DUMMY(break);
DUMMY(stat);
DUMMY(mount);
DUMMY(umount);
DUMMY(stime);
DUMMY(ptrace);
DUMMY(fstat);
DUMMY(stty);
DUMMY(gtty);
DUMMY(ftime);
DUMMY(prof);
DUMMY(phys);
DUMMY(lock);
DUMMY(mpx);
DUMMY(ulimit);
DUMMY(olduname);
DUMMY(ustat);
DUMMY(ioperm);
DUMMY(ksyslog);
DUMMY(uname);
DUMMY(vhangup);
DUMMY(idle);
DUMMY(vm86);
DUMMY(swapoff);
DUMMY(sysinfo);
DUMMY(modify_ldt);
DUMMY(adjtimex);
DUMMY(create_module);
DUMMY(init_module);
DUMMY(delete_module);
DUMMY(get_kernel_syms);
DUMMY(quotactl);
DUMMY(bdflush);

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_dummy.c,v 1.8 1997/11/06 19:28:52 phk Exp $
* $Id: linux_dummy.c,v 1.9 1998/12/19 02:55:33 julian Exp $
*/
#include <sys/param.h>
@ -35,241 +35,52 @@
#include <i386/linux/linux.h>
#include <i386/linux/linux_proto.h>
int
linux_setup(struct proc *p, struct linux_setup_args *args)
#define DUMMY(s) \
int \
linux_ ## s(struct proc *p, struct linux_ ## s ## _args *args) \
{ \
return (unsupported_msg(p, #s)); \
} \
struct __hack
static int
unsupported_msg(struct proc *p, const char *fname)
{
printf("Linux-emul(%d): setup() not supported\n", p->p_pid);
return ENOSYS;
printf("Linux-emul(%ld): %s() not supported\n", (long)p->p_pid, fname);
return (ENOSYS);
}
int
linux_break(struct proc *p, struct linux_break_args *args)
{
printf("Linux-emul(%d): break() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_stat(struct proc *p, struct linux_stat_args *args)
{
printf("Linux-emul(%d): stat() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_fstat(struct proc *p, struct linux_fstat_args *args)
{
printf("Linux-emul(%d): fstat() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_mount(struct proc *p, struct linux_mount_args *args)
{
printf("Linux-emul(%d): mount() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_umount(struct proc *p, struct linux_umount_args *args)
{
printf("Linux-emul(%d): umount() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_stime(struct proc *p, struct linux_stime_args *args)
{
printf("Linux-emul(%d): stime() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ptrace(struct proc *p, struct linux_ptrace_args *args)
{
printf("Linux-emul(%d): ptrace() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_stty(struct proc *p, struct linux_stty_args *args)
{
printf("Linux-emul(%d): stty() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_gtty(struct proc *p, struct linux_gtty_args *args)
{
printf("Linux-emul(%d): gtty() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ftime(struct proc *p, struct linux_ftime_args *args)
{
printf("Linux-emul(%d): ftime() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_prof(struct proc *p, struct linux_prof_args *args)
{
printf("Linux-emul(%d): prof() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_phys(struct proc *p, struct linux_phys_args *args)
{
printf("Linux-emul(%d): phys() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_lock(struct proc *p, struct linux_lock_args *args)
{
printf("Linux-emul(%d): lock() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_mpx(struct proc *p, struct linux_mpx_args *args)
{
printf("Linux-emul(%d): mpx() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ulimit(struct proc *p, struct linux_ulimit_args *args)
{
printf("Linux-emul(%d): ulimit() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_olduname(struct proc *p, struct linux_olduname_args *args)
{
printf("Linux-emul(%d): olduname() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ustat(struct proc *p, struct linux_ustat_args *args)
{
printf("Linux-emul(%d): ustat() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_ioperm(struct proc *p, struct linux_ioperm_args *args)
{
printf("Linux-emul(%d): ioperm() not supported\n", p->p_pid);
return 0; /* EINVAL SOS XXX */
}
int
linux_ksyslog(struct proc *p, struct linux_ksyslog_args *args)
{
printf("Linux-emul(%d): ksyslog(%x) not supported\n",
p->p_pid, args->what);
return ENOSYS; /* EPERM - Peter - it's a root-only thing */
}
int
linux_vhangup(struct proc *p, struct linux_vhangup_args *args)
{
printf("Linux-emul(%d): vhangup() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_idle(struct proc *p, struct linux_idle_args *args)
{
printf("Linux-emul(%d): idle() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_vm86(struct proc *p, struct linux_vm86_args *args)
{
printf("Linux-emul(%d): vm86() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_swapoff(struct proc *p, struct linux_swapoff_args *args)
{
printf("Linux-emul(%d): swapoff() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args)
{
printf("Linux-emul(%d): sysinfo() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_uname(struct proc *p, struct linux_uname_args *args)
{
printf("Linux-emul(%d): uname() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_modify_ldt(struct proc *p, struct linux_modify_ldt_args *args)
{
printf("Linux-emul(%d): modify_ldt() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_adjtimex(struct proc *p, struct linux_adjtimex_args *args)
{
printf("Linux-emul(%d): adjtimex() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_create_module(struct proc *p, struct linux_create_module_args *args)
{
printf("Linux-emul(%d): create_module() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_init_module(struct proc *p, struct linux_init_module_args *args)
{
printf("Linux-emul(%d): init_module() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_delete_module(struct proc *p, struct linux_delete_module_args *args)
{
printf("Linux-emul(%d): delete_module() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_get_kernel_syms(struct proc *p, struct linux_get_kernel_syms_args *args)
{
printf("Linux-emul(%d): get_kernel_syms() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_quotactl(struct proc *p, struct linux_quotactl_args *args)
{
printf("Linux-emul(%d): quotactl() not supported\n", p->p_pid);
return ENOSYS;
}
int
linux_bdflush(struct proc *p, struct linux_bdflush_args *args)
{
printf("Linux-emul(%d): bdflush() not supported\n", p->p_pid);
return ENOSYS;
}
DUMMY(setup);
DUMMY(break);
DUMMY(stat);
DUMMY(mount);
DUMMY(umount);
DUMMY(stime);
DUMMY(ptrace);
DUMMY(fstat);
DUMMY(stty);
DUMMY(gtty);
DUMMY(ftime);
DUMMY(prof);
DUMMY(phys);
DUMMY(lock);
DUMMY(mpx);
DUMMY(ulimit);
DUMMY(olduname);
DUMMY(ustat);
DUMMY(ioperm);
DUMMY(ksyslog);
DUMMY(uname);
DUMMY(vhangup);
DUMMY(idle);
DUMMY(vm86);
DUMMY(swapoff);
DUMMY(sysinfo);
DUMMY(modify_ldt);
DUMMY(adjtimex);
DUMMY(create_module);
DUMMY(init_module);
DUMMY(delete_module);
DUMMY(get_kernel_syms);
DUMMY(quotactl);
DUMMY(bdflush);