update linux_times() and linux_utime() emulation,
fix sigsuspend() (actually back out my recent change there) and regen the syscall tables..
This commit is contained in:
parent
35834cd696
commit
7ec9174486
@ -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_misc.c,v 1.12 1996/02/16 18:40:50 peter Exp $
|
||||
* $Id: linux_misc.c,v 1.13 1996/03/02 19:37:57 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -675,25 +675,36 @@ struct linux_times_argv {
|
||||
long tms_cstime;
|
||||
};
|
||||
|
||||
#define CLK_TCK 100 /* Linux uses 100 */
|
||||
#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
|
||||
|
||||
int
|
||||
linux_times(struct proc *p, struct linux_times_args *args, int *retval)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct linux_times_argv tms;
|
||||
struct rusage ru;
|
||||
int error, s;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): times(*)\n", p->p_pid);
|
||||
#endif
|
||||
tms.tms_utime = p->p_uticks;
|
||||
tms.tms_stime = p->p_sticks;
|
||||
tms.tms_cutime = p->p_stats->p_cru.ru_utime.tv_sec * hz +
|
||||
((p->p_stats->p_cru.ru_utime.tv_usec * hz)/1000000);
|
||||
tms.tms_cstime = p->p_stats->p_cru.ru_stime.tv_sec * hz +
|
||||
((p->p_stats->p_cru.ru_stime.tv_usec * hz)/1000000);
|
||||
calcru(p, &ru.ru_utime, &ru.ru_stime, NULL);
|
||||
|
||||
tms.tms_utime = CONVTCK(ru.ru_utime);
|
||||
tms.tms_stime = CONVTCK(ru.ru_stime);
|
||||
|
||||
tms.tms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
|
||||
tms.tms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
|
||||
|
||||
if ((error = copyout((caddr_t)&tms, (caddr_t)args->buf,
|
||||
sizeof(struct linux_times_argv))))
|
||||
return error;
|
||||
|
||||
microtime(&tv);
|
||||
*retval = tv.tv_sec * hz + (tv.tv_usec * hz)/1000000;
|
||||
return (copyout((caddr_t)&tms, (caddr_t)args->buf,
|
||||
sizeof(struct linux_times_argv)));
|
||||
timevalsub(&tv, &boottime);
|
||||
*retval = (int)CONVTCK(tv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX move */
|
||||
@ -725,6 +736,10 @@ linux_newuname(struct proc *p, struct linux_newuname_args *args, int *retval)
|
||||
sizeof(struct linux_newuname_t)));
|
||||
}
|
||||
|
||||
struct linux_utimbuf {
|
||||
linux_time_t l_actime;
|
||||
linux_time_t l_modtime;
|
||||
};
|
||||
|
||||
int
|
||||
linux_utime(struct proc *p, struct linux_utime_args *args, int *retval)
|
||||
@ -733,7 +748,9 @@ linux_utime(struct proc *p, struct linux_utime_args *args, int *retval)
|
||||
char *path;
|
||||
struct timeval *tptr;
|
||||
} */ bsdutimes;
|
||||
struct timeval tv;
|
||||
struct timeval tv[2], *tvp;
|
||||
struct linux_utimbuf lut;
|
||||
int error;
|
||||
caddr_t sg;
|
||||
|
||||
sg = stackgap_init();
|
||||
@ -742,9 +759,21 @@ linux_utime(struct proc *p, struct linux_utime_args *args, int *retval)
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): utime(%s, *)\n", p->p_pid, args->fname);
|
||||
#endif
|
||||
tv.tv_sec = (long)args->timeptr; /* XXX: wrong?? */
|
||||
tv.tv_usec = 0;
|
||||
bsdutimes.tptr = &tv;
|
||||
if (args->times) {
|
||||
if ((error = copyin(args->times, &lut, sizeof lut)))
|
||||
return error;
|
||||
tv[0].tv_sec = lut.l_actime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = lut.l_modtime;
|
||||
tv[1].tv_usec = 0;
|
||||
/* so that utimes can copyin */
|
||||
tvp = (struct timeval *)stackgap_alloc(&sg, sizeof(tv));
|
||||
if ((error = copyout(tv, tvp, sizeof(tv))))
|
||||
return error;
|
||||
bsdutimes.tptr = tvp;
|
||||
} else
|
||||
bsdutimes.tptr = NULL;
|
||||
|
||||
bsdutimes.path = args->fname;
|
||||
return utimes(p, &bsdutimes, retval);
|
||||
}
|
||||
|
@ -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_signal.c,v 1.4 1996/03/02 19:37:58 peter Exp $
|
||||
* $Id: linux_signal.c,v 1.5 1996/03/02 21:00:11 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -267,11 +267,15 @@ linux_sigpending(struct proc *p, struct linux_sigpending_args *args,int *retval)
|
||||
return copyout(&linux_sig, args->mask, sizeof(linux_sig));
|
||||
}
|
||||
|
||||
/*
|
||||
* Linux has two extra args, restart and oldmask. We dont use these,
|
||||
* but it seems that "restart" is actually a context pointer that
|
||||
* enables the signal to happen with a different register set.
|
||||
*/
|
||||
int
|
||||
linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args,int *retval)
|
||||
{
|
||||
struct sigsuspend_args tmp;
|
||||
int error;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): sigsuspend(%08x)\n", p->p_pid, args->mask);
|
||||
@ -284,7 +288,6 @@ int
|
||||
linux_pause(struct proc *p, struct linux_pause_args *args,int *retval)
|
||||
{
|
||||
struct sigsuspend_args tmp;
|
||||
int error;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): pause()\n", p->p_pid);
|
||||
|
@ -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_misc.c,v 1.12 1996/02/16 18:40:50 peter Exp $
|
||||
* $Id: linux_misc.c,v 1.13 1996/03/02 19:37:57 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -675,25 +675,36 @@ struct linux_times_argv {
|
||||
long tms_cstime;
|
||||
};
|
||||
|
||||
#define CLK_TCK 100 /* Linux uses 100 */
|
||||
#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
|
||||
|
||||
int
|
||||
linux_times(struct proc *p, struct linux_times_args *args, int *retval)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct linux_times_argv tms;
|
||||
struct rusage ru;
|
||||
int error, s;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): times(*)\n", p->p_pid);
|
||||
#endif
|
||||
tms.tms_utime = p->p_uticks;
|
||||
tms.tms_stime = p->p_sticks;
|
||||
tms.tms_cutime = p->p_stats->p_cru.ru_utime.tv_sec * hz +
|
||||
((p->p_stats->p_cru.ru_utime.tv_usec * hz)/1000000);
|
||||
tms.tms_cstime = p->p_stats->p_cru.ru_stime.tv_sec * hz +
|
||||
((p->p_stats->p_cru.ru_stime.tv_usec * hz)/1000000);
|
||||
calcru(p, &ru.ru_utime, &ru.ru_stime, NULL);
|
||||
|
||||
tms.tms_utime = CONVTCK(ru.ru_utime);
|
||||
tms.tms_stime = CONVTCK(ru.ru_stime);
|
||||
|
||||
tms.tms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
|
||||
tms.tms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
|
||||
|
||||
if ((error = copyout((caddr_t)&tms, (caddr_t)args->buf,
|
||||
sizeof(struct linux_times_argv))))
|
||||
return error;
|
||||
|
||||
microtime(&tv);
|
||||
*retval = tv.tv_sec * hz + (tv.tv_usec * hz)/1000000;
|
||||
return (copyout((caddr_t)&tms, (caddr_t)args->buf,
|
||||
sizeof(struct linux_times_argv)));
|
||||
timevalsub(&tv, &boottime);
|
||||
*retval = (int)CONVTCK(tv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX move */
|
||||
@ -725,6 +736,10 @@ linux_newuname(struct proc *p, struct linux_newuname_args *args, int *retval)
|
||||
sizeof(struct linux_newuname_t)));
|
||||
}
|
||||
|
||||
struct linux_utimbuf {
|
||||
linux_time_t l_actime;
|
||||
linux_time_t l_modtime;
|
||||
};
|
||||
|
||||
int
|
||||
linux_utime(struct proc *p, struct linux_utime_args *args, int *retval)
|
||||
@ -733,7 +748,9 @@ linux_utime(struct proc *p, struct linux_utime_args *args, int *retval)
|
||||
char *path;
|
||||
struct timeval *tptr;
|
||||
} */ bsdutimes;
|
||||
struct timeval tv;
|
||||
struct timeval tv[2], *tvp;
|
||||
struct linux_utimbuf lut;
|
||||
int error;
|
||||
caddr_t sg;
|
||||
|
||||
sg = stackgap_init();
|
||||
@ -742,9 +759,21 @@ linux_utime(struct proc *p, struct linux_utime_args *args, int *retval)
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): utime(%s, *)\n", p->p_pid, args->fname);
|
||||
#endif
|
||||
tv.tv_sec = (long)args->timeptr; /* XXX: wrong?? */
|
||||
tv.tv_usec = 0;
|
||||
bsdutimes.tptr = &tv;
|
||||
if (args->times) {
|
||||
if ((error = copyin(args->times, &lut, sizeof lut)))
|
||||
return error;
|
||||
tv[0].tv_sec = lut.l_actime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = lut.l_modtime;
|
||||
tv[1].tv_usec = 0;
|
||||
/* so that utimes can copyin */
|
||||
tvp = (struct timeval *)stackgap_alloc(&sg, sizeof(tv));
|
||||
if ((error = copyout(tv, tvp, sizeof(tv))))
|
||||
return error;
|
||||
bsdutimes.tptr = tvp;
|
||||
} else
|
||||
bsdutimes.tptr = NULL;
|
||||
|
||||
bsdutimes.path = args->fname;
|
||||
return utimes(p, &bsdutimes, retval);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* System call prototypes.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from Id: syscalls.master,v 1.1 1996/03/02 19:04:15 peter Exp
|
||||
* created from Id: syscalls.master,v 1.2 1996/03/04 20:58:47 peter Exp
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_SYSPROTO_H_
|
||||
@ -96,7 +96,7 @@ struct linux_pause_args {
|
||||
};
|
||||
struct linux_utime_args {
|
||||
char * fname;
|
||||
struct linux_time_t * timeptr;
|
||||
struct linux_utimbuf * times;
|
||||
};
|
||||
struct linux_stty_args {
|
||||
int dummy;
|
||||
@ -185,6 +185,8 @@ struct linux_sigsetmask_args {
|
||||
linux_sigset_t mask;
|
||||
};
|
||||
struct linux_sigsuspend_args {
|
||||
int restart;
|
||||
linux_sigset_t oldmask;
|
||||
linux_sigset_t mask;
|
||||
};
|
||||
struct linux_sigpending_args {
|
||||
|
@ -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_signal.c,v 1.4 1996/03/02 19:37:58 peter Exp $
|
||||
* $Id: linux_signal.c,v 1.5 1996/03/02 21:00:11 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -267,11 +267,15 @@ linux_sigpending(struct proc *p, struct linux_sigpending_args *args,int *retval)
|
||||
return copyout(&linux_sig, args->mask, sizeof(linux_sig));
|
||||
}
|
||||
|
||||
/*
|
||||
* Linux has two extra args, restart and oldmask. We dont use these,
|
||||
* but it seems that "restart" is actually a context pointer that
|
||||
* enables the signal to happen with a different register set.
|
||||
*/
|
||||
int
|
||||
linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args,int *retval)
|
||||
{
|
||||
struct sigsuspend_args tmp;
|
||||
int error;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): sigsuspend(%08x)\n", p->p_pid, args->mask);
|
||||
@ -284,7 +288,6 @@ int
|
||||
linux_pause(struct proc *p, struct linux_pause_args *args,int *retval)
|
||||
{
|
||||
struct sigsuspend_args tmp;
|
||||
int error;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Linux-emul(%d): pause()\n", p->p_pid);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* System call numbers.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from Id: syscalls.master,v 1.1 1996/03/02 19:04:15 peter Exp
|
||||
* created from Id: syscalls.master,v 1.2 1996/03/04 20:58:47 peter Exp
|
||||
*/
|
||||
|
||||
#define LINUX_SYS_linux_setup 0
|
||||
|
@ -2,7 +2,7 @@
|
||||
* System call switch table.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from Id: syscalls.master,v 1.1 1996/03/02 19:04:15 peter Exp
|
||||
* created from Id: syscalls.master,v 1.2 1996/03/04 20:58:47 peter Exp
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -93,7 +93,7 @@ struct sysent linux_sysent[] = {
|
||||
{ 1, (sy_call_t *)linux_sigsetmask }, /* 69 = linux_sigsetmask */
|
||||
{ 2, (sy_call_t *)setreuid }, /* 70 = setreuid */
|
||||
{ 2, (sy_call_t *)setregid }, /* 71 = setregid */
|
||||
{ 1, (sy_call_t *)linux_sigsuspend }, /* 72 = linux_sigsuspend */
|
||||
{ 3, (sy_call_t *)linux_sigsuspend }, /* 72 = linux_sigsuspend */
|
||||
{ 1, (sy_call_t *)linux_sigpending }, /* 73 = linux_sigpending */
|
||||
{ 2, (sy_call_t *)osethostname }, /* 74 = osethostname */
|
||||
{ 2, (sy_call_t *)osetrlimit }, /* 75 = osetrlimit */
|
||||
|
Loading…
x
Reference in New Issue
Block a user