sysent.c revision 02bc52be7430b2f7fafe1a2c981bff49ef11d6fa
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* ONC_PLUS EXTRACT START */
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* ONC_PLUS EXTRACT END */
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.51 */
#include <sys/systrace.h>
/* ONC_PLUS EXTRACT START */
/*
* This table is the switch used to transfer to the appropriate
* routine for processing a system call. Each row contains the
* number of arguments expected, a switch that tells systrap()
* in trap.c whether a setjmp() is not necessary, and a pointer
* to the routine.
*/
/* ONC_PLUS EXTRACT END */
int access();
int alarm();
int auditsys();
int brk();
int chdir();
int chmod();
int chown();
int chroot();
int cladm();
int close();
int creat();
int dup();
int exec();
int exece();
int fcntl();
int fstat();
int fsat32();
int fdsync();
int ucredsys();
int getloadavg();
int rusagesys();
int getpagesizes();
int gtty();
int hrtsys();
#endif /* __i386 || __amd64 */
int ioctl();
int kill();
int labelsys();
int link();
int lgrpsys();
int mknod();
int mount();
int nice();
int nullsys();
int open();
int pause();
long pcsample();
int privsys();
int profil();
int rename();
void rexit();
int semsys();
int setgid();
int setpgrp();
int setuid();
int ssig();
int sigprocmask();
int sigsuspend();
int sigaltstack();
int sigaction();
int sigpending();
int sigresend();
int sigtimedwait();
int getsetcontext();
int stat();
int stime();
int stty();
int syssync();
int sysacct();
long ulimit();
int getrlimit32();
int setrlimit32();
int umask();
int umount();
int umount2();
int unlink();
int utime();
int uucopy();
int syslwp_park();
int rmdir();
int mkdir();
int getdents32();
int statfs32();
int fstatfs32();
int sysfs();
int getmsg();
int poll();
int pollsys();
int putmsg();
int uadmin();
int lstat();
int symlink();
int resolvepath();
int setgroups();
int getgroups();
int fchdir();
int fchown();
int fchmod();
int getcwd();
int statvfs();
int fstatvfs();
int sysi86();
#endif
int acl();
int facl();
long priocntlsys();
int waitsys();
int sigsendsys();
int mincore();
int smmaplf32();
int mprotect();
int munmap();
int xstat();
int lxstat();
int fxstat();
int xmknod();
#endif
int uname();
int lchown();
int getpmsg();
int putpmsg();
int memcntl();
long sysconfig();
int adjtime();
long systeminfo();
int setegid();
int seteuid();
int setreuid();
int setregid();
int install_utrap();
#ifdef __sparc
int sparc_utrap_install();
#endif
int syslwp_create();
void syslwp_exit();
int syslwp_suspend();
int syslwp_continue();
int syslwp_private();
int lwp_detach();
int lwp_info();
int lwp_kill();
int lwp_self();
int yield();
int lwp_wait();
int lwp_mutex_lock();
int lwp_mutex_timedlock();
int lwp_mutex_wakeup();
int lwp_mutex_unlock();
int lwp_mutex_trylock();
int lwp_mutex_register();
int lwp_rwlock_sys();
int lwp_sema_post();
int lwp_sema_wait();
int lwp_sema_timedwait();
int lwp_sema_trywait();
int lwp_cond_wait();
int lwp_cond_signal();
int lwp_cond_broadcast();
long pathconf();
long fpathconf();
int processor_bind();
int processor_info();
int p_online();
/*
* POSIX .4 system calls *
*/
int clock_gettime();
int clock_settime();
int clock_getres();
int timer_create();
int timer_delete();
int timer_settime();
int timer_gettime();
int timer_getoverrun();
int nanosleep();
int sigqueue();
int signotify();
int getdents64();
int stat64();
int fsat64();
int lstat64();
int fstatat64();
int fstat64();
int statvfs64();
int fstatvfs64();
int setrlimit64();
int getrlimit64();
int pread64();
int pwrite64();
int creat64();
int open64();
/*
* NTP syscalls
*/
int ntp_gettime();
int ntp_adjtime();
/*
* ++++++++++++++++++++++++
* ++ SunOS4.1 Buyback ++
* ++++++++++++++++++++++++
*
* fchroot, utimes, vhangup, gettimeofday
*/
int fchroot();
int utimes();
int vhangup();
int gettimeofday();
int getitimer();
int setitimer();
int corectl();
int modctl();
long tasksys();
long rctlsys();
long zone();
int so_socket();
int so_socketpair();
int bind();
int listen();
int accept();
int connect();
int shutdown();
int getpeername();
int getsockname();
int getsockopt();
int setsockopt();
int sockconfig();
/*
* Sysent initialization macros.
* These take the name string of the system call even though that isn't
* currently used in the sysent entry. This might be useful someday.
*
* Initialization macro for system calls which take their args in the C style.
* These system calls return the longlong_t return value and must call
* set_errno() to return an error. For SPARC, narg must be at most six.
* For more args, use the SYSENT_AP() routine.
*
* We are able to return two distinct values to userland via the rval_t.
* At this time, that corresponds to one 64-bit quantity, or two 32-bit
* quantities. The kernel does not currently need to return two 64-bit
* values, or one 128 bit value(!), but we may do one day, so the calling
* sequence between userland and the kernel should permit it.
*
* The interpretation of rval_t is provided by the sy_flags field
* which is used to determine how to arrange the results in registers
* (or on the stack) for return userland.
*/
/* returns a 64-bit quantity for both ABIs */
/* returns one 32-bit value for both ABIs: r_val1 */
/* returns 2 32-bit values: r_val1 & r_val2 */
/*
* Initialization macro for system calls which take their args in the standard
* Unix style of a pointer to the arg structure and a pointer to the rval_t.
*
* Deprecated wherever possible (slower on some architectures, and trickier
* to maintain two flavours).
*/
/*
* Conditional constructors to build the tables without #ifdef clutter
*/
#if defined(_LP64)
#define IF_LP64(true, false) true
#else
#define IF_LP64(true, false) false
#endif
#if defined(__sparc)
#define IF_sparc(true, false) true
#else
#define IF_sparc(true, false) false
#endif
#define IF_i386(true, false) true
#else
#define IF_i386(true, false) false
#endif
#define IF_x86(true, false) true
#else
#define IF_x86(true, false) false
#endif
#define IF_386_ABI(true, false) true
#else
#define IF_386_ABI(true, false) false
#endif
/*
* Define system calls that return a native 'long' quantity i.e. a 32-bit
* or 64-bit integer - depending on how the kernel is itself compiled
* e.g. read(2) returns 'ssize_t' in the kernel and in userland.
*/
/*
* Initialization macro for loadable native system calls.
*/
#define SYSENT_LOADABLE() \
/* ONC_PLUS EXTRACT END */
/*
* Initialization macro for loadable 32-bit compatibility system calls.
*/
#define SYSENT_LOADABLE32() SYSENT_LOADABLE()
/* ONC_PLUS EXTRACT START */
/*
* Native sysent table.
*/
{
/* ONC_PLUS EXTRACT END */
/* 0 */ IF_LP64(
SYSENT_NOSYS(),
/* 19 */ IF_LP64(
/* 35 */ IF_LP64(
SYSENT_NOSYS(),
/* 38 */ IF_LP64(
SYSENT_NOSYS(),
/* 50 */ IF_x86(
SYSENT_LOADABLE()), /* (was sys3b) */
/* 56 */ SYSENT_LOADABLE(),
/* 57 */ IF_LP64(
/*
* The following 6 entries were reserved for the UNIX PC.
*/
/* 64 */ SYSENT_LOADABLE(),
/* 65 */ SYSENT_LOADABLE(),
/* 66 */ SYSENT_LOADABLE(),
/* 76 */ IF_LP64(
/* 81 */ IF_LP64(
/* ONC_PLUS EXTRACT START */
/* ONC_PLUS EXTRACT END */
/* 109 */ IF_x86(
SYSENT_LOADABLE()),
/* 110 */ SYSENT_LOADABLE(),
/* 115 */ IF_LP64(
/* 123 */ IF_LP64(
SYSENT_NOSYS(),
SYSENT_NOSYS())),
/* 124 */ IF_LP64(
SYSENT_NOSYS(),
SYSENT_NOSYS())),
/* 125 */ IF_LP64(
SYSENT_NOSYS(),
SYSENT_NOSYS())),
/* 126 */ IF_LP64(
SYSENT_NOSYS(),
SYSENT_NOSYS())),
/* 128 */ IF_LP64(
/* 129 */ IF_LP64(
/* 166 */ IF_x86(
SYSENT_NOSYS()),
/*
* The 64-bit C library maps llseek() to lseek(), so this
* is needed as a native syscall only on the 32-bit kernel.
*/
/* 175 */ IF_LP64(
SYSENT_NOSYS(),
/* 208 */ IF_sparc(
SYSENT_NOSYS()),
/*
* Syscalls 213-225: 32-bit system call support for large files.
*
* (The 64-bit C library transparently maps these system calls
* back to their native versions, so almost all of them are only
* needed as native syscalls on the 32-bit kernel).
*/
/* 213 */ IF_LP64(
SYSENT_NOSYS(),
/* 214 */ IF_LP64(
SYSENT_NOSYS(),
/* 215 */ IF_LP64(
SYSENT_NOSYS(),
/* 216 */ IF_LP64(
SYSENT_NOSYS(),
/* 217 */ IF_LP64(
SYSENT_NOSYS(),
/* 218 */ IF_LP64(
SYSENT_NOSYS(),
/* 219 */ IF_LP64(
SYSENT_NOSYS(),
/* 220 */ IF_LP64(
SYSENT_NOSYS(),
/* 221 */ IF_LP64(
SYSENT_NOSYS(),
/* 222 */ IF_LP64(
SYSENT_NOSYS(),
/* 223 */ IF_LP64(
SYSENT_NOSYS(),
/* 224 */ IF_LP64(
SYSENT_NOSYS(),
/* 225 */ IF_LP64(
SYSENT_NOSYS(),
/* ONC_PLUS EXTRACT START */
};
/* ONC_PLUS EXTRACT END */
#ifdef _SYSCALL32_IMPL
extern int ulimit32();
extern ssize_t readlink32();
extern int open32();
extern int creat32();
extern int xstat32();
extern int lxstat32();
extern int fxstat32();
#endif
extern int stat32();
extern int fstatat32();
extern int lstat32();
extern int fstat32();
extern int fstatat64_32();
extern int stat64_32();
extern int lstat64_32();
extern int fstat64_32();
extern int getmsg32();
extern int putmsg32();
extern int getpmsg32();
extern int putpmsg32();
extern int getsetcontext32();
extern int statvfs32();
extern int fstatvfs32();
extern int statvfs64_32();
extern int fstatvfs64_32();
extern int sigaction32();
extern int stime32();
extern int getpagesizes32();
extern int sigaltstack32();
extern int sigqueue32();
extern int waitsys32();
extern ssize_t recvfrom32();
extern int privsys32();
extern int ucredsys32();
/* ONC_PLUS EXTRACT START */
/*
* sysent table for ILP32 processes running on
* a LP64 kernel.
*/
{
/* ONC_PLUS EXTRACT END */
/* 50 */ IF_386_ABI(
SYSENT_LOADABLE()), /* (was sys3b) */
/* 56 */ SYSENT_LOADABLE32(),
/*
* The following 6 entries were reserved for the UNIX PC.
*/
/* 64 */ SYSENT_LOADABLE32(),
/* 65 */ SYSENT_LOADABLE32(),
/* 66 */ SYSENT_LOADABLE32(),
/* ONC_PLUS EXTRACT START */
/* ONC_PLUS EXTRACT END */
/* 109 */ IF_x86(
/* 110 */ SYSENT_LOADABLE32(),
/* 123 */ IF_386_ABI(
SYSENT_NOSYS()),
/* 124 */ IF_386_ABI(
SYSENT_NOSYS()),
/* 125 */ IF_386_ABI(
SYSENT_NOSYS()),
/* 126 */ IF_386_ABI(
SYSENT_NOSYS()),
/* 166 */ IF_x86(
SYSENT_NOSYS()),
/* 208 */ SYSENT_LOADABLE32(),
/*
* Syscalls 213-225: 32-bit system call support for large files.
*/
/* ONC_PLUS EXTRACT START */
};
/* ONC_PLUS EXTRACT END */
#endif /* _SYSCALL32_IMPL */
/*
* Space allocated and initialized in init_syscallnames().
*/
char **syscallnames;
/*ARGSUSED*/
void
{}
/*ARGSUSED*/
{
proc_t *p;
/*
* We want to explicitly allow DTrace consumers to stop a process
* before it actually executes the meat of the syscall.
*/
mutex_enter(&p->p_lock);
curthread->t_dtrace_stop = 0;
stop(PR_REQUESTED, 0);
}
mutex_exit(&p->p_lock);
rval = -1;
return (rval);
}
#ifdef _SYSCALL32_IMPL
/*ARGSUSED*/
{
proc_t *p;
/*
* We want to explicitly allow DTrace consumers to stop a process
* before it actually executes the meat of the syscall.
*/
mutex_enter(&p->p_lock);
curthread->t_dtrace_stop = 0;
stop(PR_REQUESTED, 0);
}
mutex_exit(&p->p_lock);
rval = -1;
return (rval);
}
#endif
void
dtrace_systrace_rtt(void)
{
if (get_udatamodel() == DATAMODEL_NATIVE) {
if (systrace_sysent == NULL)
return;
#ifdef _SYSCALL32_IMPL
} else {
if (systrace_sysent32 == NULL)
return;
#endif
}
(*systrace_probe)(id, 0, 0, 0, 0, 0, 0);
}