summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-03-01 06:29:34 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-03-01 06:29:34 +0000
commit7c0be85c50220aebd8123e101cead81a317d2d44 (patch)
tree84881d2d3de0a8e85455bb39906451578c7b8991 /sys
parentf29e4c0c751f64e8c0b1ca52ff40fc7e8a2f874b (diff)
downloadFreeBSD-src-7c0be85c50220aebd8123e101cead81a317d2d44.zip
FreeBSD-src-7c0be85c50220aebd8123e101cead81a317d2d44.tar.gz
Let kernel POSIX timer code and mqueue code to use integer as a resource
handle, the timer_t and mqd_t types will be a pointer which userland will define it.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_time.c46
-rw-r--r--sys/kern/syscalls.master24
-rw-r--r--sys/kern/uipc_mqueue.c24
-rw-r--r--sys/sys/_types.h4
4 files changed, 49 insertions, 49 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 94df2d2..d82555c 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -85,7 +85,7 @@ static int itimer_init(void *, int, int);
static void itimer_fini(void *, int);
static void itimer_enter(struct itimer *);
static void itimer_leave(struct itimer *);
-static struct itimer *itimer_find(struct proc *, timer_t, int);
+static struct itimer *itimer_find(struct proc *, int, int);
static void itimers_alloc(struct proc *);
static void itimers_event_hook(void *arg, struct proc *p);
static int realtimer_create(struct itimer *);
@@ -97,8 +97,8 @@ static void realtimer_clocktime(clockid_t, struct timespec *);
static void realtimer_expire(void *);
static void realtimer_event_hook(struct proc *, clockid_t, int event);
static int kern_timer_create(struct thread *, clockid_t,
- struct sigevent *, timer_t *, timer_t);
-static int kern_timer_delete(struct thread *, timer_t);
+ struct sigevent *, int *, int);
+static int kern_timer_delete(struct thread *, int);
int register_posix_clock(int, struct kclock *);
void itimer_fire(struct itimer *it);
@@ -947,18 +947,18 @@ itimer_leave(struct itimer *it)
}
#ifndef _SYS_SYSPROTO_H_
-struct timer_create_args {
+struct ktimer_create_args {
clockid_t clock_id;
struct sigevent * evp;
- timer_t * timerid;
+ int * timerid;
};
#endif
int
-timer_create(struct thread *td, struct timer_create_args *uap)
+ktimer_create(struct thread *td, struct ktimer_create_args *uap)
{
struct sigevent *evp1, ev;
- timer_t id;
+ int id;
int error;
if (uap->evp != NULL) {
@@ -972,7 +972,7 @@ timer_create(struct thread *td, struct timer_create_args *uap)
error = kern_timer_create(td, uap->clock_id, evp1, &id, -1);
if (error == 0) {
- error = copyout(&id, uap->timerid, sizeof(timer_t));
+ error = copyout(&id, uap->timerid, sizeof(int));
if (error != 0)
kern_timer_delete(td, id);
}
@@ -981,7 +981,7 @@ timer_create(struct thread *td, struct timer_create_args *uap)
static int
kern_timer_create(struct thread *td, clockid_t clock_id,
- struct sigevent *evp, timer_t *timerid, timer_t preset_id)
+ struct sigevent *evp, int *timerid, int preset_id)
{
struct proc *p = td->td_proc;
struct itimer *it;
@@ -1089,19 +1089,19 @@ out:
}
#ifndef _SYS_SYSPROTO_H_
-struct timer_delete_args {
- timer_t timerid;
+struct ktimer_delete_args {
+ int timerid;
};
#endif
int
-timer_delete(struct thread *td, struct timer_delete_args *uap)
+ktimer_delete(struct thread *td, struct ktimer_delete_args *uap)
{
return (kern_timer_delete(td, uap->timerid));
}
static struct itimer *
-itimer_find(struct proc *p, timer_t timerid, int include_deleting)
+itimer_find(struct proc *p, int timerid, int include_deleting)
{
struct itimer *it;
@@ -1119,7 +1119,7 @@ itimer_find(struct proc *p, timer_t timerid, int include_deleting)
}
static int
-kern_timer_delete(struct thread *td, timer_t timerid)
+kern_timer_delete(struct thread *td, int timerid)
{
struct proc *p = td->td_proc;
struct itimer *it;
@@ -1151,8 +1151,8 @@ kern_timer_delete(struct thread *td, timer_t timerid)
}
#ifndef _SYS_SYSPROTO_H_
-struct timer_settime_args {
- timer_t timerid;
+struct ktimer_settime_args {
+ int timerid;
int flags;
const struct itimerspec * value;
struct itimerspec * ovalue;
@@ -1160,7 +1160,7 @@ struct timer_settime_args {
#endif
int
-timer_settime(struct thread *td, struct timer_settime_args *uap)
+ktimer_settime(struct thread *td, struct ktimer_settime_args *uap)
{
struct proc *p = td->td_proc;
struct itimer *it;
@@ -1195,14 +1195,14 @@ timer_settime(struct thread *td, struct timer_settime_args *uap)
}
#ifndef _SYS_SYSPROTO_H_
-struct timer_gettime_args {
- timer_t timerid;
+struct ktimer_gettime_args {
+ int timerid;
struct itimerspec * value;
};
#endif
int
-timer_gettime(struct thread *td, struct timer_gettime_args *uap)
+ktimer_gettime(struct thread *td, struct ktimer_gettime_args *uap)
{
struct proc *p = td->td_proc;
struct itimer *it;
@@ -1229,12 +1229,12 @@ timer_gettime(struct thread *td, struct timer_gettime_args *uap)
#ifndef _SYS_SYSPROTO_H_
struct timer_getoverrun_args {
- timer_t timerid;
+ int timerid;
};
#endif
int
-timer_getoverrun(struct thread *td, struct timer_getoverrun_args *uap)
+ktimer_getoverrun(struct thread *td, struct ktimer_getoverrun_args *uap)
{
struct proc *p = td->td_proc;
struct itimer *it;
@@ -1348,7 +1348,7 @@ realtimer_clocktime(clockid_t id, struct timespec *ts)
}
int
-itimer_accept(struct proc *p, timer_t timerid, ksiginfo_t *ksi)
+itimer_accept(struct proc *p, int timerid, ksiginfo_t *ksi)
{
struct itimer *it;
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 8f47a49..392bb9c 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -438,15 +438,15 @@
const struct timespec *tp); }
234 AUE_NULL MSTD { int clock_getres(clockid_t clock_id, \
struct timespec *tp); }
-235 AUE_NULL MSTD { int timer_create(clockid_t clock_id, \
- struct sigevent *evp, timer_t *timerid); }
-236 AUE_NULL MSTD { int timer_delete(timer_t timerid); }
-237 AUE_NULL MSTD { int timer_settime(timer_t timerid, int flags, \
+235 AUE_NULL MSTD { int ktimer_create(clockid_t clock_id, \
+ struct sigevent *evp, int *timerid); }
+236 AUE_NULL MSTD { int ktimer_delete(int timerid); }
+237 AUE_NULL MSTD { int ktimer_settime(int timerid, int flags, \
const struct itimerspec *value, \
struct itimerspec *ovalue); }
-238 AUE_NULL MSTD { int timer_gettime(timer_t timerid, struct \
+238 AUE_NULL MSTD { int ktimer_gettime(int timerid, struct \
itimerspec *value); }
-239 AUE_NULL MSTD { int timer_getoverrun(timer_t timerid); }
+239 AUE_NULL MSTD { int ktimer_getoverrun(int timerid); }
240 AUE_NULL MSTD { int nanosleep(const struct timespec *rqtp, \
struct timespec *rmtp); }
241 AUE_NULL UNIMPL nosys
@@ -799,22 +799,22 @@
455 AUE_NULL MSTD { int thr_new(struct thr_param *param, \
int param_size); }
456 AUE_NULL MSTD { int sigqueue(pid_t pid, int signum, void *value); }
-457 AUE_NULL MNOSTD { int mq_open(const char *path, int flags, \
+457 AUE_NULL MNOSTD { int kmq_open(const char *path, int flags, \
mode_t mode, const struct mq_attr *attr); }
-458 AUE_NULL MNOSTD { int mq_setattr(mqd_t mqd, \
+458 AUE_NULL MNOSTD { int kmq_setattr(int mqd, \
const struct mq_attr *attr, \
struct mq_attr *oattr); }
-459 AUE_NULL MNOSTD { int mq_timedreceive(mqd_t mqd, \
+459 AUE_NULL MNOSTD { int kmq_timedreceive(int mqd, \
char *msg_ptr, size_t msg_len, \
unsigned *msg_prio, \
const struct timespec *abs_timeout); }
-460 AUE_NULL MNOSTD { int mq_timedsend(mqd_t mqd, \
+460 AUE_NULL MNOSTD { int kmq_timedsend(int mqd, \
const char *msg_ptr, size_t msg_len,\
unsigned msg_prio, \
const struct timespec *abs_timeout);}
-461 AUE_NULL MNOSTD { int mq_notify(mqd_t mqd, \
+461 AUE_NULL MNOSTD { int kmq_notify(int mqd, \
const struct sigevent *sigev); }
-462 AUE_NULL MNOSTD { int mq_unlink(const char *path); }
+462 AUE_NULL MNOSTD { int kmq_unlink(const char *path); }
463 AUE_NULL MSTD { int abort2(const char *why, int nargs, void **args); }
464 AUE_NULL MSTD { int thr_set_name(long id, const char *name); }
; Please copy any additions and changes to the following compatability tables:
diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c
index 46af2e9..a6587d5 100644
--- a/sys/kern/uipc_mqueue.c
+++ b/sys/kern/uipc_mqueue.c
@@ -1893,7 +1893,7 @@ notifier_remove(struct proc *p, struct mqueue *mq, int fd)
* Syscall to open a message queue
*/
int
-mq_open(struct thread *td, struct mq_open_args *uap)
+kmq_open(struct thread *td, struct kmq_open_args *uap)
{
char path[MQFS_NAMELEN + 1];
struct mq_attr attr, *pattr;
@@ -2007,7 +2007,7 @@ mq_open(struct thread *td, struct mq_open_args *uap)
* Syscall to unlink a message queue
*/
int
-mq_unlink(struct thread *td, struct mq_unlink_args *uap)
+kmq_unlink(struct thread *td, struct kmq_unlink_args *uap)
{
char path[MQFS_NAMELEN+1];
struct mqfs_node *pn;
@@ -2083,7 +2083,7 @@ getmq_write(struct thread *td, int fd, struct file **fpp,
* Syscall
*/
int
-mq_setattr(struct thread *td, struct mq_setattr_args *uap)
+kmq_setattr(struct thread *td, struct kmq_setattr_args *uap)
{
struct mqueue *mq;
struct file *fp;
@@ -2120,7 +2120,7 @@ mq_setattr(struct thread *td, struct mq_setattr_args *uap)
* Syscall
*/
int
-mq_timedreceive(struct thread *td, struct mq_timedreceive_args *uap)
+kmq_timedreceive(struct thread *td, struct kmq_timedreceive_args *uap)
{
struct mqueue *mq;
struct file *fp;
@@ -2141,7 +2141,7 @@ mq_timedreceive(struct thread *td, struct mq_timedreceive_args *uap)
* Syscall
*/
int
-mq_timedsend(struct thread *td, struct mq_timedsend_args *uap)
+kmq_timedsend(struct thread *td, struct kmq_timedsend_args *uap)
{
struct mqueue *mq;
struct file *fp;
@@ -2161,7 +2161,7 @@ mq_timedsend(struct thread *td, struct mq_timedsend_args *uap)
* Syscall
*/
int
-mq_notify(struct thread *td, struct mq_notify_args *uap)
+kmq_notify(struct thread *td, struct kmq_notify_args *uap)
{
struct sigevent ev;
struct filedesc *fdp;
@@ -2471,12 +2471,12 @@ static struct vfsops mqfs_vfsops = {
.vfs_statfs = mqfs_statfs,
};
-SYSCALL_MODULE_HELPER(mq_open);
-SYSCALL_MODULE_HELPER(mq_setattr);
-SYSCALL_MODULE_HELPER(mq_timedsend);
-SYSCALL_MODULE_HELPER(mq_timedreceive);
-SYSCALL_MODULE_HELPER(mq_notify);
-SYSCALL_MODULE_HELPER(mq_unlink);
+SYSCALL_MODULE_HELPER(kmq_open);
+SYSCALL_MODULE_HELPER(kmq_setattr);
+SYSCALL_MODULE_HELPER(kmq_timedsend);
+SYSCALL_MODULE_HELPER(kmq_timedreceive);
+SYSCALL_MODULE_HELPER(kmq_notify);
+SYSCALL_MODULE_HELPER(kmq_unlink);
VFS_SET(mqfs_vfsops, mqueuefs, VFCF_SYNTHETIC);
MODULE_VERSION(mqueuefs, 1);
diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index 3d09307..6f1f74a 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -57,8 +57,8 @@ typedef __int64_t __rlim_t; /* resource limit - intentionally */
typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t;
typedef long __suseconds_t; /* microseconds (signed) */
-typedef __int32_t __timer_t; /* timer_gettime()... */
-typedef __int32_t __mqd_t; /* mq_open()... */
+typedef struct __timer *__timer_t; /* timer_gettime()... */
+typedef struct __mq *__mqd_t; /* mq_open()... */
typedef __uint32_t __uid_t;
typedef unsigned int __useconds_t; /* microseconds (unsigned) */
OpenPOWER on IntegriCloud