13 #include <linux/errno.h>
14 #include <linux/sched.h>
15 #include <linux/kernel.h>
18 #include <linux/stddef.h>
21 #include <linux/ptrace.h>
23 #include <linux/utsname.h>
24 #include <linux/time.h>
25 #include <linux/timex.h>
27 #include <linux/stat.h>
28 #include <linux/mman.h>
29 #include <linux/shm.h>
30 #include <linux/poll.h>
32 #include <linux/types.h>
33 #include <linux/ipc.h>
35 #include <linux/uio.h>
38 #include <linux/slab.h>
42 #include <asm/uaccess.h>
43 #include <asm/sysinfo.h>
44 #include <asm/thread_info.h>
46 #include <asm/processor.h>
57 if (brk && brk != retval)
66 unsigned long, text_len,
unsigned long,
bss_start,
67 unsigned long, bss_len)
76 printk(
"set_program_attributes(%lx %lx %lx %lx)\n",
89 #define NAME_OFFSET offsetof (struct osf_dirent, d_name)
106 osf_filldir(
void *__buf,
const char *
name,
int namlen, loff_t
offset,
107 u64 ino,
unsigned int d_type)
115 if (reclen > buf->
count)
118 if (
sizeof(d_ino) <
sizeof(ino) && d_ino != ino) {
134 dirent = (
void __user *)dirent + reclen;
136 buf->
count -= reclen;
145 long __user *,
basep)
148 struct fd arg = fdget(
fd);
172 unsigned long, prot,
unsigned long,
flags,
unsigned long,
fd,
179 printk(
"%s: unimplemented OSF mmap flags %04lx\n",
273 struct osf_stat tmp = { 0 };
297 linux_to_osf_statfs(
struct kstatfs *linux_stat,
struct osf_statfs __user *osf_stat,
298 unsigned long bufsiz)
303 tmp_stat.f_flags = 0;
304 tmp_stat.f_fsize = linux_stat->
f_frsize;
305 tmp_stat.f_bsize = linux_stat->
f_bsize;
306 tmp_stat.f_blocks = linux_stat->
f_blocks;
307 tmp_stat.f_bfree = linux_stat->
f_bfree;
308 tmp_stat.f_bavail = linux_stat->
f_bavail;
309 tmp_stat.f_files = linux_stat->
f_files;
310 tmp_stat.f_ffree = linux_stat->
f_ffree;
311 tmp_stat.f_fsid = linux_stat->
f_fsid;
312 if (bufsiz >
sizeof(tmp_stat))
313 bufsiz =
sizeof(tmp_stat);
319 unsigned long bufsiz)
332 if (bufsiz >
sizeof(tmp_stat))
333 bufsiz =
sizeof(tmp_stat);
343 error = linux_to_osf_statfs(&linux_stat,
buffer, bufsiz);
356 return linux_to_osf_stat(&stat, buf);
368 return linux_to_osf_stat(&stat, buf);
380 return linux_to_osf_stat(&stat, buf);
389 error = linux_to_osf_statfs(&linux_stat,
buffer, bufsiz);
399 error = linux_to_osf_statfs64(&linux_stat,
buffer, bufsiz);
409 error = linux_to_osf_statfs64(&linux_stat,
buffer, bufsiz);
448 osf_ufs_mount(
const char *dirname,
struct ufs_args __user *args,
int flags)
458 retval = PTR_ERR(devname);
468 osf_cdfs_mount(
const char *dirname,
struct cdfs_args __user *args,
int flags)
477 devname =
getname(tmp.devname);
478 retval = PTR_ERR(devname);
488 osf_procfs_mount(
const char *dirname,
struct procfs_args __user *args,
int flags)
505 retval = PTR_ERR(name);
576 for (i = 0; i < len; ++
i) {
577 __put_user(utsname()->domainname[i], name + i);
578 if (utsname()->domainname[i] ==
'\0')
596 #define PLE_PROPAGATE_ON_COPY 0x1
598 #define PLE_FLAG_MASK 0x1
599 #define PLE_FLAG_ALL -1
655 int __user *min_buf_size_ptr;
659 if (
get_user(error, &args->set.nbytes))
663 if (
get_user(error, &args->fset.nbytes))
667 error =
get_user(min_buf_size_ptr, &args->get.min_buf_size);
670 error =
put_user(0, min_buf_size_ptr);
673 error =
get_user(min_buf_size_ptr, &args->fget.min_buf_size);
676 error =
put_user(0, min_buf_size_ptr);
692 unsigned long usp = rdusp();
694 unsigned long oss_os = on_sig_stack(usp);
707 if (
current->sas_ss_sp && on_sig_stack(usp))
732 const char *sysinfo_table[] = {
755 res = sysinfo_table[
offset];
757 if ((
unsigned long)len > (
unsigned long)
count)
780 w = swcr_update_status(w, rdfpcr());
794 if (
nbytes <
sizeof(
unsigned int))
802 if (
nbytes <
sizeof(
unsigned long))
830 unsigned long swcr,
fpcr;
849 fpcr |= ieee_swcr_to_fpcr(swcr);
856 unsigned long exc, swcr,
fpcr, fex;
870 fpcr |= ieee_swcr_to_fpcr(swcr);
992 jiffies_to_timeval32(
unsigned long jiffies,
struct timeval32 *
value)
1004 if (put_tv32(tv, &ktv))
1021 if (get_tv32((
struct timeval *)&kts, tv))
1040 if (!error && put_it32(it, &kit))
1053 if (get_it32(&kin,
in))
1056 memset(&kin, 0,
sizeof(kin));
1062 if (put_it32(
out, &kout))
1076 if (get_tv32(&ktvs[0], &tvs[0]) ||
1077 get_tv32(&ktvs[1], &tvs[1]))
1108 if (sec < 0 || usec < 0)
1146 memset(&r, 0,
sizeof(r));
1180 (
struct rusage __user *) &r);
1207 return err ? err :
ret;
1219 unsigned long ticks;
1221 if (get_tv32(&tmp, sleep))
1230 if (put_tv32(remain, &tmp))
1264 int :32;
int :32;
int :32;
int :32;
1265 int :32;
int :32;
int :32;
int :32;
1266 int :32;
int :32;
int :32;
int :32;
1288 (put_tv32(&txc_p->time, &txc.
time)))
1297 static unsigned long
1298 arch_get_unmapped_area_1(
unsigned long addr,
unsigned long len,
1299 unsigned long limit)
1305 if (limit - len < addr)
1307 if (!vma || addr + len <= vma->
vm_start)
1316 unsigned long len,
unsigned long pgoff,
1317 unsigned long flags)
1319 unsigned long limit;
1344 addr = arch_get_unmapped_area_1 (
PAGE_ALIGN(addr), len, limit);
1345 if (addr != (
unsigned long) -
ENOMEM)
1352 if (addr != (
unsigned long) -
ENOMEM)
1356 addr = arch_get_unmapped_area_1 (
PAGE_SIZE, len, limit);
1361 #ifdef CONFIG_OSF4_COMPAT
1367 osf_fix_iov_len(
const struct iovec __user *iov,
unsigned long count)
1371 for (i = 0 ; i <
count ; i++) {
1372 int __user *iov_len_high = (
int __user *)&iov[i].iov_len + 1;
1381 const struct iovec __user *,
vector,
unsigned long, count)
1384 if (osf_fix_iov_len(
vector, count))
1390 const struct iovec __user *,
vector,
unsigned long, count)
1393 if (osf_fix_iov_len(
vector, count))