- rename nanosleep1 to kern_nanosleep

- Add a 32bit syscall entry for nanosleep

Reviewed by:	peter
Obtained from:	Yahoo!
This commit is contained in:
Paul Saab 2005-01-19 17:44:59 +00:00
parent aa959e0d17
commit 7fdf2c856f
8 changed files with 47 additions and 9 deletions

View File

@ -1286,6 +1286,37 @@ freebsd4_freebsd32_sigaction(struct thread *td,
}
#endif
int
freebsd32_nanosleep(struct thread *td, struct freebsd32_nanosleep_args *uap)
{
struct timespec32 rmt32, rqt32;
struct timespec rmt, rqt;
int error;
error = copyin(uap->rqtp, &rqt32, sizeof(rqt));
if (error)
return (error);
CP(rqt32, rqt, tv_sec);
CP(rqt32, rqt, tv_nsec);
if (uap->rmtp &&
!useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
return (EFAULT);
error = kern_nanosleep(td, &rqt, &rmt);
if (error && uap->rmtp) {
int error2;
CP(rmt, rmt32, tv_sec);
CP(rmt, rmt32, tv_nsec);
error2 = copyout(&rmt32, uap->rmtp, sizeof(rmt));
if (error2)
error = error2;
}
return (error);
}
#if 0
int

View File

@ -179,6 +179,10 @@ struct freebsd32_sysctl_args {
char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)];
char newlen_l_[PADL_(u_int32_t)]; u_int32_t newlen; char newlen_r_[PADR_(u_int32_t)];
};
struct freebsd32_nanosleep_args {
char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];
char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];
};
struct freebsd32_kevent_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char changelist_l_[PADL_(const struct kevent *)]; const struct kevent * changelist; char changelist_r_[PADR_(const struct kevent *)];
@ -231,6 +235,7 @@ int freebsd32_lseek(struct thread *, struct freebsd32_lseek_args *);
int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *);
int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *);
int freebsd32_sysctl(struct thread *, struct freebsd32_sysctl_args *);
int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *);
int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *);
int freebsd32_sendfile(struct thread *, struct freebsd32_sendfile_args *);
int freebsd32_sigaction(struct thread *, struct freebsd32_sigaction_args *);

View File

@ -201,7 +201,7 @@
#define FREEBSD32_SYS_clock_gettime 232
#define FREEBSD32_SYS_clock_settime 233
#define FREEBSD32_SYS_clock_getres 234
#define FREEBSD32_SYS_nanosleep 240
#define FREEBSD32_SYS_freebsd32_nanosleep 240
#define FREEBSD32_SYS_minherit 250
#define FREEBSD32_SYS_rfork 251
#define FREEBSD32_SYS_openbsd_poll 252

View File

@ -247,7 +247,7 @@ const char *freebsd32_syscallnames[] = {
"#237", /* 237 = timer_settime */
"#238", /* 238 = timer_gettime */
"#239", /* 239 = timer_getoverrun */
"nanosleep", /* 240 = nanosleep */
"freebsd32_nanosleep", /* 240 = freebsd32_nanosleep */
"#241", /* 241 = nosys */
"#242", /* 242 = nosys */
"#243", /* 243 = nosys */

View File

@ -265,7 +265,7 @@ struct sysent freebsd32_sysent[] = {
{ 0, (sy_call_t *)nosys }, /* 237 = timer_settime */
{ 0, (sy_call_t *)nosys }, /* 238 = timer_gettime */
{ 0, (sy_call_t *)nosys }, /* 239 = timer_getoverrun */
{ SYF_MPSAFE | AS(nanosleep_args), (sy_call_t *)nanosleep }, /* 240 = nanosleep */
{ SYF_MPSAFE | AS(freebsd32_nanosleep_args), (sy_call_t *)freebsd32_nanosleep }, /* 240 = freebsd32_nanosleep */
{ 0, (sy_call_t *)nosys }, /* 241 = nosys */
{ 0, (sy_call_t *)nosys }, /* 242 = nosys */
{ 0, (sy_call_t *)nosys }, /* 243 = nosys */

View File

@ -352,7 +352,7 @@
237 UNIMPL timer_settime
238 UNIMPL timer_gettime
239 UNIMPL timer_getoverrun
240 MNOPROTO { int nanosleep(const struct timespec *rqtp, \
240 MSTD { int freebsd32_nanosleep(const struct timespec *rqtp, \
struct timespec *rmtp); }
241 UNIMPL nosys
242 UNIMPL nosys

View File

@ -65,8 +65,6 @@ int tz_dsttime;
* timers when they expire.
*/
static int nanosleep1(struct thread *td, struct timespec *rqt,
struct timespec *rmt);
static int settime(struct thread *, struct timeval *);
static void timevalfix(struct timeval *);
static void no_lease_updatetime(int);
@ -261,8 +259,8 @@ clock_getres(struct thread *td, struct clock_getres_args *uap)
static int nanowait;
static int
nanosleep1(struct thread *td, struct timespec *rqt, struct timespec *rmt)
int
kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt)
{
struct timespec ts, ts2, ts3;
struct timeval tv;
@ -322,7 +320,7 @@ nanosleep(struct thread *td, struct nanosleep_args *uap)
if (uap->rmtp &&
!useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
return (EFAULT);
error = nanosleep1(td, &rqt, &rmt);
error = kern_nanosleep(td, &rqt, &rmt);
if (error && uap->rmtp) {
int error2;

View File

@ -297,6 +297,10 @@ int ratecheck(struct timeval *, const struct timeval *);
void timevaladd(struct timeval *t1, const struct timeval *t2);
void timevalsub(struct timeval *t1, const struct timeval *t2);
int tvtohz(struct timeval *tv);
struct thread;
int kern_nanosleep(struct thread *td, struct timespec *rqt,
struct timespec *rmt);
#else /* !_KERNEL */
#include <time.h>