summaryrefslogtreecommitdiffstats
path: root/sys/compat/freebsd32
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2011-09-16 13:58:51 +0000
committerkmacy <kmacy@FreeBSD.org>2011-09-16 13:58:51 +0000
commit99851f359e6f006b3223bb37dbc49e751ca8c13a (patch)
tree2ed8c1cfa9e408c1c66c2cde0823123897e0306e /sys/compat/freebsd32
parentbf8fedabcd023c90bb2ee4ce0e5d6d8c2b927714 (diff)
downloadFreeBSD-src-99851f359e6f006b3223bb37dbc49e751ca8c13a.zip
FreeBSD-src-99851f359e6f006b3223bb37dbc49e751ca8c13a.tar.gz
In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
Diffstat (limited to 'sys/compat/freebsd32')
-rw-r--r--sys/compat/freebsd32/freebsd32_ioctl.c2
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c38
-rw-r--r--sys/compat/freebsd32/freebsd32_util.h9
3 files changed, 29 insertions, 20 deletions
diff --git a/sys/compat/freebsd32/freebsd32_ioctl.c b/sys/compat/freebsd32/freebsd32_ioctl.c
index 1d773ca..81f5c8e 100644
--- a/sys/compat/freebsd32/freebsd32_ioctl.c
+++ b/sys/compat/freebsd32/freebsd32_ioctl.c
@@ -396,7 +396,7 @@ freebsd32_ioctl(struct thread *td, struct freebsd32_ioctl_args *uap)
ap.fd = uap->fd;
ap.com = uap->com;
PTRIN_CP(*uap, ap, data);
- return ioctl(td, &ap);
+ return sys_ioctl(td, &ap);
}
fdrop(fp, td);
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 5b6e895..6d28715 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -425,7 +425,7 @@ freebsd32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end,
r.buf = (void *) start;
r.nbyte = end - start;
r.offset = pos;
- return (pread(td, &r));
+ return (sys_pread(td, &r));
} else {
while (start < end) {
subyte((void *) start, 0);
@@ -500,7 +500,7 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
r.buf = (void *) start;
r.nbyte = end - start;
r.offset = pos;
- error = pread(td, &r);
+ error = sys_pread(td, &r);
if (error)
return (error);
@@ -527,7 +527,7 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
ap.fd = fd;
ap.pos = pos;
- return (mmap(td, &ap));
+ return (sys_mmap(td, &ap));
}
#ifdef COMPAT_FREEBSD6
@@ -1401,7 +1401,7 @@ freebsd32_pread(struct thread *td, struct freebsd32_pread_args *uap)
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
ap.offset = PAIR32TO64(off_t,uap->offset);
- return (pread(td, &ap));
+ return (sys_pread(td, &ap));
}
int
@@ -1413,7 +1413,7 @@ freebsd32_pwrite(struct thread *td, struct freebsd32_pwrite_args *uap)
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
ap.offset = PAIR32TO64(off_t,uap->offset);
- return (pwrite(td, &ap));
+ return (sys_pwrite(td, &ap));
}
#ifdef COMPAT_43
@@ -1425,7 +1425,7 @@ ofreebsd32_lseek(struct thread *td, struct ofreebsd32_lseek_args *uap)
nuap.fd = uap->fd;
nuap.offset = uap->offset;
nuap.whence = uap->whence;
- return (lseek(td, &nuap));
+ return (sys_lseek(td, &nuap));
}
#endif
@@ -1439,7 +1439,7 @@ freebsd32_lseek(struct thread *td, struct freebsd32_lseek_args *uap)
ap.fd = uap->fd;
ap.offset = PAIR32TO64(off_t,uap->offset);
ap.whence = uap->whence;
- error = lseek(td, &ap);
+ error = sys_lseek(td, &ap);
/* Expand the quad return into two parts for eax and edx */
pos = *(off_t *)(td->td_retval);
td->td_retval[RETVAL_LO] = pos & 0xffffffff; /* %eax */
@@ -1454,7 +1454,7 @@ freebsd32_truncate(struct thread *td, struct freebsd32_truncate_args *uap)
ap.path = uap->path;
ap.length = PAIR32TO64(off_t,uap->length);
- return (truncate(td, &ap));
+ return (sys_truncate(td, &ap));
}
int
@@ -1464,7 +1464,7 @@ freebsd32_ftruncate(struct thread *td, struct freebsd32_ftruncate_args *uap)
ap.fd = uap->fd;
ap.length = PAIR32TO64(off_t,uap->length);
- return (ftruncate(td, &ap));
+ return (sys_ftruncate(td, &ap));
}
#ifdef COMPAT_43
@@ -1519,7 +1519,7 @@ freebsd6_freebsd32_pread(struct thread *td, struct freebsd6_freebsd32_pread_args
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
ap.offset = PAIR32TO64(off_t,uap->offset);
- return (pread(td, &ap));
+ return (sys_pread(td, &ap));
}
int
@@ -1531,7 +1531,7 @@ freebsd6_freebsd32_pwrite(struct thread *td, struct freebsd6_freebsd32_pwrite_ar
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
ap.offset = PAIR32TO64(off_t,uap->offset);
- return (pwrite(td, &ap));
+ return (sys_pwrite(td, &ap));
}
int
@@ -1544,7 +1544,7 @@ freebsd6_freebsd32_lseek(struct thread *td, struct freebsd6_freebsd32_lseek_args
ap.fd = uap->fd;
ap.offset = PAIR32TO64(off_t,uap->offset);
ap.whence = uap->whence;
- error = lseek(td, &ap);
+ error = sys_lseek(td, &ap);
/* Expand the quad return into two parts for eax and edx */
pos = *(off_t *)(td->td_retval);
td->td_retval[RETVAL_LO] = pos & 0xffffffff; /* %eax */
@@ -1559,7 +1559,7 @@ freebsd6_freebsd32_truncate(struct thread *td, struct freebsd6_freebsd32_truncat
ap.path = uap->path;
ap.length = PAIR32TO64(off_t,uap->length);
- return (truncate(td, &ap));
+ return (sys_truncate(td, &ap));
}
int
@@ -1569,7 +1569,7 @@ freebsd6_freebsd32_ftruncate(struct thread *td, struct freebsd6_freebsd32_ftrunc
ap.fd = uap->fd;
ap.length = PAIR32TO64(off_t,uap->length);
- return (ftruncate(td, &ap));
+ return (sys_ftruncate(td, &ap));
}
#endif /* COMPAT_FREEBSD6 */
@@ -2409,7 +2409,7 @@ freebsd32_cpuset_setid(struct thread *td,
ap.id = PAIR32TO64(id_t,uap->id);
ap.setid = uap->setid;
- return (cpuset_setid(td, &ap));
+ return (sys_cpuset_setid(td, &ap));
}
int
@@ -2423,7 +2423,7 @@ freebsd32_cpuset_getid(struct thread *td,
ap.id = PAIR32TO64(id_t,uap->id);
ap.setid = uap->setid;
- return (cpuset_getid(td, &ap));
+ return (sys_cpuset_getid(td, &ap));
}
int
@@ -2438,7 +2438,7 @@ freebsd32_cpuset_getaffinity(struct thread *td,
ap.cpusetsize = uap->cpusetsize;
ap.mask = uap->mask;
- return (cpuset_getaffinity(td, &ap));
+ return (sys_cpuset_getaffinity(td, &ap));
}
int
@@ -2453,7 +2453,7 @@ freebsd32_cpuset_setaffinity(struct thread *td,
ap.cpusetsize = uap->cpusetsize;
ap.mask = uap->mask;
- return (cpuset_setaffinity(td, &ap));
+ return (sys_cpuset_setaffinity(td, &ap));
}
int
@@ -2813,5 +2813,5 @@ freebsd32_posix_fallocate(struct thread *td,
ap.fd = uap->fd;
ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
ap.len = (uap->lenlo | ((off_t)uap->lenhi << 32));
- return (posix_fallocate(td, &ap));
+ return (sys_posix_fallocate(td, &ap));
}
diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h
index 0fed7b0..9282275 100644
--- a/sys/compat/freebsd32/freebsd32_util.h
+++ b/sys/compat/freebsd32/freebsd32_util.h
@@ -88,6 +88,15 @@ SYSCALL32_MODULE(syscallname, \
.syscall_no = FREEBSD32_SYS_##syscallname \
}
+#define SYSCALL32_INIT_HELPER_COMPAT(syscallname) { \
+ .new_sysent = { \
+ .sy_narg = (sizeof(struct syscallname ## _args ) \
+ / sizeof(register_t)), \
+ .sy_call = (sy_call_t *)& sys_ ## syscallname, \
+ }, \
+ .syscall_no = FREEBSD32_SYS_##syscallname \
+}
+
int syscall32_register(int *offset, struct sysent *new_sysent,
struct sysent *old_sysent);
int syscall32_deregister(int *offset, struct sysent *old_sysent);
OpenPOWER on IntegriCloud