1 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/Makefile kernel-source-2.6.16/abi/cxenix/Makefile
2 --- kernel-source-2.6.16.orig/abi/cxenix/Makefile 1970-01-01 10:00:00.000000000 +1000
3 +++ kernel-source-2.6.16/abi/cxenix/Makefile 2006-04-27 18:50:24.000000000 +1000
6 +abi-cxenix-objs := sysent.o misc.o stubs.o signal.o pathconf.o utsname.o
8 +obj-$(CONFIG_ABI_SCO) += abi-cxenix.o
10 +abi-cxenix.o: $(abi-cxenix-objs)
11 + $(LD) -r -o $@ $(abi-cxenix-objs)
12 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/misc.c kernel-source-2.6.16/abi/cxenix/misc.c
13 --- kernel-source-2.6.16.orig/abi/cxenix/misc.c 1970-01-01 10:00:00.000000000 +1000
14 +++ kernel-source-2.6.16/abi/cxenix/misc.c 2006-04-27 18:50:24.000000000 +1000
17 + * misc.c - misc cxenix() subcalls
19 + * Copyright (c) 1993,1994 Drew Sullivan
20 + * Copyright (c) 1994-1996 Mike Jagdis
25 +#include <linux/types.h>
26 +#include <linux/module.h>
27 +#include <linux/errno.h>
28 +#include <linux/kernel.h>
29 +#include <linux/unistd.h>
30 +#include <linux/ptrace.h>
31 +#include <linux/fcntl.h>
32 +#include <linux/time.h>
33 +#include <linux/signal.h>
34 +#include <linux/syscalls.h>
35 +#include <linux/termios.h>
36 +#include <asm/uaccess.h>
38 +#include <abi/util/trace.h>
39 +#include <abi/util/sysent.h>
40 +#include <abi/svr4/sigaction.h>
67 + * locking() requires mandatory locking. Processes that attempt to
68 + * read or write a region locked with locking() are required to block.
69 + * You need to build a kernel with mandatory locking support and set
70 + * the permissions on the required file to setgid, no group execute.
73 +xnx_locking(int fd, int mode, unsigned long size)
76 + mm_segment_t old_fs;
79 + if ((mode < 0 || mode > 7) && mode != 20) {
80 +#if defined(CONFIG_ABI_TRACE)
81 + abi_trace(ABI_TRACE_API,
82 + "unsupported locking() mode=0x%x\n", mode);
88 + * Modes 5, 6 & 7 are very like the fcntl mechanism but
89 + * we can't just punt to that because the type values are
92 + if (mode > 4 && mode < 8) {
93 + struct ibcs_flock *ifl = (struct ibcs_flock *)size;
96 + if (!access_ok(VERIFY_READ, ifl, sizeof(*ifl)))
99 + get_user(t, &ifl->l_type);
101 + case XF_UNLCK: t = F_UNLCK; break;
102 + case XF_WRLCK: t = F_WRLCK; break;
103 + case XF_RDLCK: t = F_RDLCK; break;
104 + default: return -EINVAL;
106 + put_user(t, &ifl->l_type);
108 + error = sys_fcntl(fd, mode, (u_long)ifl);
110 + get_user(t, &ifl->l_type);
112 + case F_UNLCK: t = XF_UNLCK; break;
113 + case F_WRLCK: t = XF_WRLCK; break;
114 + case F_RDLCK: t = XF_RDLCK; break;
116 + put_user(t, &ifl->l_type);
118 + get_user(t, &ifl->l_sysid);
119 + put_user(t, &ifl->l_pid);
120 + put_user(0, &ifl->l_sysid);
124 + fl.l_type = (mode == 0 ? F_UNLCK
125 + : ((mode <= 2 || mode == 20) ? F_WRLCK
133 + error = sys_fcntl(fd, (mode == 5) ? F_GETLK
134 + : (!(mode % 2) ? F_SETLK : F_SETLKW), (u_long)&fl);
140 +/* Check if input is available */
145 + mm_segment_t old_fs;
149 + error = sys_ioctl(fd, FIONREAD, (long)&nbytes);
152 + if (error < 0) return error;
153 + return nbytes ? 1 : 0;
157 + * Linux has a stub sys_ftime. Perhaps this should be there? On the other
158 + * hand it's an old call that probably shouldn't be used by most modern
159 + * applications so perhaps it's better here where it needn't bloat the
163 +xnx_ftime(struct timeb *tp)
166 + struct timezone tz;
168 + mm_segment_t old_fs;
170 + if (!access_ok(VERIFY_WRITE, tp, sizeof(struct timeb)))
175 + error = sys_gettimeofday(&tv, &tz);
180 + put_user(tv.tv_sec, &tp->time);
181 + put_user((unsigned short)(tv.tv_usec/1000), &tp->millitm);
182 + put_user((short)tz.tz_minuteswest, &tp->timezone);
183 + put_user((short)tz.tz_dsttime, &tp->dstflag);
188 +#define USE_NEW_NAP_CODE
190 +#ifndef USE_NEW_NAP_CODE
191 +static __inline __sighandler_t
192 +sigaction(int sig, __sighandler_t handler)
194 + struct k_sigaction *k = ¤t->sighand->action[sig-1];
195 + __sighandler_t old_handler;
197 + spin_lock(¤t->sighand->siglock);
198 + old_handler = k->sa.sa_handler;
199 + k->sa.sa_handler = handler;
200 + spin_unlock(¤t->sighand->siglock);
202 + return old_handler;
206 +/* go to sleep for period milliseconds */
207 +/* - returns either an EINTR error or returns the elapsed time */
209 + for SCO OpenServer 5.0.6 the original nap was fixed so that it
210 + no longer waits a minimum of 2 tick (20ms)
211 + but fewer time with a 10 ms granularity */
213 +xnx_nap(long period)
215 +#ifdef USE_NEW_NAP_CODE
216 + // Hz means the number of jiffies per second.
217 + // the below code needs HZ to be 1 <= HZ <= 1000
218 + // in order to work correctly in any case.
220 +#error this code only works with HZ <= 1000
222 + struct timeval tv1, tv2;
223 + struct timezone tz;
224 + mm_segment_t oldfs;
225 + long period_s; // seconds part
226 + long period_ms_hz; // milli seconds part, scaled to a base of HZ
227 + long period_j; // jiffies
230 + return 0; // zereo request, zero reply
234 + sys_gettimeofday(&tv1, &tz);
236 + period_s = period / 1000;
237 + period_ms_hz = (period - period_s * 1000) * HZ;
238 + period_j = period_s * HZ + period_ms_hz / 1000;
239 + // take care of rounding errors, round up
240 + if (period > period_j * (1000 / HZ)) period_j++;
242 + set_current_state(TASK_INTERRUPTIBLE);
243 + schedule_timeout (period_j);
245 + sys_gettimeofday(&tv2, &tz);
248 + if (signal_pending(current))
249 + return -EINTR; // interrupted
250 + return (tv2.tv_sec - tv1.tv_sec) * 1000
251 + + (tv2.tv_usec - tv1.tv_usec + 500) / 1000;
253 + __sighandler_t old_handler;
254 + struct itimerval it;
255 + struct timeval tv1, tv2;
256 + struct timezone tz;
257 + mm_segment_t oldfs;
262 + it.it_interval.tv_sec = 0;
263 + it.it_interval.tv_usec = 0;
264 + it.it_value.tv_sec = 0;
265 + it.it_value.tv_usec = period * 1000;
270 + sys_gettimeofday(&tv1, &tz);
271 + old_handler = sigaction(SIGALRM, SIG_DFL); // SIG_DFL -> terminate
272 + sys_setitimer(ITIMER_REAL, &it, NULL);
274 + sigaction(SIGALRM, old_handler);
275 + sys_gettimeofday(&tv2, &tz);
278 + deactivate_signal(current, SIGALRM);
280 + if (signal_pending(current))
282 + return ((tv2.tv_sec - tv1.tv_sec) * 1000000
283 + + (tv2.tv_usec - tv1.tv_usec)) / 1000;
288 + * eaccess() checks access to the given path using the effective
289 + * uid/gid rather than the real uid/gid.
292 +xnx_eaccess(char *path, int mode)
298 + ouid = current->uid;
299 + ogid = current->gid;
300 + current->uid = current->euid;
301 + current->gid = current->egid;
303 + err = sys_access(path, mode);
305 + current->uid = ouid;
306 + current->gid = ogid;
310 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/pathconf.c kernel-source-2.6.16/abi/cxenix/pathconf.c
311 --- kernel-source-2.6.16.orig/abi/cxenix/pathconf.c 1970-01-01 10:00:00.000000000 +1000
312 +++ kernel-source-2.6.16/abi/cxenix/pathconf.c 2006-04-27 18:50:24.000000000 +1000
315 + * pathconf.c - support for xenix pathconf
317 + * Copyright (c) 1993,1994 Drew Sullivan
318 + * Copyright (c) 1994-1996 Mike Jagdis
323 +#include <linux/errno.h>
324 +#include <linux/fs.h>
325 +#include <linux/slab.h>
326 +#include <linux/sched.h>
327 +#include <linux/unistd.h>
328 +#include <linux/syscalls.h>
329 +#include <linux/statfs.h>
330 +#include <asm/uaccess.h>
340 + _PC_CHOWN_RESTRICTED = 6,
346 +xnx_name_max(char *path)
359 + error = sys_statfs(p, &stf);
365 + return (stf.f_namelen);
369 +xnx_pathconf(char *path, int name)
374 + * Although Linux headers define values on a per
375 + * filesystem basis there is no way to access
376 + * these without hard coding fs information here
377 + * so for now we use a bogus value.
380 + case _PC_MAX_CANON:
382 + case _PC_MAX_INPUT:
388 + case _PC_CHOWN_RESTRICTED:
390 + * We should really think about this and tell
395 + /* Not sure... It could be fs dependent? */
400 + return xnx_name_max(path);
406 +xnx_fpathconf(int fildes, int name)
411 + * Although Linux headers define values on a per
412 + * filesystem basis there is no way to access
413 + * these without hard coding fs information here
414 + * so for now we use a bogus value.
417 + case _PC_MAX_CANON:
419 + case _PC_MAX_INPUT:
425 + case _PC_CHOWN_RESTRICTED:
427 + * We should really think about this and tell
432 + /* Not sure... It could be fs dependent? */
440 + mm_segment_t old_fs;
444 + error = sys_fstatfs(fildes, &buf);
447 + return buf.f_namelen;
454 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/signal.c kernel-source-2.6.16/abi/cxenix/signal.c
455 --- kernel-source-2.6.16.orig/abi/cxenix/signal.c 1970-01-01 10:00:00.000000000 +1000
456 +++ kernel-source-2.6.16/abi/cxenix/signal.c 2006-04-27 18:50:24.000000000 +1000
460 +#include <linux/module.h>
461 +#include <linux/kernel.h>
462 +#include <linux/personality.h>
463 +#include <linux/sched.h>
464 +#define __KERNEL_SYSCALLS__
465 +#include <linux/unistd.h>
466 +#include <asm/uaccess.h>
468 +#include <abi/cxenix/signal.h>
469 +#include <abi/signal.h>
471 +#include <abi/util/map.h>
472 +#include <abi/util/sysent.h>
476 +xnx_sigaction(int sco_signum, const struct sco_sigaction *action,
477 + struct sco_sigaction *oldaction)
479 + struct sco_sigaction new_sa, old_sa;
480 + struct sigaction nsa, osa;
484 + if (sco_signum >= NSIGNALS)
486 + signo = current_thread_info()->exec_domain->signal_map[sco_signum];
489 + if (!access_ok(VERIFY_WRITE, oldaction,
490 + sizeof(struct sco_sigaction)))
495 + error = copy_from_user(&new_sa, action,
496 + sizeof(struct sco_sigaction));
499 + nsa.sa_restorer = NULL;
500 + nsa.sa_handler = new_sa.sa_handler;
501 + nsa.sa_mask = map_sigvec_to_kernel(new_sa.sa_mask,
502 + current_thread_info()->exec_domain->signal_map);
503 + nsa.sa_flags = SA_NOMASK;
504 + if (new_sa.sa_flags & SCO_SA_NOCLDSTOP)
505 + nsa.sa_flags |= SA_NOCLDSTOP;
510 + error = sys_rt_sigaction(signo, action ? &nsa : NULL,
511 + oldaction ? &osa : NULL, sizeof(sigset_t));
514 + if (error || !oldaction)
517 + old_sa.sa_handler = osa.sa_handler;
518 + old_sa.sa_mask = map_sigvec_from_kernel(osa.sa_mask,
519 + current_thread_info()->exec_domain->signal_invmap);
520 + old_sa.sa_flags = 0;
521 + if (osa.sa_flags & SA_NOCLDSTOP)
522 + old_sa.sa_flags |= SCO_SA_NOCLDSTOP;
524 + if (copy_to_user(oldaction, &old_sa, sizeof(struct sco_sigaction)))
530 +xnx_sigpending(u_long *setp)
532 + sigset_t lxpending;
535 + spin_lock_irq(¤t->sighand->siglock);
536 + sigandsets(&lxpending, ¤t->blocked, ¤t->pending.signal);
537 + spin_unlock_irq(¤t->sighand->siglock);
539 + pending = map_sigvec_from_kernel(lxpending,
540 + current_thread_info()->exec_domain->signal_invmap);
542 + if (copy_to_user(setp, &pending, sizeof(u_long)))
546 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/stubs.c kernel-source-2.6.16/abi/cxenix/stubs.c
547 --- kernel-source-2.6.16.orig/abi/cxenix/stubs.c 1970-01-01 10:00:00.000000000 +1000
548 +++ kernel-source-2.6.16/abi/cxenix/stubs.c 2006-04-27 18:50:24.000000000 +1000
551 + * stubs.c - stubs for unimplemented cxenix subcalls
553 + * Copyright (c) 1993,1994 Drew Sullivan.
554 + * Copyright (c) 1994-1996 Mike Jagdis.
559 +#include <linux/errno.h>
560 +#include <linux/types.h>
561 +#include <linux/ptrace.h>
563 +#include <abi/cxenix/sysent.h>
567 +xnx_creatsem(char *sem_name, int mode)
573 +xnx_opensem(char *sem_name)
579 +xnx_sigsem(int sem_num)
585 +xnx_waitsem(int sem_num)
591 +xnx_nbwaitsem(int sem_num)
598 +xnx_sdget(char *path, int flags, long size, int mode)
604 +xnx_sdfree(char* addr)
610 +xnx_sdenter(char *addr, int flags)
616 +xnx_sdleave(char *addr)
622 +xnx_sdgetv(char *addr)
628 +xnx_sdwaitv(char *addr, int vnum)
635 + * This allows processes to be allowed to exceed available swap. The man
636 + * page isn't too clear - it seems to suggest Xenix supports physical
637 + * memory > swap but this doesn't make sense to me? It almost certainly
638 + * isn't useful for Linux to actually do anything with this - just lie.
646 +xnx_proctl(int pid, int command, char *arg)
652 +xnx_execseg(excode_t oldaddr, unsigned size)
659 +xnx_unexecseg(excode_t addr)
665 + * This allows running adb without executing any programs, but disassembly
666 + * will work fine with that lie.
669 +xnx_paccess(int pid, int cmd, int offset, int count, char *ptr)
673 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/sysent.c kernel-source-2.6.16/abi/cxenix/sysent.c
674 --- kernel-source-2.6.16.orig/abi/cxenix/sysent.c 1970-01-01 10:00:00.000000000 +1000
675 +++ kernel-source-2.6.16/abi/cxenix/sysent.c 2006-04-27 18:50:24.000000000 +1000
679 +#include <linux/module.h>
680 +#include <linux/kernel.h>
681 +#include <linux/personality.h>
682 +#include <linux/sched.h>
683 +#include <linux/ptrace.h>
684 +#include <linux/syscalls.h>
685 +#include <asm/uaccess.h>
687 +#include <abi/svr4/sysent.h>
688 +#include <abi/cxenix/sysent.h>
690 +#include <abi/util/errno.h>
691 +#include <abi/util/sysent.h>
694 +MODULE_DESCRIPTION("Xenix/OpenServer cxenix call support");
695 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
696 +MODULE_LICENSE("GPL");
699 +static struct sysent cxenix_table[] = {
700 +/* 0 */ { 0, Ukn, "syscall", "" },
701 +/* 1 */ { xnx_locking, 3, "locking", "ddd" },
702 +/* 2 */ { xnx_creatsem, 2, "creatsem", "sd" },
703 +/* 3 */ { xnx_opensem, 1, "opensem", "s" },
704 +/* 4 */ { xnx_sigsem, 1, "sigsem", "d" },
705 +/* 5 */ { xnx_waitsem, 1, "waitsem", "d" },
706 +/* 6 */ { xnx_nbwaitsem, 1, "nbwaitsem", "d" },
707 +/* 7 */ { xnx_rdchk, 1, "rdchk", "d" },
708 +/* 8 */ { 0, Ukn, "stkgro", "" },
709 +/* 9 */ { 0, Ukn, "?", "" },
710 +/* 10 */ { sys_ftruncate, 2, "chsize", "dd" },
711 +/* 11 */ { xnx_ftime, 1, "ftime", "x" },
712 +/* 12 */ { xnx_nap, 1, "nap", "d" },
713 +/* 13 */ { xnx_sdget, 4, "sdget", "sddd" },
714 +/* 14 */ { xnx_sdfree, 1, "sdfree", "x" },
715 +/* 15 */ { xnx_sdenter, 2, "sdenter", "xd" },
716 +/* 16 */ { xnx_sdleave, 1, "sdleave", "x" },
717 +/* 17 */ { xnx_sdgetv, 1, "sdgetv", "x" },
718 +/* 18 */ { xnx_sdwaitv, 2, "sdwaitv", "xd" },
719 +/* 19 */ { 0, Ukn, "brkctl", "" },
720 +/* 20 */ { 0, Ukn, "?", "" },
721 +/* 21 */ { 0, 2, "sco-getcwd?", "dx" },
722 +/* 22 */ { 0, Ukn, "?", "" },
723 +/* 23 */ { 0, Ukn, "?", "" },
724 +/* 24 */ { 0, Ukn, "?", "" },
725 +/* 25 */ { 0, Ukn, "?", "" },
726 +/* 26 */ { 0, Ukn, "?", "" },
727 +/* 27 */ { 0, Ukn, "?", "" },
728 +/* 28 */ { 0, Ukn, "?", "" },
729 +/* 29 */ { 0, Ukn, "?", "" },
730 +/* 30 */ { 0, Ukn, "?", "" },
731 +/* 31 */ { 0, Ukn, "?", "" },
732 +/* 32 */ { xnx_proctl, 3, "proctl", "ddx" },
733 +/* 33 */ { xnx_execseg, 2, "execseg", "xd" },
734 +/* 34 */ { xnx_unexecseg, 1, "unexecseg", "x" },
735 +/* 35 */ { 0, Ukn, "?", "" },
736 +/* 36 */ { sys_select, 5, "select", "dxxxx" },
737 +/* 37 */ { xnx_eaccess, 2, "eaccess", "so" },
738 +/* 38 */ { xnx_paccess, 5, "paccess", "dddds" },
739 +/* 39 */ { xnx_sigaction, 3, "sigaction", "dxx" },
740 +/* 40 */ { abi_sigprocmask, 3, "sigprocmask", "dxx" },
741 +/* 41 */ { xnx_sigpending, 1, "sigpending", "x" },
742 +/* 42 */ { abi_sigsuspend, Spl, "sigsuspend", "x" },
743 +/* 43 */ { sys_getgroups16, 2, "getgroups", "dx" },
744 +/* 44 */ { sys_setgroups16, 2, "setgroups", "dx" },
745 +/* 45 */ { ibcs_sysconf, 1, "sysconf", "d" },
746 +/* 46 */ { xnx_pathconf, 2, "pathconf", "sd" },
747 +/* 47 */ { xnx_fpathconf, 2, "fpathconf", "dd" },
748 +/* 48 */ { sys_rename, 2, "rename", "ss" },
749 +/* 49 */ { 0, Ukn, "?", "" },
750 +/* 50 */ { xnx_utsname, 1, "utsname", "x" },
751 +/* 51 */ { 0, Ukn, "?", "" },
752 +/* 52 */ { 0, Ukn, "?", "" },
753 +/* 53 */ { 0, Ukn, "?", "" },
754 +/* 54 */ { 0, Ukn, "?", "" },
755 +/* 55 */ { sys_getitimer, 2, "getitimer", "dx" },
756 +/* 56 */ { sys_setitimer, 3, "setitimer", "dxx" }
760 +void cxenix(struct pt_regs *regs)
762 + int sysno = regs->eax >> 8;
764 + if (sysno >= ARRAY_SIZE(cxenix_table))
765 + set_error(regs, iABI_errors(-EINVAL));
767 + lcall7_dispatch(regs, &cxenix_table[sysno], 1);
770 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
771 +EXPORT_SYMBOL(cxenix);
773 diff -Nur kernel-source-2.6.16.orig/abi/cxenix/utsname.c kernel-source-2.6.16/abi/cxenix/utsname.c
774 --- kernel-source-2.6.16.orig/abi/cxenix/utsname.c 1970-01-01 10:00:00.000000000 +1000
775 +++ kernel-source-2.6.16/abi/cxenix/utsname.c 2006-04-27 18:50:24.000000000 +1000
778 + * utsname.c - support for the utsname subcall of cxenix
780 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
785 +#include <linux/mm.h>
786 +#include <linux/sched.h>
787 +#include <linux/personality.h>
788 +#include <linux/utsname.h>
789 +#include <linux/eisa.h>
790 +#include <asm/uaccess.h>
793 +static char sco_serial[10] = "public";
795 +struct xnx_utsname {
802 + char sysserial[10];
809 +// this function and macro design is from arch/sparc64/solaris/misc.c
810 +static int __set_utsfield(char __user *to, int to_size,
811 + const char *from, int from_size,
814 + int len = min(from_size, to_size);
817 + if (copy_to_user(to, from, len))
820 + off = len < to_size? len: len - 1;
822 + const char *p = strnchr(from, len, '.');
823 + if (p) off = p - from;
826 + if (__put_user('\0', to + off))
832 +#define set_utsfield(to, from, dotchop) \
833 + __set_utsfield((to), sizeof(to), \
834 + (from), sizeof(from), \
837 +static int __set_utsvalue(void __user *to, int to_size,
838 + const void *from, int from_size)
840 + int len = min(from_size, to_size);
842 + if (copy_to_user(to, from, len))
848 +#define set_utsvalue(to, from) \
849 + __set_utsvalue((to), sizeof(*to), \
850 + (from), sizeof(*from))
853 +xnx_utsname(u_long addr)
855 + struct xnx_utsname *utp = (struct xnx_utsname *)addr;
856 + unsigned short usvalue;
861 + * This shouldn't be invoked by anything that isn't running
862 + * in the SCO personality. I can envisage a program that uses
863 + * this to test if utp is running on SCO or not. It probably
864 + * won't happen but let's make sure utp doesn't anyway...
866 + if (!is_cur_personality(PER_SCOSVR3))
869 + down_read(&uts_sem);
870 + if (access_ok(VERIFY_WRITE, utp, sizeof (struct xnx_utsname))) {
871 + if (abi_fake_utsname) {
872 + error |= set_utsfield(utp->sysname, "SCO_SV", 0);
873 + error |= set_utsfield(utp->nodename, system_utsname.nodename, 1);
874 + error |= set_utsfield(utp->release, "3.2v5.0.0\0", 0);
876 + error |= set_utsfield(utp->sysname, system_utsname.nodename, 1);
877 + error |= set_utsfield(utp->nodename, system_utsname.nodename, 1);
878 + error |= set_utsfield(utp->release, system_utsname.release, 0);
880 + error |= set_utsfield(utp->kernelid, system_utsname.version, 0);
881 + error |= set_utsfield(utp->machine, system_utsname.machine, 0);
883 + error |= set_utsfield(utp->bustype, "EISA", 0);
885 + error |= set_utsfield(utp->bustype, "ISA", 0);
887 + error |= set_utsfield(utp->sysserial, sco_serial, 0);
889 + error |= set_utsvalue(&utp->sysorigin, &usvalue);
890 + error |= set_utsvalue(&utp->sysoem, &usvalue);
891 + error |= set_utsfield(utp->numusers, "unlim", 0);
893 + error |= set_utsvalue(&utp->numcpu, &lvalue);
899 diff -Nur kernel-source-2.6.16.orig/abi/ibcs/Makefile kernel-source-2.6.16/abi/ibcs/Makefile
900 --- kernel-source-2.6.16.orig/abi/ibcs/Makefile 1970-01-01 10:00:00.000000000 +1000
901 +++ kernel-source-2.6.16/abi/ibcs/Makefile 2006-04-27 18:50:24.000000000 +1000
904 +abi-ibcs-objs := sysent.o
906 +obj-$(CONFIG_ABI_IBCS) += abi-ibcs.o
908 +abi-ibcs.o: $(abi-ibcs-objs)
909 + $(LD) -r -o $@ $(abi-ibcs-objs)
910 diff -Nur kernel-source-2.6.16.orig/abi/ibcs/sysent.c kernel-source-2.6.16/abi/ibcs/sysent.c
911 --- kernel-source-2.6.16.orig/abi/ibcs/sysent.c 1970-01-01 10:00:00.000000000 +1000
912 +++ kernel-source-2.6.16/abi/ibcs/sysent.c 2006-04-27 18:50:24.000000000 +1000
915 + * Copyright (c) 2001 Christoph Hellwig.
916 + * All rights reserved.
918 + * This program is free software; you can redistribute it and/or modify
919 + * it under the terms of the GNU General Public License as published by
920 + * the Free Software Foundation; either version 2 of the License, or
921 + * (at your option) any later version.
923 + * This program is distributed in the hope that it will be useful,
924 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
925 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
926 + * GNU General Public License for more details.
928 + * You should have received a copy of the GNU General Public License
929 + * along with this program; if not, write to the Free Software
930 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
936 + * SVR4 personality switch.
938 +#include <linux/config.h>
939 +#include <linux/kernel.h>
940 +#include <linux/module.h>
941 +#include <linux/init.h>
942 +#include <linux/personality.h>
943 +#include <linux/syscalls.h>
944 +#include <linux/socket.h>
945 +#include <linux/highuid.h>
946 +#include <linux/net.h>
947 +#include <asm/uaccess.h>
949 +#include <abi/svr4/sysent.h>
950 +#include <abi/signal.h>
952 +#include <abi/util/errno.h>
953 +#include <abi/util/sysent.h>
954 +#include <abi/util/socket.h>
956 +MODULE_DESCRIPTION("iBCS2/iABI4 personality");
957 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
958 +MODULE_LICENSE("GPL");
962 + * We could remove some of the long identity mapped runs but at the
963 + * expense of extra comparisons for each mapping at run time...
965 +static u_char ibcs_err_table[] = {
966 +/* 0 - 9 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
967 +/* 10 - 19 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
968 +/* 20 - 29 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
969 +/* 30 - 39 */ 30, 31, 32, 33, 34, 45, 78, 46, 89, 93,
970 +/* 40 - 49 */ 90, 90, 35, 36, 37, 38, 39, 40, 41, 42,
971 +/* 50 - 59 */ 43, 44, 50, 51, 52, 53, 54, 55, 56, 57,
972 +/* 60 - 69 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
973 +/* 70 - 79 */ 70, 71, 74, 76, 77, 79, 80, 81, 82, 83,
974 +/* 80 - 89 */ 84, 85, 86, 87, 88, 91, 92, 94, 95, 96,
975 +/* 90 - 99 */ 97, 98, 99, 120, 121, 122, 123, 124, 125, 126,
976 +/* 100 - 109 */ 127, 128, 129, 130, 131, 132, 133, 134, 143, 144,
977 +/* 110 - 119 */ 145, 146, 147, 148, 149, 150, 22, 135, 137, 138,
978 +/* 120 - 122 */ 139, 140, 28
982 + * Map Linux RESTART* values (512,513,514) to EINTR
984 +static u_char lnx_err_table[] = {
985 +/* 512 - 514 */ EINTR, EINTR, EINTR
988 +struct map_segment ibcs_err_map[] = {
989 + { 0, 0+sizeof(ibcs_err_table)-1, ibcs_err_table },
990 + { 512, 512+sizeof(lnx_err_table)-1, lnx_err_table },
994 +static long linux_to_ibcs_signals[NSIGNALS+1] = {
995 +/* 0 - 3 */ 0, IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT,
996 +/* 4 - 7 */ IBCS_SIGILL, IBCS_SIGTRAP, IBCS_SIGABRT, -1,
997 +/* 8 - 11 */ IBCS_SIGFPE, IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV,
998 +/* 12 - 15 */ IBCS_SIGUSR2, IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM,
999 +/* 16 - 19 */ IBCS_SIGSEGV, IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP,
1000 +/* 20 - 23 */ IBCS_SIGTSTP, IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGURG,
1001 +/* 24 - 27 */ IBCS_SIGGXCPU, IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF,
1002 +/* 28 - 31 */ IBCS_SIGWINCH, IBCS_SIGIO, IBCS_SIGPWR, -1,
1006 +static long ibcs_to_linux_signals[NSIGNALS+1] = {
1007 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
1008 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGUNUSED,
1009 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGUNUSED, SIGSEGV,
1010 +/* 12 - 15 */ SIGUNUSED, SIGPIPE, SIGALRM, SIGTERM,
1011 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
1012 +/* 20 - 23 */ SIGWINCH, SIGURG, SIGPOLL, SIGSTOP,
1013 +/* 24 - 27 */ SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU,
1014 +/* 28 - 31 */ SIGVTALRM, SIGPROF, SIGXCPU, SIGXFSZ,
1018 +static char ibcs_socktype[] = {
1027 +static struct map_segment ibcs_socktype_map[] = {
1028 + { 1, 6, ibcs_socktype },
1032 +static struct map_segment ibcs_sockopt_map[] = {
1033 + { 0x0001, 0x0001, (char *)SO_DEBUG },
1034 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
1035 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
1036 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
1037 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
1038 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
1039 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
1040 + { 0x0080, 0x0080, (char *)SO_LINGER },
1041 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
1042 + { 0x0200, 0x0200, (char *)SO_ORDREL },
1043 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
1044 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
1045 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
1046 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
1047 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
1048 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
1049 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
1050 + { 0x1007, 0x1007, (char *)SO_ERROR },
1051 + { 0x1008, 0x1008, (char *)SO_TYPE },
1052 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
1056 +static struct map_segment ibcs_af_map[] = {
1062 +static struct sysent ibcs_syscall_table[] = {
1063 + { abi_syscall, Fast, "syscall", "" }, /* 0 */
1064 + { sys_exit, 1, "exit", "d" }, /* 1 */
1065 + { abi_fork, Spl, "fork", "" }, /* 2 */
1066 + { abi_read, 3, "read", "dpd" }, /* 3 */
1067 + { sys_write, 3, "write", "dpd" }, /* 4 */
1068 + { svr4_open, 3, "open", "soo" }, /* 5 */
1069 + { sys_close, 1, "close", "d" }, /* 6 */
1070 + { abi_wait, Spl, "wait", "xxx" }, /* 7 */
1071 + { sys_creat, 2, "creat", "so" }, /* 8 */
1072 + { sys_link, 2, "link", "ss" }, /* 9 */
1073 + { sys_unlink, 1, "unlink", "s" }, /* 10 */
1074 + { abi_exec, Spl, "exec", "sxx" }, /* 11 */
1075 + { sys_chdir, 1, "chdir", "s" }, /* 12 */
1076 + { abi_time, 0, "time", "" }, /* 13 */
1077 + { svr4_mknod, 3, "mknod", "soo" }, /* 14 */
1078 + { sys_chmod, 2, "chmod", "so" }, /* 15 */
1079 + { sys_chown, 3, "chown", "sdd" }, /* 16 */
1080 + { abi_brk, 1, "brk/break", "x" }, /* 17 */
1081 + { svr4_stat, 2, "stat", "sp" }, /* 18 */
1082 + { sys_lseek, 3, "seek/lseek", "ddd" }, /* 19 */
1083 + { abi_getpid, Spl, "getpid", "" }, /* 20 */
1084 + { 0, Ukn, "mount", "" }, /* 21 */
1085 + { sys_umount, 1, "umount", "s" }, /* 22 */
1086 + { sys_setuid, 1, "setuid", "d" }, /* 23 */
1087 + { abi_getuid, Spl, "getuid", "" }, /* 24 */
1088 + { sys_stime, 1, "stime", "d" }, /* 25 */
1089 + { 0, Ukn, "ptrace", "" }, /* 26 */
1090 + { sys_alarm, 1, "alarm", "d" }, /* 27 */
1091 + { svr4_fstat, 2, "fstat", "dp" }, /* 28 */
1092 + { sys_pause, 0, "pause", "" }, /* 29 */
1093 + { sys_utime, 2, "utime", "xx" }, /* 30 */
1094 + { 0, Ukn, "stty", "" }, /* 31 */
1095 + { 0, Ukn, "gtty", "" }, /* 32 */
1096 + { sys_access, 2, "access", "so" }, /* 33 */
1097 + { sys_nice, 1, "nice", "d" }, /* 34 */
1098 + { svr4_statfs, 4, "statfs", "spdd" }, /* 35 */
1099 + { sys_sync, 0, "sync", "" }, /* 36 */
1100 + { abi_kill, 2, "kill", "dd" }, /* 37 */
1101 + { svr4_fstatfs, 4, "fstatfs", "dpdd" }, /* 38 */
1102 + { abi_procids, Spl, "procids", "d" }, /* 39 */
1103 + { 0, Ukn, "cxenix", "" }, /* 40 */
1104 + { sys_dup, 1, "dup", "d" }, /* 41 */
1105 + { abi_pipe, Spl, "pipe", "" }, /* 42 */
1106 + { sys_times, 1, "times", "p" }, /* 43 */
1107 + { 0, Ukn, "prof", "" }, /* 44 */
1108 + { 0, Ukn, "lock/plock", "" }, /* 45 */
1109 + { sys_setgid, 1, "setgid", "d" }, /* 46 */
1110 + { abi_getgid, Spl, "getgid", "" }, /* 47 */
1111 + { abi_sigfunc, Fast, "sigfunc", "xxx" }, /* 48 */
1112 + { svr4_msgsys, Spl, "msgsys", "dxddd" }, /* 49 */
1113 + { svr4_sysi86, 3, "sysi86", "d" }, /* 50 */
1114 + { sys_acct, 1, "acct/sysacct", "x" }, /* 51 */
1115 + { svr4_shmsys, Fast, "shmsys", "ddxo" }, /* 52 */
1116 + { svr4_semsys, Spl, "semsys", "dddx" }, /* 53 */
1117 + { svr4_ioctl, Spl, "ioctl", "dxx" }, /* 54 */
1118 + { 0, 3, "uadmin", "xxx" }, /* 55 */
1119 + { 0, Ukn, "?", "" }, /* 56 */
1120 + { v7_utsname, 1, "utsys", "x" }, /* 57 */
1121 + { sys_fsync, 1, "fsync", "d" }, /* 58 */
1122 + { abi_exec, Spl, "execv", "spp" }, /* 59 */
1123 + { sys_umask, 1, "umask", "o" }, /* 60 */
1124 + { sys_chroot, 1, "chroot", "s" }, /* 61 */
1125 + { svr4_fcntl, 3, "fcntl", "dxx" }, /* 62 */
1126 + { svr4_ulimit, 2, "ulimit", "xx" }, /* 63 */
1127 + { 0, Ukn, "?", "" }, /* 64 */
1128 + { 0, Ukn, "?", "" }, /* 65 */
1129 + { 0, Ukn, "?", "" }, /* 66 */
1130 + { 0, Ukn, "?", "" }, /* 67 */
1131 + { 0, Ukn, "?", "" }, /* 68 */
1132 + { 0, Ukn, "?", "" }, /* 69 */
1133 + { 0, Ukn, "advfs", "" }, /* 70 */
1134 + { 0, Ukn, "unadvfs", "" }, /* 71 */
1135 + { 0, Ukn, "rmount", "" }, /* 72 */
1136 + { 0, Ukn, "rumount", "" }, /* 73 */
1137 + { 0, Ukn, "rfstart", "" }, /* 74 */
1138 + { 0, Ukn, "?", "" }, /* 75 */
1139 + { 0, Ukn, "rdebug", "" }, /* 76 */
1140 + { 0, Ukn, "rfstop", "" }, /* 77 */
1141 + { 0, Ukn, "rfsys", "" }, /* 78 */
1142 + { sys_rmdir, 1, "rmdir", "s" }, /* 79 */
1143 + { abi_mkdir, 2, "mkdir", "so" }, /* 80 */
1144 + { svr4_getdents, 3, "getdents", "dxd" }, /* 81 */
1145 + { 0, Ukn, "libattach", "" }, /* 82 */
1146 + { 0, Ukn, "libdetach", "" }, /* 83 */
1147 + { svr4_sysfs, 3, "sysfs", "dxx" }, /* 84 */
1148 + { svr4_getmsg, Spl, "getmsg", "dxxx" }, /* 85 */
1149 + { svr4_putmsg, Spl, "putmsg", "dxxd" }, /* 86 */
1150 + { sys_poll, 3, "poll", "xdd" }, /* 87 */
1151 + { svr4_lstat, 2, "lstat", "sp" }, /* 88 */
1152 + { sys_symlink, 2, "symlink", "ss" }, /* 89 */
1153 + { sys_readlink, 3, "readlink", "spd" }, /* 90 */
1154 + { sys_setgroups, 2, "setgroups", "dp" }, /* 91 */
1155 + { sys_getgroups, 2, "getgroups", "dp" }, /* 92 */
1156 + { sys_fchmod, 2, "fchmod", "do" }, /* 93 */
1157 + { sys_fchown, 3, "fchown", "ddd" }, /* 94 */
1158 + { abi_sigprocmask, 3, "sigprocmask", "dxx" }, /* 95 */
1159 + { abi_sigsuspend, Spl, "sigsuspend", "x" }, /* 96 */
1160 + { 0, 2, "sigaltstack", "xx" }, /* 97 */
1161 + { abi_sigaction, 3, "sigaction", "dxx" }, /* 98 */
1162 + { svr4_sigpending, 2, "sigpending", "dp" }, /* 99 */
1163 + { svr4_context, Spl, "context", "" }, /* 100 */
1164 + { 0, Ukn, "evsys", "" }, /* 101 */
1165 + { 0, Ukn, "evtrapret", "" }, /* 102 */
1166 + { svr4_statvfs, 2, "statvfs", "sp" }, /* 103 */
1167 + { svr4_fstatvfs, 2, "fstatvfs", "dp" }, /* 104 */
1168 + { 0, Ukn, "sysisc", "" }, /* 105 */
1169 + { 0, Ukn, "nfssys", "" }, /* 106 */
1170 + { 0, 4, "waitid", "ddxd" }, /* 107 */
1171 + { 0, 3, "sigsendsys", "ddd" }, /* 108 */
1172 + { svr4_hrtsys, Spl, "hrtsys", "xxx" }, /* 109 */
1173 + { 0, 3, "acancel", "dxd" }, /* 110 */
1174 + { 0, Ukn, "async", "" }, /* 111 */
1175 + { 0, Ukn, "priocntlsys", "" }, /* 112 */
1176 + { svr4_pathconf, 2, "pathconf", "sd" }, /* 113 */
1177 + { 0, 3, "mincore", "xdx" }, /* 114 */
1178 + { svr4_mmap, 6, "mmap", "xxxxdx"},/* 115 */
1179 + { sys_mprotect, 3, "mprotect", "xdx" },/* 116 */
1180 + { sys_munmap, 2, "munmap", "xd" },/* 117 */
1181 + { svr4_fpathconf, 2, "fpathconf", "dd" }, /* 118 */
1182 + { abi_fork, Spl, "vfork", "" }, /* 119 */
1183 + { sys_fchdir, 1, "fchdir", "d" }, /* 120 */
1184 + { sys_readv, 3, "readv", "dxd" }, /* 121 */
1185 + { sys_writev, 3, "writev", "dxd" }, /* 122 */
1186 + { svr4_xstat, 3, "xstat", "dsx" }, /* 123 */
1187 + { svr4_lxstat, 3, "lxstat", "dsx" }, /* 124 */
1188 + { svr4_fxstat, 3, "fxstat", "ddx" }, /* 125 */
1189 + { svr4_xmknod, 4, "xmknod", "dsox" }, /* 126 */
1190 + { 0, Ukn, "syslocal", "d" }, /* 127 */
1191 + { svr4_getrlimit, 2, "setrlimit", "dx" }, /* 128 */
1192 + { svr4_setrlimit, 2, "getrlimit", "dx" }, /* 129 */
1193 + { 0, 3, "lchown", "sdd" }, /* 130 */
1194 + { 0, Ukn, "memcntl", "" }, /* 131 */
1195 +#if defined(CONFIG_ABI_XTI)
1196 + { svr4_getpmsg, 5, "getpmsg", "dxxxx" }, /* 132 */
1197 + { svr4_putpmsg, 5, "putpmsg", "dxxdd" }, /* 133 */
1199 + { 0, 5, "getpmsg", "dxxxx" }, /* 132 */
1200 + { 0, 5, "putpmsg", "dxxdd" }, /* 133 */
1202 + { sys_rename, 2, "rename", "ss" }, /* 134 */
1203 + { abi_utsname, 1, "uname", "x" }, /* 135 */
1204 + { svr4_setegid, 1, "setegid", "d" }, /* 136 */
1205 + { svr4_sysconfig, 1, "sysconfig", "d" }, /* 137 */
1206 + { 0, Ukn, "adjtime", "" }, /* 138 */
1207 + { svr4_sysinfo, 3, "systeminfo", "dsd" }, /* 139 */
1208 + { socksys_syscall, 1, "socksys", "x" }, /* 140 */
1209 + { svr4_seteuid, 1, "seteuid", "d" }, /* 141 */
1210 + { 0, Ukn, "?", "" }, /* 142 */
1211 + { 0, Ukn, "?", "" }, /* 143 */
1212 + { 0, 2, "secsys", "dx" }, /* 144 */
1213 + { 0, 4, "filepriv", "sdxd" }, /* 145 */
1214 + { 0, 3, "procpriv", "dxd" }, /* 146 */
1215 + { 0, 3, "devstat", "sdx" }, /* 147 */
1216 + { 0, 5, "aclipc", "ddddx" }, /* 148 */
1217 + { 0, 3, "fdevstat", "ddx" }, /* 149 */
1218 + { 0, 3, "flvlfile", "ddx" }, /* 150 */
1219 + { 0, 3, "lvlfile", "sdx" }, /* 151 */
1220 + { 0, Ukn, "?", "" }, /* 152 */
1221 + { 0, 2, "lvlequal", "xx" }, /* 153 */
1222 + { 0, 2, "lvlproc", "dx" }, /* 154 */
1223 + { 0, Ukn, "?", "" }, /* 155 */
1224 + { 0, 4, "lvlipc", "dddx" }, /* 156 */
1225 + { 0, 4, "acl", "sddx" }, /* 157 */
1226 + { 0, Ukn, "auditevt", "" }, /* 158 */
1227 + { 0, Ukn, "auditctl", "" }, /* 159 */
1228 + { 0, Ukn, "auditdmp", "" }, /* 160 */
1229 + { 0, Ukn, "auditlog", "" }, /* 161 */
1230 + { 0, Ukn, "auditbuf", "" }, /* 162 */
1231 + { 0, 2, "lvldom", "xx" }, /* 163 */
1232 + { 0, Ukn, "lvlvfs", "" }, /* 164 */
1233 + { 0, 2, "mkmld", "so" }, /* 165 */
1234 + { 0, Ukn, "mlddone", "" }, /* 166 */
1235 + { 0, 2, "secadvise", "xx" }, /* 167 */
1236 + { 0, Ukn, "online", "" }, /* 168 */
1237 + { sys_setitimer, 3, "setitimer", "dxx" }, /* 169 */
1238 + { sys_getitimer, 2, "getitimer", "dx" }, /* 170 */
1239 + { sys_gettimeofday, 2, "gettimeofday", "xx" }, /* 171 */
1240 + { sys_settimeofday, 2, "settimeofday", "xx" }, /* 172 */
1241 + { 0, Ukn, "lwpcreate", "" }, /* 173 */
1242 + { 0, Ukn, "lwpexit", "" }, /* 174 */
1243 + { 0, Ukn, "lwpwait", "" }, /* 175 */
1244 + { 0, Ukn, "lwpself", "" }, /* 176 */
1245 + { 0, Ukn, "lwpinfo", "" }, /* 177 */
1246 + { 0, Ukn, "lwpprivate", "" }, /* 178 */
1247 + { 0, Ukn, "processorbind","" }, /* 179 */
1248 + { 0, Ukn, "processorexbind","" }, /* 180 */
1249 + { 0, Ukn, "", "" }, /* 181 */
1250 + { 0, Ukn, "sync_mailbox", "" }, /* 182 */
1251 + { 0, Ukn, "prepblock", "" }, /* 183 */
1252 + { 0, Ukn, "block", "" }, /* 184 */
1253 + { 0, Ukn, "rdblock", "" }, /* 185 */
1254 + { 0, Ukn, "unblock", "" }, /* 186 */
1255 + { 0, Ukn, "cancelblock", "" }, /* 187 */
1256 + { 0, Ukn, "?", "" }, /* 188 */
1257 + { 0, Ukn, "pread", "" }, /* 189 */
1258 + { 0, Ukn, "pwrite", "" }, /* 190 */
1259 + { sys_truncate, 2, "truncate", "sd" }, /* 191 */
1260 + { sys_ftruncate, 2, "ftruncate", "dd" }, /* 192 */
1261 + { 0, Ukn, "lwpkill", "" }, /* 193 */
1262 + { 0, Ukn, "sigwait", "" }, /* 194 */
1263 + { 0, Ukn, "fork1", "" }, /* 195 */
1264 + { 0, Ukn, "forkall", "" }, /* 196 */
1265 + { 0, Ukn, "modload", "" }, /* 197 */
1266 + { 0, Ukn, "moduload", "" }, /* 198 */
1267 + { 0, Ukn, "modpath", "" }, /* 199 */
1268 + { 0, Ukn, "modstat", "" }, /* 200 */
1269 + { 0, Ukn, "modadm", "" }, /* 201 */
1270 + { 0, Ukn, "getksym", "" }, /* 202 */
1271 + { 0, Ukn, "lwpsuspend", "" }, /* 203 */
1272 + { 0, Ukn, "lwpcontinue", "" }, /* 204 */
1273 + { 0, Ukn, "?", "" }, /* 205 */
1274 + { 0, Ukn, "?", "" }, /* 206 */
1275 + { 0, Ukn, "?", "" }, /* 207 */
1276 + { 0, Ukn, "?", "" },
1277 + { 0, Ukn, "?", "" },
1278 + { 0, Ukn, "?", "" },
1279 + { 0, Ukn, "?", "" },
1280 + { 0, Ukn, "?", "" },
1281 + { 0, Ukn, "?", "" },
1282 + { 0, Ukn, "?", "" },
1283 + { 0, Ukn, "?", "" }
1287 +ibcs_lcall7(int segment, struct pt_regs *regs)
1289 + int sysno = regs->eax & 0xff;
1291 + if (sysno >= ARRAY_SIZE(ibcs_syscall_table))
1292 + set_error(regs, iABI_errors(-EINVAL));
1294 + lcall7_dispatch(regs, &ibcs_syscall_table[regs->eax & 0xff], 1);
1297 +static struct exec_domain ibcs_exec_domain = {
1298 + name: "iBCS2/iABI4",
1299 + handler: ibcs_lcall7,
1300 + pers_low: 1 /* PER_SVR4 */,
1301 + pers_high: 2 /* PER_SVR3 */,
1302 + signal_map: ibcs_to_linux_signals,
1303 + signal_invmap: linux_to_ibcs_signals,
1304 + err_map: ibcs_err_map,
1305 + socktype_map: ibcs_socktype_map,
1306 + sockopt_map: ibcs_sockopt_map,
1307 + af_map: ibcs_af_map,
1308 + module: THIS_MODULE
1314 + return register_exec_domain(&ibcs_exec_domain);
1321 + unregister_exec_domain(&ibcs_exec_domain);
1324 +module_init(ibcs_init);
1325 +module_exit(ibcs_exit);
1326 diff -Nur kernel-source-2.6.16.orig/abi/isc/Makefile kernel-source-2.6.16/abi/isc/Makefile
1327 --- kernel-source-2.6.16.orig/abi/isc/Makefile 1970-01-01 10:00:00.000000000 +1000
1328 +++ kernel-source-2.6.16/abi/isc/Makefile 2006-04-27 18:50:24.000000000 +1000
1331 +abi-isc-objs := sysent.o
1333 +obj-$(CONFIG_ABI_ISC) += abi-isc.o
1335 +abi-isc.o: $(abi-isc-objs)
1336 + $(LD) -r -o $@ $(abi-isc-objs)
1337 diff -Nur kernel-source-2.6.16.orig/abi/isc/sysent.c kernel-source-2.6.16/abi/isc/sysent.c
1338 --- kernel-source-2.6.16.orig/abi/isc/sysent.c 1970-01-01 10:00:00.000000000 +1000
1339 +++ kernel-source-2.6.16/abi/isc/sysent.c 2006-04-27 18:50:24.000000000 +1000
1342 + * Copyright (c) 2001 Christoph Hellwig.
1343 + * All rights reserved.
1345 + * This program is free software; you can redistribute it and/or modify
1346 + * it under the terms of the GNU General Public License as published by
1347 + * the Free Software Foundation; either version 2 of the License, or
1348 + * (at your option) any later version.
1350 + * This program is distributed in the hope that it will be useful,
1351 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1352 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1353 + * GNU General Public License for more details.
1355 + * You should have received a copy of the GNU General Public License
1356 + * along with this program; if not, write to the Free Software
1357 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1363 + * ISC personality switch.
1365 +#include <linux/config.h>
1366 +#include <linux/kernel.h>
1367 +#include <linux/module.h>
1368 +#include <linux/init.h>
1369 +#include <linux/personality.h>
1370 +#include <linux/syscalls.h>
1371 +#include <linux/socket.h>
1372 +#include <linux/net.h>
1373 +#include <asm/uaccess.h>
1375 +#include <abi/svr4/sysent.h>
1376 +#include <abi/signal.h>
1378 +#include <abi/util/errno.h>
1379 +#include <abi/util/sysent.h>
1380 +#include <abi/util/socket.h>
1382 +MODULE_DESCRIPTION("ISC personality");
1383 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
1384 +MODULE_LICENSE("GPL");
1388 +static int isc_setostype(int);
1391 + * We could remove some of the long identity mapped runs but at the
1392 + * expense of extra comparisons for each mapping at run time...
1394 +static u_char isc_err_table[] = {
1395 +/* 0 - 9 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1396 +/* 10 - 19 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1397 +/* 20 - 29 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1398 +/* 30 - 39 */ 30, 31, 32, 33, 34, 45, 78, 46, 89, 93,
1399 +/* 40 - 49 */ 90, 90, 35, 36, 37, 38, 39, 40, 41, 42,
1400 +/* 50 - 59 */ 43, 44, 50, 51, 52, 53, 54, 55, 56, 57,
1401 +/* 60 - 69 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1402 +/* 70 - 79 */ 70, 71, 74, 76, 77, 79, 80, 81, 82, 83,
1403 +/* 80 - 89 */ 84, 85, 86, 87, 88, 91, 92, 94, 95, 96,
1404 +/* 90 - 99 */ 97, 98, 99, 120, 121, 122, 123, 124, 125, 126,
1405 +/* 100 - 109 */ 127, 128, 129, 130, 131, 132, 133, 134, 143, 144,
1406 +/* 110 - 119 */ 145, 146, 147, 148, 149, 150, 22, 135, 137, 138,
1407 +/* 120 - 122 */ 139, 140, 28
1411 + * Map Linux RESTART* values (512,513,514) to EINTR
1413 +static u_char lnx_err_table[] = {
1414 +/* 512 - 514 */ EINTR, EINTR, EINTR
1417 +struct map_segment isc_err_map[] = {
1418 + { 0, 0+sizeof(isc_err_table)-1, isc_err_table },
1419 + { 512, 512+sizeof(lnx_err_table)-1, lnx_err_table },
1424 + * ISC's error mapping is a little different.
1426 +static long linux_to_isc_signals[NSIGNALS+1] = {
1427 +/* 0 - 3 */ 0, IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT,
1428 +/* 4 - 7 */ IBCS_SIGILL, IBCS_SIGTRAP, IBCS_SIGABRT, -1,
1429 +/* 8 - 11 */ IBCS_SIGFPE, IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV,
1430 +/* 12 - 15 */ IBCS_SIGUSR2, IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM,
1431 +/* 16 - 19 */ IBCS_SIGSEGV, IBCS_SIGCHLD, ISC_SIGCONT, ISC_SIGSTOP,
1432 +/* 20 - 23 */ ISC_SIGTSTP, IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGUSR1,
1433 +/* 24 - 27 */ IBCS_SIGGXCPU, IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF,
1434 +/* 28 - 31 */ IBCS_SIGWINCH, IBCS_SIGIO, IBCS_SIGPWR, -1,
1438 +static long isc_to_linux_signals[NSIGNALS+1] = {
1439 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
1440 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGUNUSED,
1441 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGUNUSED, SIGSEGV,
1442 +/* 12 - 15 */ SIGUNUSED, SIGPIPE, SIGALRM, SIGTERM,
1443 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
1444 +/* 20 - 23 */ SIGWINCH, -1, SIGPOLL, SIGCONT,
1445 +/* 24 - 27 */ SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU,
1446 +/* 28 - 31 */ SIGVTALRM, SIGPROF, SIGXCPU, SIGXFSZ,
1450 +static char isc_socktype[] = {
1459 +static struct map_segment isc_socktype_map[] = {
1460 + { 1, 6, isc_socktype },
1464 +static struct map_segment isc_sockopt_map[] = {
1465 + { 0x0001, 0x0001, (char *)SO_DEBUG },
1466 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
1467 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
1468 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
1469 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
1470 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
1471 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
1472 + { 0x0080, 0x0080, (char *)SO_LINGER },
1473 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
1474 + { 0x0200, 0x0200, (char *)SO_ORDREL },
1475 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
1476 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
1477 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
1478 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
1479 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
1480 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
1481 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
1482 + { 0x1007, 0x1007, (char *)SO_ERROR },
1483 + { 0x1008, 0x1008, (char *)SO_TYPE },
1484 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
1488 +static struct map_segment isc_af_map[] = {
1494 +static struct sysent sysisc_table[] = {
1495 +/* 0 */ { 0, Ukn, "sysisc0", "" },
1496 +/* 1 */ { isc_setostype, 1, "setostype", "d" },
1497 +/* 2 */ { sys_rename, 2, "rename", "ss" },
1498 +/* 3 */ { abi_sigaction, 3, "sigaction", "dxx" },
1499 +/* 4 */ { abi_sigprocmask, 3, "sicprocmask", "dxx" },
1500 +/* 5 */ { 0, 1, "sigpending", "x" },
1501 +/* 6 */ { sys_getgroups16, 2, "getgroups", "dp" },
1502 +/* 7 */ { sys_setgroups16, 2, "setgroups", "dp" },
1503 +/* 8 */ { 0, Ukn, "pathconf", "" },
1504 +/* 9 */ { 0, Ukn, "fpathconf", "" },
1505 +/* 10 */ { ibcs_sysconf, 1, "sysconf", "d" },
1506 +/* 11 */ { sys_waitpid, 3, "waitpid", "dxx" },
1507 +/* 12 */ { sys_setsid, 0, "setsid", "" },
1508 +/* 13 */ { sys_setpgid, 2, "setpgid", "dd" },
1509 +/* 14 */ { 0, Ukn, "adduser", "" },
1510 +/* 15 */ { 0, Ukn, "setuser", "" },
1511 +/* 16 */ { 0, Ukn, "sysisc16", "" },
1512 +/* 17 */ { abi_sigsuspend, Spl, "sigsuspend", "x" },
1513 +/* 18 */ { sys_symlink, 2, "symlink", "ss" },
1514 +/* 19 */ { sys_readlink, 3, "readlink", "spd" },
1515 +/* 20 */ { 0, Ukn, "getmajor", "" }
1519 +isc_sysisc(struct pt_regs *regs)
1523 + __get_user(sysno, ((unsigned long *)regs->esp)+1);
1525 + if (sysno >= ARRAY_SIZE(sysisc_table))
1526 + set_error(regs, iABI_errors(-EINVAL));
1528 + lcall7_dispatch(regs, &sysisc_table[sysno], 2);
1532 +isc_setostype(int arg1)
1537 +static struct sysent isc_syscall_table[] = {
1538 + { abi_syscall, Fast, "syscall", "" }, /* 0 */
1539 + { sys_exit, 1, "exit", "d" }, /* 1 */
1540 + { abi_fork, Spl, "fork", "" }, /* 2 */
1541 + { abi_read, 3, "read", "dpd" }, /* 3 */
1542 + { sys_write, 3, "write", "dpd" }, /* 4 */
1543 + { svr4_open, 3, "open", "soo" }, /* 5 */
1544 + { sys_close, 1, "close", "d" }, /* 6 */
1545 + { abi_wait, Spl, "wait", "xxx" }, /* 7 */
1546 + { sys_creat, 2, "creat", "so" }, /* 8 */
1547 + { sys_link, 2, "link", "ss" }, /* 9 */
1548 + { sys_unlink, 1, "unlink", "s" }, /* 10 */
1549 + { abi_exec, Spl, "exec", "sxx" }, /* 11 */
1550 + { sys_chdir, 1, "chdir", "s" }, /* 12 */
1551 + { abi_time, 0, "time", "" }, /* 13 */
1552 + { svr4_mknod, 3, "mknod", "soo" }, /* 14 */
1553 + { sys_chmod, 2, "chmod", "so" }, /* 15 */
1554 + { sys_chown, 3, "chown", "sdd" }, /* 16 */
1555 + { abi_brk, 1, "brk/break", "x" }, /* 17 */
1556 + { svr4_stat, 2, "stat", "sp" }, /* 18 */
1557 + { sys_lseek, 3, "seek/lseek", "ddd" }, /* 19 */
1558 + { abi_getpid, Spl, "getpid", "" }, /* 20 */
1559 + { 0, Ukn, "mount", "" }, /* 21 */
1560 + { sys_umount, 1, "umount", "s" }, /* 22 */
1561 + { sys_setuid, 1, "setuid", "d" }, /* 23 */
1562 + { abi_getuid, Spl, "getuid", "" }, /* 24 */
1563 + { sys_stime, 1, "stime", "d" }, /* 25 */
1564 + { 0, Ukn, "ptrace", "" }, /* 26 */
1565 + { sys_alarm, 1, "alarm", "d" }, /* 27 */
1566 + { svr4_fstat, 2, "fstat", "dp" }, /* 28 */
1567 + { sys_pause, 0, "pause", "" }, /* 29 */
1568 + { sys_utime, 2, "utime", "xx" }, /* 30 */
1569 + { 0, Ukn, "stty", "" }, /* 31 */
1570 + { 0, Ukn, "gtty", "" }, /* 32 */
1571 + { sys_access, 2, "access", "so" }, /* 33 */
1572 + { sys_nice, 1, "nice", "d" }, /* 34 */
1573 + { svr4_statfs, 4, "statfs", "spdd" }, /* 35 */
1574 + { sys_sync, 0, "sync", "" }, /* 36 */
1575 + { abi_kill, 2, "kill", "dd" }, /* 37 */
1576 + { svr4_fstatfs, 4, "fstatfs", "dpdd" }, /* 38 */
1577 + { abi_procids, Spl, "procids", "d" }, /* 39 */
1578 + { 0, Ukn, "cxenix", "" }, /* 40 */
1579 + { sys_dup, 1, "dup", "d" }, /* 41 */
1580 + { abi_pipe, Spl, "pipe", "" }, /* 42 */
1581 + { sys_times, 1, "times", "p" }, /* 43 */
1582 + { 0, Ukn, "prof", "" }, /* 44 */
1583 + { 0, Ukn, "lock/plock", "" }, /* 45 */
1584 + { sys_setgid, 1, "setgid", "d" }, /* 46 */
1585 + { abi_getgid, Spl, "getgid", "" }, /* 47 */
1586 + { abi_sigfunc, Fast, "sigfunc", "xxx" }, /* 48 */
1587 + { svr4_msgsys, Spl, "msgsys", "dxddd" }, /* 49 */
1588 + { svr4_sysi86, 3, "sysi86", "d" }, /* 50 */
1589 + { sys_acct, 1, "acct/sysacct", "x" }, /* 51 */
1590 + { svr4_shmsys, Fast, "shmsys", "ddxo" }, /* 52 */
1591 + { svr4_semsys, Spl, "semsys", "dddx" }, /* 53 */
1592 + { svr4_ioctl, Spl, "ioctl", "dxx" }, /* 54 */
1593 + { 0, 3, "uadmin", "xxx" }, /* 55 */
1594 + { 0, Ukn, "?", "" }, /* 56 */
1595 + { v7_utsname, 1, "utsys", "x" }, /* 57 */
1596 + { sys_fsync, 1, "fsync", "d" }, /* 58 */
1597 + { abi_exec, Spl, "execv", "spp" }, /* 59 */
1598 + { sys_umask, 1, "umask", "o" }, /* 60 */
1599 + { sys_chroot, 1, "chroot", "s" }, /* 61 */
1600 + { svr4_fcntl, 3, "fcntl", "dxx" }, /* 62 */
1601 + { svr4_ulimit, 2, "ulimit", "xx" }, /* 63 */
1602 + { 0, Ukn, "?", "" }, /* 64 */
1603 + { 0, Ukn, "?", "" }, /* 65 */
1604 + { 0, Ukn, "?", "" }, /* 66 */
1605 + { 0, Ukn, "?", "" }, /* 67 */
1606 + { 0, Ukn, "?", "" }, /* 68 */
1607 + { 0, Ukn, "?", "" }, /* 69 */
1608 + { 0, Ukn, "advfs", "" }, /* 70 */
1609 + { 0, Ukn, "unadvfs", "" }, /* 71 */
1610 + { 0, Ukn, "rmount", "" }, /* 72 */
1611 + { 0, Ukn, "rumount", "" }, /* 73 */
1612 + { 0, Ukn, "rfstart", "" }, /* 74 */
1613 + { 0, Ukn, "?", "" }, /* 75 */
1614 + { 0, Ukn, "rdebug", "" }, /* 76 */
1615 + { 0, Ukn, "rfstop", "" }, /* 77 */
1616 + { 0, Ukn, "rfsys", "" }, /* 78 */
1617 + { sys_rmdir, 1, "rmdir", "s" }, /* 79 */
1618 + { abi_mkdir, 2, "mkdir", "so" }, /* 80 */
1619 + { svr4_getdents, 3, "getdents", "dxd" }, /* 81 */
1620 + { 0, Ukn, "libattach", "" }, /* 82 */
1621 + { 0, Ukn, "libdetach", "" }, /* 83 */
1622 + { svr4_sysfs, 3, "sysfs", "dxx" }, /* 84 */
1623 + { svr4_getmsg, Spl, "getmsg", "dxxx" }, /* 85 */
1624 + { svr4_putmsg, Spl, "putmsg", "dxxd" }, /* 86 */
1625 + { sys_poll, 3, "poll", "xdd" }, /* 87 */
1626 + { svr4_lstat, 2, "lstat", "sp" }, /* 88 */
1627 + { sys_symlink, 2, "symlink", "ss" }, /* 89 */
1628 + { sys_readlink, 3, "readlink", "spd" }, /* 90 */
1629 + { sys_setgroups, 2, "setgroups", "dp" }, /* 91 */
1630 + { sys_getgroups, 2, "getgroups", "dp" }, /* 92 */
1631 + { sys_fchmod, 2, "fchmod", "do" }, /* 93 */
1632 + { sys_fchown, 3, "fchown", "ddd" }, /* 94 */
1633 + { abi_sigprocmask, 3, "sigprocmask", "dxx" }, /* 95 */
1634 + { abi_sigsuspend, Spl, "sigsuspend", "x" }, /* 96 */
1635 + { 0, 2, "sigaltstack", "xx" }, /* 97 */
1636 + { abi_sigaction, 3, "sigaction", "dxx" }, /* 98 */
1637 + { svr4_sigpending, 2, "sigpending", "dp" }, /* 99 */
1638 + { svr4_context, Spl, "context", "" }, /* 100 */
1639 + { 0, Ukn, "evsys", "" }, /* 101 */
1640 + { 0, Ukn, "evtrapret", "" }, /* 102 */
1641 + { svr4_statvfs, 2, "statvfs", "sp" }, /* 103 */
1642 + { svr4_fstatvfs, 2, "fstatvfs", "dp" }, /* 104 */
1643 + { isc_sysisc, Fast, "sysisc", "" }, /* 105 */
1644 + { 0, Ukn, "nfssys", "" }, /* 106 */
1645 + { 0, 4, "waitid", "ddxd" }, /* 107 */
1646 + { 0, 3, "sigsendsys", "ddd" }, /* 108 */
1647 + { svr4_hrtsys, Spl, "hrtsys", "xxx" }, /* 109 */
1648 + { 0, 3, "acancel", "dxd" }, /* 110 */
1649 + { 0, Ukn, "async", "" }, /* 111 */
1650 + { 0, Ukn, "priocntlsys", "" }, /* 112 */
1651 + { svr4_pathconf, 2, "pathconf", "sd" }, /* 113 */
1652 + { 0, 3, "mincore", "xdx" }, /* 114 */
1653 + { svr4_mmap, 6, "mmap", "xxxxdx"},/* 115 */
1654 + { sys_mprotect, 3, "mprotect", "xdx" },/* 116 */
1655 + { sys_munmap, 2, "munmap", "xd" },/* 117 */
1656 + { svr4_fpathconf, 2, "fpathconf", "dd" }, /* 118 */
1657 + { abi_fork, Spl, "vfork", "" }, /* 119 */
1658 + { sys_fchdir, 1, "fchdir", "d" }, /* 120 */
1659 + { sys_readv, 3, "readv", "dxd" }, /* 121 */
1660 + { sys_writev, 3, "writev", "dxd" }, /* 122 */
1661 + { svr4_xstat, 3, "xstat", "dsx" }, /* 123 */
1662 + { svr4_lxstat, 3, "lxstat", "dsx" }, /* 124 */
1663 + { svr4_fxstat, 3, "fxstat", "ddx" }, /* 125 */
1664 + { svr4_xmknod, 4, "xmknod", "dsox" }, /* 126 */
1665 + { 0, Ukn, "syslocal", "d" }, /* 127 */
1666 + { svr4_getrlimit, 2, "setrlimit", "dx" }, /* 128 */
1667 + { svr4_setrlimit, 2, "getrlimit", "dx" }, /* 129 */
1668 + { 0, 3, "lchown", "sdd" }, /* 130 */
1669 + { 0, Ukn, "memcntl", "" }, /* 131 */
1670 +#if defined(CONFIG_ABI_XTI)
1671 + { svr4_getpmsg, 5, "getpmsg", "dxxxx" }, /* 132 */
1672 + { svr4_putpmsg, 5, "putpmsg", "dxxdd" }, /* 133 */
1674 + { 0, 5, "getpmsg", "dxxxx" }, /* 132 */
1675 + { 0, 5, "putpmsg", "dxxdd" }, /* 133 */
1677 + { sys_rename, 2, "rename", "ss" }, /* 134 */
1678 + { abi_utsname, 1, "uname", "x" }, /* 135 */
1679 + { svr4_setegid, 1, "setegid", "d" }, /* 136 */
1680 + { svr4_sysconfig, 1, "sysconfig", "d" }, /* 137 */
1681 + { 0, Ukn, "adjtime", "" }, /* 138 */
1682 + { svr4_sysinfo, 3, "systeminfo", "dsd" }, /* 139 */
1683 + { socksys_syscall, 1, "socksys", "x" }, /* 140 */
1684 + { svr4_seteuid, 1, "seteuid", "d" }, /* 141 */
1685 + { 0, Ukn, "?", "" }, /* 142 */
1686 + { 0, Ukn, "?", "" }, /* 143 */
1687 + { 0, 2, "secsys", "dx" }, /* 144 */
1688 + { 0, 4, "filepriv", "sdxd" }, /* 145 */
1689 + { 0, 3, "procpriv", "dxd" }, /* 146 */
1690 + { 0, 3, "devstat", "sdx" }, /* 147 */
1691 + { 0, 5, "aclipc", "ddddx" }, /* 148 */
1692 + { 0, 3, "fdevstat", "ddx" }, /* 149 */
1693 + { 0, 3, "flvlfile", "ddx" }, /* 150 */
1694 + { 0, 3, "lvlfile", "sdx" }, /* 151 */
1695 + { 0, Ukn, "?", "" }, /* 152 */
1696 + { 0, 2, "lvlequal", "xx" }, /* 153 */
1697 + { 0, 2, "lvlproc", "dx" }, /* 154 */
1698 + { 0, Ukn, "?", "" }, /* 155 */
1699 + { 0, 4, "lvlipc", "dddx" }, /* 156 */
1700 + { 0, 4, "acl", "sddx" }, /* 157 */
1701 + { 0, Ukn, "auditevt", "" }, /* 158 */
1702 + { 0, Ukn, "auditctl", "" }, /* 159 */
1703 + { 0, Ukn, "auditdmp", "" }, /* 160 */
1704 + { 0, Ukn, "auditlog", "" }, /* 161 */
1705 + { 0, Ukn, "auditbuf", "" }, /* 162 */
1706 + { 0, 2, "lvldom", "xx" }, /* 163 */
1707 + { 0, Ukn, "lvlvfs", "" }, /* 164 */
1708 + { 0, 2, "mkmld", "so" }, /* 165 */
1709 + { 0, Ukn, "mlddone", "" }, /* 166 */
1710 + { 0, 2, "secadvise", "xx" }, /* 167 */
1711 + { 0, Ukn, "online", "" }, /* 168 */
1712 + { sys_setitimer, 3, "setitimer", "dxx" }, /* 169 */
1713 + { sys_getitimer, 2, "getitimer", "dx" }, /* 170 */
1714 + { sys_gettimeofday, 2, "gettimeofday", "xx" }, /* 171 */
1715 + { sys_settimeofday, 2, "settimeofday", "xx" }, /* 172 */
1716 + { 0, Ukn, "lwpcreate", "" }, /* 173 */
1717 + { 0, Ukn, "lwpexit", "" }, /* 174 */
1718 + { 0, Ukn, "lwpwait", "" }, /* 175 */
1719 + { 0, Ukn, "lwpself", "" }, /* 176 */
1720 + { 0, Ukn, "lwpinfo", "" }, /* 177 */
1721 + { 0, Ukn, "lwpprivate", "" }, /* 178 */
1722 + { 0, Ukn, "processorbind","" }, /* 179 */
1723 + { 0, Ukn, "processorexbind","" }, /* 180 */
1724 + { 0, Ukn, "", "" }, /* 181 */
1725 + { 0, Ukn, "sync_mailbox", "" }, /* 182 */
1726 + { 0, Ukn, "prepblock", "" }, /* 183 */
1727 + { 0, Ukn, "block", "" }, /* 184 */
1728 + { 0, Ukn, "rdblock", "" }, /* 185 */
1729 + { 0, Ukn, "unblock", "" }, /* 186 */
1730 + { 0, Ukn, "cancelblock", "" }, /* 187 */
1731 + { 0, Ukn, "?", "" }, /* 188 */
1732 + { 0, Ukn, "pread", "" }, /* 189 */
1733 + { 0, Ukn, "pwrite", "" }, /* 190 */
1734 + { sys_truncate, 2, "truncate", "sd" }, /* 191 */
1735 + { sys_ftruncate, 2, "ftruncate", "dd" }, /* 192 */
1736 + { 0, Ukn, "lwpkill", "" }, /* 193 */
1737 + { 0, Ukn, "sigwait", "" }, /* 194 */
1738 + { 0, Ukn, "fork1", "" }, /* 195 */
1739 + { 0, Ukn, "forkall", "" }, /* 196 */
1740 + { 0, Ukn, "modload", "" }, /* 197 */
1741 + { 0, Ukn, "moduload", "" }, /* 198 */
1742 + { 0, Ukn, "modpath", "" }, /* 199 */
1743 + { 0, Ukn, "modstat", "" }, /* 200 */
1744 + { 0, Ukn, "modadm", "" }, /* 201 */
1745 + { 0, Ukn, "getksym", "" }, /* 202 */
1746 + { 0, Ukn, "lwpsuspend", "" }, /* 203 */
1747 + { 0, Ukn, "lwpcontinue", "" }, /* 204 */
1748 + { 0, Ukn, "?", "" }, /* 205 */
1749 + { 0, Ukn, "?", "" }, /* 206 */
1750 + { 0, Ukn, "?", "" }, /* 207 */
1751 + { 0, Ukn, "?", "" },
1752 + { 0, Ukn, "?", "" },
1753 + { 0, Ukn, "?", "" },
1754 + { 0, Ukn, "?", "" },
1755 + { 0, Ukn, "?", "" },
1756 + { 0, Ukn, "?", "" },
1757 + { 0, Ukn, "?", "" },
1758 + { 0, Ukn, "?", "" }
1762 +isc_lcall7(int segment, struct pt_regs *regs)
1764 + int sysno = regs->eax & 0xff;
1766 + if (sysno >= ARRAY_SIZE(isc_syscall_table))
1767 + set_error(regs, iABI_errors(-EINVAL));
1769 + lcall7_dispatch(regs, &isc_syscall_table[sysno], 1);
1772 +static struct exec_domain isc_exec_domain = {
1774 + handler: isc_lcall7,
1775 + pers_low: 5 /* PER_ISCR4 */,
1776 + pers_high: 5 /* PER_ISCR4 */,
1777 + signal_map: isc_to_linux_signals,
1778 + signal_invmap: linux_to_isc_signals,
1779 + err_map: isc_err_map,
1780 + socktype_map: isc_socktype_map,
1781 + sockopt_map: isc_sockopt_map,
1782 + af_map: isc_af_map,
1783 + module: THIS_MODULE
1789 + return register_exec_domain(&isc_exec_domain);
1796 + unregister_exec_domain(&isc_exec_domain);
1799 +module_init(isc_init);
1800 +module_exit(isc_exit);
1801 diff -Nur kernel-source-2.6.16.orig/abi/Kconfig kernel-source-2.6.16/abi/Kconfig
1802 --- kernel-source-2.6.16.orig/abi/Kconfig 1970-01-01 10:00:00.000000000 +1000
1803 +++ kernel-source-2.6.16/abi/Kconfig 2006-04-27 18:50:24.000000000 +1000
1806 +# Linux-ABI configuration
1809 +# this file gets source'ed into the kernel file formats menu entry
1810 +# via ./fs/Kconfig.binfmt
1813 + bool "Extended Linux-ABI support (alien binarys and syscalls)"
1817 + Support for a few alien syscall interfaces. This allows you to run
1818 + a binary that got build for other Unix compatible platforms.
1822 + tristate "SVR3/SVR4 family syscall support for x86 binarys"
1828 +comment "SVR3/SVR4 based syscall support for x86: (please check one or more)"
1829 + depends on ABI_SVR4
1832 + tristate "iBCS2/iABI4 syscall support"
1833 + depends on ABI_SVR4
1836 + tristate "ISC syscall support"
1837 + depends on ABI_SVR4
1840 + tristate "SCO OpenServer 5/SCO Unix 3.x/Xenix syscall support"
1841 + depends on ABI_SVR4
1844 + tristate "Solaris 2.x syscall support"
1845 + depends on ABI_SVR4
1848 + tristate "UnixWare 7.x syscall support"
1849 + depends on ABI_SVR4
1852 + tristate "Wyse V/386 syscall support"
1853 + depends on ABI_SVR4
1856 +comment "SVR3/SVR4 related binary format support for x86:"
1857 + depends on ABI_SVR4
1860 + tristate "COFF binary support (SVR3)"
1861 + depends on ABI_SVR4
1864 + tristate "x.out binary support (Xenix)"
1865 + depends on ABI_SVR4
1867 +config BINFMT_XOUT_X286
1868 + bool "x.out segmented binary support (Xenix/80286)"
1869 + depends on BINFMT_XOUT
1872 +config ABI_LATE_PROBING
1874 + prompt "Late probing of personality trough syscall handler"
1878 + There is a minor general uncertainty on identification of binary
1879 + formats. It might happen that statically linked SVr4 binary could
1880 + be falsely assigned to a Linux personality. Solaris/x86 binarys
1881 + are another sample for a falsely assigned Linux personality.
1882 + If this option is set the lcall handler for Linux will switch
1883 + to SVr4 personality as soon as lcall 0x07 is used, or it will
1884 + switch to Solaris personality when lcall 0x27 is used.
1885 + Since this on-the-fly personality switching is a one way path
1886 + a malicious program might make use of exactly that ability.
1887 + For system consistency reasons personality detection should go
1888 + that way. The better solution is to improve the personality
1889 + detection code at load time in contrast to runtime detection.
1890 + At present load time probing is not perfect, so better say yes.
1894 + prompt "Include prints for syscall tracking via ABI_TRACE ioctl"
1898 + This option allows to control the inclusion of code that prints
1899 + kernel messages for tracking special syscalls events like errors.
1900 + Typically this messages further have to be enabled via the
1901 + ABI_TRACE ioctl. This option will not remove the ioctl interface
1902 + but will only remove the backend coding which produces the prints.
1903 + You can disable thise option if you want to reduce the kernel size
1904 + or have other concerns, e.g. code size or possible message floods.
1906 +# --- internal options, values will get derived from prior settings ---
1908 +# the abi-util (./abi/util) codebase
1909 +# does currently only contain code for the ABI_TRACE coding
1910 +# and has to be present as soon as the SVR4 code is present.
1913 + depends on ABI_TRACE
1914 + default y if ABI_SVR4=y
1915 + default m if ABI_SVR4=m
1928 +config ABI_TLI_OPTMGMT
1933 +config ABI_XTI_OPTMGMT
1938 +# there are syscall interfaces which do get statically linked
1939 +config ABI_SYSCALL_STATICS
1941 + default y if ABI_UW7=y || ABI_SOLARIS=y || ABI_IBCS=y || ABI_ISC=y || ABI_SCO=y || ABI_WYSE=y
1944 +# there are syscall interfaces which do get build as module
1945 +config ABI_SYSCALL_MODULES
1947 + default y if ABI_UW7=m || ABI_SOLARIS=m || ABI_IBCS=m || ABI_ISC=m || ABI_SCO=m || ABI_WYSE=m
1950 +# the LCALL7 code for SVR4 family support must _not_ be a module
1951 +# when there is at least a single, statically bound syscall driver.
1952 +# if there are only modules, then the LCALL code can be a module as well.
1953 +# if there is no module at all then we dont need the LCALL7 code.
1956 + default y if ABI_SYSCALL_STATICS=y
1957 + default m if ABI_SYSCALL_MODULES=y
1961 +# * only a static SVR4 core coding will allow static syscall drivers,
1962 +# * setting a syscall driver to modules will be the only way to allow
1963 +# this single module to plug into SVR4 core coding.
1964 +# * there is no generic "register my entrypoints" request for modules
1965 +# in the curent codebase. (this might be a TODO)
1966 +# * the exported LCALL7 syms will only be usefull to syscall driver modules.
1967 +# * LCALL7 is only usefull if there are syscall drivers (static or module).
1968 +# * an "empty" SVR4 might be usefull for debugging and non-x86 targets.
1971 diff -Nur kernel-source-2.6.16.orig/abi/Makefile kernel-source-2.6.16/abi/Makefile
1972 --- kernel-source-2.6.16.orig/abi/Makefile 1970-01-01 10:00:00.000000000 +1000
1973 +++ kernel-source-2.6.16/abi/Makefile 2006-04-27 18:50:24.000000000 +1000
1975 +obj-$(CONFIG_ABI) += util/
1976 +obj-$(CONFIG_ABI_SVR4) += svr4/
1977 +obj-$(CONFIG_ABI_SCO) += sco/ cxenix/
1978 +obj-$(CONFIG_ABI_WYSE) += wyse/
1979 +obj-$(CONFIG_ABI_UW7) += uw7/
1980 +obj-$(CONFIG_ABI_SOLARIS) += solaris/
1981 +obj-$(CONFIG_ABI_IBCS) += ibcs/
1982 +obj-$(CONFIG_ABI_ISC) += isc/
1983 diff -Nur kernel-source-2.6.16.orig/abi/sco/ioctl.c kernel-source-2.6.16/abi/sco/ioctl.c
1984 --- kernel-source-2.6.16.orig/abi/sco/ioctl.c 1970-01-01 10:00:00.000000000 +1000
1985 +++ kernel-source-2.6.16/abi/sco/ioctl.c 2006-04-27 18:50:24.000000000 +1000
1988 + * ioctl.c - SCO Unix ioctl(2) switch
1990 + * Copyright (C) 1991, 1992 Linus Torvalds
1992 + * Written by Drew Sullivan.
1993 + * Rewritten by Mike Jagdis.
1998 +#include <linux/config.h>
1999 +#include <linux/errno.h>
2000 +#include <linux/kernel.h>
2001 +#include <linux/ptrace.h>
2002 +#include <asm/uaccess.h>
2004 +#include <asm/abi_machdep.h>
2005 +#include <abi/sco/ioctl.h>
2006 +#include <abi/svr4/ioctl.h>
2010 + * do_ioctl() is a meta mapper, that is
2011 + * it looks up the class of the ioctl and then
2012 + * dispatchs to lower level routines to handle the
2013 + * mapping of the actual ioctls
2016 +do_ioctl(struct pt_regs *regs, int fd, unsigned long ioctl_num, void *arg)
2018 + unsigned int class = ioctl_num >> 8;
2019 + char class_str[4];
2024 + * SCO ioctls on the pseudo NFS device probably.
2027 + return abi_ioctl_socksys(fd, ioctl_num, arg);
2030 + * SCO console keyboard stuff?
2036 + return sco_tape_ioctl(fd, ioctl_num, arg);
2039 + return bsd_ioctl_termios(fd, ioctl_num, arg);
2042 + return svr4_fil_ioctl(fd, ioctl_num, arg);
2045 + * Xenix ioctl compatibility.
2048 + return svr4_term_ioctl(fd, ioctl_num & 0xFF, arg);
2050 + case ('i' << 16) | ('X' << 8): /* iBCS2 POSIX */
2051 + case 'x': /* Pre-iBCS2 POSIX */
2052 + return sco_term_ioctl(fd, ioctl_num & 0xFF, arg);
2056 + return svr4_console_ioctl(fd, ioctl_num, arg);
2058 + case ('i' << 16) | ('C' << 8): /* iBCS2 POSIX */
2059 + return svr4_video_ioctl(fd, ioctl_num & 0xFF, arg);
2062 + * These aren't implemented and are never likely to be as they
2063 + * are specific to drivers for obscure hardware. (For those
2064 + * that don't know they're the JERQ ioctls. Says it all
2071 + * The 'S' set could also be display mode switch
2072 + * ioctls in a SCO 3.2.x x<4 environment. It should
2073 + * depend on the descriptor they are applied to.
2074 + * According to ISC the Xenix STREAMS ioctls had the
2075 + * high bit set on the command to differentiate them
2076 + * from mode switch ioctls. Yuk, yuk, yuk...
2079 + return svr4_stream_ioctl(regs, fd, ioctl_num & 0x7F, arg);
2082 + * These are STREAMS socket module ioctls.
2085 +#if defined(CONFIG_ABI_XTI)
2086 + return svr4_sockmod_ioctl(fd, ioctl_num & 0xFF, arg);
2092 + * These are SCO <vtkd.h> ioctls - see vtkd.h
2096 + return sco_vtkbd_ioctl(fd, ioctl_num, arg);
2099 + * SCO channel mapping. I can't find any documentation
2100 + * for this. These are the LD?MAP ioctls defined in
2101 + * sys/termio.h and sys/emap.h. They are used by mapchan.
2108 + * If we haven't handled it yet it must be a BSD style ioctl
2109 + * with a (possible) argument description in the high word of
2112 + switch (class & 0xff) {
2115 + * From SVR4 as specified in sys/iocomm.h.
2118 + return svr4_fil_ioctl(fd, ioctl_num, arg);
2121 + * BSD or V7 terminal ioctls.
2124 + return bsd_ioctl_termios(fd, ioctl_num, arg);
2127 + * SVR3 streams based socket TCP/IP ioctls.
2129 + * These are handed over to the standard ioctl
2130 + * handler since /dev/socksys is an emulated device
2131 + * and front ends any sockets created through it.
2132 + * Note that 'S' ioctls without the BSDish argument
2133 + * type in the high bytes are STREAMS ioctls and 'I'
2134 + * ioctls without the BSDish type in the high bytes
2135 + * are the STREAMS socket module ioctls. (see above).
2140 + return abi_ioctl_socksys(fd, ioctl_num, arg);
2144 + * If nothing has handled it yet someone may have to do some
2147 + class_str[0] = class & 0xFF0000 ? (char)((class >> 16) & 0xFF) : '.';
2148 + class_str[1] = class & 0x00FF00 ? (char)((class >> 8) & 0xFF) : '.';
2149 + class_str[2] = class & 0x0000FF ? (char)((class ) & 0xFF) : '.';
2152 + printk(KERN_DEBUG "sco: ioctl(%d, %lx[%s], 0x%p) unsupported\n",
2153 + fd, ioctl_num, class_str, arg);
2159 +sco_ioctl(struct pt_regs *regs)
2165 + fd = (int)get_syscall_parameter(regs, 0);
2166 + num = (u_int)get_syscall_parameter(regs, 1);
2167 + data = (caddr_t)get_syscall_parameter(regs, 2);
2169 + return do_ioctl(regs, fd, num, data);
2171 diff -Nur kernel-source-2.6.16.orig/abi/sco/Makefile kernel-source-2.6.16/abi/sco/Makefile
2172 --- kernel-source-2.6.16.orig/abi/sco/Makefile 1970-01-01 10:00:00.000000000 +1000
2173 +++ kernel-source-2.6.16/abi/sco/Makefile 2006-04-27 18:50:24.000000000 +1000
2176 +abi-sco-objs := sysent.o misc.o mmap.o ptrace.o secureware.o \
2179 +# various ioctl emulation stuff
2180 +abi-sco-objs += ioctl.o termios.o tapeio.o vtkbd.o
2183 +obj-$(CONFIG_ABI_SCO) += abi-sco.o
2185 +abi-sco.o: $(abi-sco-objs)
2186 + $(LD) -r -o $@ $(abi-sco-objs)
2187 diff -Nur kernel-source-2.6.16.orig/abi/sco/misc.c kernel-source-2.6.16/abi/sco/misc.c
2188 --- kernel-source-2.6.16.orig/abi/sco/misc.c 1970-01-01 10:00:00.000000000 +1000
2189 +++ kernel-source-2.6.16/abi/sco/misc.c 2006-04-27 18:50:24.000000000 +1000
2192 + * Copyright (c) 2001 Christoph Hellwig.
2193 + * All rights reserved.
2195 + * This program is free software; you can redistribute it and/or modify
2196 + * it under the terms of the GNU General Public License as published by
2197 + * the Free Software Foundation; either version 2 of the License, or
2198 + * (at your option) any later version.
2200 + * This program is distributed in the hope that it will be useful,
2201 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2202 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2203 + * GNU General Public License for more details.
2205 + * You should have received a copy of the GNU General Public License
2206 + * along with this program; if not, write to the Free Software
2207 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2213 + * Misc SCO syscalls.
2215 +#include <linux/errno.h>
2216 +#include <linux/sched.h>
2217 +#include <linux/file.h>
2218 +#include <linux/types.h>
2219 +#include <linux/spinlock.h>
2220 +#include <linux/stat.h>
2221 +#include <linux/syscalls.h>
2222 +#include <linux/fs.h>
2223 +#include <asm/uaccess.h>
2225 +#include <abi/svr4/sysent.h>
2229 +sco_lseek(int fd, u_long offset, int whence)
2233 + error = sys_lseek(fd, offset, whence);
2234 + if (error == -ESPIPE) {
2235 + struct file *fp = fget(fd);
2240 + ip = fp->f_dentry->d_inode;
2241 + if (ip && (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode)))
2250 +sco_fcntl(int fd, u_int cmd, u_long arg)
2253 + * This could be SCO's get highest fd open if the fd we
2254 + * are called on is -1 otherwise it could be F_CHKFL.
2256 + if (fd == -1 && cmd == 8) {
2257 + struct files_struct *files = current->files;
2260 + /* compare to ./fs/open.c: get_unused_fd */
2261 + spin_lock(&files->file_lock);
2262 + rval = find_first_zero_bit(files_fdtable(files)->open_fds->fds_bits, files_fdtable(files)->max_fdset);
2263 + spin_unlock(&files->file_lock);
2268 + return svr4_fcntl(fd, cmd, arg);
2272 +sco_sysi86(int cmd, void *arg1, int arg2)
2275 + case 114 /*SI86GETFEATURES*/ :
2277 + * No, I don't know what these feature flags actually
2278 + * _mean_. This vector just matches SCO OS 5.0.0.
2280 +#define OSR5_FEATURES "\001\001\001\001\001\001\001\001\002\001\001\001"
2281 + arg2 = max(arg2, 12);
2282 + if (copy_to_user(arg1, OSR5_FEATURES, arg2))
2286 + return svr4_sysi86(cmd, arg1, arg2);
2289 diff -Nur kernel-source-2.6.16.orig/abi/sco/mmap.c kernel-source-2.6.16/abi/sco/mmap.c
2290 --- kernel-source-2.6.16.orig/abi/sco/mmap.c 1970-01-01 10:00:00.000000000 +1000
2291 +++ kernel-source-2.6.16/abi/sco/mmap.c 2006-04-27 18:50:24.000000000 +1000
2294 + * Copyright (c) 2001 Caldera Deutschland GmbH.
2295 + * All rights reserved.
2297 + * This program is free software; you can redistribute it and/or modify
2298 + * it under the terms of the GNU General Public License as published by
2299 + * the Free Software Foundation; either version 2 of the License, or
2300 + * (at your option) any later version.
2302 + * This program is distributed in the hope that it will be useful,
2303 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2304 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2305 + * GNU General Public License for more details.
2307 + * You should have received a copy of the GNU General Public License
2308 + * along with this program; if not, write to the Free Software
2309 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2315 + * Support for mmap on SCO OpenServer 5.
2317 +#include <linux/mm.h>
2318 +#include <linux/errno.h>
2319 +#include <linux/file.h>
2320 +#include <linux/mman.h>
2321 +#include <asm/uaccess.h>
2323 +#include <abi/sco/mman.h>
2324 +#include <abi/sco/types.h>
2326 +#include <abi/util/trace.h>
2330 +sco_mmap(u_long addr, size_t len, int prot, int flags, int fd, sco_off_t off)
2332 + struct file *file;
2335 + if (flags & SCO_MAP_UNIMPL) {
2336 +#if defined(CONFIG_ABI_TRACE)
2337 + abi_trace(ABI_TRACE_UNIMPL,
2338 + "unsupported mmap flags: 0x%x\n", flags & SCO_MAP_UNIMPL);
2340 + flags &= ~SCO_MAP_UNIMPL;
2347 + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
2348 + down_write(¤t->mm->mmap_sem);
2349 + mapaddr = do_mmap(file, addr, len, prot, flags | MAP_FIXED, off);
2350 + up_write(¤t->mm->mmap_sem);
2354 + if (mapaddr == addr)
2358 diff -Nur kernel-source-2.6.16.orig/abi/sco/ptrace.c kernel-source-2.6.16/abi/sco/ptrace.c
2359 --- kernel-source-2.6.16.orig/abi/sco/ptrace.c 1970-01-01 10:00:00.000000000 +1000
2360 +++ kernel-source-2.6.16/abi/sco/ptrace.c 2006-04-27 18:50:24.000000000 +1000
2363 + * ptrace.c - SCO OpenServer ptrace(2) support.
2365 + * Copyright (c) 1995 Mike Jagdis (jaggy@purplet.demon.co.uk)
2371 + * This file is nearly identical to abi/wyse/ptrace.c, please keep it in sync.
2373 +#include <linux/module.h>
2374 +#include <linux/errno.h>
2375 +#include <linux/sched.h>
2376 +#include <linux/kernel.h>
2377 +#include <linux/mm.h>
2378 +#include <linux/personality.h>
2379 +#include <linux/user.h>
2380 +#define __KERNEL_SYSCALLS__
2381 +#include <linux/unistd.h>
2382 +#include <linux/ptrace.h>
2384 +#include <asm/uaccess.h>
2386 +#include <abi/signal.h>
2387 +#include <abi/util/trace.h>
2391 +#define U(X) ((unsigned long)&((struct user *)0)->X)
2393 +static unsigned long sco_to_linux_reg[NREGS] = {
2394 + U(regs.gs), U(regs.fs), U(regs.es), U(regs.ds),
2395 + U(regs.edi), U(regs.esi),
2397 + U(regs.esp /* ESP */),
2398 + U(regs.ebx), U(regs.edx), U(regs.ecx), U(regs.eax),
2399 + U(signal /* Trap */),
2400 + U(reserved /* ERR */),
2401 + U(regs.eip), U(regs.cs), U(regs.eflags),
2402 + U(regs.esp), U(regs.ss)
2405 +#if defined(CONFIG_ABI_TRACE)
2406 +static const char *regnam[] = {
2407 + "EBX", "ECX", "EDX", "ESI", "EDI", "EBP", "EAX",
2408 + "DS", "ES", "FS", "GS", "ORIG_EAX", "EIP", "CS",
2409 + "EFL", "UESP", "SS"
2414 +sco_ptrace(int req, int pid, u_long addr, u_long data)
2419 + * Slight variations between iBCS and Linux codes.
2421 + if (req == PTRACE_ATTACH)
2423 + else if (req == PTRACE_DETACH)
2426 + if (req == 3 || req == 6) {
2427 + /* get offset of u_ar0 */
2428 + if (addr == 0x1200)
2431 + /* remap access to the registers. */
2432 + if ((addr & 0xff00) == 0x4000) { /* Registers */
2433 + addr = (addr & 0xff) >> 2;
2436 + addr = sco_to_linux_reg[addr];
2442 + if (req == 7 && data > 0) {
2443 + if (data > NSIGNALS)
2445 + data = current_thread_info()->exec_domain->signal_map[data];
2448 + if (req == 1 || req == 2 || req == 3) {
2449 + mm_segment_t old_fs = get_fs();
2453 + error = sys_ptrace(req, pid, addr, (long)&res);
2460 +#if defined(CONFIG_ABI_TRACE)
2461 + if (req == 3 || req == 6) {
2462 + abi_trace(ABI_TRACE_API, "%ld [%s] = 0x%08lx\n",
2463 + addr >> 2, (addr >> 2) < ARRAY_SIZE(regnam) ?
2464 + regnam[addr >> 2] : "???",
2465 + req == 3 ? res : data);
2469 + if (req == 1 || req == 2 || req == 3)
2472 + return sys_ptrace(req, pid, addr, data);
2474 diff -Nur kernel-source-2.6.16.orig/abi/sco/secureware.c kernel-source-2.6.16/abi/sco/secureware.c
2475 --- kernel-source-2.6.16.orig/abi/sco/secureware.c 1970-01-01 10:00:00.000000000 +1000
2476 +++ kernel-source-2.6.16/abi/sco/secureware.c 2006-04-27 18:50:24.000000000 +1000
2479 + * Copyright (c) 1994 Mike Jagdis.
2480 + * All rights reserved.
2482 + * This program is free software; you can redistribute it and/or modify
2483 + * it under the terms of the GNU General Public License as published by
2484 + * the Free Software Foundation; either version 2 of the License, or
2485 + * (at your option) any later version.
2487 + * This program is distributed in the hope that it will be useful,
2488 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2489 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2490 + * GNU General Public License for more details.
2492 + * You should have received a copy of the GNU General Public License
2493 + * along with this program; if not, write to the Free Software
2494 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2499 +#include <linux/errno.h>
2500 +#include <linux/kernel.h>
2501 +#include <linux/sched.h>
2504 + * SecureWare, Inc. provided the C2 security subsystem used on SCO Unix.
2505 + * This is not that package. This does not even attempt to emulate
2506 + * that package. This emulates just enough of the "obvious" bits to
2507 + * allow some programs to get a bit further. It is not useful to
2508 + * try to implement C2 security in an emulator. Nor is it particularly
2509 + * useful to run SCO's secure admin programs on Linux anyway...
2512 + SW_GETLUID = 0x01,
2513 + SW_SETLUID = 0x02,
2517 +sw_security(int cmd, void *p1, void *p2, void *p3, void *p4, void *p5)
2522 + * We want the login user id. We don't have it
2523 + * specifically so we'll just use the real uid
2524 + * instead - it should be good enough.
2526 + return (current->uid);
2529 + * Strictly we should only be able to call setluid()
2530 + * once but we can't enforce that. We have the choice
2531 + * between having it always succeed or always fail.
2532 + * Since setluid() should only ever be invoked by
2533 + * things like login processes we always fail it.
2538 + printk(KERN_ERR "%s: unsupported security call cmd=%d\n", __FILE__, cmd);
2541 diff -Nur kernel-source-2.6.16.orig/abi/sco/stat.c kernel-source-2.6.16/abi/sco/stat.c
2542 --- kernel-source-2.6.16.orig/abi/sco/stat.c 1970-01-01 10:00:00.000000000 +1000
2543 +++ kernel-source-2.6.16/abi/sco/stat.c 2006-04-27 18:50:24.000000000 +1000
2546 + * Copyright (c) 2001 Caldera Deutschland GmbH.
2547 + * All rights reserved.
2549 + * This program is free software; you can redistribute it and/or modify
2550 + * it under the terms of the GNU General Public License as published by
2551 + * the Free Software Foundation; either version 2 of the License, or
2552 + * (at your option) any later version.
2554 + * This program is distributed in the hope that it will be useful,
2555 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2556 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2557 + * GNU General Public License for more details.
2559 + * You should have received a copy of the GNU General Public License
2560 + * aint32_t with this program; if not, write to the Free Software
2561 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2567 + * SCO OpenServer xstat/fxstat/lxstat support.
2569 +#include <linux/kernel.h>
2570 +#include <linux/fs.h>
2571 +#include <linux/sched.h>
2572 +#include <linux/file.h>
2573 +#include <linux/string.h>
2574 +#include <asm/uaccess.h>
2576 +#include <abi/sco/types.h>
2577 +#include <abi/sco/stat.h>
2578 +#include <abi/svr4/stat.h>
2580 +#include <abi/util/trace.h>
2581 +#include <abi/util/stat.h>
2584 +enum {SVR4_stat = 1, SCO_xstat = 51};
2587 +report_sco_xstat(struct kstat *stp, struct sco_xstat *bufp)
2589 + struct sco_xstat buf;
2591 + memset(&buf, 0, sizeof(struct sco_xstat));
2593 + buf.st_dev = linux_to_sco_dev_t(stp->dev);
2594 + buf.st_ino = linux_to_sco_ino_t(stp->ino);
2595 + buf.st_mode = stp->mode;
2596 + buf.st_nlink = stp->nlink;
2597 + buf.st_uid = linux_to_sco_uid_t(stp->uid);
2598 + buf.st_gid = linux_to_sco_gid_t(stp->gid);
2599 + buf.st_rdev = linux_to_sco_dev_t(stp->rdev);
2601 + if (stp->size > MAX_NON_LFS)
2602 + return -EOVERFLOW; /* XXX: what to return for SCO?? */
2604 + buf.st_size = stp->size;
2606 + buf.st_atime = stp->atime.tv_sec;
2607 + buf.st_mtime = stp->mtime.tv_sec;
2608 + buf.st_ctime = stp->ctime.tv_sec;
2610 + buf.st_blksize = stp->blksize;
2611 + buf.st_blocks = stp->blocks;
2613 + strcpy(buf.st_fstype, "ext2");
2615 + buf.st_sco_flags = 0; /* 1 if remote */
2617 + if (copy_to_user(bufp, &buf, sizeof(struct sco_xstat)))
2623 +sco_xstat(int vers, char *filename, void *bufp)
2628 + error = vfs_stat(filename, &st);
2634 + return report_svr4_stat(&st, bufp);
2636 + return report_sco_xstat(&st, bufp);
2639 +#if defined(CONFIG_ABI_TRACE)
2640 + abi_trace(ABI_TRACE_API, "xstat version %d not supported\n", vers);
2646 +sco_lxstat(int vers, char *filename, void *bufp)
2651 + error = vfs_lstat(filename, &st);
2657 + return report_svr4_stat(&st, bufp);
2659 + return report_sco_xstat(&st, bufp);
2662 +#if defined(CONFIG_ABI_TRACE)
2663 + abi_trace(ABI_TRACE_API, "lxstat version %d not supported\n", vers);
2669 +sco_fxstat(int vers, int fd, void *bufp)
2674 + error = vfs_fstat(fd, &st);
2680 + return report_svr4_stat(&st, bufp);
2682 + return report_sco_xstat(&st, bufp);
2685 +#if defined(CONFIG_ABI_TRACE)
2686 + abi_trace(ABI_TRACE_API, "fxstat version %d not supported\n", vers);
2690 diff -Nur kernel-source-2.6.16.orig/abi/sco/statvfs.c kernel-source-2.6.16/abi/sco/statvfs.c
2691 --- kernel-source-2.6.16.orig/abi/sco/statvfs.c 1970-01-01 10:00:00.000000000 +1000
2692 +++ kernel-source-2.6.16/abi/sco/statvfs.c 2006-04-27 18:50:24.000000000 +1000
2695 + * Copyright (c) 2001 Caldera Deutschland GmbH.
2696 + * Copyright (c) 2001 Christoph Hellwig.
2697 + * All rights reserved.
2699 + * This program is free software; you can redistribute it and/or modify
2700 + * it under the terms of the GNU General Public License as published by
2701 + * the Free Software Foundation; either version 2 of the License, or
2702 + * (at your option) any later version.
2704 + * This program is distributed in the hope that it will be useful,
2705 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2706 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2707 + * GNU General Public License for more details.
2709 + * You should have received a copy of the GNU General Public License
2710 + * along with this program; if not, write to the Free Software
2711 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2717 + * SCO OpenServer statvfs/fstatvfs support.
2719 +#include <linux/kernel.h>
2720 +#include <linux/fs.h>
2721 +#include <linux/sched.h>
2722 +#include <linux/file.h>
2723 +#include <linux/string.h>
2724 +#include <linux/vfs.h>
2725 +#include <linux/mount.h>
2726 +#include <linux/namei.h>
2727 +#include <asm/uaccess.h>
2729 +#include <abi/sco/types.h>
2733 +report_statvfs(struct vfsmount *mnt, struct inode *ip, struct sco_statvfs *bufp)
2735 + struct sco_statvfs buf;
2739 + error = vfs_statfs(mnt->mnt_sb, &s);
2743 + memset(&buf, 0, sizeof(struct sco_statvfs));
2745 + buf.f_bsize = s.f_bsize;
2746 + buf.f_frsize = s.f_bsize;
2747 + buf.f_blocks = s.f_blocks;
2748 + buf.f_bfree = s.f_bfree;
2749 + buf.f_bavail = s.f_bavail;
2750 + buf.f_files = s.f_files;
2751 + buf.f_free = s.f_ffree;
2752 + buf.f_favail = s.f_ffree; /* SCO addition in the middle! */
2753 + buf.f_sid = ip->i_sb->s_dev;
2756 + * Get the name of the filesystem.
2758 + * Sadly, some code "in the wild" actually checks the name
2759 + * against a hard coded list to see if it is a "real" fs or not.
2761 + * I believe Informix Dynamic Server for SCO is one such.
2763 + if (strncmp(ip->i_sb->s_type->name, "ext2", 4) == 0)
2764 + strcpy(buf.f_basetype, "HTFS");
2766 + strcpy(buf.f_basetype, ip->i_sb->s_type->name);
2768 + /* Check for a few flags statvfs wants but statfs doesn't have. */
2769 + if (IS_RDONLY(ip))
2771 + if (mnt->mnt_flags & MNT_NOSUID)
2774 + buf.f_namemax = s.f_namelen;
2776 + if (copy_to_user(bufp, &buf, sizeof(struct sco_statvfs)))
2782 +sco_statvfs(char *filename, struct sco_statvfs *bufp)
2784 + struct nameidata nd;
2787 + error = user_path_walk(filename, &nd);
2789 + error = report_statvfs(nd.mnt, nd.dentry->d_inode, bufp);
2790 + path_release(&nd);
2796 +sco_fstatvfs(int fd, struct sco_statvfs *bufp)
2799 + int error = -EBADF;
2803 + error = report_statvfs(fp->f_vfsmnt,
2804 + fp->f_dentry->d_inode, bufp);
2809 diff -Nur kernel-source-2.6.16.orig/abi/sco/sysent.c kernel-source-2.6.16/abi/sco/sysent.c
2810 --- kernel-source-2.6.16.orig/abi/sco/sysent.c 1970-01-01 10:00:00.000000000 +1000
2811 +++ kernel-source-2.6.16/abi/sco/sysent.c 2006-04-27 18:50:24.000000000 +1000
2814 + * Copyright (c) 2001 Christoph Hellwig.
2815 + * All rights reserved.
2817 + * This program is free software; you can redistribute it and/or modify
2818 + * it under the terms of the GNU General Public License as published by
2819 + * the Free Software Foundation; either version 2 of the License, or
2820 + * (at your option) any later version.
2822 + * This program is distributed in the hope that it will be useful,
2823 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2824 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2825 + * GNU General Public License for more details.
2827 + * You should have received a copy of the GNU General Public License
2828 + * along with this program; if not, write to the Free Software
2829 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2835 + * SCO Unix 3.x personality switch
2837 +#include <linux/kernel.h>
2838 +#include <linux/module.h>
2839 +#include <linux/init.h>
2840 +#include <linux/personality.h>
2841 +#include <linux/types.h>
2842 +#include <linux/syscalls.h>
2843 +#include <linux/socket.h>
2844 +#include <linux/net.h>
2845 +#include <asm/uaccess.h>
2847 +#include <abi/sco/signal.h>
2848 +#include <abi/sco/sysent.h>
2849 +#include <abi/svr4/sysent.h>
2850 +#include <abi/cxenix/sysent.h>
2852 +#include <abi/signal.h>
2854 +#include <abi/util/errno.h>
2855 +#include <abi/util/map.h>
2856 +#include <abi/util/sysent.h>
2857 +#include <abi/util/socket.h>
2860 +MODULE_DESCRIPTION("OpenServer/Xenix personality");
2861 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
2862 +MODULE_LICENSE("GPL");
2865 +static u_char sco_err_table[] = {
2866 +/* 0 - 9 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
2867 +/* 10 - 19 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2868 +/* 20 - 29 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
2869 +/* 30 - 39 */ 30, 31, 32, 33, 34, 45, 78, 46, 89, 145,
2870 +/* 40 - 49 */ 150, 90, 35, 36, 37, 38, 39, 40, 41, 42,
2871 +/* 50 - 59 */ 43, 44, 50, 51, 52, 53, 54, 55, 56, 57,
2872 +/* 60 - 69 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
2873 +/* 70 - 79 */ 70, 71, 74, 76, 77, 79, 80, 81, 82, 83,
2874 +/* 80 - 89 */ 84, 85, 86, 87, 88, 152, 153, 22, 93, 94,
2875 +/* 90 - 99 */ 95, 96, 118, 97, 98, 99, 100, 101, 102, 103,
2876 +/* 100 - 109 */ 104, 105, 106, 107, 108, 63, 110, 111, 112, 113,
2877 +/* 110 - 119 */ 114, 115, 116, 117, 92, 91, 151, 135, 137, 138,
2878 +/* 120 - 122 */ 139, 140, 28
2882 + * Map Linux RESTART* values (512,513,514) to EINTR
2884 +static u_char lnx_err_table[] = {
2885 +/* 512 - 514 */ EINTR, EINTR, EINTR
2888 +static struct map_segment sco_err_map[] = {
2889 + { 0, 0+sizeof(sco_err_table)-1, sco_err_table },
2890 + { 512, 512+sizeof(lnx_err_table)-1, lnx_err_table },
2894 +/* XXX: move to signal.h */
2895 +#define SCO__SIGSTKFLT SCO_SIGTERM /* Stack fault */
2897 +static long linux_to_sco_signals[NSIGNALS + 1] = {
2898 +/* 0 - 3 */ 0, SCO_SIGHUP, SCO_SIGINT, SCO_SIGQUIT,
2899 +/* 4 - 7 */ SCO_SIGILL, SCO_SIGTRAP, SCO_SIGABRT, SCO_SIGBUS,
2900 +/* 8 - 11 */ SCO_SIGFPE, SCO_SIGKILL, SCO_SIGUSR1, SCO_SIGSEGV,
2901 +/* 12 - 15 */ SCO_SIGUSR2, SCO_SIGPIPE, SCO_SIGALRM, SCO_SIGTERM,
2902 +/* 16 - 19 */ SCO__SIGSTKFLT, SCO_SIGCLD, SCO_SIGCONT, SCO_SIGSTOP,
2903 +/* 20 - 23 */ SCO_SIGTSTP, SCO_SIGTTIN, SCO_SIGTTOU, SCO_SIGURG,
2904 +/* 24 - 27 */ SCO_SIGXCPU, SCO_SIGXFSZ, SCO_SIGVTALRM, SCO_SIGPROF,
2905 +/* 28 - 31 */ SCO_SIGWINCH, SCO_SIGPOLL, SCO_SIGPWR, SCO_SIGSYS,
2909 +static long linux_to_xenix_signals[NSIGNALS+1] = {
2910 +/* 0 - 3 */ 0, IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT,
2911 +/* 4 - 7 */ IBCS_SIGILL, IBCS_SIGTRAP, IBCS_SIGABRT, -1,
2912 +/* 8 - 11 */ IBCS_SIGFPE, IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV,
2913 +/* 12 - 15 */ IBCS_SIGUSR2, IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM,
2914 +/* 16 - 19 */ IBCS_SIGSEGV, IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP,
2915 +/* 20 - 23 */ IBCS_SIGTSTP, IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGUSR1,
2916 +/* 24 - 27 */ IBCS_SIGGXCPU, IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF,
2917 +/* 28 - 31 */ IBCS_SIGWINCH, 20 /*SIGIO*/, IBCS_SIGPWR, -1,
2921 +static long sco_to_linux_signals[NSIGNALS+1] = {
2922 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
2923 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGABRT,
2924 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGBUS, SIGSEGV,
2925 +/* 12 - 15 */ SIGSYS, SIGPIPE, SIGALRM, SIGTERM,
2926 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
2927 +/* 20 - 23 */ SIGWINCH, SIGURG, SIGPOLL, SIGSTOP,
2928 +/* 24 - 27 */ SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU,
2929 +/* 28 - 31 */ SIGVTALRM, SIGPROF, SIGXCPU, SIGXFSZ,
2933 +static long xenix_to_linux_signals[NSIGNALS+1] = {
2934 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
2935 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGUNUSED,
2936 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGUNUSED, SIGSEGV,
2937 +/* 12 - 15 */ SIGUNUSED, SIGPIPE, SIGALRM, SIGTERM,
2938 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
2939 +/* 20 - 23 */ SIGPOLL, -1, -1, -1,
2940 +/* 24 - 27 */ -1, -1, -1, -1,
2941 +/* 28 - 31 */ -1, -1, -1, -1,
2945 +static char sco_socktype[] = {
2954 +static struct map_segment sco_socktype_map[] = {
2955 + { 1, 6, sco_socktype },
2959 +static struct map_segment sco_sockopt_map[] = {
2960 + { 0x0001, 0x0001, (char *)SO_DEBUG },
2961 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
2962 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
2963 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
2964 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
2965 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
2966 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
2967 + { 0x0080, 0x0080, (char *)SO_LINGER },
2968 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
2969 + { 0x0200, 0x0200, (char *)SO_ORDREL },
2970 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
2971 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
2972 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
2973 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
2974 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
2975 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
2976 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
2977 + { 0x1007, 0x1007, (char *)SO_ERROR },
2978 + { 0x1008, 0x1008, (char *)SO_TYPE },
2979 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
2984 + * The first three entries (AF_UNSPEC, AF_UNIX and AF_INET)
2985 + * are identity mapped. All others aren't available under
2986 + * Linux, nor are Linux's AF_AX25 and AF_IPX available from
2987 + * SCO as far as I know.
2989 +static struct map_segment sco_af_map[] = {
2995 +static struct sysent sco_syscall_table[] = {
2996 +/* 0 */ { abi_syscall, Fast, "syscall", "" },
2997 +/* 1 */ { sys_exit, 1, "exit", "d" },
2998 +/* 2 */ { abi_fork, Spl, "fork", "" },
2999 +/* 3 */ { abi_read, 3, "read", "dpd" },
3000 +/* 4 */ { sys_write, 3, "write", "dpd" },
3001 +/* 5 */ { svr4_open, 3, "open", "soo" },
3002 +/* 6 */ { sys_close, 1, "close", "d" },
3003 +/* 7 */ { abi_wait, Spl, "wait", "xxx" },
3004 +/* 8 */ { sys_creat, 2, "creat", "so" },
3005 +/* 9 */ { sys_link, 2, "link", "ss" },
3006 +/* 10 */ { sys_unlink, 1, "unlink", "s" },
3007 +/* 11 */ { abi_exec, Spl, "exec", "sxx" },
3008 +/* 12 */ { sys_chdir, 1, "chdir", "s" },
3009 +/* 13 */ { abi_time, 0, "time", "" },
3010 +/* 14 */ { svr4_mknod, 3, "mknod", "soo" },
3011 +/* 15 */ { sys_chmod, 2, "chmod", "so" },
3012 +/* 16 */ { sys_chown, 3, "chown", "sdd" },
3013 +/* 17 */ { abi_brk, 1, "brk/break", "x" },
3014 +/* 18 */ { svr4_stat, 2, "stat", "sp" },
3015 +/* 19 */ { sco_lseek, 3, "seek/lseek", "ddd" },
3016 +/* 20 */ { abi_getpid, Spl, "getpid", "" },
3017 +/* 21 */ { 0, Ukn, "mount", "" },
3018 +/* 22 */ { sys_umount, 1, "umount", "s" },
3019 +/* 23 */ { sys_setuid, 1, "setuid", "d" },
3020 +/* 24 */ { abi_getuid, Spl, "getuid", "" },
3021 +/* 25 */ { sys_stime, 1, "stime", "d" },
3022 +/* 26 */ { sco_ptrace, 4, "ptrace", "xdxx" },
3023 +/* 27 */ { sys_alarm, 1, "alarm", "d" },
3024 +/* 28 */ { svr4_fstat, 2, "fstat", "dp" },
3025 +/* 29 */ { sys_pause, 0, "pause", "" },
3026 +/* 30 */ { sys_utime, 2, "utime", "xx" },
3027 +/* 31 */ { 0, Ukn, "stty", "" },
3028 +/* 32 */ { 0, Ukn, "gtty", "" },
3029 +/* 33 */ { sys_access, 2, "access", "so" },
3030 +/* 34 */ { sys_nice, 1, "nice", "d" },
3031 +/* 35 */ { svr4_statfs, 4, "statfs", "spdd" },
3032 +/* 36 */ { sys_sync, 0, "sync", "" },
3033 +/* 37 */ { abi_kill, 2, "kill", "dd" },
3034 +/* 38 */ { svr4_fstatfs, 4, "fstatfs", "dpdd" },
3035 +/* 39 */ { abi_procids, Spl, "procids", "d" },
3036 +/* 40 */ { cxenix, Fast, "cxenix", "" },
3037 +/* 41 */ { sys_dup, 1, "dup", "d" },
3038 +/* 42 */ { abi_pipe, Spl, "pipe", "" },
3039 +/* 43 */ { sys_times, 1, "times", "p" },
3040 +/* 44 */ { 0 , Ukn, "prof", "" },
3041 +/* 45 */ { 0, Ukn, "lock/plock", "" },
3042 +/* 46 */ { sys_setgid, 1, "setgid", "d" },
3043 +/* 47 */ { abi_getgid, Spl, "getgid", "" },
3044 +/* 48 */ { abi_sigfunc, Fast, "sigfunc", "xxx" },
3045 +/* 49 */ { svr4_msgsys, Spl, "msgsys", "dxddd" },
3046 +/* 50 */ { sco_sysi86, 3, "sysi86/sys3b", "d" },
3047 +/* 51 */ { sys_acct, 1, "acct/sysacct", "x" },
3048 +/* 52 */ { svr4_shmsys, Fast, "shmsys", "ddxo" },
3049 +/* 53 */ { svr4_semsys, Spl, "semsys", "dddx" },
3050 +/* 54 */ { sco_ioctl, Spl, "ioctl", "dxx" },
3051 +/* 55 */ { 0, 3, "uadmin", "xxx" },
3052 +/* 56 */ { 0, Ukn, "?", "" },
3053 +/* 57 */ { v7_utsname, 1, "utsys", "x" },
3054 +/* 58 */ { sys_fsync, 1, "fsync", "d" },
3055 +/* 59 */ { abi_exec, Spl, "execv", "spp" },
3056 +/* 60 */ { sys_umask, 1, "umask", "o" },
3057 +/* 61 */ { sys_chroot, 1, "chroot", "s" },
3058 +/* 62 */ { sco_fcntl, 3, "fcntl", "dxx" },
3059 +/* 63 */ { svr4_ulimit, 2, "ulimit", "xx" },
3060 +/* 64 */ { 0, Ukn, "?", "" },
3061 +/* 65 */ { 0, Ukn, "?", "" },
3062 +/* 66 */ { 0, Ukn, "?", "" },
3063 +/* 67 */ { 0, Ukn, "?", "" },
3064 +/* 68 */ { 0, Ukn, "?", "" },
3065 +/* 69 */ { 0, Ukn, "?", "" },
3066 +/* 70 */ { 0, Ukn, "advfs", "" },
3067 +/* 71 */ { 0, Ukn, "unadvfs", "" },
3068 +/* 72 */ { 0, Ukn, "rmount", "" },
3069 +/* 73 */ { 0, Ukn, "rumount", "" },
3070 +/* 74 */ { 0, Ukn, "rfstart", "" },
3071 +/* 75 */ { 0, Ukn, "?", "" },
3072 +/* 76 */ { 0, Ukn, "rdebug", "" },
3073 +/* 77 */ { 0, Ukn, "rfstop", "" },
3074 +/* 78 */ { 0, Ukn, "rfsys", "" },
3075 +/* 79 */ { sys_rmdir, 1, "rmdir", "s" },
3076 +/* 80 */ { abi_mkdir, 2, "mkdir", "so" },
3077 +/* 81 */ { svr4_getdents, 3, "getdents", "dxd" },
3078 +/* 82 */ { 0, Ukn, "libattach", "" },
3079 +/* 83 */ { 0, Ukn, "libdetach", "" },
3080 +/* 84 */ { svr4_sysfs, 3, "sysfs", "dxx" },
3081 +/* 85 */ { svr4_getmsg, Spl, "getmsg", "dxxx" },
3082 +/* 86 */ { svr4_putmsg, Spl, "putmsg", "dxxd" },
3083 +/* 87 */ { sys_poll, 3, "poll", "xdd" },
3084 +/* 88 */ { 0, Ukn, "nosys88", "" },
3085 +/* 89 */ { sw_security, 6, "security", "dxxxxx"},
3086 +/* 90 */ { sys_symlink, 2, "symlink", "ss" },
3087 +/* 91 */ { svr4_lstat, 2, "lstat", "sp" },
3088 +/* 92 */ { sys_readlink, 3, "readlink", "spd" },
3091 + * Ok, this is where the good-old SCO calls end.
3092 + * Everything from here onwards is OSR5-specific.
3094 + * In fact OSR5 documents only the following calls:
3102 + * o gettimeofday (171)
3103 + * o settimeofday (172)
3105 + * Everything else is guesswork (from AVR4/iABI4), even though
3106 + * the OSR5 ELF libs use at least some of those... (e.g. mmap).
3109 +/* 93 */ { 0, Ukn, "?", "" },
3110 +/* 94 */ { 0, Ukn, "?", "" },
3111 +/* 95 */ { abi_sigprocmask, 3, "sigprocmask", "dxx" },
3112 +/* 96 */ { abi_sigsuspend, Spl, "sigsuspend", "x" },
3113 +/* 97 */ { 0, 2, "sigaltstack", "xx" },
3114 +/* 98 */ { abi_sigaction, 3, "sigaction", "dxx" },
3115 +/* 99 */ { svr4_sigpending, 2, "sigpending", "dp" },
3116 +/* 100 */ { svr4_context, Spl, "context", "" },
3117 +/* 101 */ { 0, Ukn, "evsys", "" },
3118 +/* 102 */ { 0, Ukn, "evtrapret", "" },
3119 +/* 103 */ { sco_statvfs, 2, "statvfs", "sp" },
3120 +/* 104 */ { sco_fstatvfs, 2, "fstatvfs", "dp" },
3121 +/* 105 */ { 0, Ukn, "unimp (sysisc)","" },
3122 +/* 106 */ { 0, Ukn, "nfssys", "" },
3123 +/* 107 */ { 0, 4, "waitid", "ddxd" },
3124 +/* 108 */ { 0, 3, "sigsendsys", "ddd" },
3125 +/* 109 */ { svr4_hrtsys, Spl, "hrtsys", "xxx" },
3126 +/* 110 */ { 0, 3, "acancel", "dxd" },
3127 +/* 111 */ { 0, Ukn, "async", "" },
3128 +/* 112 */ { 0, Ukn, "priocntlsys", "" },
3129 +/* 113 */ { svr4_pathconf, 2, "pathconf", "sd" },
3130 +/* 114 */ { sys_mincore, 3, "mincore", "xdx" },
3131 +/* 115 */ { sco_mmap, 6, "mmap", "xxxxdx"},
3132 +/* 116 */ { sys_mprotect, 3, "mprotect", "xdx" },
3133 +/* 117 */ { sys_munmap, 2, "munmap", "xd" },
3134 +/* 118 */ { svr4_fpathconf, 2, "fpathconf", "dd" },
3135 +/* 119 */ { abi_fork, Spl, "vfork", "" },
3136 +/* 120 */ { sys_fchdir, 1, "fchdir", "d" },
3137 +/* 121 */ { sys_readv, 3, "readv", "dxd" },
3138 +/* 122 */ { sys_writev, 3, "writev", "dxd" },
3139 +/* 123 */ { sco_xstat, 3, "xstat", "dsx" },
3140 +/* 124 */ { sco_lxstat, 3, "lxstat", "dsx" },
3141 +/* 125 */ { sco_fxstat, 3, "fxstat", "ddx" },
3142 +/* 126 */ { svr4_xmknod, 4, "xmknod", "dsox" },
3143 +/* 127 */ { 0, Ukn, "syslocal", "d" },
3144 +/* 128 */ { svr4_getrlimit, 2, "setrlimit", "dx" },
3145 +/* 129 */ { svr4_setrlimit, 2, "getrlimit", "dx" },
3146 +/* 130 */ { 0, Ukn, "?", "" },
3147 +/* 131 */ { 0, Ukn, "?", "" },
3148 +/* 132 */ { 0, Ukn, "?", "" },
3149 +/* 133 */ { 0, Ukn, "?", "" },
3150 +/* 134 */ { 0, Ukn, "?", "" },
3151 +/* 135 */ { 0, Ukn, "?", "" },
3152 +/* 136 */ { 0, Ukn, "?", "" },
3153 +/* 137 */ { 0, Ukn, "?", "" },
3154 +/* 138 */ { 0, Ukn, "?", "" },
3155 +/* 139 */ { 0, Ukn, "?", "" },
3156 +/* 140 */ { socksys_syscall, 1, "socksys", "x" },
3157 +/* 141 */ { 0, Ukn, "?", "" },
3158 +/* 142 */ { 0, Ukn, "?", "" },
3159 +/* 143 */ { 0, Ukn, "?", "" },
3162 + * The next three are used when an OSR5 app is launched by
3163 + * a UnixWare libc.
3165 + * These aren't supported by the UW7 personality either, but
3166 + * adding the names here makes the traces look saner.
3169 +/* 144 */ { 0, 2, "uw7-secsys", "dx" },
3170 +/* 145 */ { 0, 4, "uw7-filepriv", "sdxd" },
3171 +/* 146 */ { 0, 3, "uw7-procpriv", "dxd" },
3173 +/* 147 */ { 0, Ukn, "?", "" },
3174 +/* 148 */ { 0, Ukn, "?", "" },
3175 +/* 149 */ { 0, Ukn, "?", "" },
3176 +/* 150 */ { 0, Ukn, "?", "" },
3177 +/* 151 */ { 0, Ukn, "?", "" },
3178 +/* 152 */ { 0, Ukn, "?", "" },
3179 +/* 153 */ { 0, Ukn, "?", "" },
3180 +/* 154 */ { 0, Ukn, "?", "" },
3181 +/* 155 */ { 0, Ukn, "?", "" },
3182 +/* 156 */ { 0, Ukn, "?", "" },
3183 +/* 157 */ { 0, Ukn, "?", "" },
3184 +/* 158 */ { 0, Ukn, "?", "" },
3185 +/* 159 */ { 0, Ukn, "?", "" },
3186 +/* 160 */ { 0, Ukn, "?", "" },
3187 +/* 161 */ { 0, Ukn, "?", "" },
3188 +/* 162 */ { 0, Ukn, "?", "" },
3189 +/* 163 */ { 0, Ukn, "?", "" },
3190 +/* 164 */ { 0, Ukn, "?", "" },
3191 +/* 165 */ { 0, Ukn, "?", "" },
3192 +/* 166 */ { 0, Ukn, "?", "" },
3193 +/* 167 */ { 0, Ukn, "?", "" },
3194 +/* 168 */ { 0, Ukn, "?", "" },
3195 +/* 169 */ { 0, Ukn, "?", "" },
3196 +/* 170 */ { 0, Ukn, "?", "" },
3197 +/* 171 */ { sys_gettimeofday, 2, "gettimeofday", "xx" },
3198 +/* 172 */ { sys_settimeofday, 2, "settimeofday", "xx" },
3202 +sco_lcall7(int segment, struct pt_regs *regs)
3204 + int sysno = regs->eax & 0xff;
3206 + if (sysno >= ARRAY_SIZE(sco_syscall_table))
3207 + set_error(regs, iABI_errors(-EINVAL));
3209 + lcall7_dispatch(regs, &sco_syscall_table[sysno], 1);
3213 +static struct exec_domain sco_exec_domain = {
3214 + name: "OpenServer",
3215 + handler: sco_lcall7,
3216 + pers_low: 3 /* PER_SCOSVR3, PER_OSR5 */,
3217 + pers_high: 3 /* PER_SCOSVR3, PER_OSR5 */,
3218 + signal_map: sco_to_linux_signals,
3219 + signal_invmap: linux_to_sco_signals,
3220 + err_map: sco_err_map,
3221 + socktype_map: sco_socktype_map,
3222 + sockopt_map: sco_sockopt_map,
3223 + af_map: sco_af_map,
3224 + module: THIS_MODULE
3227 +static struct exec_domain xenix_exec_domain = {
3229 + handler: sco_lcall7,
3230 + pers_low: 7 /* PER_XENIX */,
3231 + pers_high: 7 /* PER_XENIX */,
3232 + signal_map: xenix_to_linux_signals,
3233 + signal_invmap: linux_to_xenix_signals,
3234 + err_map: sco_err_map,
3235 + socktype_map: sco_socktype_map,
3236 + sockopt_map: sco_sockopt_map,
3237 + af_map: sco_af_map,
3238 + module: THIS_MODULE
3243 +sco_module_init(void)
3247 + err = register_exec_domain(&sco_exec_domain);
3252 + err = register_exec_domain(&xenix_exec_domain);
3254 + unregister_exec_domain(&sco_exec_domain);
3262 +sco_module_exit(void)
3264 + unregister_exec_domain(&xenix_exec_domain);
3265 + unregister_exec_domain(&sco_exec_domain);
3268 +module_init(sco_module_init);
3269 +module_exit(sco_module_exit);
3270 diff -Nur kernel-source-2.6.16.orig/abi/sco/tapeio.c kernel-source-2.6.16/abi/sco/tapeio.c
3271 --- kernel-source-2.6.16.orig/abi/sco/tapeio.c 1970-01-01 10:00:00.000000000 +1000
3272 +++ kernel-source-2.6.16/abi/sco/tapeio.c 2006-04-27 18:50:24.000000000 +1000
3276 +#include <linux/kernel.h>
3277 +#include <linux/mtio.h>
3278 +#include <linux/unistd.h>
3279 +#include <linux/syscalls.h>
3281 +#include <asm/uaccess.h>
3285 +sco_tape_ioctl(int fd, u_int cmd, caddr_t data)
3291 + mtop.mt_count = 1;
3293 + switch (cmd & 0xff) {
3294 + case 1: /* MT_RESET */
3295 + mtop.mt_op = MTRESET;
3298 + case 2: /* MT_RETEN */
3299 + mtop.mt_op = MTRETEN;
3302 + case 3: /* MT_REWIND */
3303 + mtop.mt_op = MTREW;
3306 + case 4: /* MT_ERASE */
3307 + case 23: /* HP_ERASE */
3308 + mtop.mt_op = MTERASE;
3311 + case 6: /* MT_RFM */
3312 + mtop.mt_op = MTFSF;
3315 + case 7: /* MT_WFM */
3316 + mtop.mt_op = MTWEOF;
3319 + case 8: /* MT_LOAD */
3320 + mtop.mt_op = MTLOAD;
3323 + case 9: /* MT_UNLOAD */
3324 + mtop.mt_op = MTOFFL;
3327 + case 19: /* MT_RSM */
3328 + mtop.mt_op = MTFSS;
3331 + case 20: /* MT_WSM */
3332 + mtop.mt_op = MTWSM;
3335 + case 21: /* MT_EOD */
3336 + mtop.mt_op = MTEOM;
3339 + case 24: /* MT_SETBLK */
3340 + mtop.mt_op = MTSETBLK;
3341 + mtop.mt_count = (int)data;
3344 + case 25: /* MT_LOCK */
3345 + mtop.mt_op = MTLOCK;
3348 + case 26: /* MT_UNLOCK */
3349 + mtop.mt_op = MTUNLOCK;
3355 + The following function codes are just copied from the SCO
3359 + case 0: /* MT_STATUS */
3360 + case 5: /* MT_AMOUNT */
3361 + case 10: /* MT_DSTATUS */
3362 + case 11: /* MT_FORMAT */
3363 + case 12: /* MT_GETHDR */
3364 + case 13: /* MT_PUTHDR */
3365 + case 14: /* MT_GETNEWBB */
3366 + case 15: /* MT_PUTNEWBB */
3367 + case 16: /* MT_GETVTBL */
3368 + case 17: /* MT_PUTVTBL */
3369 + case 18: /* MT_SERVO */
3370 + case 22: /* MT_FORMPART */
3371 + case 38: /* MT_SETANSI */
3372 + case 64: /* MT_REPORT */
3375 + printk (KERN_ERR "abi: SCO tape ioctl func=%d arg=%x unsupported\n",
3376 + cmd & 0xff, (int)data);
3382 + error = sys_ioctl(fd, MTIOCTOP, (long)&mtop);
3386 diff -Nur kernel-source-2.6.16.orig/abi/sco/termios.c kernel-source-2.6.16/abi/sco/termios.c
3387 --- kernel-source-2.6.16.orig/abi/sco/termios.c 1970-01-01 10:00:00.000000000 +1000
3388 +++ kernel-source-2.6.16/abi/sco/termios.c 2006-04-27 18:50:24.000000000 +1000
3391 + * Copyright (C) 1991, 1992 Linus Torvalds
3393 + * Written by Drew Sullivan.
3394 + * Rewritten by Mike Jagdis.
3399 +#include <linux/errno.h>
3400 +#include <linux/kernel.h>
3401 +#include <linux/termios.h>
3402 +#include <linux/unistd.h>
3403 +#include <linux/syscalls.h>
3404 +#include <asm/uaccess.h>
3406 +#include <abi/svr4/ioctl.h>
3407 +#include <abi/svr4/termios.h>
3410 +#define SCO_NCCS (SVR_NCC+5)
3412 +struct sco_termios {
3413 + u_int16_t c_iflag;
3414 + u_int16_t c_oflag;
3415 + u_int16_t c_cflag;
3416 + u_int16_t c_lflag;
3418 + u_char c_cc[SCO_NCCS];
3424 +sco_to_linux_termios(int fd, int op, struct sco_termios *it)
3427 + mm_segment_t old_fs;
3429 + char sco_cc[SCO_NCCS];
3432 + if (!access_ok(VERIFY_READ, it, sizeof(struct sco_termios)))
3435 + old_fs = get_fs();
3437 + error = sys_ioctl(fd, TCGETS, (long)&t);
3443 + __get_user(t.c_iflag, &it->c_iflag);
3444 + t.c_iflag &= ~0100000; /* DOSMODE */
3446 + __get_user(t.c_oflag, &it->c_oflag);
3448 + __get_user(t.c_cflag, &it->c_cflag);
3449 + if (t.c_cflag & 0100000) /* CRTSFL - SCO only? */
3450 + t.c_cflag |= CRTSCTS;
3451 + t.c_cflag &= ~0170000; /* LOBLK|CTSFLOW|RTSFLOW|CRTSFL */
3453 + lflag = t.c_lflag;
3454 + t.c_lflag &= ~0100777;
3455 + __get_user(r, &it->c_lflag);
3458 + if ((t.c_lflag & 0100000))
3459 + sys_ioctl(fd, TIOCEXCL, 0);
3461 + sys_ioctl(fd, TIOCNXCL, 0);
3463 + t.c_lflag &= ~0100000;
3464 + t.c_lflag |= (t.c_lflag & 0000400) << 7; /* Move IEXTEN */
3465 + t.c_lflag &= ~0000400;
3466 + t.c_lflag |= (t.c_lflag & 0001000) >> 1; /* Move TOSTOP */
3467 + t.c_lflag &= ~0001000;
3468 + t.c_lflag |= (lflag & 0001000); /* Restore ECHOCTL */
3470 + __get_user(t.c_line, &it->c_line); /* XXX Map this? */
3472 + if (copy_from_user(sco_cc, &it->c_cc, SCO_NCCS))
3475 + t.c_cc[0] = sco_cc[0];
3476 + t.c_cc[1] = sco_cc[1];
3477 + t.c_cc[2] = sco_cc[2];
3478 + t.c_cc[3] = sco_cc[3];
3479 + t.c_cc[7] = sco_cc[7];
3480 + t.c_cc[8] = sco_cc[11];
3481 + t.c_cc[9] = sco_cc[12];
3482 + t.c_cc[10] = sco_cc[10];
3483 + t.c_cc[16] = sco_cc[6];
3484 + if (t.c_lflag & ICANON) {
3485 + t.c_cc[4] = sco_cc[4];
3486 + t.c_cc[11] = sco_cc[5];
3488 + t.c_cc[4] = sco_cc[8];
3489 + t.c_cc[5] = sco_cc[5];
3490 + t.c_cc[6] = sco_cc[4];
3491 + t.c_cc[11] = sco_cc[9];
3495 + error = sys_ioctl(fd, op, (long)&t);
3502 +linux_to_sco_termios(int fd, int op, struct sco_termios *it)
3505 + char sco_cc[SCO_NCCS];
3506 + mm_segment_t old_fs;
3509 + if (!access_ok(VERIFY_WRITE, it, sizeof(struct sco_termios)))
3512 + old_fs = get_fs();
3514 + error = sys_ioctl(fd, op, (long)&t);
3519 + put_user(t.c_iflag & 0017777, &it->c_iflag);
3521 + put_user(t.c_oflag & 0177777, &it->c_oflag);
3523 + if (t.c_cflag & CRTSCTS)
3524 + t.c_cflag |= 0100000; /* CRTSFL - SCO only? */
3525 + put_user(t.c_cflag & 0177777, &it->c_cflag);
3527 + t.c_lflag &= ~0001000;
3528 + t.c_lflag |= (t.c_lflag & 0000400) << 1;
3529 + t.c_lflag &= ~0000400;
3530 + t.c_lflag |= (t.c_lflag & 0100000) >> 7;
3531 + t.c_lflag &= ~0100000;
3532 + put_user(t.c_lflag & 0001777, &it->c_lflag);
3534 + put_user(t.c_line, &it->c_line); /* XXX Map this? */
3536 + sco_cc[0] = t.c_cc[0];
3537 + sco_cc[1] = t.c_cc[1];
3538 + sco_cc[2] = t.c_cc[2];
3539 + sco_cc[3] = t.c_cc[3];
3540 + sco_cc[6] = t.c_cc[16];
3541 + sco_cc[7] = t.c_cc[7];
3542 + sco_cc[8] = t.c_cc[4];
3543 + sco_cc[9] = t.c_cc[11];
3544 + sco_cc[10] = t.c_cc[10];
3545 + sco_cc[11] = t.c_cc[8];
3546 + sco_cc[12] = t.c_cc[9];
3547 + if (t.c_lflag & ICANON) {
3548 + sco_cc[4] = t.c_cc[4];
3549 + sco_cc[5] = t.c_cc[11];
3551 + sco_cc[4] = t.c_cc[6];
3552 + sco_cc[5] = t.c_cc[5];
3555 + if (copy_to_user(&it->c_cc, sco_cc, SCO_NCCS))
3562 +sco_term_ioctl(int fd, unsigned int func, void *arg)
3565 + case 1: /* XCGETA */
3566 + return linux_to_sco_termios(fd, TCGETS, arg);
3567 + case 2: /* XCSETA */
3568 + return sco_to_linux_termios(fd, TCSETS, arg);
3569 + case 3: /* XCSETAW */
3570 + return sco_to_linux_termios(fd, TCSETSW, arg);
3571 + case 4: /* XCSETAF */
3572 + return sco_to_linux_termios(fd, TCSETSF, arg);
3574 + printk(KERN_ERR "iBCS: SCO termios ioctl %d unsupported\n", func);
3577 diff -Nur kernel-source-2.6.16.orig/abi/sco/vtkbd.c kernel-source-2.6.16/abi/sco/vtkbd.c
3578 --- kernel-source-2.6.16.orig/abi/sco/vtkbd.c 1970-01-01 10:00:00.000000000 +1000
3579 +++ kernel-source-2.6.16/abi/sco/vtkbd.c 2006-04-27 18:50:24.000000000 +1000
3582 + * This provides internal emulation support for the SCO <sys/vtkd.h> on
3583 + * the multiscreen console. More or less, this involves translating the
3584 + * input ioctl()'s into a similar Linux ioctl()'s.
3586 + * Not emulated SCO multiscreen functions:
3589 + * Not emulated SCO keyboard functions:
3590 + * KIOCDOSMODE set DOSMODE
3591 + * KIOCNONDOSMODE unset DOSMODE
3592 + * KDDISPINFO get display start and size
3593 + * KDGKBSTATE get state of keyboard shift keys
3595 + * Written by Scott Michel, scottm@intime.com
3596 + * (c) 1994 Scott Michel as part of the Linux iBCS-2 emulator project.
3601 +#include <linux/errno.h>
3602 +#include <linux/kernel.h>
3603 +#include <linux/vt.h>
3604 +#include <linux/kd.h>
3605 +#include <linux/syscalls.h>
3606 +#include <asm/uaccess.h>
3610 + int in; /* only lower 8 bits */
3611 + int out; /* Linux version */
3614 + { 1, KDDISPTYPE },
3617 + { 3, KDUNMAPDISP },
3622 + { 10, KDSETMODE },
3626 + { 61, KDDISABIO },
3630 + { 63, KIOCSOUND },
3631 + { 64, KDGKBTYPE },
3638 +sco_vtkbd_ioctl(int fd, u_int cmd, caddr_t data)
3640 + u_int gen = (cmd >> 8) & 0xff;
3641 + u_int spec = cmd & 0xff;
3647 + * Could make this translation process table based, but, why
3648 + * waste the valuable kernel space ?
3651 + newf = (spec == 1 ? VT_OPENQRY :
3652 + (spec == 2 ? VT_SETMODE :
3653 + (spec == 3 ? VT_GETMODE :
3654 + (spec == 4 ? VT_RELDISP :
3655 + (spec == 5 ? VT_ACTIVATE : -1)))));
3657 + return sys_ioctl(fd, newf, (long)data);
3660 + for (i = 0; i < ARRAY_SIZE(trantab); i++) {
3661 + if (spec == trantab[i].in)
3662 + return sys_ioctl(fd, trantab[i].out, (long)data);
3666 + printk(KERN_ERR "%s: vtkd ioctl 0x%02x unsupported\n", __FILE__, cmd);
3669 diff -Nur kernel-source-2.6.16.orig/abi/solaris/lfs.c kernel-source-2.6.16/abi/solaris/lfs.c
3670 --- kernel-source-2.6.16.orig/abi/solaris/lfs.c 1970-01-01 10:00:00.000000000 +1000
3671 +++ kernel-source-2.6.16/abi/solaris/lfs.c 2006-04-27 18:50:24.000000000 +1000
3674 + * Solaris Large File Summit support
3679 +#include <linux/errno.h>
3680 +#include <linux/stat.h>
3681 +#include <linux/fs.h>
3682 +#include <linux/sched.h>
3683 +#include <linux/kernel.h>
3684 +#include <linux/mm.h>
3685 +#include <linux/file.h>
3686 +#include <linux/slab.h>
3687 +#include <linux/mman.h>
3688 +#include <linux/net.h>
3689 +#include <linux/socket.h>
3690 +#include <linux/un.h>
3691 +#include <linux/dirent.h>
3692 +#include <linux/syscalls.h>
3693 +#include <asm/uaccess.h>
3695 +#include <abi/util/map.h>
3696 +#include <abi/svr4/sysent.h>
3700 +sol_open64(const char *fname, int flag, int mode)
3704 + struct file *file;
3705 + mm_segment_t old_fs;
3707 + struct sockaddr_un addr;
3709 + fd = sys_open(fname, map_flags(flag, fl_svr4_to_linux) | O_LARGEFILE, mode);
3713 + /* Sometimes a program may open a pathname which it expects
3714 + * to be a named pipe (or STREAMS named pipe) when the
3715 + * Linux domain equivalent is a Unix domain socket. (e.g.
3716 + * UnixWare uses a STREAMS named pipe /dev/X/Nserver.0 for
3717 + * X :0 but Linux uses a Unix domain socket /tmp/.X11-unix/X0)
3718 + * It isn't enough just to make the symlink because you cannot
3719 + * open() a socket and read/write it. If we spot the error we can
3720 + * switch to socket(), connect() and things will likely work
3721 + * as expected however.
3725 + return fd; /* Huh?!? */
3726 + if (!S_ISSOCK(file->f_dentry->d_inode->i_mode)) {
3733 + args[0] = AF_UNIX;
3734 + args[1] = SOCK_STREAM;
3736 + old_fs = get_fs();
3738 + fd = sys_socketcall(SYS_SOCKET, args);
3743 + p = getname(fname);
3746 + return PTR_ERR(p);
3748 + if (strlen(p) >= UNIX_PATH_MAX) {
3753 + addr.sun_family = AF_UNIX;
3754 + strcpy(addr.sun_path, p);
3758 + args[1] = (int)&addr;
3759 + args[2] = sizeof(struct sockaddr_un);
3761 + error = sys_socketcall(SYS_CONNECT, args);
3772 +struct sol_dirent64 {
3773 + unsigned long long d_ino;
3774 + unsigned long long d_off;
3775 + unsigned short d_reclen;
3780 +/* If/when the readdir function is changed to read multiple entries
3781 + * at once this should be updated to take advantage of the fact.
3783 + * N.B. For Linux the reclen in a dirent is the number of characters
3784 + * in the filename, for SCO (at least) reclen is the total size of
3785 + * the particular dirent rounded up to the next multiple of 4. The SCO
3786 + * behaviour is faithfully emulated here.
3789 + * We don't truncate long filenames at all when copying. If we meet a
3790 + * long filename and the buffer supplied by the application simply isn't
3791 + * big enough to hold it we'll return without filling the buffer (i.e
3792 + * return 0). The application will see this as a (premature) end of
3793 + * directory. Is there a work around for this at all???
3796 +sol_getdents64(int fd, char *buf, int nbytes)
3798 + int error, here, posn, reclen;
3799 + struct file *file;
3800 + struct old_linux_dirent *d;
3801 + mm_segment_t old_fs;
3803 + if (!access_ok(VERIFY_WRITE, buf, nbytes))
3806 + /* Check the file handle here. This is so we can access the current
3807 + * position in the file structure safely without a tedious call
3808 + * to sys_lseek that does nothing useful.
3814 + d = (struct old_linux_dirent *)__get_free_page(GFP_KERNEL);
3820 + error = posn = reclen = 0;
3821 + while (posn + reclen < nbytes) {
3823 + struct sol_dirent64 tmpbuf;
3824 + /* Save the current position and get another dirent */
3825 + here = file->f_pos;
3826 + old_fs = get_fs();
3827 + set_fs (get_ds());
3828 + error = old_readdir(fd, d, 1);
3833 + /* If it'll fit in the buffer save it.
3834 + * Otherwise back up so it is read next time around.
3835 + * Oh, if we're at the beginning of the buffer there's
3836 + * no chance that this entry will ever fit so don't
3837 + * copy it and don't back off - we'll just pretend it
3840 + string_size = d->d_namlen + 1; /* chars in d_name + trailing zero */
3841 + reclen = (sizeof(long long) /* d_ino */
3842 + + sizeof(long long) /* d_offset */
3843 + + sizeof(unsigned short) /* d_namlen */
3845 + + 3) & (~3); /* align to a 4 byte boundary */
3846 + if (posn + reclen <= nbytes) {
3847 + tmpbuf.d_off = file->f_pos;
3848 + tmpbuf.d_ino = d->d_ino;
3849 + tmpbuf.d_off = file->f_pos;
3850 + tmpbuf.d_reclen = reclen;
3851 + if (copy_to_user(buf+posn, &tmpbuf,
3852 + sizeof(struct sol_dirent64) -1))
3857 + if (copy_to_user(buf+posn+sizeof(struct sol_dirent64)-2,
3858 + &d->d_name, string_size))
3864 + } else if (posn) {
3865 + sys_lseek(fd, here, 0);
3866 + } /* else posn == 0 */
3869 + /* Loose the intermediate buffer. */
3870 + free_page((unsigned long)d);
3874 + /* If we've put something in the buffer return the byte count
3875 + * otherwise return the error status.
3877 + return ((posn > 0) ? posn : error);
3882 +sol_mmap64(u_int addr, u_int len, int prot, int flags,
3883 + int fd, u_int off_hi, u_int off)
3885 + loff_t off64 = (off | ((loff_t)off_hi << 32));
3886 + u_long pgoff = (off64 >> PAGE_SHIFT);
3887 + struct file *file = NULL;
3890 + if ((off64 + PAGE_ALIGN(len)) < off64)
3893 + if (!(off64 & ~PAGE_MASK))
3896 + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
3897 + if (!(flags & MAP_ANONYMOUS)) {
3898 + if (!(file = fget(fd)))
3902 + if (!(flags & 0x80000000) && addr)
3903 + flags |= MAP_FIXED;
3905 + flags &= 0x7fffffff;
3907 + down_write(¤t->mm->mmap_sem);
3908 + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
3909 + up_write(¤t->mm->mmap_sem);
3915 diff -Nur kernel-source-2.6.16.orig/abi/solaris/Makefile kernel-source-2.6.16/abi/solaris/Makefile
3916 --- kernel-source-2.6.16.orig/abi/solaris/Makefile 1970-01-01 10:00:00.000000000 +1000
3917 +++ kernel-source-2.6.16/abi/solaris/Makefile 2006-04-27 18:50:24.000000000 +1000
3920 +abi-solaris-objs:= lfs.o solarisx86.o socket.o stat.o sysent.o
3922 +obj-$(CONFIG_ABI_SOLARIS) += abi-solaris.o
3924 +abi-solaris.o: $(abi-solaris-objs)
3925 + $(LD) -r -o $@ $(abi-solaris-objs)
3926 diff -Nur kernel-source-2.6.16.orig/abi/solaris/socket.c kernel-source-2.6.16/abi/solaris/socket.c
3927 --- kernel-source-2.6.16.orig/abi/solaris/socket.c 1970-01-01 10:00:00.000000000 +1000
3928 +++ kernel-source-2.6.16/abi/solaris/socket.c 2006-04-27 18:50:24.000000000 +1000
3931 + * socket.c: Socket syscall emulation for Solaris 2.6+
3933 + * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
3935 + * 1999-08-19 Fixed socketpair code
3936 + * Jason Rappleye (rappleye@ccr.buffalo.edu)
3941 +#include <linux/types.h>
3942 +#include <linux/sched.h>
3943 +#include <linux/smp_lock.h>
3944 +#include <linux/mm.h>
3945 +#include <linux/slab.h>
3946 +#include <linux/net.h>
3947 +#include <linux/socket.h>
3948 +#include <linux/file.h>
3949 +#include <linux/syscalls.h>
3951 +#include <asm/uaccess.h>
3952 +#include <asm/string.h>
3954 +#define SOCK_SOL_STREAM 2
3955 +#define SOCK_SOL_DGRAM 1
3956 +#define SOCK_SOL_RAW 4
3957 +#define SOCK_SOL_RDM 5
3958 +#define SOCK_SOL_SEQPACKET 6
3960 +#define SOL_SO_SNDLOWAT 0x1003
3961 +#define SOL_SO_RCVLOWAT 0x1004
3962 +#define SOL_SO_SNDTIMEO 0x1005
3963 +#define SOL_SO_RCVTIMEO 0x1006
3964 +#define SOL_SO_STATE 0x2000
3966 +#define SOL_SS_NDELAY 0x040
3967 +#define SOL_SS_NONBLOCK 0x080
3968 +#define SOL_SS_ASYNC 0x100
3970 +#define SO_STATE 0x000e
3974 + * 64 bit vs 32bit issues.
3976 +#if BITS_PER_LONG == 32
3977 +# define sys32_getsockopt sys_getsockopt
3978 +# define A(ptr) ((void *)(ptr))
3979 +# define __kernel_size_t32 __kernel_size_t
3983 +int sunos_setsockopt(int fd, int level, int optname, u32 optval,
3986 + int tr_opt = optname;
3989 + if (level == SOL_IP) {
3990 + /* Multicast socketopts (ttl, membership) */
3991 + if (tr_opt >=2 && tr_opt <= 6)
3994 + ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen);
3998 +int sunos_getsockopt(int fd, int level, int optname,
3999 + u32 optval, u32 optlen)
4001 + int tr_opt = optname;
4004 + if (level == SOL_IP) {
4005 + /* Multicast socketopts (ttl, membership) */
4006 + if (tr_opt >=2 && tr_opt <= 6)
4009 + ret = sys32_getsockopt(fd, level, tr_opt, (char *)optval, (int *)optlen);
4013 +static int socket_check(int family, int type)
4015 + if (family != PF_UNIX && family != PF_INET)
4016 + return -ESOCKTNOSUPPORT;
4018 + case SOCK_SOL_STREAM:
4019 + type = SOCK_STREAM;
4021 + case SOCK_SOL_DGRAM:
4022 + type = SOCK_DGRAM;
4024 + case SOCK_SOL_RAW:
4027 + case SOCK_SOL_RDM:
4030 + case SOCK_SOL_SEQPACKET:
4031 + type = SOCK_SEQPACKET;
4039 +static int solaris_to_linux_sockopt(int optname)
4041 + switch (optname) {
4042 + case SOL_SO_SNDLOWAT:
4043 + optname = SO_SNDLOWAT;
4045 + case SOL_SO_RCVLOWAT:
4046 + optname = SO_RCVLOWAT;
4048 + case SOL_SO_SNDTIMEO:
4049 + optname = SO_SNDTIMEO;
4051 + case SOL_SO_RCVTIMEO:
4052 + optname = SO_RCVTIMEO;
4054 + case SOL_SO_STATE:
4055 + optname = SO_STATE;
4062 +int solaris_socket(int family, int type, int protocol)
4064 + type = socket_check (family, type);
4067 + return sys_socket(family, type, protocol);
4070 +int solaris_socketpair(int *usockvec)
4072 + /* solaris socketpair really only takes one arg at the syscall
4073 + * level, int * usockvec. The libs apparently take care of
4074 + * making sure that family==AF_UNIX and type==SOCK_STREAM. The
4075 + * pointer we really want ends up residing in the first (and
4076 + * supposedly only) argument.
4079 + return sys_socketpair(AF_UNIX, SOCK_STREAM, 0, (int *)usockvec);
4082 +int solaris_bind(int fd, struct sockaddr *addr, int addrlen)
4084 + return sys_bind(fd, addr, addrlen);
4087 +int solaris_setsockopt(int fd, int level, int optname, u32 optval, int optlen)
4089 + optname = solaris_to_linux_sockopt(optname);
4092 + if (optname == SO_STATE)
4095 + return sunos_setsockopt(fd, level, optname, optval, optlen);
4098 +int solaris_getsockopt(int fd, int level, int optname, u32 optval, u32 optlen)
4100 + optname = solaris_to_linux_sockopt(optname);
4104 + if (optname == SO_STATE)
4105 + optname = SOL_SO_STATE;
4107 + return sunos_getsockopt(fd, level, optname, optval, optlen);
4110 +int solaris_connect(int fd, struct sockaddr *addr, int addrlen)
4112 + return sys_connect(fd, addr, addrlen);
4115 +int solaris_accept(int fd, struct sockaddr *addr, int *addrlen)
4117 + return sys_accept(fd, addr, addrlen);
4120 +int solaris_listen(int fd, int backlog)
4122 + return sys_listen(fd, backlog);
4125 +int solaris_shutdown(int fd, int how)
4127 + return sys_shutdown(fd, how);
4130 +#define MSG_SOL_OOB 0x1
4131 +#define MSG_SOL_PEEK 0x2
4132 +#define MSG_SOL_DONTROUTE 0x4
4133 +#define MSG_SOL_EOR 0x8
4134 +#define MSG_SOL_CTRUNC 0x10
4135 +#define MSG_SOL_TRUNC 0x20
4136 +#define MSG_SOL_WAITALL 0x40
4137 +#define MSG_SOL_DONTWAIT 0x80
4139 +static int solaris_to_linux_msgflags(int flags)
4141 + int fl = flags & (MSG_OOB|MSG_PEEK|MSG_DONTROUTE);
4143 + if (flags & MSG_SOL_EOR) fl |= MSG_EOR;
4144 + if (flags & MSG_SOL_CTRUNC) fl |= MSG_CTRUNC;
4145 + if (flags & MSG_SOL_TRUNC) fl |= MSG_TRUNC;
4146 + if (flags & MSG_SOL_WAITALL) fl |= MSG_WAITALL;
4147 + if (flags & MSG_SOL_DONTWAIT) fl |= MSG_DONTWAIT;
4151 +static int linux_to_solaris_msgflags(int flags)
4153 + int fl = flags & (MSG_OOB|MSG_PEEK|MSG_DONTROUTE);
4155 + if (flags & MSG_EOR) fl |= MSG_SOL_EOR;
4156 + if (flags & MSG_CTRUNC) fl |= MSG_SOL_CTRUNC;
4157 + if (flags & MSG_TRUNC) fl |= MSG_SOL_TRUNC;
4158 + if (flags & MSG_WAITALL) fl |= MSG_SOL_WAITALL;
4159 + if (flags & MSG_DONTWAIT) fl |= MSG_SOL_DONTWAIT;
4163 +int solaris_recvfrom(int s, char *buf, int len, int flags, u32 from, u32 fromlen)
4165 + return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), (struct sockaddr *)A(from), (int *)A(fromlen));
4168 +int solaris_recv(int s, char *buf, int len, int flags)
4170 + return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), NULL, NULL);
4173 +int solaris_sendto(int s, char *buf, int len, int flags, u32 to, u32 tolen)
4175 + return sys_sendto(s, buf, len, solaris_to_linux_msgflags(flags), (struct sockaddr *)A(to), (int)A(tolen));
4178 +int solaris_send(int s, char *buf, int len, int flags)
4180 + return sys_sendto(s, buf, len, solaris_to_linux_msgflags(flags), NULL, 0);
4183 +int solaris_getpeername(int fd, struct sockaddr *addr, int *addrlen)
4185 + return sys_getpeername(fd, addr, addrlen);
4188 +int solaris_getsockname(int fd, struct sockaddr *addr, int *addrlen)
4190 + return sys_getsockname(fd, addr, addrlen);
4193 +/* XXX This really belongs in some header file... -DaveM */
4194 +#define MAX_SOCK_ADDR 128 /* 108 for Unix domain -
4195 + 16 for IP, 16 for IPX,
4197 + about 80 for AX.25 */
4199 +struct sol_nmsghdr {
4205 + u32 msg_controllen;
4209 +struct sol_cmsghdr {
4213 + unsigned char cmsg_data[0];
4221 +static inline int iov_from_user32_to_kern(struct iovec *kiov,
4222 + struct iovec32 *uiov32,
4230 + if(get_user(len, &uiov32->iov_len) ||
4231 + get_user(buf, &uiov32->iov_base)) {
4232 + tot_len = -EFAULT;
4236 + kiov->iov_base = (void *)A(buf);
4237 + kiov->iov_len = (__kernel_size_t) len;
4245 +static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
4246 + struct sol_nmsghdr *umsg)
4248 + u32 tmp1, tmp2, tmp3;
4251 + err = get_user(tmp1, &umsg->msg_name);
4252 + err |= __get_user(tmp2, &umsg->msg_iov);
4253 + err |= __get_user(tmp3, &umsg->msg_control);
4257 + kmsg->msg_name = (void *)A(tmp1);
4258 + kmsg->msg_iov = (struct iovec *)A(tmp2);
4259 + kmsg->msg_control = (void *)A(tmp3);
4261 + err = get_user(kmsg->msg_namelen, &umsg->msg_namelen);
4262 + err |= get_user(kmsg->msg_controllen, &umsg->msg_controllen);
4263 + err |= get_user(kmsg->msg_flags, &umsg->msg_flags);
4265 + kmsg->msg_flags = solaris_to_linux_msgflags(kmsg->msg_flags);
4270 +/* I've named the args so it is easy to tell whose space the pointers are in. */
4271 +static int verify_iovec32(struct msghdr *kern_msg, struct iovec *kern_iov,
4272 + char *kern_address, int mode)
4276 + if(kern_msg->msg_namelen) {
4277 + if(mode==VERIFY_READ) {
4278 + int err = move_addr_to_kernel(kern_msg->msg_name,
4279 + kern_msg->msg_namelen,
4284 + kern_msg->msg_name = kern_address;
4286 + kern_msg->msg_name = NULL;
4288 + if(kern_msg->msg_iovlen > UIO_FASTIOV) {
4289 + kern_iov = kmalloc(kern_msg->msg_iovlen * sizeof(struct iovec),
4295 + tot_len = iov_from_user32_to_kern(kern_iov,
4296 + (struct iovec32 *)kern_msg->msg_iov,
4297 + kern_msg->msg_iovlen);
4299 + kern_msg->msg_iov = kern_iov;
4300 + else if(kern_msg->msg_iovlen > UIO_FASTIOV)
4306 +int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned user_flags)
4308 + struct socket *sock;
4309 + char address[MAX_SOCK_ADDR];
4310 + struct iovec iov[UIO_FASTIOV];
4311 + unsigned char ctl[sizeof(struct cmsghdr) + 20];
4312 + unsigned char *ctl_buf = ctl;
4313 + struct msghdr kern_msg;
4314 + int err, total_len;
4316 + if(msghdr_from_user32_to_kern(&kern_msg, user_msg))
4318 + if(kern_msg.msg_iovlen > UIO_MAXIOV)
4320 + err = verify_iovec32(&kern_msg, iov, address, VERIFY_READ);
4325 + if(kern_msg.msg_controllen) {
4326 + struct sol_cmsghdr *ucmsg = (struct sol_cmsghdr *)kern_msg.msg_control;
4327 + unsigned long *kcmsg;
4328 + __kernel_size_t32 cmlen;
4330 + if(kern_msg.msg_controllen > sizeof(ctl) &&
4331 + kern_msg.msg_controllen <= 256) {
4333 + ctl_buf = kmalloc(kern_msg.msg_controllen, GFP_KERNEL);
4337 + __get_user(cmlen, &ucmsg->cmsg_len);
4338 + kcmsg = (unsigned long *) ctl_buf;
4339 + *kcmsg++ = (unsigned long)cmlen;
4341 + if(copy_from_user(kcmsg, &ucmsg->cmsg_level,
4342 + kern_msg.msg_controllen - sizeof(__kernel_size_t32)))
4344 + kern_msg.msg_control = ctl_buf;
4346 + kern_msg.msg_flags = solaris_to_linux_msgflags(user_flags);
4349 + sock = sockfd_lookup(fd, &err);
4350 + if (sock != NULL) {
4351 + if (sock->file->f_flags & O_NONBLOCK)
4352 + kern_msg.msg_flags |= MSG_DONTWAIT;
4353 + err = sock_sendmsg(sock, &kern_msg, total_len);
4359 + /* N.B. Use kfree here, as kern_msg.msg_controllen might change? */
4360 + if(ctl_buf != ctl)
4363 + if(kern_msg.msg_iov != iov)
4364 + kfree(kern_msg.msg_iov);
4369 +int solaris_recvmsg(int fd, struct sol_nmsghdr *user_msg, unsigned user_flags)
4371 + struct iovec iovstack[UIO_FASTIOV];
4372 + struct msghdr kern_msg;
4373 + char addr[MAX_SOCK_ADDR];
4374 + struct socket *sock;
4375 + struct iovec *iov = iovstack;
4376 + struct sockaddr *uaddr;
4378 + unsigned long cmsg_ptr;
4379 + int err, total_len, len = 0;
4381 + if(msghdr_from_user32_to_kern(&kern_msg, user_msg))
4383 + if(kern_msg.msg_iovlen > UIO_MAXIOV)
4386 + uaddr = kern_msg.msg_name;
4387 + uaddr_len = &user_msg->msg_namelen;
4388 + err = verify_iovec32(&kern_msg, iov, addr, VERIFY_WRITE);
4393 + cmsg_ptr = (unsigned long) kern_msg.msg_control;
4394 + kern_msg.msg_flags = 0;
4397 + sock = sockfd_lookup(fd, &err);
4398 + if (sock != NULL) {
4399 + if (sock->file->f_flags & O_NONBLOCK)
4400 + user_flags |= MSG_DONTWAIT;
4401 + err = sock_recvmsg(sock, &kern_msg, total_len, user_flags);
4408 + if(uaddr != NULL && err >= 0)
4409 + err = move_addr_to_user(addr, kern_msg.msg_namelen, uaddr, uaddr_len);
4411 + err = __put_user(linux_to_solaris_msgflags(kern_msg.msg_flags), &user_msg->msg_flags);
4413 + /* XXX Convert cmsg back into userspace 32-bit format... */
4414 + err = __put_user((unsigned long)kern_msg.msg_control - cmsg_ptr,
4415 + &user_msg->msg_controllen);
4419 + if(kern_msg.msg_iov != iov)
4420 + kfree(kern_msg.msg_iov);
4426 diff -Nur kernel-source-2.6.16.orig/abi/solaris/solarisx86.c kernel-source-2.6.16/abi/solaris/solarisx86.c
4427 --- kernel-source-2.6.16.orig/abi/solaris/solarisx86.c 1970-01-01 10:00:00.000000000 +1000
4428 +++ kernel-source-2.6.16/abi/solaris/solarisx86.c 2006-04-27 18:50:24.000000000 +1000
4431 +#include <linux/types.h>
4432 +#include <linux/kernel.h>
4433 +#include <linux/sched.h>
4434 +#include <linux/socket.h>
4435 +#include <linux/file.h>
4436 +#include <linux/mm.h>
4437 +#include <linux/syscalls.h>
4438 +#include <asm/uaccess.h>
4440 +#include <abi/svr4/sigset.h>
4443 +int sol_llseek(struct pt_regs * regs)
4446 + unsigned long offset_high, offset_low;
4449 + unsigned int rvalue;
4450 + mm_segment_t old_fs;
4451 + struct inode *inode;
4452 + struct file *file;
4453 + get_user(fd, ((unsigned int *)regs->esp)+1);
4454 + get_user(offset_low, ((unsigned long *)regs->esp)+2);
4455 + get_user(offset_high, ((unsigned long *)regs->esp)+3);
4456 + get_user(origin, ((unsigned int *)regs->esp)+4);
4458 + old_fs = get_fs();
4460 + rvalue = sys_llseek(fd,offset_high,offset_low,&res,origin);
4463 + if ( rvalue < -ENOIOCTLCMD) {
4464 + regs->edx = (res >> 32);
4465 + rvalue = (res & 0xffffffff);
4467 + else if (rvalue == -ESPIPE) {
4468 + /* Solaris allows you to seek on a pipe */
4471 + inode = file->f_dentry->d_inode;
4472 + if (inode && (S_ISCHR(inode->i_mode)
4473 + || S_ISBLK(inode->i_mode))) {
4484 +int sol_memcntl(unsigned addr, unsigned len, int cmd, unsigned arg,
4485 + int attr, int mask)
4487 + // printk("ibcs_memcntl being ignored\n");
4498 +int sol_acl(char *pathp, int cmd, int nentries, void *aclbufp)
4514 diff -Nur kernel-source-2.6.16.orig/abi/solaris/stat.c kernel-source-2.6.16/abi/solaris/stat.c
4515 --- kernel-source-2.6.16.orig/abi/solaris/stat.c 1970-01-01 10:00:00.000000000 +1000
4516 +++ kernel-source-2.6.16/abi/solaris/stat.c 2006-04-27 18:50:24.000000000 +1000
4519 + * Copyright (c) 2001 Christoph Hellwig.
4520 + * All rights reserved.
4522 + * This program is free software; you can redistribute it and/or modify
4523 + * it under the terms of the GNU General Public License as published by
4524 + * the Free Software Foundation; either version 2 of the License, or
4525 + * (at your option) any later version.
4527 + * This program is distributed in the hope that it will be useful,
4528 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4529 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4530 + * GNU General Public License for more details.
4532 + * You should have received a copy of the GNU General Public License
4533 + * aint32_t with this program; if not, write to the Free Software
4534 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4540 + * Solaris 2 stat64 & friends support.
4542 +#include <linux/kernel.h>
4543 +#include <linux/fs.h>
4544 +#include <linux/sched.h>
4545 +#include <linux/file.h>
4546 +#include <linux/string.h>
4547 +#include <asm/uaccess.h>
4549 +#include <abi/solaris/types.h>
4550 +#include <abi/solaris/stat.h>
4552 +#include <abi/util/trace.h>
4553 +#include <abi/util/stat.h>
4557 +report_sol_stat64(struct kstat *stp, struct sol_stat64 *bufp)
4559 + struct sol_stat64 buf;
4561 + memset(&buf, 0, sizeof(struct sol_stat64));
4564 + buf.st_dev = linux_to_sol_dev_t(stp->dev);
4565 + buf.st_ino = linux_to_sol_ino_t(stp->ino);
4566 + buf.st_mode = stp->mode;
4567 + buf.st_nlink = stp->nlink;
4568 + buf.st_uid = linux_to_sol_uid_t(stp->uid);
4569 + buf.st_gid = linux_to_sol_gid_t(stp->gid);
4570 + buf.st_rdev = linux_to_sol_dev_t(stp->rdev);
4571 + buf.st_size = stp->size;
4573 + buf.st_atime = stp->atime.tv_sec;
4574 + buf.st_mtime = stp->mtime.tv_sec;
4575 + buf.st_ctime = stp->ctime.tv_sec;
4577 + buf.st_blksize = stp->blksize;
4578 + buf.st_blocks = stp->blocks;
4580 + strcpy(buf.st_fstype, "ext2");
4582 + if (copy_to_user(bufp, &buf, sizeof(struct sol_stat64)))
4588 +sol_stat64(char *filename, struct sol_stat64 *bufp)
4593 + error = vfs_stat(filename, &st);
4595 + error = report_sol_stat64(&st, bufp);
4600 +sol_lstat64(char *filename, struct sol_stat64 *bufp)
4605 + error = vfs_lstat(filename, &st);
4607 + error = report_sol_stat64(&st, bufp);
4612 +sol_fstat64(int fd, struct sol_stat64 *bufp)
4617 + error = vfs_fstat(fd, &st);
4619 + error = report_sol_stat64(&st, bufp);
4622 diff -Nur kernel-source-2.6.16.orig/abi/solaris/sysent.c kernel-source-2.6.16/abi/solaris/sysent.c
4623 --- kernel-source-2.6.16.orig/abi/solaris/sysent.c 1970-01-01 10:00:00.000000000 +1000
4624 +++ kernel-source-2.6.16/abi/solaris/sysent.c 2006-04-27 18:50:24.000000000 +1000
4627 + * Copyright (c) 2001 Christoph Hellwig.
4628 + * All rights reserved.
4630 + * This program is free software; you can redistribute it and/or modify
4631 + * it under the terms of the GNU General Public License as published by
4632 + * the Free Software Foundation; either version 2 of the License, or
4633 + * (at your option) any later version.
4635 + * This program is distributed in the hope that it will be useful,
4636 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4637 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4638 + * GNU General Public License for more details.
4640 + * You should have received a copy of the GNU General Public License
4641 + * along with this program; if not, write to the Free Software
4642 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4648 + * Solaris sysent and error tables.
4650 +#include <linux/config.h>
4651 +#include <linux/kernel.h>
4652 +#include <linux/module.h>
4653 +#include <linux/init.h>
4654 +#include <linux/personality.h>
4655 +#include <linux/syscalls.h>
4656 +#include <linux/socket.h>
4657 +#include <linux/net.h>
4658 +#include <asm/uaccess.h>
4660 +#include <abi/signal.h>
4662 +#include <abi/svr4/sysent.h>
4663 +#include <abi/solaris/sysent.h>
4664 +#include <abi/util/socket.h>
4666 +#include <abi/util/errno.h>
4667 +#include <abi/util/sysent.h>
4669 +/* kernel module specifications */
4670 +#ifndef EXPORT_NO_SYMBOLS
4671 +#define EXPORT_NO_SYMBOLS
4674 +MODULE_DESCRIPTION("Solaris personality");
4675 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
4676 +MODULE_LICENSE("GPL");
4681 +/* XXX kill this one */
4682 +#define ITR(trace, name, args) ,name,args
4686 + * We could remove some of the long identity mapped runs but at the
4687 + * expense of extra comparisons for each mapping at run time...
4689 +static u_char solaris_err_table[] = {
4690 +/* 0 - 9 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
4691 +/* 10 - 19 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
4692 +/* 20 - 29 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
4693 +/* 30 - 39 */ 30, 31, 32, 33, 34, 45, 78, 46, 89, 93,
4694 +/* 40 - 49 */ 90, 90, 35, 36, 37, 38, 39, 40, 41, 42,
4695 +/* 50 - 59 */ 43, 44, 50, 51, 52, 53, 54, 55, 56, 57,
4696 +/* 60 - 69 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
4697 +/* 70 - 79 */ 70, 71, 74, 76, 77, 79, 80, 81, 82, 83,
4698 +/* 80 - 89 */ 84, 85, 86, 87, 88, 91, 92, 94, 95, 96,
4699 +/* 90 - 99 */ 97, 98, 99, 120, 121, 122, 123, 124, 125, 126,
4700 +/* 100 - 109 */ 127, 128, 129, 130, 131, 132, 133, 134, 143, 144,
4701 +/* 110 - 119 */ 145, 146, 147, 148, 149, 150, 22, 135, 137, 138,
4702 +/* 120 - 122 */ 139, 140, 28
4706 + * Map Linux RESTART* values (512,513,514) to EINTR
4708 +static u_char lnx_err_table[] = {
4709 +/* 512 - 514 */ EINTR, EINTR, EINTR
4712 +struct map_segment solaris_err_map[] = {
4713 + { 0, 0+sizeof(solaris_err_table)-1, solaris_err_table },
4714 + { 512, 512+sizeof(lnx_err_table)-1, lnx_err_table },
4718 +static long linux_to_solaris_signals[NSIGNALS+1] = {
4719 +/* 0 - 3 */ 0, IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT,
4720 +/* 4 - 7 */ IBCS_SIGILL, IBCS_SIGTRAP, IBCS_SIGABRT, -1,
4721 +/* 8 - 11 */ IBCS_SIGFPE, IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV,
4722 +/* 12 - 15 */ IBCS_SIGUSR2, IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM,
4723 +/* 16 - 19 */ IBCS_SIGSEGV, IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP,
4724 +/* 20 - 23 */ IBCS_SIGTSTP, IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGURG,
4725 +/* 24 - 27 */ IBCS_SIGGXCPU, IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF,
4726 +/* 28 - 31 */ IBCS_SIGWINCH, IBCS_SIGIO, IBCS_SIGPWR, -1,
4730 +static long solaris_to_linux_signals[NSIGNALS+1] = {
4731 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
4732 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGUNUSED,
4733 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGUNUSED, SIGSEGV,
4734 +/* 12 - 15 */ SIGUNUSED, SIGPIPE, SIGALRM, SIGTERM,
4735 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
4736 +/* 20 - 23 */ SIGWINCH, SIGURG, SIGPOLL, SIGSTOP,
4737 +/* 24 - 27 */ SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU,
4738 +/* 28 - 31 */ SIGVTALRM, SIGPROF, SIGXCPU, SIGXFSZ,
4742 +static char solaris_socktype[] = {
4751 +static struct map_segment solaris_socktype_map[] = {
4752 + { 1, 6, solaris_socktype },
4756 +static struct map_segment solaris_sockopt_map[] = {
4757 + { 0x0001, 0x0001, (char *)SO_DEBUG },
4758 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
4759 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
4760 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
4761 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
4762 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
4763 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
4764 + { 0x0080, 0x0080, (char *)SO_LINGER },
4765 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
4766 + { 0x0200, 0x0200, (char *)SO_ORDREL },
4767 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
4768 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
4769 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
4770 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
4771 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
4772 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
4773 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
4774 + { 0x1007, 0x1007, (char *)SO_ERROR },
4775 + { 0x1008, 0x1008, (char *)SO_TYPE },
4776 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
4780 +static struct map_segment solaris_af_map[] = {
4786 +static struct sysent solaris_syscall_table[] = {
4787 + { abi_syscall, Fast ITR(0, "syscall", "") }, /* 0 */
4788 + { sys_exit, 1 ITR(0, "exit", "d") }, /* 1 */
4789 + { abi_fork, Spl ITR(0, "fork", "") }, /* 2 */
4790 + { abi_read, 3 ITR(0, "read", "dpd") }, /* 3 */
4791 + { sys_write, 3 ITR(0, "write", "dpd") }, /* 4 */
4792 + { svr4_open, 3 ITR(0, "open", "soo") }, /* 5 */
4793 + { sys_close, 1 ITR(0, "close", "d") }, /* 6 */
4794 + { abi_wait, Spl ITR(0, "wait", "xxx") }, /* 7 */
4795 + { sys_creat, 2 ITR(0, "creat", "so") }, /* 8 */
4796 + { sys_link, 2 ITR(0, "link", "ss") }, /* 9 */
4797 + { sys_unlink, 1 ITR(0, "unlink", "s") }, /* 10 */
4798 + { abi_exec, Spl ITR(0, "exec", "sxx") }, /* 11 */
4799 + { sys_chdir, 1 ITR(0, "chdir", "s") }, /* 12 */
4800 + { abi_time, 0 ITR(0, "time", "") }, /* 13 */
4801 + { svr4_mknod, 3 ITR(0, "mknod", "soo") }, /* 14 */
4802 + { sys_chmod, 2 ITR(0, "chmod", "so") }, /* 15 */
4803 + { sys_chown, 3 ITR(0, "chown", "sdd") }, /* 16 */
4804 + { abi_brk, 1 ITR(0, "brk/break", "x") }, /* 17 */
4805 + { svr4_stat, 2 ITR(0, "stat", "sp") }, /* 18 */
4806 + { sys_lseek, 3 ITR(0, "seek/lseek", "ddd") }, /* 19 */
4807 + { abi_getpid, Spl ITR(0, "getpid", "") }, /* 20 */
4808 + { 0, Ukn ITR(1, "mount", "") }, /* 21 */
4809 + { sys_umount, 1 ITR(0, "umount", "s") }, /* 22 */
4810 + { sys_setuid, 1 ITR(0, "setuid", "d") }, /* 23 */
4811 + { abi_getuid, Spl ITR(0, "getuid", "") }, /* 24 */
4812 + { sys_stime, 1 ITR(0, "stime", "d") }, /* 25 */
4813 + { 0, Ukn ITR(0, "ptrace", "") }, /* 26 */
4814 + { sys_alarm, 1 ITR(0, "alarm", "d") }, /* 27 */
4815 + { svr4_fstat, 2 ITR(0, "fstat", "dp") }, /* 28 */
4816 + { sys_pause, 0 ITR(0, "pause", "") }, /* 29 */
4817 + { sys_utime, 2 ITR(0, "utime", "xx") }, /* 30 */
4818 + { 0, Ukn ITR(0, "stty", "") }, /* 31 */
4819 + { 0, Ukn ITR(1, "gtty", "") }, /* 32 */
4820 + { sys_access, 2 ITR(0, "access", "so") }, /* 33 */
4821 + { sys_nice, 1 ITR(0, "nice", "d") }, /* 34 */
4822 + { svr4_statfs, 4 ITR(0, "statfs", "spdd") }, /* 35 */
4823 + { sys_sync, 0 ITR(0, "sync", "") }, /* 36 */
4824 + { abi_kill, 2 ITR(0, "kill", "dd") }, /* 37 */
4825 + { svr4_fstatfs, 4 ITR(0, "fstatfs", "dpdd") }, /* 38 */
4826 + { abi_procids, Spl ITR(0, "procids", "d") }, /* 39 */
4827 + { 0, Ukn ITR(0, "cxenix", "") }, /* 40 */
4828 + { sys_dup, 1 ITR(0, "dup", "d") }, /* 41 */
4829 + { abi_pipe, Spl ITR(0, "pipe", "") }, /* 42 */
4830 + { sys_times, 1 ITR(0, "times", "p") }, /* 43 */
4831 + { 0, 0 ITR(0, "prof", "") }, /* 44 */
4832 + { 0, Ukn ITR(1, "lock/plock", "") }, /* 45 */
4833 + { sys_setgid, 1 ITR(0, "setgid", "d") }, /* 46 */
4834 + { abi_getgid, Spl ITR(0, "getgid", "") }, /* 47 */
4835 + { abi_sigfunc, Fast ITR(0, "sigfunc", "xxx") }, /* 48 */
4836 + { svr4_msgsys, Spl ITR(0, "msgsys", "dxddd")}, /* 49 */
4837 + { svr4_sysi86, 3 ITR(0, "sysi86/sys3b", "d") }, /* 50 */
4838 + { sys_acct, 1 ITR(0, "acct/sysacct", "x") }, /* 51 */
4839 + { svr4_shmsys, Fast ITR(0, "shmsys", "ddxo")}, /* 52 */
4840 + { svr4_semsys, Spl ITR(0, "semsys", "dddx")}, /* 53 */
4841 + { svr4_ioctl, Spl ITR(0, "ioctl", "dxx") }, /* 54 */
4842 + { 0, 3 ITR(0, "uadmin", "xxx") }, /* 55 */
4843 + { 0, Ukn ITR(1, "?", "") }, /* 56 */
4844 + { v7_utsname, 1 ITR(0, "utsys", "x") }, /* 57 */
4845 + { sys_fsync, 1 ITR(0, "fsync", "d") }, /* 58 */
4846 + { abi_exec, Spl ITR(0, "execv", "spp") }, /* 59 */
4847 + { sys_umask, 1 ITR(0, "umask", "o") }, /* 60 */
4848 + { sys_chroot, 1 ITR(0, "chroot", "s") }, /* 61 */
4849 + { svr4_fcntl, 3 ITR(0, "fcntl", "dxx") }, /* 62 */
4850 + { svr4_ulimit, 2 ITR(0, "ulimit", "xx") }, /* 63 */
4851 + { 0, Ukn ITR(1, "?", "") }, /* 64 */
4852 + { 0, Ukn ITR(1, "?", "") }, /* 65 */
4853 + { 0, Ukn ITR(1, "?", "") }, /* 66 */
4854 + { 0, Ukn ITR(1, "?", "") }, /* 67 */
4855 + { 0, Ukn ITR(1, "?", "") }, /* 68 */
4856 + { 0, Ukn ITR(1, "?", "") }, /* 69 */
4857 + { 0, Ukn ITR(1, "advfs", "") }, /* 70 */
4858 + { 0, Ukn ITR(1, "unadvfs", "") }, /* 71 */
4859 + { 0, Ukn ITR(1, "rmount", "") }, /* 72 */
4860 + { 0, Ukn ITR(1, "rumount", "") }, /* 73 */
4861 + { 0, Ukn ITR(1, "rfstart", "") }, /* 74 */
4862 + { 0, Ukn ITR(1, "?", "") }, /* 75 */
4863 + { 0, Ukn ITR(1, "rdebug", "") }, /* 76 */
4864 + { 0, Ukn ITR(1, "rfstop", "") }, /* 77 */
4865 + { 0, Ukn ITR(1, "rfsys", "") }, /* 78 */
4866 + { sys_rmdir, 1 ITR(0, "rmdir", "s") }, /* 79 */
4867 + { abi_mkdir, 2 ITR(0, "mkdir", "so") }, /* 80 */
4868 + { svr4_getdents, 3 ITR(0, "getdents", "dxd") }, /* 81 */
4869 + { 0, Ukn ITR(1, "libattach", "") }, /* 82 */
4870 + { 0, Ukn ITR(1, "libdetach", "") }, /* 83 */
4871 + { svr4_sysfs, 3 ITR(0, "sysfs", "dxx") }, /* 84 */
4872 + { svr4_getmsg, Spl ITR(0, "getmsg", "dxxx") }, /* 85 */
4873 + { svr4_putmsg, Spl ITR(0, "putmsg", "dxxd") }, /* 86 */
4874 + { sys_poll, 3 ITR(0, "poll", "xdd") }, /* 87 */
4875 + { svr4_lstat, 2 ITR(0, "lstat", "sp") }, /* 88 */
4876 + { sys_symlink, 2 ITR(0, "symlink", "ss") }, /* 89 */
4877 + { sys_readlink, 3 ITR(0, "readlink", "spd") }, /* 90 */
4878 + { sys_setgroups, 2 ITR(0, "setgroups", "dp") }, /* 91 */
4879 + { sys_getgroups, 2 ITR(0, "getgroups", "dp") }, /* 92 */
4880 + { sys_fchmod, 2 ITR(0, "fchmod", "do") }, /* 93 */
4881 + { sys_fchown, 3 ITR(0, "fchown", "ddd") }, /* 94 */
4882 + { abi_sigprocmask, 3 ITR(0, "sigprocmask", "dxx") }, /* 95 */
4883 + { abi_sigsuspend, Spl ITR(0, "sigsuspend", "x") }, /* 96 */
4884 + { 0, 2 ITR(1, "sigaltstack", "xx") }, /* 97 */
4885 + { abi_sigaction, 3 ITR(0, "sigaction", "dxx") }, /* 98 */
4886 + { svr4_sigpending, 2 ITR(1, "sigpending", "dp") }, /* 99 */
4887 + { svr4_context, Spl ITR(0, "context", "") }, /* 100 */
4888 + { 0, Ukn ITR(1, "evsys", "") }, /* 101 */
4889 + { 0, Ukn ITR(1, "evtrapret", "") }, /* 102 */
4890 + { svr4_statvfs, 2 ITR(0, "statvfs", "sp") }, /* 103 */
4891 + { svr4_fstatvfs, 2 ITR(0, "fstatvfs", "dp") }, /* 104 */
4892 + { 0, Ukn ITR(0, "sysisc", "") }, /* 105 */
4893 + { 0, Ukn ITR(1, "nfssys", "") }, /* 106 */
4894 + { 0, 4 ITR(0, "waitid", "ddxd") }, /* 107 */
4895 + { 0, 3 ITR(1, "sigsendsys", "ddd") }, /* 108 */
4896 + { svr4_hrtsys, Spl ITR(0, "hrtsys", "xxx") }, /* 109 */
4897 + { 0, 3 ITR(1, "acancel", "dxd") }, /* 110 */
4898 + { 0, Ukn ITR(1, "async", "") }, /* 111 */
4899 + { 0, Ukn ITR(1, "priocntlsys", "") }, /* 112 */
4900 + { svr4_pathconf, 2 ITR(1, "pathconf", "sd") }, /* 113 */
4901 + { 0, 3 ITR(1, "mincore", "xdx") }, /* 114 */
4902 + { svr4_mmap, 6 ITR(0, "mmap", "xxxxdx") },/* 115 */
4903 + { sys_mprotect, 3 ITR(0, "mprotect", "xdx") },/* 116 */
4904 + { sys_munmap, 2 ITR(0, "munmap", "xd") },/* 117 */
4905 + { svr4_fpathconf, 2 ITR(1, "fpathconf", "dd") }, /* 118 */
4906 + { abi_fork, Spl ITR(0, "vfork", "") }, /* 119 */
4907 + { sys_fchdir, 1 ITR(0, "fchdir", "d") }, /* 120 */
4908 + { sys_readv, 3 ITR(0, "readv", "dxd") }, /* 121 */
4909 + { sys_writev, 3 ITR(0, "writev", "dxd") }, /* 122 */
4910 + { svr4_xstat, 3 ITR(0, "xstat", "dsx") }, /* 123 */
4911 + { svr4_lxstat, 3 ITR(0, "lxstat", "dsx") }, /* 124 */
4912 + { svr4_fxstat, 3 ITR(0, "fxstat", "ddx") }, /* 125 */
4913 + { svr4_xmknod, 4 ITR(0, "xmknod", "dsox")}, /* 126 */
4914 + { 0, Spl ITR(0, "syslocal", "d") }, /* 127 */
4915 + { svr4_getrlimit, 2 ITR(0, "setrlimit", "dx") }, /* 128 */
4916 + { svr4_setrlimit, 2 ITR(0, "getrlimit", "dx") }, /* 129 */
4917 + { 0, 3 ITR(1, "lchown", "sdd") }, /* 130 */
4918 + { 0, Ukn ITR(1, "memcntl", "") }, /* 131 */
4919 +#ifdef CONFIG_ABI_XTI
4920 + { svr4_getpmsg, 5 ITR(0, "getpmsg", "dxxxx")}, /* 132 */
4921 + { svr4_putpmsg, 5 ITR(0, "putpmsg", "dxxdd")}, /* 133 */
4923 + { 0, 5 ITR(0, "getpmsg", "dxxxx")}, /* 132 */
4924 + { 0, 5 ITR(0, "putpmsg", "dxxdd")}, /* 133 */
4926 + { sys_rename, 2 ITR(0, "rename", "ss") }, /* 134 */
4927 + { abi_utsname, 1 ITR(0, "uname", "x") }, /* 135 */
4928 + { svr4_setegid, 1 ITR(1, "setegid", "d") }, /* 136 */
4929 + { svr4_sysconfig, 1 ITR(0, "sysconfig", "d") }, /* 137 */
4930 + { 0, Ukn ITR(1, "adjtime", "") }, /* 138 */
4931 + { svr4_sysinfo, 3 ITR(0, "systeminfo", "dsd") }, /* 139 */
4932 + { socksys_syscall, 1 ITR(0, "socksys_syscall","x") }, /* 140 */
4933 + { svr4_seteuid, 1 ITR(1, "seteuid", "d") }, /* 141 */
4934 + { 0, Ukn ITR(1, "vtrace", "") }, /* 142 */
4935 + { 0, Ukn ITR(1, "fork1", "") }, /* 143 */
4936 + { 0, Ukn ITR(1, "sigtimedwait", "") }, /* 144 */
4937 + { 0, Ukn ITR(1, "lwp_info", "") }, /* 145 */
4938 + { 0, Ukn ITR(1, "yield", "") }, /* 146 */
4939 + { 0, Ukn ITR(1, "lwp_sema_wait", "") }, /* 147 */
4940 + { 0, Ukn ITR(1, "lwp_sema_post", "") }, /* 148 */
4941 + { 0, Ukn ITR(1, "lwp_sema_trywait","") }, /* 149 */
4942 + { 0, Ukn ITR(1, "?", "") }, /* 150 */
4943 + { 0, Ukn ITR(1, "?", "") }, /* 151 */
4944 + { 0, Ukn ITR(1, "modctl", "") }, /* 152 */
4945 + { 0, Ukn ITR(1, "fchroot", "") }, /* 153 */
4946 + { 0, Ukn ITR(1, "utimes", "") }, /* 154 */
4947 + { 0, Ukn ITR(1, "vhangup", "") }, /* 155 */
4948 + { sys_gettimeofday, 2 ITR(0, "gettimeofday", "xx") }, /* 156 */
4949 + { sys_getitimer, 2 ITR(0, "getitimer", "dx") }, /* 157 */
4950 + { sys_setitimer, 3 ITR(0, "setitimer", "dxx") }, /* 158 */
4951 + { 0, Ukn ITR(1, "lwp_create", "") }, /* 159 */
4952 + { 0, Ukn ITR(1, "lwp_exit", "") }, /* 160 */
4953 + { 0, Ukn ITR(1, "lwp_suspend", "") }, /* 161 */
4954 + { 0, Ukn ITR(1, "lwp_continue", "") }, /* 162 */
4955 + { 0, Ukn ITR(1, "lwp_kill", "") }, /* 163 */
4956 + { 0, Ukn ITR(1, "lwp_self", "") }, /* 164 */
4957 + { 0, Ukn ITR(1, "lwp_setprivate","") }, /* 165 */
4958 + { 0, Ukn ITR(1, "lwp_getprivate","") }, /* 166 */
4959 + { 0, Ukn ITR(1, "lwp_wait", "") }, /* 167 */
4960 + { 0, Ukn ITR(1, "lwp_mutex_unlock","") }, /* 168 */
4961 + { 0, Ukn ITR(1, "lwp_mutex_lock","") }, /* 169 */
4962 + { 0, Ukn ITR(1, "lwp_cond_wait", "") }, /* 170 */
4963 + { 0, Ukn ITR(1, "lwp_cond_signal","") }, /* 171 */
4964 + { 0, Ukn ITR(1, "lwp_cond_broadcast","") }, /* 172 */
4965 + { sys_pread64, -4 ITR(1, "pread", "dpdd") }, /* 173 */
4966 + { sys_pwrite64, -4 ITR(1, "pwrite", "dpdd") }, /* 174 */
4967 + { sol_llseek, Spl ITR(1, "llseek", "dxxd") }, /* 175 */
4968 + { 0, Ukn ITR(1, "inst_sync", "") }, /* 176 */
4969 + { 0, Ukn ITR(1, "?", "") }, /* 177 */
4970 + { 0, Ukn ITR(1, "kaio", "") }, /* 178 */
4971 + { 0, Ukn ITR(1, "?", "") }, /* 179 */
4972 + { 0, Ukn ITR(1, "?", "") }, /* 180 */
4973 + { 0, Ukn ITR(1, "?", "") }, /* 181 */
4974 + { 0, Ukn ITR(1, "?", "") }, /* 182 */
4975 + { 0, Ukn ITR(1, "?", "") }, /* 183 */
4976 + { 0, Ukn ITR(1, "tsolsys", "") }, /* 184 */
4977 + { sol_acl, 4 ITR(1, "acl", "sddp") }, /* 185 */
4978 + { 0, Ukn ITR(1, "auditsys", "") }, /* 186 */
4979 + { 0, Ukn ITR(1, "processor_bind","") }, /* 187 */
4980 + { 0, Ukn ITR(1, "processor_info","") }, /* 188 */
4981 + { 0, Ukn ITR(1, "p_online", "") }, /* 189 */
4982 + { 0, Ukn ITR(1, "sigqueue", "") }, /* 190 */
4983 + { 0, Ukn ITR(1, "clock_gettime", "") }, /* 191 */
4984 + { 0, Ukn ITR(1, "clock_settime", "") }, /* 192 */
4985 + { 0, Ukn ITR(1, "clock_getres", "") }, /* 193 */
4986 + { 0, Ukn ITR(1, "timer_create", "") }, /* 194 */
4987 + { 0, Ukn ITR(1, "timer_delete", "") }, /* 195 */
4988 + { 0, Ukn ITR(1, "timer_settime", "") }, /* 196 */
4989 + { 0, Ukn ITR(1, "timer_gettime", "") }, /* 197 */
4990 + { 0, Ukn ITR(1, "timer_getoverrun","") }, /* 198 */
4991 + { sys_nanosleep, 2 ITR(1, "nanosleep", "pp") }, /* 199 */
4992 + { 0, Ukn ITR(1, "modstat", "") }, /* 200 */
4993 + { 0, Ukn ITR(1, "facl", "") }, /* 201 */
4994 + { sys_setreuid, 2 ITR(1, "setreuid", "dd") }, /* 202 */
4995 + { sys_setregid, 2 ITR(1, "setregid", "dd") }, /* 203 */
4996 + { 0, Ukn ITR(1, "install_utrap", "") }, /* 204 */
4997 + { 0, Ukn ITR(1, "signotify", "") }, /* 205 */
4998 + { 0, Ukn ITR(1, "schedctl", "") }, /* 206 */
4999 + { 0, Ukn ITR(1, "pset", "") }, /* 207 */
5000 + { 0, Ukn ITR(1, "?", "") }, /* 208 */
5001 + { 0, Ukn ITR(1, "resolvepath", "") }, /* 209 */
5002 + { 0, Ukn ITR(1, "signotifywait", "") }, /* 210 */
5003 + { 0, Ukn ITR(1, "lwp_sigredirect","") }, /* 211 */
5004 + { 0, Ukn ITR(1, "lwp_alarm", "") }, /* 212 */
5005 + { sol_getdents64, 3 ITR(0, "getdents64", "dxd") }, /* 213 */
5006 + { sol_mmap64, 7 ITR(1, "mmap64", "pxdddxx")}, /*214 */
5007 + { sol_stat64, 2 ITR(0, "stat64", "sp") }, /* 215 */
5008 + { sol_lstat64, 2 ITR(0, "lstat64", "sp") }, /* 216 */
5009 + { sol_fstat64, 2 ITR(0, "fstat64", "dp") }, /* 217 */
5010 + { 0, Ukn ITR(1, "statvfs64", "") }, /* 218 */
5011 + { 0, Ukn ITR(1, "fstatvfs64", "") }, /* 219 */
5012 + { 0, Ukn ITR(1, "setrlimit64", "") }, /* 220 */
5013 + { 0, Ukn ITR(1, "getrlimit64", "") }, /* 221 */
5014 + { 0, Ukn ITR(1, "pread64", "") }, /* 222 */
5015 + { 0, Ukn ITR(1, "pwrite64", "") }, /* 223 */
5016 + { 0, Ukn ITR(1, "creat64", "") }, /* 224 */
5017 + { sol_open64, 3 ITR(0, "open64", "soo") }, /* 225 */
5018 + { 0, Ukn ITR(1, "rpcsys", "") }, /* 226 */
5019 + { 0, Ukn ITR(1, "?", "") }, /* 227 */
5020 + { 0, Ukn ITR(1, "?", "") }, /* 228 */
5021 + { 0, Ukn ITR(1, "?", "") }, /* 229 */
5022 + { solaris_socket, 3 ITR(1, "so_socket", "ddd") }, /* 230 */
5023 + { solaris_socketpair,1 ITR(1, "so_socketpair", "dddx") }, /* 231 */
5024 + { solaris_bind, 3 ITR(1, "bind", "dxd") }, /* 232 */
5025 + { solaris_listen, 2 ITR(1, "listen", "dd") }, /* 233 */
5026 + { solaris_accept, 3 ITR(1, "accept", "dxx") }, /* 234 */
5027 + { solaris_connect, 3 ITR(1, "connect", "dxd") }, /* 235 */
5028 + { solaris_shutdown, 2 ITR(1, "shutdown", "dd") }, /* 236 */
5029 + { solaris_recv, 4 ITR(1, "recv", "dxdd") }, /* 237 */
5030 + { solaris_recvfrom, 6 ITR(1, "recvfrom", "dxddxd")}, /* 238 */
5031 + { solaris_recvmsg, 3 ITR(1, "recvmsg", "dxd") }, /* 239 */
5032 + { solaris_send, 4 ITR(1, "send", "dxdd") }, /* 240 */
5033 + { solaris_sendmsg, 3 ITR(0, "sendmsg", "dxd") }, /* 241 */
5034 + { solaris_sendto, 6 ITR(1, "sendto", "dxddxd")}, /* 242 */
5035 + { solaris_getpeername,3 ITR(1, "getpeername", "dxx") }, /* 243 */
5036 + { solaris_getsockname,3 ITR(1, "getsockname", "dxx") }, /* 244 */
5037 + { solaris_getsockopt,5 ITR(1, "getsockopt", "dddxx")}, /* 245 */
5038 + { solaris_setsockopt,5 ITR(1, "setsockopt", "dddxd")}, /* 246 */
5039 + { 0, Ukn ITR(1, "sockconfig", "") }, /* 247 */
5040 + { 0, Ukn ITR(1, "ntp_gettime", "") }, /* 248 */
5041 + { 0, Ukn ITR(0, "ntp_adjtime", "") }, /* 249 */
5042 + { 0, Ukn ITR(1, "?", "") }, /* 250 */
5043 + { 0, Ukn ITR(1, "?", "") }, /* 251 */
5044 + { 0, Ukn ITR(1, "?", "") }, /* 252 */
5045 + { 0, Ukn ITR(1, "?", "") }, /* 253 */
5046 + { 0, Ukn ITR(1, "?", "") }, /* 254 */
5047 + { 0, Ukn ITR(1, "?", "") } /* 255 */
5050 +static void solaris_lcall7(int segment, struct pt_regs * regs)
5052 + int sysno = regs->eax & 0xff;
5054 + if (sysno >= ARRAY_SIZE(solaris_syscall_table))
5055 + set_error(regs, iABI_errors(-EINVAL));
5057 + lcall7_dispatch(regs, &solaris_syscall_table[sysno], 1);
5060 +static struct exec_domain solaris_exec_domain = {
5062 + handler: solaris_lcall7,
5063 + pers_low: 13 /* PER_SOLARIS */,
5064 + pers_high: 13 /* PER_SOLARIS */,
5065 + signal_map: solaris_to_linux_signals,
5066 + signal_invmap: linux_to_solaris_signals,
5067 + err_map: solaris_err_map,
5068 + socktype_map: solaris_socktype_map,
5069 + sockopt_map: solaris_sockopt_map,
5070 + af_map: solaris_af_map,
5071 + module: THIS_MODULE,
5075 +static void __exit solaris_cleanup(void)
5077 + unregister_exec_domain(&solaris_exec_domain);
5080 +static int __init solaris_init(void)
5082 + return register_exec_domain(&solaris_exec_domain);
5085 +module_init(solaris_init);
5086 +module_exit(solaris_cleanup);
5087 diff -Nur kernel-source-2.6.16.orig/abi/svr4/consio.c kernel-source-2.6.16/abi/svr4/consio.c
5088 --- kernel-source-2.6.16.orig/abi/svr4/consio.c 1970-01-01 10:00:00.000000000 +1000
5089 +++ kernel-source-2.6.16/abi/svr4/consio.c 2006-04-27 18:50:24.000000000 +1000
5093 +#include <linux/errno.h>
5094 +#include <linux/kernel.h>
5095 +#include <linux/types.h>
5096 +#include <linux/module.h>
5100 +svr4_console_ioctl(int fd, u_int cmd, caddr_t data)
5103 + case 0x6301: /* CONS_CURRENT: Get display adapter type */
5104 + case 0x6302: /* CONS_GET: Get display mode setting */
5106 + * Always error so the application never tries
5107 + * anything overly fancy on the console.
5110 + case 0x4304: /* _TTYDEVTYPE */
5111 + /* If on console then 1, if pseudo tty then 2 */
5115 + printk(KERN_ERR "iBCS: console ioctl %d unsupported\n", cmd);
5120 +svr4_video_ioctl(int fd, u_int cmd, caddr_t data)
5123 + case 1: /* MAP_CLASS */
5124 + /* Get video memory map & IO privilege */
5127 + /* This doesn't agree with my SCO 3.2.4 ???? */
5128 + case 4: /* C_IOC */
5129 + /* see /etc/conf/pack.d/cn/class.h on any SCO unix box :-) */
5136 + printk(KERN_ERR "iBCS: video ioctl %d unsupported\n", cmd);
5140 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
5141 +EXPORT_SYMBOL(svr4_console_ioctl);
5142 +EXPORT_SYMBOL(svr4_video_ioctl);
5144 diff -Nur kernel-source-2.6.16.orig/abi/svr4/fcntl.c kernel-source-2.6.16/abi/svr4/fcntl.c
5145 --- kernel-source-2.6.16.orig/abi/svr4/fcntl.c 1970-01-01 10:00:00.000000000 +1000
5146 +++ kernel-source-2.6.16/abi/svr4/fcntl.c 2006-04-27 18:50:24.000000000 +1000
5149 + * Copyright (c) 2002 Caldera Deutschland GmbH.
5150 + * All rights reserved.
5152 + * This program is free software; you can redistribute it and/or modify
5153 + * it under the terms of the GNU General Public License as published by
5154 + * the Free Software Foundation; either version 2 of the License, or
5155 + * (at your option) any later version.
5157 + * This program is distributed in the hope that it will be useful,
5158 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5159 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5160 + * GNU General Public License for more details.
5162 + * You should have received a copy of the GNU General Public License
5163 + * along with this program; if not, write to the Free Software
5164 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5167 +#ident "@(#)fcntl.c 1.1 02/23/02"
5169 +#include <linux/types.h>
5170 +#include <linux/errno.h>
5171 +#include <linux/fcntl.h>
5172 +#include <linux/sched.h>
5173 +#include <linux/kernel.h>
5174 +#include <linux/syscalls.h>
5175 +#include <linux/module.h>
5177 +#include <asm/uaccess.h>
5178 +#include <asm/ioctls.h>
5180 +#include <abi/svr4/types.h>
5181 +#include <abi/util/trace.h>
5182 +#include <abi/util/map.h>
5185 +struct svr4_flock {
5186 + int16_t l_type; /* numbers don't match */
5188 + svr4_off_t l_start;
5189 + svr4_off_t l_len; /* 0 means to end of file */
5196 + * ISC (at least) assumes O_CREAT if O_TRUNC is given.
5197 + * This is emulated here but is it correct for SVR4 in general?
5199 +unsigned short fl_svr4_to_linux[] = {
5200 + 0x0001, 0x0002, 0x0800, 0x0400, 0x1000, 0x0000, 0x0000, 0x0800,
5201 + 0x0040, 0x0240, 0x0080, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000
5204 +unsigned short fl_linux_to_svr4[] = {
5205 + 0x0001, 0x0002, 0x0000, 0x0000, 0x0000, 0x0000, 0x0100, 0x0400,
5206 + 0x0800, 0x0200, 0x0008, 0x0004, 0x0010, 0x0000, 0x0000, 0x0000
5209 +static inline int svr4_fcntl_flock(int fd, unsigned int cmd, unsigned long arg)
5211 + struct svr4_flock fl, *flp = (struct svr4_flock *)arg;
5212 + struct flock l_fl;
5217 + * We are not supposed to fail once the lock is set,
5218 + * thus we check the userspace pointer for writeaccess now.
5220 + if (!access_ok(VERIFY_WRITE, flp, sizeof(struct svr4_flock)))
5223 + rval = copy_from_user(&fl, flp, sizeof(struct svr4_flock));
5227 + l_fl.l_type = fl.l_type - 1;
5228 + l_fl.l_whence = fl.l_whence;
5229 + l_fl.l_start = fl.l_start;
5230 + l_fl.l_len = fl.l_len;
5231 + l_fl.l_pid = fl.l_pid;
5233 +#if defined(CONFIG_ABI_TRACE)
5234 + abi_trace(ABI_TRACE_API,
5235 + "lock l_type: %d l_whence: %d "
5236 + "l_start: %u l_len: %u "
5237 + "l_sysid: %d l_pid: %d\n",
5238 + fl.l_type, fl.l_whence,
5239 + fl.l_start, fl.l_len,
5240 + fl.l_sysid, fl.l_pid);
5245 + rval = sys_fcntl(fd, cmd, (unsigned long)&l_fl);
5251 + fl.l_type = l_fl.l_type + 1;
5252 + fl.l_whence = l_fl.l_whence;
5253 + fl.l_start = l_fl.l_start;
5254 + fl.l_len = l_fl.l_len;
5256 + fl.l_pid = l_fl.l_pid;
5258 + if (__copy_to_user(flp, &fl, sizeof(struct svr4_flock)))
5263 +int svr4_fcntl(int fd, unsigned int cmd, unsigned long arg)
5268 + case 0: /* F_DUPFD */
5269 + case 1: /* F_GETFD */
5270 + case 2: /* F_SETFD */
5271 + return sys_fcntl(fd, cmd, arg);
5272 + case 3: /* F_GETFL */
5273 + rval = sys_fcntl(fd, cmd, arg);
5274 + return map_flags(rval, fl_linux_to_svr4);
5275 + case 4: /* F_SETFL */
5276 + arg = map_flags(arg, fl_svr4_to_linux);
5277 + return sys_fcntl(fd, cmd, arg);
5278 + case 14: /* F_GETLK SVR4 */
5281 + case 5: /* F_GETLK */
5282 + case 6: /* F_SETLK */
5283 + case 7: /* F_SETLKW */
5284 + return svr4_fcntl_flock(fd, cmd, arg);
5285 + case 10: /* F_ALLOCSP */
5286 + /* Extend allocation for specified portion of file. */
5288 + case 11: /* F_FREESP */
5289 + /* Free a portion of a file. */
5293 + * These are intended to support the Xenix chsize() and
5294 + * rdchk() system calls. I don't know if these may be
5295 + * generated by applications or not.
5297 + case 0x6000: /* F_CHSIZE */
5298 + return sys_ftruncate(fd, arg);
5299 + case 0x6001: /* F_RDCHK */
5306 + rval = sys_ioctl(fd, FIONREAD, (long)&nbytes);
5311 + return (nbytes ? 1 : 0);
5314 + case 8: /* F_CHKFL */
5318 + * These are made from the Xenix locking() system call.
5319 + * According to available documentation these would
5320 + * never be generated by an application - only by the
5321 + * kernel Xenix support.
5323 + case 0x6300: /* F_LK_UNLCK */
5324 + case 0x7200: /* F_LK_LOCK */
5325 + case 0x6200: /* F_LK_NBLCK */
5326 + case 0x7100: /* F_LK_RLCK */
5327 + case 0x6100: /* F_LK_NBRLCK */
5331 +#if defined(CONFIG_ABI_TRACE)
5332 + abi_trace(ABI_TRACE_API,
5333 + "unsupported fcntl 0x%x, arg 0x%lx\n", cmd, arg);
5339 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
5340 +EXPORT_SYMBOL(fl_svr4_to_linux);
5341 +EXPORT_SYMBOL(svr4_fcntl);
5343 diff -Nur kernel-source-2.6.16.orig/abi/svr4/filio.c kernel-source-2.6.16/abi/svr4/filio.c
5344 --- kernel-source-2.6.16.orig/abi/svr4/filio.c 1970-01-01 10:00:00.000000000 +1000
5345 +++ kernel-source-2.6.16/abi/svr4/filio.c 2006-04-27 18:50:24.000000000 +1000
5348 + * Copyright (c) 2001 Christoph Hellwig.
5349 + * All rights reserved.
5351 + * This program is free software; you can redistribute it and/or modify
5352 + * it under the terms of the GNU General Public License as published by
5353 + * the Free Software Foundation; either version 2 of the License, or
5354 + * (at your option) any later version.
5356 + * This program is distributed in the hope that it will be useful,
5357 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5358 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5359 + * GNU General Public License for more details.
5361 + * You should have received a copy of the GNU General Public License
5362 + * along with this program; if not, write to the Free Software
5363 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5369 + * SVR4 file ioctls.
5372 +#include <linux/sched.h>
5373 +#include <linux/file.h>
5374 +#include <linux/sockios.h>
5375 +#include <linux/syscalls.h>
5376 +#include <linux/module.h>
5378 +#include <asm/uaccess.h>
5379 +#include <asm/ioctls.h>
5381 +#include <abi/ioctl.h>
5385 +svr4_fil_ioctl(int fd, u_int cmd, caddr_t data)
5389 + case BSD__IOV('f', 1):
5390 + case BSD__IO('f', 1):
5391 + FD_SET(fd, files_fdtable(current->files)->close_on_exec);
5395 + case BSD__IOV('f', 2):
5396 + case BSD__IO('f', 2):
5397 + FD_CLR(fd, files_fdtable(current->files)->close_on_exec);
5400 + case BSD__IOV('f', 3):
5401 + case BSD__IO('f', 3): {
5402 + int error, nbytes;
5407 + error = sys_ioctl(fd, FIONREAD, (long)&nbytes);
5410 + return (error <= 0 ? error : nbytes);
5414 + case BSD__IOW('f', 123, int):
5415 + return sys_ioctl(fd, FIOGETOWN, (long)data);
5418 + case BSD__IOW('f', 124, int):
5419 + return sys_ioctl(fd, FIOSETOWN, (long)data);
5422 + case BSD__IOW('f', 125, int):
5423 + return sys_ioctl(fd, FIOASYNC, (long)data);
5426 + case BSD__IOW('f', 126, int):
5427 + return sys_ioctl(fd, FIONBIO, (long)data);
5430 + case BSD__IOR('f', 127, int):
5431 + return sys_ioctl(fd, FIONREAD, (long)data);
5434 + printk(KERN_ERR "%s: file ioctl 0x%08x unsupported\n", __FUNCTION__, cmd);
5438 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
5439 +EXPORT_SYMBOL(svr4_fil_ioctl);
5441 diff -Nur kernel-source-2.6.16.orig/abi/svr4/hrtsys.c kernel-source-2.6.16/abi/svr4/hrtsys.c
5442 --- kernel-source-2.6.16.orig/abi/svr4/hrtsys.c 1970-01-01 10:00:00.000000000 +1000
5443 +++ kernel-source-2.6.16/abi/svr4/hrtsys.c 2006-04-27 18:50:24.000000000 +1000
5446 + * Copyright (C) 1994 Eric Youngdale.
5448 + * The hrtsys interface is used by SVR4, and is effectively a way of doing
5449 + * itimer. I do not know why this is used instead of the regular itimer
5450 + * stuff, but it appears to be related to bsd programs/functionality.
5455 +#include <linux/module.h>
5456 +#include <linux/ptrace.h>
5457 +#include <linux/errno.h>
5458 +#include <linux/mm.h>
5459 +#include <linux/string.h>
5460 +#include <linux/syscalls.h>
5461 +#include <asm/uaccess.h>
5463 +#include <asm/abi_machdep.h>
5464 +#include <abi/util/trace.h>
5467 +struct hrt_time_t {
5468 + unsigned long secs;
5469 + unsigned long sub_sec; /* Less than one second. */
5470 + unsigned long resolution; /* Resolution of timer */
5476 + struct hrt_time_t interval;
5477 + struct hrt_time_t tod;
5484 +ibcs_hrtcntl (struct pt_regs * regs)
5486 + unsigned int param[4];
5487 + struct timeval * tv;
5490 + for (i=0; i<4; i++)
5491 + param[i] = get_syscall_parameter (regs, 1+i);
5493 + if (param[0] != 1 || param[1] != 1 || param[2] != 0)
5496 + tv = (struct timeval *) param[3];
5498 +#if defined(CONFIG_ABI_TRACE)
5499 + abi_trace(ABI_TRACE_API, "hrtcntl(0x%lx)\n", (u_long)tv);
5502 + if (!access_ok(VERIFY_WRITE, (char *) tv,sizeof *tv))
5505 + return sys_gettimeofday(tv, NULL);
5509 +ibcs_hrtalarm (struct pt_regs * regs)
5511 + struct itimerval get_buffer;
5512 + struct hrtcmd * hcmd;
5513 + int i, error, cmd, retval, which;
5514 + mm_segment_t old_fs = get_fs();
5516 + i = get_syscall_parameter (regs, 2);
5520 + hcmd = (struct hrtcmd *) get_syscall_parameter (regs, 1);
5522 + if (!access_ok (VERIFY_WRITE, (char *) hcmd,sizeof *hcmd))
5525 + get_user (cmd, ((unsigned long *) hcmd));
5527 + /* Now figure out which clock we want to fiddle with */
5528 + get_user (which, ((unsigned long *) hcmd)+1);
5530 +#if defined(CONFIG_ABI_TRACE)
5531 + abi_trace(ABI_TRACE_API, "hrtalarm(0x%lx %d)\n",
5532 + (u_long)cmd, which);
5551 + if(({long r; get_user(r, ((unsigned long *) hcmd)+4); r;}) != 1000000)
5553 + if (copy_from_user(&get_buffer.it_value, ((unsigned long *) hcmd)+2,
5554 + sizeof(struct timeval)))
5556 + memset(&get_buffer.it_interval, 0, sizeof(struct timeval));
5558 + retval = sys_setitimer(which, &get_buffer, NULL);
5563 + retval = sys_getitimer(which, &get_buffer);
5566 +#if defined(CONFIG_ABI_TRACE)
5567 + abi_trace(ABI_TRACE_API, "hrtalarm(d %lx) %lx %lx %lx %lx\n",
5569 + get_buffer.it_interval.tv_sec,
5570 + get_buffer.it_interval.tv_usec,
5571 + get_buffer.it_value.tv_sec,
5572 + get_buffer.it_value.tv_usec);
5575 + put_user(1000000, &hcmd->interval.resolution);
5576 + if (copy_to_user(((unsigned long *) hcmd)+2, &get_buffer.it_interval,
5577 + sizeof(get_buffer)))
5582 + if(({long r; get_user(r, ((unsigned long *) hcmd)+4); r;}) != 1000000)
5584 + if(({long r; get_user(r, ((unsigned long *) hcmd)+7); r;}) != 1000000)
5586 + if (copy_from_user(&get_buffer.it_value, &hcmd->tod,
5587 + sizeof(struct timeval)))
5589 + if (copy_from_user(&get_buffer.it_interval, &hcmd->interval,
5590 + sizeof(struct timeval)))
5593 + retval = sys_setitimer(which, &get_buffer, NULL);
5597 + memset(&get_buffer, 0, sizeof(get_buffer));
5599 + retval = sys_setitimer(which, &get_buffer, NULL);
5610 +svr4_hrtsys (struct pt_regs * regs)
5614 + func = get_syscall_parameter (regs, 0);
5616 +#if defined(CONFIG_ABI_TRACE)
5617 + abi_trace(ABI_TRACE_API, "hrtsys(%d)\n", func);
5622 + retval = ibcs_hrtcntl(regs);
5625 + retval = ibcs_hrtalarm(regs);
5636 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
5637 +EXPORT_SYMBOL(svr4_hrtsys);
5639 diff -Nur kernel-source-2.6.16.orig/abi/svr4/ioctl.c kernel-source-2.6.16/abi/svr4/ioctl.c
5640 --- kernel-source-2.6.16.orig/abi/svr4/ioctl.c 1970-01-01 10:00:00.000000000 +1000
5641 +++ kernel-source-2.6.16/abi/svr4/ioctl.c 2006-04-27 18:50:24.000000000 +1000
5644 + * Copyright (C) 1991, 1992 Linus Torvalds
5646 + * Written by Drew Sullivan.
5647 + * Rewritten by Mike Jagdis.
5652 +#include <linux/config.h>
5653 +#include <linux/errno.h>
5654 +#include <linux/kernel.h>
5655 +#include <linux/module.h>
5656 +#include <linux/syscalls.h>
5657 +#include <asm/uaccess.h>
5659 +#include <asm/abi_machdep.h>
5660 +#include <abi/svr4/ioctl.h>
5664 + * __svr4_ioctl() is a meta mapper, that is
5665 + * it looks up the class of the ioctl and then
5666 + * dispatchs to lower level routines to handle the
5667 + * mapping of the actual ioctls
5670 +__svr4_ioctl(struct pt_regs *regs, int fd, unsigned long ioctl_num, void *arg)
5672 + unsigned int class = ioctl_num >> 8;
5673 + char class_str[4];
5678 + * SCO ioctls on the pseudo NFS device probably.
5681 + return abi_ioctl_socksys(fd, ioctl_num, arg);
5684 + * SCO console keyboard stuff?
5690 + return svr4_tape_ioctl(fd, ioctl_num, arg);
5693 + return svr4_fil_ioctl(fd, ioctl_num, arg);
5696 + * Xenix ioctl compatibility.
5699 + return svr4_term_ioctl(fd, ioctl_num & 0xFF, arg);
5703 + return svr4_console_ioctl(fd, ioctl_num, arg);
5705 + case ('i' << 16) | ('C' << 8): /* iBCS2 POSIX */
5706 + return svr4_video_ioctl(fd, ioctl_num & 0xFF, arg);
5709 + * SCO 3.2.2 uses ('X'<<8)|1 for access to the video map
5710 + * and the 'X' set is also used for synchronous comm
5711 + * lines (I think?). SVR4 uses it for tty extensions to
5712 + * support hardware flow control and external clocks.
5715 + return svr4_termiox_ioctl(fd, ioctl_num & 0xFF, arg);
5718 + * These aren't implemented and are never likely to be as they
5719 + * are specific to drivers for obscure hardware. (For those
5720 + * that don't know they're the JERQ ioctls. Says it all
5727 + * The 'S' set could also be display mode switch
5728 + * ioctls in a SCO 3.2.x x<4 environment. It should
5729 + * depend on the descriptor they are applied to.
5730 + * According to ISC the Xenix STREAMS ioctls had the
5731 + * high bit set on the command to differentiate them
5732 + * from mode switch ioctls. Yuk, yuk, yuk...
5735 + return svr4_stream_ioctl(regs, fd, ioctl_num & 0x7F, arg);
5738 + * These are STREAMS socket module ioctls.
5741 +#if defined(CONFIG_ABI_XTI)
5742 + return svr4_sockmod_ioctl(fd, ioctl_num & 0xFF, arg);
5748 + * EUC ioctls. These are something to do with chararcter
5749 + * code set conversions in SVR4. If we don't support
5750 + * them the correct thing to do is to return EINVAL.
5756 + * SCO channel mapping. I can't find any documentation
5757 + * for this. These are the LD?MAP ioctls defined in
5758 + * sys/termio.h and sys/emap.h. They are used by mapchan.
5765 + * If we haven't handled it yet it must be a BSD style ioctl
5766 + * with a (possible) argument description in the high word of
5769 + switch (class & 0xff) {
5772 + * From SVR4 as specified in sys/iocomm.h.
5775 + return svr4_fil_ioctl(fd, ioctl_num, arg);
5778 + * BSD or V7 terminal ioctls.
5781 + return bsd_ioctl_termios(fd, ioctl_num, arg);
5784 + * "Traditional" BSD and Wyse V/386 3.2.1A TCP/IP ioctls.
5789 + return abi_ioctl_socksys(fd, ioctl_num, arg);
5792 + * SVR3 streams based socket TCP/IP ioctls.
5794 + * These are handed over to the standard ioctl
5795 + * handler since /dev/socksys is an emulated device
5796 + * and front ends any sockets created through it.
5797 + * Note that 'S' ioctls without the BSDish argument
5798 + * type in the high bytes are STREAMS ioctls and 'I'
5799 + * ioctls without the BSDish type in the high bytes
5800 + * are the STREAMS socket module ioctls. (see above).
5805 + return abi_ioctl_socksys(fd, ioctl_num, arg);
5809 + * If nothing has handled it yet someone may have to do some
5812 + class_str[0] = class & 0xFF0000 ? (char)((class >> 16) & 0xFF) : '.';
5813 + class_str[1] = class & 0x00FF00 ? (char)((class >> 8) & 0xFF) : '.';
5814 + class_str[2] = class & 0x0000FF ? (char)((class ) & 0xFF) : '.';
5817 + printk(KERN_DEBUG "svr4: ioctl(%d, %lx[%s], 0x%p) unsupported\n",
5818 + fd, ioctl_num, class_str, arg);
5824 +svr4_ioctl(struct pt_regs * regs)
5830 + fd = (int)get_syscall_parameter(regs, 0);
5831 + num = (u_int)get_syscall_parameter(regs, 1);
5832 + data = (caddr_t)get_syscall_parameter(regs, 2);
5834 + return __svr4_ioctl(regs, fd, num, data);
5837 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
5838 +EXPORT_SYMBOL(__svr4_ioctl);
5839 +EXPORT_SYMBOL(svr4_ioctl);
5841 diff -Nur kernel-source-2.6.16.orig/abi/svr4/ipc.c kernel-source-2.6.16/abi/svr4/ipc.c
5842 --- kernel-source-2.6.16.orig/abi/svr4/ipc.c 1970-01-01 10:00:00.000000000 +1000
5843 +++ kernel-source-2.6.16/abi/svr4/ipc.c 2006-04-27 18:50:24.000000000 +1000
5846 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
5847 + * Copyright (C) 2001 Christoph Hellwig (hch@caldera.de)
5849 + * Massive work over with a fine tooth comb, lots of rewriting. There
5850 + * were a *lot* of bugs in this - mismatched structs that weren't
5851 + * mapped, wrong pointers etc. I've tested this version with the
5852 + * demo programs from the Wyse V/386 IPC documentation which exercise
5853 + * all the functions. I don't have any major IPC using applications
5854 + * to test it with - as far as I know...
5856 + * Again rewritten for Linux 2.4 - Linux 2.4 changes a lot of structures
5857 + * and the cruft this file relied on has simply changed...
5859 + * Original copyright etc. follows:
5861 + * Copyright (C) 1993,1994 Joe Portman (baron@hebron.connected.com)
5862 + * First stab at ibcs shm, sem and msg handlers
5865 + * Please contact the author above before blindly making changes
5866 + * to this file. You will break things.
5868 + * 04-15-1994 JLP III
5869 + * Still no msgsys, but IPC_STAT now works for shm calls
5870 + * Corrected argument order for sys_ipc calls, to accomodate Mike's
5871 + * changes, so that we can just call sys_ipc instead of the internal
5872 + * sys_* calls for ipc functions.
5873 + * Cleaned up translation of perm structures
5874 + * tstshm for Oracle now works.
5876 + * 04-23-1994 JLP III
5877 + * Added in msgsys calls, Tested and working
5878 + * Added translation for IPC_SET portions of all xxxctl functions.
5879 + * Added SHM_LOCK and SHM_UNLOCK to shmsys
5881 + * 04-28-1994 JLP III
5882 + * Special thanks to Brad Pepers for adding in the GETALL and SETALL
5883 + * case of semaphores. (pepersb@cuug.ab.ca)
5888 +#include <linux/module.h>
5889 +#include <linux/errno.h>
5890 +#include <linux/fs.h>
5891 +#include <linux/kernel.h>
5892 +#include <linux/personality.h>
5893 +#include <linux/ptrace.h>
5894 +#include <linux/sched.h>
5895 +#include <linux/string.h>
5896 +#define __KERNEL_SYSCALLS__
5897 +#include <linux/unistd.h>
5898 +#include <linux/syscalls.h>
5899 +#include <linux/ipc.h>
5900 +#include <linux/sem.h>
5901 +#include <linux/shm.h>
5902 +#include <linux/msg.h>
5904 +#include <asm/uaccess.h>
5905 +#include <asm/ipc.h>
5907 +#include <abi/svr4/ipc.h>
5908 +#include <abi/util/trace.h>
5909 +#include <abi/util/errno.h>
5912 +static __inline__ void
5913 +ip_to_lp(struct ibcs2_ipc_perm *ip, struct ipc_perm *lp)
5915 + lp->uid = ip->uid;
5916 + lp->gid = ip->gid;
5917 + lp->cuid = ip->cuid;
5918 + lp->cgid = ip->cgid;
5919 + lp->mode = ip->mode;
5920 + lp->seq = ip->seq;
5921 + lp->key = ip->key;
5924 +static __inline__ void
5925 +lp_to_ip(struct ipc_perm *lp, struct ibcs2_ipc_perm *ip)
5927 + ip->uid = lp->uid;
5928 + ip->gid = lp->gid;
5929 + ip->cuid = lp->cuid;
5930 + ip->cgid = lp->cgid;
5931 + ip->mode = lp->mode;
5932 + ip->seq = lp->seq;
5933 + ip->key = lp->key;
5936 +static __inline__ void
5937 +ip_to_lp_l(struct abi4_ipc_perm *ip, struct ipc_perm *lp)
5939 + lp->uid = ip->uid;
5940 + lp->gid = ip->gid;
5941 + lp->cuid = ip->cuid;
5942 + lp->cgid = ip->cgid;
5943 + lp->mode = ip->mode;
5944 + lp->seq = ip->seq;
5945 + lp->key = ip->key;
5948 +static __inline__ void
5949 +lp_to_ip_l(struct ipc_perm *lp, struct abi4_ipc_perm *ip)
5951 + ip->uid = lp->uid;
5952 + ip->gid = lp->gid;
5953 + ip->cuid = lp->cuid;
5954 + ip->cgid = lp->cgid;
5955 + ip->mode = lp->mode;
5956 + ip->seq = lp->seq;
5957 + ip->key = lp->key;
5961 +isem_to_lsem(struct ibcs2_semid_ds *is, struct semid_ds *ls)
5963 + ip_to_lp(&is->sem_perm, &ls->sem_perm);
5965 + ls->sem_base = is->sem_base;
5966 + ls->sem_nsems = is->sem_nsems;
5967 + ls->sem_otime = is->sem_otime;
5968 + ls->sem_ctime = is->sem_ctime;
5972 +lsem_to_isem(struct semid_ds *ls, struct ibcs2_semid_ds *is)
5974 + lp_to_ip(&ls->sem_perm, &is->sem_perm);
5976 + is->sem_base = ls->sem_base;
5977 + is->sem_nsems = ls->sem_nsems;
5978 + is->sem_otime = ls->sem_otime;
5979 + is->sem_ctime = ls->sem_ctime;
5983 +isem_to_lsem_l(struct abi4_semid_ds *is, struct semid_ds *ls)
5985 + ip_to_lp_l(&is->sem_perm, &ls->sem_perm);
5987 + ls->sem_base = is->sem_base;
5988 + ls->sem_nsems = is->sem_nsems;
5989 + ls->sem_otime = is->sem_otime;
5990 + ls->sem_ctime = is->sem_ctime;
5994 +lsem_to_isem_l(struct semid_ds *ls, struct abi4_semid_ds *is)
5996 + memset(is, 0, sizeof(*is));
5998 + lp_to_ip_l(&ls->sem_perm, &is->sem_perm);
6000 + is->sem_base = ls->sem_base;
6001 + is->sem_nsems = ls->sem_nsems;
6002 + is->sem_otime = ls->sem_otime;
6003 + is->sem_ctime = ls->sem_ctime;
6007 +__ibcs2_semctl(int first, int second, int third, union semun *fourth)
6009 + struct ibcs2_semid_ds is, *isp;
6010 + struct semid_ds ls;
6011 + union semun lsemun;
6015 + err = get_user(isp, (struct ibcs2_semid_ds **)&fourth->buf);
6019 + err = copy_from_user(&is, isp, sizeof(is)) ? -EFAULT : 0;
6023 + isem_to_lsem(&is, &ls);
6028 + err = sys_ipc(SEMCTL, first, second, third, &lsemun,0);
6034 + lsem_to_isem(&ls, &is);
6035 + return copy_to_user(isp, &is, sizeof(is)) ? -EFAULT : 0;
6039 +__abi4_semctl(int first, int second, int third, union semun *fourth)
6041 + struct abi4_semid_ds is, *isp;
6042 + struct semid_ds ls;
6043 + union semun lsemun;
6047 + err = get_user(isp, (struct abi4_semid_ds **)&fourth->buf);
6051 + err = copy_from_user(&is, isp, sizeof(is)) ? -EFAULT : 0;
6055 + isem_to_lsem_l(&is, &ls);
6060 + err = sys_ipc(SEMCTL, first, second, third, &lsemun,0);
6066 + lsem_to_isem_l(&ls, &is);
6067 + return copy_to_user(isp, &is, sizeof(is)) ? -EFAULT : 0;
6071 +svr4_semctl(int arg1, int arg2, int arg3, union semun *arg4)
6073 + int cmd = svr4sem2linux[arg3];
6076 + case SVR4_SEM_SETALL:
6077 + case SVR4_SEM_GETALL:
6078 + return __ibcs2_semctl(arg1, 0, cmd, arg4);
6079 + case SVR4_IPC_RMID:
6080 + case SVR4_IPC_RMID_L:
6081 + case SVR4_SEM_SETVAL:
6082 + case SVR4_SEM_GETVAL:
6083 + case SVR4_SEM_GETPID:
6084 + case SVR4_SEM_GETNCNT:
6085 + case SVR4_SEM_GETZCNT:
6086 + return sys_ipc(SEMCTL, arg1, arg2, cmd, arg4, 0);
6087 + case SVR4_IPC_SET:
6088 + case SVR4_IPC_STAT:
6089 + return __ibcs2_semctl(arg1, arg2, cmd, arg4);
6090 + case SVR4_IPC_STAT_L:
6091 + case SVR4_IPC_SET_L:
6092 + return __abi4_semctl(arg1, arg2, cmd, arg4);
6095 + __abi_trace("semctl: unsupported command %d\n", arg3);
6100 +svr4_semget(int arg1, int arg2, int arg3)
6102 +#if defined(CONFIG_ABI_TRACE)
6103 + abi_trace(ABI_TRACE_API, "semget(%d, %d, %o)\n", arg1, arg2, arg3);
6105 + return sys_semget(arg1, arg2, arg3);
6110 +svr4_semop(int arg1, struct sembuf *arg2, int arg3)
6112 +#if defined(CONFIG_ABI_TRACE)
6113 + if (abi_traced(ABI_TRACE_API)) {
6114 + struct sembuf tmp, *tp = arg2;
6117 + for (i = 0; i < arg3; i++) {
6118 + if (copy_from_user (&tmp, tp, sizeof(tmp)))
6119 + { __abi_trace("semop(-EFAULT)\n");
6122 + __abi_trace("semop(%d, %d, 0%o)\n",
6123 + tmp.sem_num, tmp.sem_op,
6130 + return sys_semop(arg1, arg2, arg3);
6134 +svr4_semsys(struct pt_regs *regp)
6136 + int which, arg1, arg2, arg3;
6137 + union semun *arg4;
6139 + which = get_syscall_parameter(regp, 0);
6140 + arg1 = get_syscall_parameter(regp, 1);
6141 + arg2 = get_syscall_parameter(regp, 2);
6142 + arg3 = get_syscall_parameter(regp, 3);
6145 + * XXX - The value for arg4 depends on how union
6146 + * passing is implement on this architecture and
6147 + * compiler. The following is *only* known to be
6148 + * right for Intel (the default else case).
6151 + arg4 = (union semun *)get_syscall_parameter(regp, 4);
6153 + arg4 = (union semun *)(((u_long *)regp->esp) + (5));
6158 + return svr4_semctl(arg1, arg2, arg3, arg4);
6160 + return svr4_semget(arg1, arg2, arg3);
6162 + return svr4_semop(arg1, (struct sembuf *)arg2, arg3);
6169 +ishm_to_lshm(struct ibcs2_shmid_ds *is, struct shmid_ds *ls)
6171 + ip_to_lp(&is->shm_perm, &ls->shm_perm);
6172 + ls->shm_segsz = is->shm_segsz;
6173 + ls->shm_lpid = is->shm_lpid;
6174 + ls->shm_cpid = is->shm_cpid;
6175 + ls->shm_nattch = is->shm_nattch;
6176 + ls->shm_atime = is->shm_atime;
6177 + ls->shm_dtime = is->shm_dtime;
6178 + ls->shm_ctime = is->shm_ctime;
6182 +lshm_to_ishm(struct shmid_ds *ls, struct ibcs2_shmid_ds *is)
6184 + lp_to_ip(&ls->shm_perm, &is->shm_perm);
6185 + is->shm_segsz = ls->shm_segsz;
6186 + is->shm_lpid = ls->shm_lpid;
6187 + is->shm_cpid = ls->shm_cpid;
6188 + is->shm_nattch = ls->shm_nattch;
6189 + is->shm_atime = ls->shm_atime;
6190 + is->shm_dtime = ls->shm_dtime;
6191 + is->shm_ctime = ls->shm_ctime;
6195 +ishm_to_lshm_l(struct abi4_shmid_ds *is, struct shmid_ds *ls)
6197 + ip_to_lp_l(&is->shm_perm, &ls->shm_perm);
6198 + ls->shm_segsz = is->shm_segsz;
6199 + ls->shm_lpid = is->shm_lpid;
6200 + ls->shm_cpid = is->shm_cpid;
6201 + ls->shm_nattch = is->shm_nattch;
6202 + ls->shm_atime = is->shm_atime;
6203 + ls->shm_dtime = is->shm_dtime;
6204 + ls->shm_ctime = is->shm_ctime;
6208 +lshm_to_ishm_l(struct shmid_ds *ls, struct abi4_shmid_ds *is)
6210 + memset(is, 0, sizeof(*is));
6211 + lp_to_ip_l(&ls->shm_perm, &is->shm_perm);
6212 + is->shm_segsz = ls->shm_segsz;
6213 + is->shm_lpid = ls->shm_lpid;
6214 + is->shm_cpid = ls->shm_cpid;
6215 + is->shm_nattch = ls->shm_nattch;
6216 + is->shm_atime = ls->shm_atime;
6217 + is->shm_dtime = ls->shm_dtime;
6218 + is->shm_ctime = ls->shm_ctime;
6222 +svr4_shmdt(struct pt_regs *regp)
6224 + caddr_t addr = (caddr_t)get_syscall_parameter(regp, 1);
6226 +#if defined(CONFIG_ABI_TRACE)
6227 + abi_trace(ABI_TRACE_API, "shmdt(%p)\n", addr);
6229 + return sys_shmdt(addr);
6233 +svr4_shmctl(int arg1, int cmd, char *arg3)
6235 + struct ibcs2_shmid_ds is;
6236 + struct abi4_shmid_ds is4;
6237 + struct shmid_ds ls;
6241 +#if defined(CONFIG_ABI_TRACE)
6242 + abi_trace(ABI_TRACE_API, "shmctl(%d, %x, %p)\n", arg1, cmd, arg3);
6246 + case SVR4_SHM_LOCK:
6247 + return sys_shmctl(arg1, SHM_LOCK, (struct shmid_ds *)arg3);
6248 + case SVR4_SHM_UNLOCK:
6249 + return sys_shmctl(arg1, SHM_UNLOCK, (struct shmid_ds *)arg3);
6250 + case SVR4_IPC_SET:
6251 + err = copy_from_user(&is, arg3, sizeof(is)) ? -EFAULT : 0;
6254 + ishm_to_lshm(&is, &ls);
6258 + err = sys_shmctl(arg1, IPC_SET, &ls);
6263 + lshm_to_ishm(&ls, &is);
6264 + err = copy_to_user(arg3, &is, sizeof(is)) ? -EFAULT : 0;
6266 + case SVR4_IPC_SET_L:
6267 + err = copy_from_user(&is4, arg3, sizeof(is4)) ? -EFAULT : 0;
6270 + ishm_to_lshm_l(&is4, &ls);
6274 + err = sys_shmctl(arg1, IPC_SET, &ls);
6279 + lshm_to_ishm_l(&ls, &is4);
6280 + err = copy_to_user(arg3, &is4, sizeof(is4)) ? -EFAULT : 0;
6282 + case SVR4_IPC_RMID:
6283 + case SVR4_IPC_RMID_L:
6284 + return sys_shmctl(arg1, IPC_RMID, (struct shmid_ds *)arg3);
6285 + case SVR4_IPC_STAT:
6288 + err = sys_shmctl(arg1, IPC_STAT, &ls);
6294 + lshm_to_ishm(&ls, &is);
6295 + err = copy_to_user(arg3, &is, sizeof(is)) ? -EFAULT : 0;
6297 + case SVR4_IPC_STAT_L:
6300 + err = sys_shmctl(arg1, IPC_STAT, &ls);
6305 + lshm_to_ishm_l(&ls, &is4);
6306 + err = copy_to_user((char *)arg3, &is4, sizeof(is4)) ? -EFAULT : 0;
6309 +#if defined(CONFIG_ABI_TRACE)
6310 + __abi_trace("shmctl: unsupported command %d\n", cmd);
6319 +svr4_shmsys(struct pt_regs *regp)
6321 + int arg1, arg2, arg3, cmd, err = 0;
6325 + cmd = get_syscall_parameter(regp, 0);
6326 + if (cmd == SVR4_shmdt) {
6327 + err = svr4_shmdt(regp);
6331 + arg1 = get_syscall_parameter(regp, 1);
6332 + arg2 = get_syscall_parameter(regp, 2);
6333 + arg3 = get_syscall_parameter(regp, 3);
6337 +#if defined(CONFIG_ABI_TRACE)
6338 + abi_trace(ABI_TRACE_API, "shmat(%d, %x, %o)\n", arg1, arg2, arg3);
6343 + err = do_shmat(arg1, (caddr_t)arg2, arg3, &raddr);
6348 +#if defined(CONFIG_ABI_TRACE)
6349 + abi_trace(ABI_TRACE_API, "shmat returns %x\n", err);
6353 +#if defined(CONFIG_ABI_TRACE)
6354 + abi_trace(ABI_TRACE_API, "shmget(%d, %x, %o)\n", arg1, arg2, arg3);
6356 + err = sys_shmget(arg1, arg2, arg3);
6357 +#if defined(CONFIG_ABI_TRACE)
6358 + abi_trace(ABI_TRACE_API, "shmget returns %d\n", err);
6362 + err = svr4_shmctl(arg1, arg2, (char *)arg3);
6365 +#if defined(CONFIG_ABI_TRACE)
6366 + __abi_trace("shmsys: unsupported command: %x\n", cmd);
6372 + if (err < 0 && err > -255) {
6373 + set_error(regp, iABI_errors(-err));
6374 + abi_trace(ABI_TRACE_API, "Error %d\n", get_result(regp));
6378 + clear_error(regp);
6379 + set_result(regp, err);
6384 +imsq_to_lmsq(struct ibcs2_msqid_ds * im, struct msqid_ds * lm)
6386 + ip_to_lp(&im->msg_perm, &lm->msg_perm);
6387 + lm->msg_first = im->msg_first;
6388 + lm->msg_last = im->msg_last;
6389 + lm->msg_cbytes = im->msg_cbytes;
6390 + lm->msg_qnum = im->msg_qnum;
6391 + lm->msg_qbytes = im->msg_qbytes;
6392 + lm->msg_lspid = im->msg_lspid;
6393 + lm->msg_lrpid = im->msg_lrpid;
6394 + lm->msg_stime = im->msg_stime;
6395 + lm->msg_rtime = im->msg_rtime;
6396 + lm->msg_ctime = im->msg_ctime;
6400 +lmsq_to_imsq(struct msqid_ds *lm, struct ibcs2_msqid_ds *im)
6402 + lp_to_ip(&lm->msg_perm, &im->msg_perm);
6403 + im->msg_first = lm->msg_first;
6404 + im->msg_last = lm->msg_last;
6405 + im->msg_cbytes = lm->msg_cbytes;
6406 + im->msg_qnum = lm->msg_qnum;
6407 + im->msg_qbytes = lm->msg_qbytes;
6408 + im->msg_lspid = lm->msg_lspid;
6409 + im->msg_lrpid = lm->msg_lrpid;
6410 + im->msg_stime = lm->msg_stime;
6411 + im->msg_rtime = lm->msg_rtime;
6412 + im->msg_ctime = lm->msg_ctime;
6416 +imsq_to_lmsq_l(struct abi4_msqid_ds *im, struct msqid_ds *lm)
6418 + ip_to_lp_l(&im->msg_perm, &lm->msg_perm);
6419 + lm->msg_first = im->msg_first;
6420 + lm->msg_last = im->msg_last;
6421 + lm->msg_cbytes = im->msg_cbytes;
6422 + lm->msg_qnum = im->msg_qnum;
6423 + lm->msg_qbytes = im->msg_qbytes;
6424 + lm->msg_lspid = im->msg_lspid;
6425 + lm->msg_lrpid = im->msg_lrpid;
6426 + lm->msg_stime = im->msg_stime;
6427 + lm->msg_rtime = im->msg_rtime;
6428 + lm->msg_ctime = im->msg_ctime;
6432 +lmsq_to_imsq_l(struct msqid_ds *lm, struct abi4_msqid_ds *im)
6434 + memset(im, 0, sizeof(*im));
6435 + lp_to_ip_l(&lm->msg_perm, &im->msg_perm);
6436 + im->msg_first = lm->msg_first;
6437 + im->msg_last = lm->msg_last;
6438 + im->msg_cbytes = lm->msg_cbytes;
6439 + im->msg_qnum = lm->msg_qnum;
6440 + im->msg_qbytes = lm->msg_qbytes;
6441 + im->msg_lspid = lm->msg_lspid;
6442 + im->msg_lrpid = lm->msg_lrpid;
6443 + im->msg_stime = lm->msg_stime;
6444 + im->msg_rtime = lm->msg_rtime;
6445 + im->msg_ctime = lm->msg_ctime;
6449 +svr4_msgctl(int arg1, int cmd, char *arg3)
6451 + struct ibcs2_msqid_ds im;
6452 + struct abi4_msqid_ds im4;
6453 + struct msqid_ds lm;
6458 + case SVR4_IPC_SET:
6459 + err = copy_from_user(&im, arg3, sizeof(im)) ? -EFAULT : 0;
6463 + imsq_to_lmsq(&im, &lm);
6467 + err = sys_msgctl(arg1, IPC_SET, &lm);
6470 + lmsq_to_imsq(&lm, &im);
6471 + err = copy_to_user(arg3, &im, sizeof(im)) ? -EFAULT : 0;
6473 + case SVR4_IPC_SET_L:
6474 + err = copy_from_user(&im4, arg3, sizeof(im4)) ? -EFAULT : 0;
6477 + imsq_to_lmsq_l(&im4, &lm);
6481 + err = sys_msgctl(arg1, IPC_SET, &lm);
6484 + lmsq_to_imsq_l(&lm, &im4);
6485 + err = copy_to_user(arg3, &im4, sizeof(im4)) ? -EFAULT : 0;
6487 + case SVR4_IPC_RMID:
6488 + case SVR4_IPC_RMID_L:
6489 + return sys_msgctl(arg1, IPC_RMID, (struct msqid_ds *)arg3);
6490 + case SVR4_IPC_STAT:
6493 + err = sys_msgctl(arg1, IPC_STAT, &lm);
6499 + lmsq_to_imsq(&lm, &im);
6500 + err = copy_to_user(arg3, &im, sizeof(im)) ? -EFAULT : 0;
6502 + case SVR4_IPC_STAT_L:
6505 + err = sys_msgctl(arg1, IPC_STAT, &lm);
6511 + lmsq_to_imsq_l(&lm, &im4);
6512 + err = copy_to_user(arg3, &im4, sizeof(im4)) ? -EFAULT : 0;
6515 + __abi_trace("msgctl: unsupported command: %x\n", cmd);
6523 +svr4_msgsys(struct pt_regs *regp)
6525 + int err, cmd, arg1, arg2, arg3, arg4, arg5;
6528 + * Special handling as msgrcv is ugly.
6530 + cmd = get_syscall_parameter(regp, 0);
6531 + arg1 = get_syscall_parameter(regp, 1);
6532 + arg2 = get_syscall_parameter(regp, 2);
6536 + return sys_msgget((key_t)arg1, arg2);
6538 + arg3 = get_syscall_parameter(regp, 3);
6539 + return svr4_msgctl(arg1, arg2, (caddr_t)arg3);
6541 + arg3 = get_syscall_parameter(regp, 3);
6542 + arg4 = get_syscall_parameter(regp, 4);
6543 + arg5 = get_syscall_parameter(regp, 5);
6544 + return sys_msgrcv(arg1, (struct msgbuf *)arg2, arg3, arg4, arg5);
6546 + arg3 = get_syscall_parameter(regp, 3);
6547 + arg4 = get_syscall_parameter(regp, 4);
6548 + err = sys_msgsnd(arg1, (struct msgbuf *)arg2, arg3, arg4);
6549 + return ((err > 0) ? 0 : err);
6552 + __abi_trace("msgsys: unsupported command: %x\n", cmd);
6556 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
6557 +EXPORT_SYMBOL(svr4_msgsys);
6558 +EXPORT_SYMBOL(svr4_semsys);
6559 +EXPORT_SYMBOL(svr4_shmsys);
6561 diff -Nur kernel-source-2.6.16.orig/abi/svr4/Makefile kernel-source-2.6.16/abi/svr4/Makefile
6562 --- kernel-source-2.6.16.orig/abi/svr4/Makefile 1970-01-01 10:00:00.000000000 +1000
6563 +++ kernel-source-2.6.16/abi/svr4/Makefile 2006-04-27 18:50:24.000000000 +1000
6566 +svr4-y := hrtsys.o ioctl.o ipc.o mmap.o open.o svr4.o sysconf.o \
6567 + sysfs.o sysinfo.o sysi86.o ulimit.o utsname.o stream.o \
6568 + stat.o socksys.o signal.o misc.o socket.o statvfs.o \
6571 +# emulations for all kinds of weird ioctls...
6572 +svr4-y += filio.o termios.o consio.o tapeio.o sockio.o
6575 +svr4-$(CONFIG_ABI_XTI) += timod.o xti.o
6576 +svr4-$(CONFIG_ABI_SPX) += timod.o
6578 +abi-svr4-objs += $(sort $(svr4-y))
6581 +obj-$(CONFIG_ABI_SVR4) += abi-svr4.o
6583 +abi-svr4.o: $(abi-svr4-objs)
6584 + $(LD) -r -o $@ $(abi-svr4-objs)
6585 diff -Nur kernel-source-2.6.16.orig/abi/svr4/misc.c kernel-source-2.6.16/abi/svr4/misc.c
6586 --- kernel-source-2.6.16.orig/abi/svr4/misc.c 1970-01-01 10:00:00.000000000 +1000
6587 +++ kernel-source-2.6.16/abi/svr4/misc.c 2006-04-27 18:50:24.000000000 +1000
6590 + * Copyright (C) 1993 Linus Torvalds
6591 + * Copyright (C) 2001 Caldera Deutschland GmbH
6593 + * Modified by Eric Youngdale to include all ibcs syscalls.
6594 + * Re-written by Drew Sullivan to handle lots more of the syscalls correctly.
6599 +#include <linux/module.h>
6600 +#include <linux/types.h>
6601 +#include <linux/errno.h>
6602 +#include <linux/sched.h>
6603 +#include <linux/kernel.h>
6604 +#include <linux/mm.h>
6605 +#include <linux/gfp.h>
6606 +#include <linux/stat.h>
6607 +#include <linux/stddef.h>
6608 +#include <linux/unistd.h>
6609 +#include <linux/ptrace.h>
6610 +#include <linux/fcntl.h>
6611 +#include <linux/time.h>
6612 +#include <linux/personality.h>
6613 +#include <linux/syscalls.h>
6615 +#include <linux/fs.h>
6616 +#include <linux/sys.h>
6617 +#include <linux/slab.h>
6618 +#include <linux/file.h>
6619 +#include <linux/dirent.h>
6621 +#include <asm/uaccess.h>
6622 +#include <asm/system.h>
6624 +#include <abi/signal.h>
6625 +#include <abi/util/trace.h>
6627 +#include <abi/svr4/types.h>
6630 +MODULE_DESCRIPTION("common code for SVR3/SVR4 based personalities");
6631 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
6632 +MODULE_LICENSE("GPL");
6638 + return sys_time(0);
6642 +abi_brk(unsigned long brk)
6644 + unsigned long newbrk = PAGE_ALIGN(brk), oldbrk, sysbrk;
6646 + down_read(¤t->mm->mmap_sem);
6649 + oldbrk = PAGE_ALIGN(current->mm->brk);
6650 + up_read(¤t->mm->mmap_sem);
6652 + if (newbrk != oldbrk) {
6653 + sysbrk = sys_brk(brk);
6654 + if (PAGE_ALIGN(sysbrk) != newbrk)
6660 + /* return non-pagealigned old brk value */
6661 + oldbrk = current->mm->brk;
6662 + up_read(¤t->mm->mmap_sem);
6667 + * UNIX wants a 0-edx after fork and may have set
6668 + * the carry flag before calling fork.
6671 +abi_fork(struct pt_regs *regs)
6675 + regs->eflags &= ~1;
6676 + retval = do_fork(SIGCHLD, regs->esp, regs, 0,
6677 + /* parent_tidptr */NULL, /* child_tidptr */NULL);
6683 + * Unlike Linux, UNIX does not use C calling conventions
6687 +abi_pipe(struct pt_regs *regs)
6689 + int filedes[2], retval;
6691 + retval = do_pipe(filedes);
6692 + if (retval == 0) {
6693 + retval = filedes[0];
6694 + regs->edx = filedes[1];
6700 + * Note the double value return in eax and edx.
6703 +abi_getpid(struct pt_regs *regs)
6705 + regs->edx = current->parent->pid;
6706 + return current->pid;
6710 + * Note the double value return in eax and edx.
6713 +abi_getuid(struct pt_regs *regs)
6715 + regs->edx = current->euid;
6716 + return current->uid;
6720 + * Note the double value return in eax and edx.
6723 +abi_getgid(struct pt_regs *regs)
6725 + regs->edx = current->egid;
6726 + return current->gid;
6738 +#define MAGIC_WAITPID_FLAG (FLAG_ZF | FLAG_PF | FLAG_SF | FLAG_OF)
6741 +abi_wait(struct pt_regs * regs)
6744 + long result, kopt = 0;
6749 + * Xenix wait() puts status to edx and returns pid.
6751 + * XXX xenix should get it's own syyent table so we can
6752 + * XXX rip this cruft out.
6754 + if (is_cur_personality(PER_XENIX)) {
6757 + result = sys_wait4(-1, &loc, 0, NULL);
6765 + * if ZF,PF,SF,and OF are set then it is waitpid
6767 + if ((regs->eflags & MAGIC_WAITPID_FLAG) == MAGIC_WAITPID_FLAG) {
6768 + get_user(pid, ((u_long *)regs->esp)+1);
6769 + get_user(loc, ((u_long *)regs->esp)+2);
6770 + get_user(opt, ((u_long *)regs->esp)+3);
6773 + * Now translate the options from the SVr4 numbers
6778 + kopt |= WUNTRACED;
6780 + result = sys_wait4(pid, (u_int *)loc, kopt, NULL);
6782 + get_user(loc, ((u_long *)regs->esp)+1);
6783 + result = sys_wait4(-1, (u_int *)loc, WUNTRACED, NULL);
6786 + if (result < 0 || !loc)
6789 + get_user(regs->edx, (u_long *)loc);
6790 + if ((regs->edx & 0xff) == 0x7f) {
6793 + sig = (regs->edx >> 8) & 0xff;
6794 + if (sig < NSIGNALS)
6795 + sig = current_thread_info()->exec_domain->signal_map[sig];
6796 + regs->edx = (regs->edx & (~0xff00)) | (sig << 8);
6797 + put_user(regs->edx, (u_long *)loc);
6798 + } else if (regs->edx && regs->edx == (regs->edx & 0xff)) {
6799 + if ((regs->edx & 0x7f) < NSIGNALS)
6800 + regs->edx = current_thread_info()->exec_domain->signal_map[regs->edx & 0x7f];
6801 + put_user(regs->edx, (u_long *)loc);
6806 +#if defined(CONFIG_ABI_TRACE)
6808 + * Trace arguments of exec().
6810 + * We show up to twenty arguments and enviroment variables.
6811 + * This could as well be sysctl configurable.
6814 +trace_exec(struct pt_regs *regs, char *pgm, char **argv, char **envp)
6816 + char **v, *p = NULL, *q = NULL;
6821 + __abi_trace("\tpgm: %p pointer error %ld\n", pgm, PTR_ERR(q));
6823 + __abi_trace("\tpgm: %p \"%s\"\n", pgm, q);
6827 + for (i = 0, v = argv; v && i < 20; v++, i++) {
6828 + if (get_user(p, v) || !p)
6833 + __abi_trace("\targ: %p pointer error %ld\n",
6836 + __abi_trace("\targ: %p \"%s\"\n", p, q);
6842 + __abi_trace("\targ: ...\n");
6844 + for (i = 0, v = envp; v && i < 20; v++, i++) {
6845 + if (get_user(p, v) || !p)
6850 + __abi_trace("\tenv: %p pointer error %ld\n",
6853 + __abi_trace("\tenv: %p \"%s\"\n", p, q);
6859 + __abi_trace("\tenv: ...\n");
6864 + * Execute a new program.
6866 + * The difference from the native version is that we
6867 + * optionally trace the arguments.
6870 +abi_exec(struct pt_regs *regs)
6872 + char *pgm, **argv, **envp;
6877 + ulptr = (u_long *)&pgm;
6878 + if (get_user(*ulptr, ((u_long *)regs->esp)+1))
6880 + ulptr = (u_long *)&argv;
6881 + if (get_user(*ulptr, ((u_long *)regs->esp)+2))
6883 + ulptr = (u_long *)&envp;
6884 + if (get_user(*ulptr, ((u_long *)regs->esp)+3))
6887 +#if defined(CONFIG_ABI_TRACE)
6888 + if (abi_traced(ABI_TRACE_API))
6889 + trace_exec(regs, pgm, argv, envp);
6892 + filename = getname(pgm);
6893 + if (!IS_ERR(filename)) {
6894 + error = do_execve(filename, argv, envp, regs);
6895 + putname (filename);
6897 + error = PTR_ERR(filename);
6902 + * Yet another crufy SysV multiplexed syscall.
6903 + * This time it's all the process group and session handling.
6905 + * NOTE: we return EPERM on get_user failures as EFAULT is not
6906 + * a valid return value for theses calls.
6909 +abi_procids(struct pt_regs *regs)
6911 + int offset = 0, op;
6913 + if (get_user(op, ((u_long *)regs->esp)+1))
6916 + /* Remap op codes for current personality if necessary. */
6917 + switch (get_cur_personality_id()) {
6918 + case (PERID_SVR3):
6919 + case (PERID_SCOSVR3):
6920 + case (PERID_WYSEV386):
6921 + case (PERID_XENIX):
6923 + * SCO at least uses an interesting library to
6924 + * syscall mapping that leaves an extra return
6925 + * address between the op code and the arguments.
6927 + * WTF does SCO at least mean?
6928 + * Could someone please verify this with another
6929 + * SVR3 derivate as I have none.
6934 + if (op < 0 || op > 5)
6936 + op = "\000\001\005\003\377\377"[op];
6940 + case 0: /* getpgrp */
6941 + return process_group(current);
6943 + case 1: /* setpgrp */
6944 + sys_setpgid(0, 0);
6945 + return process_group(current);
6947 + case 2: /* getsid */
6951 + if (get_user(pid, ((u_long *)regs->esp)+2 + offset))
6953 + return sys_getsid(pid);
6956 + case 3: /* setsid */
6957 + return sys_setsid();
6959 + case 4: /* getpgid */
6963 + if (get_user(pid, ((u_long *)regs->esp)+2 + offset))
6965 + return sys_getpgid(pid);
6968 + case 5: /* setpgid */
6972 + if (get_user(pid, ((u_long *)regs->esp)+2 + offset))
6974 + if (get_user(pgid, ((u_long *)regs->esp)+3 + offset))
6976 + return sys_setpgid(pid, pgid);
6985 + * Stupid bloody thing is trying to read a directory.
6987 + * Some old programs expect this to work. It works on SCO.
6988 + * To emulate it we have to map a dirent to a direct. This
6989 + * involves shrinking a long inode to a short. Fortunately
6990 + * nothing this archaic is likely to care about anything
6991 + * but the filenames of entries with non-zero inodes.
6994 +abi_read_dir(int fd, char *buf, int count)
6997 + struct old_linux_dirent *de;
7000 + int posn = 0, reclen = 0;
7008 + de = (struct old_linux_dirent *)__get_free_page(GFP_KERNEL);
7013 + while (posn + reclen < count) {
7017 + * Save the current position and get another dirent
7022 + set_fs (get_ds());
7023 + error = old_readdir(fd, de, 1);
7030 + * If it'll fit in the buffer save it.
7031 + * Otherwise back up so it is read next time around.
7032 + * Oh, if we're at the beginning of the buffer there's
7033 + * no chance that this entry will ever fit so don't
7034 + * copy it and don't back off - we'll just pretend it
7039 + * SCO (at least) handles long filenames by breaking
7040 + * them up in to 14 character chunks of which all
7041 + * but the last have the inode set to 0xffff.
7042 + * Those chunks will get aligned to a 4 byte boundary
7043 + * thus leaving two bytes in each entry for other purposes.
7045 + * Well, that's SCO E(A)FS.
7046 + * HTFS and DTFS should handle it better.
7049 + reclen = 16 * ((de->d_namlen + 13) / 14);
7050 + if (posn + reclen > count) {
7052 + sys_lseek(fd, here, 0);
7059 + * Put all but the last chunk.
7061 + while (de->d_namlen > 14) {
7062 + put_user(0xffff, (u_short *)(buf+posn));
7064 + if (copy_to_user(buf+posn, p, 14))
7068 + de->d_namlen -= 14;
7072 + * Put the last chunk. Note the we have to fold a
7073 + * long inode number down to a short avoiding
7074 + * giving a zero inode number since that indicates
7075 + * an unused directory slot. Note also that the
7076 + * folding used here must match that used in stat()
7077 + * or path finding programs that do read() on
7078 + * directories will fail.
7082 + * This appears to match what SCO does for
7083 + * reads on a directory with long inodes.
7085 + if ((u_long)de->d_ino > 0xfffe) {
7086 + if (put_user(0xfffe, buf+posn))
7089 + if (put_user((short)de->d_ino, buf+posn))
7094 + * This attempts to match the way stat and
7095 + * getdents fold long inodes to shorts.
7097 + if ((u_long)de->d_ino & 0xffff ) {
7098 + if (put_user((u_long)de->d_ino & 0xffff, buf+posn))
7101 + if (put_user(0xfffe, buf+posn))
7106 + if (copy_to_user(buf+posn, p, de->d_namlen))
7110 + * Ensure that filenames that don't fill the array
7111 + * completely are null filled.
7113 + for (; de->d_namlen < 14; de->d_namlen++) {
7114 + if (put_user('\0', buf+posn+de->d_namlen))
7120 + free_page((u_long)de);
7124 + * If we've put something in the buffer return the byte count
7125 + * otherwise return the error status.
7127 + return (posn ? posn : error);
7131 + free_page((u_long)de);
7138 + * We could use Linux read if there wouldn't be the
7139 + * read on directory issue..
7142 +abi_read(int fd, char *buf, int count)
7146 + error = sys_read(fd, buf, count);
7147 + if (error == -EISDIR)
7148 + error = abi_read_dir(fd, buf, count);
7153 + * Linux doesn't allow trailing slashes in mkdir.
7154 + * Old UNIX apps expect it work anyway, so we have
7155 + * to get rid of them here.
7158 +abi_mkdir(const char *fname, int mode)
7164 + tmp = getname(fname);
7166 + return PTR_ERR(tmp);
7168 + for (p = tmp; *p; p++);
7175 + error = sys_mkdir(tmp, mode);
7183 + * Unlike UNIX Linux doesn't allow to create
7184 + * directories using mknod.
7187 +svr4_mknod(char *filename, svr4_o_mode_t mode, svr4_o_dev_t dev)
7189 + if ((mode & 0017000) == 0040000)
7190 + return abi_mkdir(filename, mode);
7191 + return sys_mknod(filename, mode,
7192 + MKDEV (SVR4_O_MAJOR (dev), SVR4_O_MINOR (dev)));
7196 +svr4_do_xmknod(char *filename, svr4_mode_t mode, svr4_dev_t dev)
7198 + u_int minor = SVR4_MINOR (dev), major = SVR4_MAJOR (dev);
7200 + if (minor > 0xff || major > 0xff)
7202 + return svr4_mknod(filename, mode, SVR4_O_MKDEV (major, minor));
7206 +enum {SVR4_mknod = 1, SVR4_xmknod = 2};
7209 +svr4_xmknod(int vers, char *filename, svr4_mode_t mode, svr4_dev_t dev)
7213 + return svr4_mknod(filename, mode, dev);
7215 + return svr4_do_xmknod(filename, mode, dev);
7218 +#if defined(CONFIG_ABI_TRACE)
7219 + abi_trace(ABI_TRACE_API, "xmknod version %d not supported\n", vers);
7225 +abi_kill(int pid, int sig)
7227 + int insig, outsig;
7229 + insig = (sig & 0xff);
7230 + outsig = current_thread_info()->exec_domain->signal_map[insig];
7232 +#if defined(CONFIG_ABI_TRACE)
7233 + abi_trace(ABI_TRACE_SIGNAL, "kill: %d -> %d\n", insig, outsig);
7236 + return sys_kill(pid, outsig);
7239 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
7240 +EXPORT_SYMBOL(abi_brk);
7241 +EXPORT_SYMBOL(abi_exec);
7242 +EXPORT_SYMBOL(abi_fork);
7243 +EXPORT_SYMBOL(abi_getgid);
7244 +EXPORT_SYMBOL(abi_getpid);
7245 +EXPORT_SYMBOL(abi_getuid);
7246 +EXPORT_SYMBOL(abi_kill);
7247 +EXPORT_SYMBOL(abi_mkdir);
7248 +EXPORT_SYMBOL(abi_pipe);
7249 +EXPORT_SYMBOL(abi_procids);
7250 +EXPORT_SYMBOL(abi_read);
7251 +EXPORT_SYMBOL(abi_time);
7252 +EXPORT_SYMBOL(abi_wait);
7253 +EXPORT_SYMBOL(svr4_mknod);
7254 +EXPORT_SYMBOL(svr4_xmknod);
7256 diff -Nur kernel-source-2.6.16.orig/abi/svr4/mmap.c kernel-source-2.6.16/abi/svr4/mmap.c
7257 --- kernel-source-2.6.16.orig/abi/svr4/mmap.c 1970-01-01 10:00:00.000000000 +1000
7258 +++ kernel-source-2.6.16/abi/svr4/mmap.c 2006-04-27 18:50:24.000000000 +1000
7261 + * Copyright (c) 2001 Christoph Hellwig.
7262 + * All rights reserved.
7264 + * This program is free software; you can redistribute it and/or modify
7265 + * it under the terms of the GNU General Public License as published by
7266 + * the Free Software Foundation; either version 2 of the License, or
7267 + * (at your option) any later version.
7269 + * This program is distributed in the hope that it will be useful,
7270 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7271 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7272 + * GNU General Public License for more details.
7274 + * You should have received a copy of the GNU General Public License
7275 + * along with this program; if not, write to the Free Software
7276 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7282 + * Support for mmap on SVR4 and derivates.
7284 +#include <linux/mm.h>
7285 +#include <linux/errno.h>
7286 +#include <linux/file.h>
7287 +#include <linux/mman.h>
7288 +#include <linux/module.h>
7290 +#include <asm/uaccess.h>
7292 +#include <abi/svr4/mman.h>
7293 +#include <abi/svr4/types.h>
7295 +#include <abi/util/trace.h>
7299 +svr4_mmap(u_long addr, size_t len, int prot, int flags, int fd, svr4_off_t off)
7301 + struct file *file = NULL;
7304 + if (flags & SVR4_MAP_UNIMPL) {
7305 +#if defined(CONFIG_ABI_TRACE)
7306 + abi_trace(ABI_TRACE_UNIMPL,
7307 + "unsupported mmap flags: 0x%x\n", flags & SVR4_MAP_UNIMPL);
7309 + flags &= ~SVR4_MAP_UNIMPL;
7312 + if (!(flags & SVR4_MAP_ANONYMOUS)) {
7317 + flags &= ~SVR4_MAP_ANONYMOUS;
7318 + flags |= MAP_ANONYMOUS;
7321 + down_write(¤t->mm->mmap_sem);
7322 + mapaddr = do_mmap(file, addr, len, prot, flags, off);
7323 + up_write(¤t->mm->mmap_sem);
7332 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
7333 +EXPORT_SYMBOL(svr4_mmap);
7335 diff -Nur kernel-source-2.6.16.orig/abi/svr4/open.c kernel-source-2.6.16/abi/svr4/open.c
7336 --- kernel-source-2.6.16.orig/abi/svr4/open.c 1970-01-01 10:00:00.000000000 +1000
7337 +++ kernel-source-2.6.16/abi/svr4/open.c 2006-04-27 18:50:24.000000000 +1000
7340 + * Copyright (c) 1993 Joe Portman (baron@hebron.connected.com)
7341 + * Copyright (c) 1993, 1994 Drew Sullivan (re-worked for iBCS2)
7342 + * Copyright (c) 2000 Christoph Hellwig (rewrote lookup-related code)
7347 +#include <linux/config.h>
7348 +#include <linux/module.h>
7350 +#include <linux/vfs.h>
7351 +#include <linux/types.h>
7352 +#include <linux/utime.h>
7353 +#include <linux/errno.h>
7354 +#include <linux/fcntl.h>
7355 +#include <linux/stat.h>
7356 +#include <linux/string.h>
7357 +#include <linux/sched.h>
7358 +#include <linux/kernel.h>
7359 +#include <linux/signal.h>
7360 +#include <linux/tty.h>
7361 +#include <linux/time.h>
7362 +#include <linux/slab.h>
7363 +#include <linux/socket.h>
7364 +#include <linux/net.h>
7365 +#include <linux/un.h>
7366 +#include <linux/file.h>
7367 +#include <linux/dirent.h>
7368 +#include <linux/personality.h>
7369 +#include <linux/syscalls.h>
7370 +#include <linux/namei.h>
7372 +#include <asm/uaccess.h>
7373 +#include <asm/bitops.h>
7375 +#include <asm/abi_machdep.h>
7376 +#include <abi/svr4/statfs.h>
7377 +#include <abi/svr4/sysent.h>
7379 +#include <abi/util/trace.h>
7380 +#include <abi/util/map.h>
7384 +copy_kstatfs(struct svr4_statfs *buf, struct kstatfs *st)
7386 + struct svr4_statfs ibcsstat;
7388 + ibcsstat.f_type = st->f_type;
7389 + ibcsstat.f_bsize = st->f_bsize;
7390 + ibcsstat.f_frsize = 0;
7391 + ibcsstat.f_blocks = st->f_blocks;
7392 + ibcsstat.f_bfree = st->f_bfree;
7393 + ibcsstat.f_files = st->f_files;
7394 + ibcsstat.f_ffree = st->f_ffree;
7395 + memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
7396 + memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
7398 + /* Finally, copy it to the user's buffer */
7399 + return copy_to_user(buf, &ibcsstat, sizeof(struct svr4_statfs));
7402 +int svr4_statfs(const char * path, struct svr4_statfs * buf, int len, int fstype)
7404 + struct svr4_statfs ibcsstat;
7406 + if (len > (int)sizeof(struct svr4_statfs))
7410 + struct nameidata nd;
7413 + error = user_path_walk(path, &nd);
7415 + struct kstatfs tmp;
7417 + error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
7418 + if (!error && copy_kstatfs(buf, &tmp))
7420 + path_release(&nd);
7427 + * Linux can't stat unmounted filesystems so we
7428 + * simply lie and claim 500MB of 8GB is free. Sorry.
7430 + ibcsstat.f_bsize = 1024;
7431 + ibcsstat.f_frsize = 0;
7432 + ibcsstat.f_blocks = 8 * 1024 * 1024; /* 8GB */
7433 + ibcsstat.f_bfree = 500 * 1024; /* 100MB */
7434 + ibcsstat.f_files = 60000;
7435 + ibcsstat.f_ffree = 50000;
7436 + memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
7437 + memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
7439 + /* Finally, copy it to the user's buffer */
7440 + return copy_to_user(buf, &ibcsstat, len) ? -EFAULT : 0;
7443 +int svr4_fstatfs(unsigned int fd, struct svr4_statfs * buf, int len, int fstype)
7445 + struct svr4_statfs ibcsstat;
7447 + if (len > (int)sizeof(struct svr4_statfs))
7451 + struct file * file;
7452 + struct kstatfs tmp;
7459 + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
7460 + if (!error && copy_kstatfs(buf, &tmp))
7469 + * Linux can't stat unmounted filesystems so we
7470 + * simply lie and claim 500MB of 8GB is free. Sorry.
7472 + ibcsstat.f_bsize = 1024;
7473 + ibcsstat.f_frsize = 0;
7474 + ibcsstat.f_blocks = 8 * 1024 * 1024; /* 8GB */
7475 + ibcsstat.f_bfree = 500 * 1024; /* 100MB */
7476 + ibcsstat.f_files = 60000;
7477 + ibcsstat.f_ffree = 50000;
7478 + memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
7479 + memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
7481 + /* Finally, copy it to the user's buffer */
7482 + return copy_to_user(buf, &ibcsstat, len) ? -EFAULT : 0;
7485 +int svr4_open(const char *fname, int flag, int mode)
7488 + return sys_open(fname, map_flags(flag, fl_svr4_to_linux), mode);
7492 + struct file *file;
7493 + mm_segment_t old_fs;
7495 + struct sockaddr_un addr;
7497 + fd = sys_open(fname, map_flags(flag, fl_svr4_to_linux), mode);
7501 + /* Sometimes a program may open a pathname which it expects
7502 + * to be a named pipe (or STREAMS named pipe) when the
7503 + * Linux domain equivalent is a Unix domain socket. (e.g.
7504 + * UnixWare uses a STREAMS named pipe /dev/X/Nserver.0 for
7505 + * X :0 but Linux uses a Unix domain socket /tmp/.X11-unix/X0)
7506 + * It isn't enough just to make the symlink because you cannot
7507 + * open() a socket and read/write it. If we spot the error we can
7508 + * switch to socket(), connect() and things will likely work
7509 + * as expected however.
7513 + return fd; /* Huh?!? */
7514 + if (!S_ISSOCK(file->f_dentry->d_inode->i_mode)) {
7521 + args[0] = AF_UNIX;
7522 + args[1] = SOCK_STREAM;
7524 + old_fs = get_fs();
7526 + fd = sys_socketcall(SYS_SOCKET, args);
7531 + p = getname(fname);
7534 + return PTR_ERR(p);
7536 + if (strlen(p) >= UNIX_PATH_MAX) {
7541 + addr.sun_family = AF_UNIX;
7542 + strcpy(addr.sun_path, p);
7546 + args[1] = (int)&addr;
7547 + args[2] = sizeof(struct sockaddr_un);
7549 + error = sys_socketcall(SYS_CONNECT, args);
7560 +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
7561 +#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
7563 +struct svr4_getdents_callback {
7564 + struct dirent * current_dir;
7565 + struct dirent * previous;
7570 +static int svr4_filldir(void * __buf, const char * name, int namlen,
7571 + loff_t offset, ino_t ino, unsigned int d_type)
7573 + struct dirent * dirent;
7574 + struct svr4_getdents_callback * buf = (struct svr4_getdents_callback *) __buf;
7575 + int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
7577 + buf->error = -EINVAL; /* only used if we fail.. */
7578 + if (reclen > buf->count)
7581 + dirent = buf->previous;
7583 + put_user(offset, &dirent->d_off);
7584 + dirent = buf->current_dir;
7585 + buf->previous = dirent;
7587 + if (is_cur_personality_flag(PERF_SHORT_INODE)) {
7588 + /* read() on a directory only handles
7589 + * short inodes but cannot use 0 as that
7590 + * indicates an empty directory slot.
7591 + * Therefore stat() must also fold
7592 + * inode numbers avoiding 0. Which in
7593 + * turn means that getdents() must fold
7594 + * inodes avoiding 0 - if the program
7595 + * was built in a short inode environment.
7596 + * If we have short inodes in the dirent
7597 + * we also have a two byte pad so we
7598 + * can let the high word fall in the pad.
7599 + * This makes it a little more robust if
7600 + * we guessed the inode size wrong.
7602 + if (!((unsigned long)dirent->d_ino & 0xffff))
7603 + dirent->d_ino = 0xfffffffe;
7606 + put_user(ino, &dirent->d_ino);
7607 + put_user(reclen, &dirent->d_reclen);
7608 + if (copy_to_user(dirent->d_name, name, namlen))
7610 + put_user(0, dirent->d_name + namlen);
7611 + { char *ptr = (char *)dirent;
7613 + dirent = (struct dirent *)ptr;
7615 + buf->current_dir = dirent;
7616 + buf->count -= reclen;
7622 +int svr4_getdents(int fd, char *dirent, int count)
7624 + struct file * file;
7625 + struct dirent * lastdirent;
7626 + struct svr4_getdents_callback buf;
7634 + buf.current_dir = (struct dirent *) dirent;
7635 + buf.previous = NULL;
7636 + buf.count = count;
7638 + error = vfs_readdir(file, svr4_filldir, &buf);
7641 + error = buf.error;
7642 + lastdirent = buf.previous;
7644 + put_user(file->f_pos, &lastdirent->d_off);
7645 + error = count - buf.count;
7655 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
7656 +EXPORT_SYMBOL(svr4_fstatfs);
7657 +EXPORT_SYMBOL(svr4_getdents);
7658 +EXPORT_SYMBOL(svr4_open);
7659 +EXPORT_SYMBOL(svr4_statfs);
7661 diff -Nur kernel-source-2.6.16.orig/abi/svr4/signal.c kernel-source-2.6.16/abi/svr4/signal.c
7662 --- kernel-source-2.6.16.orig/abi/svr4/signal.c 1970-01-01 10:00:00.000000000 +1000
7663 +++ kernel-source-2.6.16/abi/svr4/signal.c 2006-04-27 18:50:24.000000000 +1000
7666 + * signal.c - signal emulation code
7668 + * This module does not go through the normal processing routines for
7669 + * ibcs. The reason for this is that for most events, the return is a
7670 + * procedure address for the previous setting. This procedure address
7671 + * may be negative which is not an error. Therefore, the return processing
7672 + * for standard functions is skipped by declaring this routine as a "special"
7673 + * module for the decoder and dealing with the register settings directly.
7675 + * Please consider this closely if you plan on changing this mode.
7681 +#include <linux/module.h>
7682 +#include <linux/errno.h>
7683 +#include <linux/sched.h>
7684 +#include <linux/kernel.h>
7685 +#include <linux/mm.h>
7686 +#include <linux/stddef.h>
7687 +#define __KERNEL_SYSCALLS__
7688 +#include <linux/unistd.h>
7689 +#include <linux/ptrace.h>
7690 +#include <linux/fcntl.h>
7691 +#include <linux/personality.h>
7692 +#include <linux/fs.h>
7693 +#include <linux/sys.h>
7694 +#include <linux/signal.h>
7695 +#include <linux/syscalls.h>
7697 +#include <asm/system.h>
7698 +#include <asm/uaccess.h>
7700 +#include <abi/util/map.h>
7701 +#include <abi/util/errno.h>
7702 +#include <abi/util/trace.h>
7705 +#define SIG_HOLD ((__sighandler_t)2) /* hold signal */
7707 +#include <abi/signal.h>
7708 +#include <abi/svr4/sigaction.h>
7710 +typedef void (*pfn) (void); /* Completion function */
7713 + * Parameters to the signal functions have a common stack frame. This
7714 + * defines the stack frame.
7716 +#define SIGNAL_NUMBER(regp) get_syscall_parameter((regp), 0)
7717 +#define HIDDEN_PARAM(regp) (SIGNAL_NUMBER((regp)) & ~0xFF)
7718 +#define SECOND_PARAM(regp) get_syscall_parameter((regp), 1)
7719 +#define THIRD_PARAM(regp) ((u_long)(regp)->edx)
7721 +/* Return a mask that includes SIG only. */
7722 +#define __sigmask(sig) (1 << ((sig) - 1))
7723 +#define _S(nr) (1 << ((nr) - 1))
7724 +#define _BLOCKABLE (~(_S(IBCS_SIGKILL) | _S(IBCS_SIGSTOP)))
7727 +static __inline int
7728 +abi_signal_suspend(struct pt_regs *regs, old_sigset_t mask)
7730 + return signal_suspend(regs, mask);
7735 +deactivate_signal(struct task_struct *task, int signum)
7737 + spin_lock_irq(&task->sighand->siglock);
7738 + sigdelset(&task->pending.signal, signum);
7739 + recalc_sigpending();
7740 + spin_unlock_irq(&task->sighand->siglock);
7744 + * Translate the signal number to the corresponding item for Linux.
7746 +static __inline int
7747 +abi_mapsig(int sig)
7749 + if ((u_int)sig >= NSIGNALS)
7751 + return (current_thread_info()->exec_domain->signal_map[sig]);
7755 + * Either we want this static or in a header...
7758 +abi_signo(struct pt_regs *regp, int *sigp)
7762 + value = abi_mapsig(SIGNAL_NUMBER(regp) & 0xFF);
7763 + if (value == -1) {
7764 + set_error(regp, iABI_errors(EINVAL));
7773 + * Process the signal() function from iBCS
7775 + * This version appeared in "Advanced Programming in the Unix Environment"
7776 + * by W. Richard Stevens, page 298.
7779 +abi_sig_handler(struct pt_regs *regp, int sig,
7780 + __sighandler_t handler, int oneshot)
7782 + struct sigaction act, oact;
7786 + sigemptyset(&act.sa_mask);
7787 + act.sa_restorer = NULL;
7788 + act.sa_handler = handler;
7792 + act.sa_flags |= SA_ONESHOT | SA_NOMASK;
7796 + error = sys_rt_sigaction(sig, &act, &oact, sizeof(sigset_t));
7800 + set_error(regp, iABI_errors(-error));
7802 + set_result(regp, (int)oact.sa_handler);
7807 + * Process the signal() function from iBCS
7810 +abi_signal(struct pt_regs *regp)
7812 + __sighandler_t vec;
7815 + if (abi_signo(regp, &sig)) {
7816 + vec = (__sighandler_t)SECOND_PARAM(regp);
7817 + abi_sig_handler(regp, sig, vec, 1);
7824 + * Process the SVR4 sigset function.
7826 + * This is basically the same as the signal() routine with the
7827 + * exception that it will accept a SIG_HOLD parameter.
7829 + * A SIG_HOLD will defer the processing of the signal until a sigrelse()
7830 + * function is called or the signal handler is set again using this function.
7833 +abi_sigset(struct pt_regs *regp)
7836 + sigset_t newmask, oldmask;
7837 + __sighandler_t vec;
7842 + if (abi_signo(regp, &sig) == 0)
7845 + vec = (__sighandler_t)SECOND_PARAM(regp);
7846 + action = SIG_BLOCK;
7848 + if (vec != SIG_HOLD) {
7849 + action = SIG_UNBLOCK;
7850 + deactivate_signal(current, sig);
7851 + abi_sig_handler(regp, sig, vec, 0);
7855 + * Process the signal hold/unhold function.
7857 + sigemptyset(&newmask);
7858 + sigaddset(&newmask, sig);
7862 + error = sys_rt_sigprocmask(action, &newmask, &oldmask,
7863 + sizeof(sigset_t));
7867 + set_error(regp, iABI_errors(-error));
7873 + * Process the iBCS sighold function.
7875 + * Suspend the signal from future recognition.
7878 +abi_sighold(struct pt_regs *regp)
7880 + sigset_t newmask, oldmask;
7884 + if (!abi_signo(regp, &sig))
7887 + sigemptyset(&newmask);
7888 + sigaddset(&newmask, sig);
7892 + error = sys_rt_sigprocmask(SIG_BLOCK, &newmask,
7893 + &oldmask, sizeof(sigset_t));
7897 + set_error(regp, iABI_errors(-error));
7901 + * Process the iBCS sigrelse.
7903 + * Re-enable the signal processing from a previously suspended
7904 + * signal. This may have been done by calling the sighold() function
7905 + * or a longjmp() during the signal processing routine. If you do a
7906 + * longjmp() function then it is expected that you will call sigrelse
7907 + * or set the handler again using sigset before going on with the program.
7910 +abi_sigrelse(struct pt_regs *regp)
7912 + sigset_t newmask, oldmask;
7916 + if (!abi_signo(regp, &sig))
7919 + sigemptyset(&newmask);
7920 + sigaddset(&newmask, sig);
7924 + error = sys_rt_sigprocmask(SIG_UNBLOCK, &newmask,
7925 + &oldmask, sizeof(sigset_t));
7929 + set_error(regp, iABI_errors(-error));
7933 + * Process the iBCS sigignore
7935 + * This is basically a signal (...,SIG_IGN) call.
7938 +abi_sigignore(struct pt_regs *regp)
7940 + struct sigaction act, oact;
7944 + if (!abi_signo(regp, &sig))
7947 + sigemptyset(&act.sa_mask);
7949 + act.sa_restorer = NULL;
7950 + act.sa_handler = SIG_IGN;
7955 + error = sys_rt_sigaction(sig, &act, &oact, sizeof(sigset_t));
7959 + set_error(regp, iABI_errors(-error));
7963 + * Process the iBCS sigpause
7965 + * Wait for the signal indicated to arrive before resuming the
7966 + * processing. I do not know if the signal is processed first using
7967 + * the normal event processing before the return. If someone can
7968 + * shed some light on this then please correct this code. I block
7969 + * the signal and look for it to show up in the pending list.
7972 +abi_sigpause(struct pt_regs *regs)
7974 + old_sigset_t newset;
7977 + if (!abi_signo(regs, &sig))
7979 + newset = (~0UL) & (1UL << (sig-1));
7981 + if ((error = abi_signal_suspend(regs, newset) < 0))
7982 + set_error(regs, iABI_errors(-error));
7986 + * This is the service routine for the syscall #48 (signal funcs).
7988 + * Examine the request code and branch on the request to the appropriate
7992 +abi_sigfunc(struct pt_regs *regp)
7994 + int sig_type = (int)HIDDEN_PARAM(regp);
7996 +#if defined(CONFIG_ABI_TRACE)
7997 + abi_trace(ABI_TRACE_SIGNAL|ABI_TRACE_SIGNAL_F,
7998 + "sig%s(%ld, 0x%08lx, 0x%08lx)\n",
7999 + sig_type == 0 ? "nal"
8000 + : (sig_type == 0x100 ? "set"
8001 + : (sig_type == 0x200 ? "hold"
8002 + : (sig_type == 0x400 ? "relse"
8003 + : (sig_type == 0x800 ? "ignore"
8004 + : (sig_type == 0x1000 ? "pause"
8006 + SIGNAL_NUMBER(regp) & 0xff,
8007 + SECOND_PARAM(regp),
8008 + THIRD_PARAM(regp));
8011 + regp->eflags &= ~1;
8014 + switch (sig_type) {
8022 + abi_sighold(regp);
8025 + abi_sigrelse(regp);
8028 + abi_sigignore(regp);
8031 + abi_sigpause(regp);
8034 + set_error(regp, EINVAL);
8036 +#if defined(CONFIG_ABI_TRACE)
8037 + abi_trace(ABI_TRACE_SIGNAL|ABI_TRACE_SIGNAL_F,
8038 + "sigfunc(%x, %ld, %lx, %lx) unsupported\n",
8039 + sig_type, SIGNAL_NUMBER(regp),
8040 + SECOND_PARAM(regp), THIRD_PARAM(regp));
8045 +#if defined(CONFIG_ABI_TRACE)
8046 + abi_trace(ABI_TRACE_SIGNAL|ABI_TRACE_SIGNAL_F,
8047 + "returns %d\n", get_result(regp));
8053 + * This function is used to handle the sigaction call from SVr4 binaries.
8055 + * If anyone else uses this, this function needs to be modified since the
8056 + * order and size of the ibcs_sigaction structure is different in ibcs
8057 + * and the SVr4 ABI
8060 +abi_sigaction(int abi_signum, const struct abi_sigaction *action,
8061 + struct abi_sigaction *oldaction)
8063 + struct abi_sigaction new_sa, old_sa;
8064 + struct sigaction nsa, osa;
8068 + signo = abi_mapsig(abi_signum);
8073 + if (!access_ok(VERIFY_WRITE, oldaction,
8074 + sizeof(struct abi_sigaction)))
8079 + error = copy_from_user(&new_sa, action,
8080 + sizeof(struct abi_sigaction));
8083 + nsa.sa_restorer = NULL;
8084 + nsa.sa_handler = new_sa.sa_handler;
8085 + nsa.sa_mask = map_sigvec_to_kernel(new_sa.sa_mask,
8086 + current_thread_info()->exec_domain->signal_map);
8087 + if (new_sa.sa_flags & ABI_SA_ONSTACK)
8088 + nsa.sa_flags |= SA_ONSTACK;
8089 + if (new_sa.sa_flags & ABI_SA_RESTART)
8090 + nsa.sa_flags |= SA_RESTART;
8091 + if (new_sa.sa_flags & ABI_SA_NODEFER)
8092 + nsa.sa_flags |= SA_NODEFER;
8093 + if (new_sa.sa_flags & ABI_SA_RESETHAND)
8094 + nsa.sa_flags |= SA_RESETHAND;
8095 + if (new_sa.sa_flags & ABI_SA_NOCLDSTOP)
8096 + nsa.sa_flags |= SA_NOCLDSTOP;
8097 + if (new_sa.sa_flags & ABI_SA_NOCLDWAIT)
8098 + nsa.sa_flags |= SA_NOCLDWAIT;
8103 + error = sys_rt_sigaction(signo, action ? &nsa : NULL,
8104 + oldaction ? &osa : NULL, sizeof(sigset_t));
8107 + if (error || !oldaction)
8110 + old_sa.sa_handler = osa.sa_handler;
8111 + old_sa.sa_mask = map_sigvec_from_kernel(osa.sa_mask,
8112 + current_thread_info()->exec_domain->signal_invmap);
8113 + old_sa.sa_flags = 0;
8114 + if (osa.sa_flags & SA_ONSTACK)
8115 + old_sa.sa_flags |= ABI_SA_ONSTACK;
8116 + if (osa.sa_flags & SA_RESTART)
8117 + old_sa.sa_flags |= ABI_SA_RESTART;
8118 + if (osa.sa_flags & SA_NODEFER)
8119 + old_sa.sa_flags |= ABI_SA_NODEFER;
8120 + if (osa.sa_flags & SA_RESETHAND)
8121 + old_sa.sa_flags |= ABI_SA_RESETHAND;
8122 + if (osa.sa_flags & SA_NOCLDSTOP)
8123 + old_sa.sa_flags |= ABI_SA_NOCLDSTOP;
8124 + if (osa.sa_flags & SA_NOCLDWAIT)
8125 + old_sa.sa_flags |= ABI_SA_NOCLDWAIT;
8127 + * We already did the verify_area at the beginning.
8129 + if (__copy_to_user(oldaction, &old_sa, sizeof(struct abi_sigaction)))
8135 +static short int howcnv[] = {SIG_SETMASK, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK};
8138 +abi_sigprocmask(int how, u_long *abinset, u_long *abioset)
8140 + sigset_t new_set, *nset = NULL;
8141 + sigset_t old_set, *oset = NULL;
8142 + u_long new_set_abi, old_set_abi;
8147 + get_user(new_set_abi, abinset);
8148 + new_set = map_sigvec_to_kernel(new_set_abi,
8149 + current_thread_info()->exec_domain->signal_map);
8158 + error = sys_rt_sigprocmask(howcnv[how], nset, oset, sizeof(sigset_t));
8161 + if (!error && abioset) {
8162 + old_set_abi = map_sigvec_from_kernel(old_set,
8163 + current_thread_info()->exec_domain->signal_invmap);
8164 + put_user(old_set_abi, abioset);
8171 +abi_sigsuspend(struct pt_regs *regs)
8173 + u_long abi_mask, *abi_maskp;
8174 + old_sigset_t mask;
8176 + abi_maskp = (u_long *)SIGNAL_NUMBER(regs);
8177 + if (get_user(abi_mask, abi_maskp))
8180 + mask = map_bitvec(abi_mask, current_thread_info()->exec_domain->signal_map);
8181 +#if defined(CONFIG_ABI_TRACE)
8182 + abi_trace(ABI_TRACE_SIGNAL,
8183 + "sigsuspend(mask = %lx)\n", mask);
8185 + return abi_signal_suspend(regs, mask);
8188 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
8189 +EXPORT_SYMBOL(abi_sigaction);
8190 +EXPORT_SYMBOL(abi_sigfunc);
8191 +EXPORT_SYMBOL(abi_sigprocmask);
8192 +EXPORT_SYMBOL(abi_sigsuspend);
8193 +EXPORT_SYMBOL(deactivate_signal);
8195 diff -Nur kernel-source-2.6.16.orig/abi/svr4/socket.c kernel-source-2.6.16/abi/svr4/socket.c
8196 --- kernel-source-2.6.16.orig/abi/svr4/socket.c 1970-01-01 10:00:00.000000000 +1000
8197 +++ kernel-source-2.6.16/abi/svr4/socket.c 2006-04-27 18:50:24.000000000 +1000
8200 + * Copyright (c) 1994,1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
8205 +#include <linux/module.h>
8206 +#include <linux/fs.h>
8207 +#include <linux/mm.h>
8208 +#include <linux/net.h>
8209 +#include <linux/personality.h>
8210 +#include <linux/ptrace.h>
8211 +#include <linux/socket.h>
8212 +#include <linux/syscalls.h>
8213 +#include <linux/types.h>
8214 +#include <asm/uaccess.h>
8215 +#include <asm/ioctls.h>
8217 +#include <abi/util/map.h>
8218 +#include <abi/util/trace.h>
8219 +#include <abi/util/socket.h>
8223 +abi_do_setsockopt(unsigned long *sp)
8226 + int level, optname;
8228 + if (!access_ok(VERIFY_READ,
8229 + ((unsigned long *)sp),
8233 + get_user(level, ((unsigned long *)sp)+1);
8234 + get_user(optname, ((unsigned long *)sp)+2);
8236 +#if defined(CONFIG_ABI_TRACE)
8237 + if (abi_traced(ABI_TRACE_STREAMS|ABI_TRACE_SOCKSYS)) {
8238 + u_long optval, optlen;
8240 + get_user(optval, ((u_long *)sp) + 3);
8241 + get_user(optlen, ((u_long *)sp) + 4);
8242 + __abi_trace("setsockopt level=%d, optname=%d, "
8243 + "optval=0x%08lx, optlen=0x%08lx\n",
8244 + level, optname, optval, optlen);
8249 + case 0: /* IPPROTO_IP aka SOL_IP */
8250 + /* This is correct for the SCO family. Hopefully
8251 + * it is correct for other SYSV...
8256 + if (optname > 4) {
8258 + if (optname <= 33)
8260 + if (optname < 32 || optname > 36)
8263 + put_user(optname, ((unsigned long *)sp)+2);
8267 + put_user(SOL_SOCKET, ((unsigned long *)sp)+1);
8268 + optname = map_value(current_thread_info()->exec_domain->sockopt_map, optname, 0);
8269 + put_user(optname, ((unsigned long *)sp)+2);
8271 + switch (optname) {
8273 + unsigned long optlen;
8275 + /* SO_LINGER takes a struct linger
8276 + * as the argument but some code
8277 + * uses an int and expects to get
8278 + * away without an error. Sigh...
8280 + get_user(optlen, ((unsigned long *)sp)+4);
8281 + if (optlen == sizeof(int))
8286 + /* The following are not currently implemented
8287 + * under Linux so we must fake them in
8288 + * reasonable ways. (Only SO_PROTOTYPE is
8289 + * documented in SCO's man page).
8291 + case SO_PROTOTYPE:
8295 + return -ENOPROTOOPT;
8297 + case SO_USELOOPBACK:
8302 + /* The following are not currenty implemented
8303 + * under Linux and probably aren't settable
8306 + case SO_IMASOCKET:
8307 + return -ENOPROTOOPT;
8311 + /* FIXME: We assume everything else uses the
8312 + * same level and option numbers. This is true
8313 + * for IPPROTO_TCP(/SOL_TCP) and TCP_NDELAY
8314 + * but is known to be incorrect for other
8315 + * potential options :-(.
8320 + return sys_socketcall(SYS_SETSOCKOPT, sp);
8324 +abi_do_getsockopt(unsigned long *sp)
8327 + int level, optname;
8330 + unsigned long *ulptr;
8332 + if (!access_ok(VERIFY_READ,
8333 + ((unsigned long *)sp),
8337 + ulptr = (unsigned long *)&level;
8338 + get_user(*ulptr, ((unsigned long *)sp)+1);
8339 + ulptr = (unsigned long *)&optname;
8340 + get_user(*ulptr, ((unsigned long *)sp)+2);
8341 + ulptr = (unsigned long *)&optval;
8342 + get_user(*ulptr, ((unsigned long *)sp)+3);
8343 + ulptr = (unsigned long *)&optlen;
8344 + get_user(*ulptr, ((unsigned long *)sp)+4);
8346 +#if defined(CONFIG_ABI_TRACE)
8347 + if (abi_traced(ABI_TRACE_STREAMS|ABI_TRACE_SOCKSYS)) {
8350 + get_user(l, optlen);
8351 + __abi_trace("getsockopt level=%d, optname=%d, optval=0x%08lx, "
8352 + "optlen=0x%08lx[%ld]\n", level, optname,
8353 + (u_long)optval, (u_long)optlen, l);
8358 + case 0: /* IPPROTO_IP aka SOL_IP */
8359 + /* This is correct for the SCO family. Hopefully
8360 + * it is correct for other SYSV...
8365 + if (optname > 4) {
8367 + if (optname <= 33)
8369 + if (optname < 32 || optname > 36)
8372 + put_user(optname, ((unsigned long *)sp)+2);
8376 + put_user(SOL_SOCKET, ((unsigned long *)sp)+1);
8377 + optname = map_value(current_thread_info()->exec_domain->sockopt_map, optname, 0);
8378 + put_user(optname, ((unsigned long *)sp)+2);
8380 + switch (optname) {
8384 + /* SO_LINGER takes a struct linger
8385 + * as the argument but some code
8386 + * uses an int and expects to get
8387 + * away without an error. Sigh...
8389 + get_user(l, optlen);
8390 + if (l == sizeof(int)) {
8391 + put_user(0, (long *)optval);
8397 + /* The following are not currently implemented
8398 + * under Linux so we must fake them in
8399 + * reasonable ways. (Only SO_PROTOTYPE is
8400 + * documented in SCO's man page).
8402 + case SO_PROTOTYPE: {
8403 + unsigned long len;
8404 + error = get_user(len, optlen);
8407 + if (len < sizeof(long))
8410 + if (access_ok(VERIFY_WRITE,
8413 + put_user(0, (long *)optval);
8414 + put_user(sizeof(long),
8424 + return -ENOPROTOOPT;
8426 + case SO_USELOOPBACK:
8429 + case SO_IMASOCKET: {
8430 + unsigned long len;
8431 + error = get_user(len, optlen);
8434 + if (len < sizeof(long))
8437 + if (access_ok(VERIFY_WRITE,
8440 + put_user(1, (long *)optval);
8441 + put_user(sizeof(long),
8450 + /* FIXME: We assume everything else uses the
8451 + * same level and option numbers. This is true
8452 + * for IPPROTO_TCP(/SOL_TCP) and TCP_NDELAY
8453 + * but is known to be incorrect for other
8454 + * potential options :-(.
8459 + return sys_socketcall(SYS_GETSOCKOPT, sp);
8461 diff -Nur kernel-source-2.6.16.orig/abi/svr4/sockio.c kernel-source-2.6.16/abi/svr4/sockio.c
8462 --- kernel-source-2.6.16.orig/abi/svr4/sockio.c 1970-01-01 10:00:00.000000000 +1000
8463 +++ kernel-source-2.6.16/abi/svr4/sockio.c 2006-04-27 18:50:24.000000000 +1000
8467 +#include <linux/config.h>
8468 +#include <linux/errno.h>
8469 +#include <linux/fs.h>
8470 +#include <linux/sched.h>
8471 +#include <linux/kernel.h>
8472 +#include <linux/sockios.h>
8473 +#include <linux/file.h>
8474 +#include <linux/slab.h>
8475 +#include <linux/syscalls.h>
8476 +#include <asm/uaccess.h>
8477 +#include <asm/ioctls.h>
8479 +#include <abi/stream.h>
8480 +#include <abi/tli.h>
8481 +#include <abi/socksys.h> /* for socksys_fdinit */
8483 +#include <abi/svr4/ioctl.h>
8484 +#include <abi/util/trace.h>
8488 + * Check if the inode belongs to /dev/socksys.
8490 +#define IS_SOCKSYS(ip) (MAJOR((ip)->i_rdev) == SOCKSYS_MAJOR)
8494 +i_nread(u_int fd, struct file *fp, struct inode *ip,
8495 + void *data, struct pt_regs *regs)
8499 + if (!access_ok(VERIFY_WRITE, data, sizeof(u_long))) {
8504 +#if !defined(CONFIG_ABI_XTI)
8505 + if (S_ISSOCK(ip->i_mode)) {
8506 + struct T_private *ti = Priv(fp);
8508 + if (IS_SOCKSYS(ip))
8509 + timod_update_socket(fd, fp, regs);
8511 + if (ti && ti->pfirst) {
8512 + put_user(ti->pfirst->length, (u_long *)data);
8514 + return 1; /* at least 1... (FIXME) */
8521 + error = sys_ioctl(fd, TIOCINQ, (long)data);
8522 + if (error == -EINVAL)
8527 + __get_user(error, (u_long *)data);
8535 +i_peek(u_int fd, struct file *fp, struct inode *ip,
8536 + void *data, struct pt_regs *regs)
8538 +#if !defined(CONFIG_ABI_XTI)
8542 + struct T_private *ti = Priv(fp);
8543 + struct T_primsg *tp;
8544 + struct strpeek buf, *uap = data;
8545 + int error = -EFAULT;
8547 + if (copy_from_user(&buf, uap, sizeof(buf)))
8551 + if (!S_ISSOCK(ip->i_mode))
8554 + if (IS_SOCKSYS(ip))
8555 + timod_update_socket(fd, fp, regs);
8557 + if (!ti || !ti->pfirst)
8562 + if (!buf.flags || buf.flags == tp->pri) {
8567 + if (buf.ctl.maxlen <= tp->length)
8568 + l = buf.ctl.maxlen;
8572 + if (copy_to_user(buf.ctl.buf,
8573 + ((char *)&tp->type) + ti->offset, l))
8576 + if (put_user(l, &uap->ctl.len))
8579 + if (buf.dat.maxlen >= 0 && put_user(0, &uap->dat.len))
8582 + if (put_user(tp->pri, &uap->flags))
8590 +#endif /* CONFIG_ABI_XTI */
8594 +i_str(u_int fd, struct file *fp, struct inode *ip,
8595 + void *data, struct pt_regs *regs)
8599 + * Unpack the ioctl data and forward as a normal
8600 + * ioctl. Timeouts are not handled (yet?).
8603 + int cmd, timeout, len;
8605 + } it, *uap = data;
8607 + if (copy_from_user(&it, uap, sizeof(struct strioctl)))
8609 + cmd = it.cmd >> 8;
8611 +#if defined(CONFIG_ABI_TRACE)
8612 + abi_trace(ABI_TRACE_STREAMS, "STREAMS I_STR ioctl(%d, 0x%08x, %p)\n",
8613 + fd, it.cmd, it.data);
8616 +#ifdef CONFIG_ABI_XTI
8618 + return timod_ioctl(regs, fd, it.cmd & 0xff, it.data, it.len,
8621 + return __svr4_ioctl(regs, fd, it.cmd, it.data);
8625 +svr4_stream_ioctl(struct pt_regs *regs, int fd, u_int cmd, caddr_t data)
8634 + ip = fp->f_dentry->d_inode;
8637 + * Special hack^H^Hndling for socksys fds
8639 + if (S_ISSOCK(ip->i_mode) == 0 && IS_SOCKSYS(ip)) {
8640 + error = socksys_fdinit(fd, 0, NULL, NULL);
8647 + ip = fp->f_dentry->d_inode;
8651 + case 001: /* I_NREAD */
8652 + return i_nread(fd, fp, ip, data, regs);
8654 + case 017: /* I_PEEK */
8655 + return i_peek(fd, fp, ip, data, regs);
8661 + case 010: /* I_STR */
8662 + return i_str(fd, fp, ip, data, regs);
8663 + case 002: { /* I_PUSH */
8666 + /* Get the name anyway to validate it. */
8667 + tmp = getname(data);
8669 + return PTR_ERR(tmp);
8671 +#if defined(CONFIG_ABI_TRACE)
8672 + abi_trace(ABI_TRACE_STREAMS,
8673 + "%d STREAMS I_PUSH %s\n", fd, tmp);
8679 + case 003: /* I_POP */
8680 +#if defined(CONFIG_ABI_TRACE)
8681 + abi_trace(ABI_TRACE_STREAMS, "%d STREAMS I_POP\n", fd);
8685 + case 005: /* I_FLUSH */
8688 + case 013: { /* I_FIND */
8691 + /* Get the name anyway to validate it. */
8692 + tmp = getname(data);
8694 + return PTR_ERR(tmp);
8696 +#if defined(CONFIG_ABI_TRACE)
8697 + abi_trace(ABI_TRACE_STREAMS,
8698 + "%d STREAMS I_FIND %s\n", fd, tmp);
8700 +#ifdef CONFIG_ABI_XTI
8701 + if (!strcmp(tmp, "timod")) {
8710 + /* FIXME: These are bogus. */
8711 + case 011: /* I_SETSIG */
8712 + return sys_ioctl(fd, FIOSETOWN, (long)current->pid);
8713 + case 012: /* I_GETSIG */
8714 + return sys_ioctl(fd, FIOGETOWN, (long)data);
8716 + case 020: /* I_FDINSERT */
8717 +#ifdef CONFIG_ABI_XTI
8718 + return stream_fdinsert(regs, fd,
8719 + (struct strfdinsert *)data);
8724 + case 004: /* I_LOOK */
8725 + case 006: /* I_SRDOPT */
8726 + case 007: /* I_GRDOPT */
8727 + case 014: /* I_LINK */
8728 + case 015: /* I_UNLINK */
8729 + case 021: /* I_SENDFD */
8730 + case 022: /* I_RECVFD */
8731 + case 023: /* I_SWROPT */
8732 + case 040: /* I_SETCLTIME */
8733 + return 0; /* Lie... */
8734 + case 042: /* I_CANPUT */
8736 + * Arg is the priority band in question. We only
8737 + * support one priority band so data must be 0.
8738 + * If the band is writable we should return 1, if
8739 + * the band is flow controlled we should return 0.
8744 + /* FIXME: How can we test if a write would block? */
8747 + case 024: /* I_GWROPT */
8748 + case 025: /* I_LIST */
8749 + case 026: /* I_PLINK */
8750 + case 027: /* I_PUNLINK */
8751 + case 030: /* I_SETEV */
8752 + case 031: /* I_GETEV */
8753 + case 032: /* I_STREV */
8754 + case 033: /* I_UNSTREV */
8755 + case 034: /* I_FLUSHBAND */
8756 + case 035: /* I_CKBAND */
8757 + case 036: /* I_GETBAND */
8758 + case 037: /* I_ATMARK */
8759 + case 041: /* I_GETCLTIME */
8760 + /* Unsupported - drop out. */
8767 + printk(KERN_ERR "iBCS: STREAMS ioctl 0%o unsupported\n", cmd);
8771 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
8772 +EXPORT_SYMBOL(svr4_stream_ioctl);
8774 diff -Nur kernel-source-2.6.16.orig/abi/svr4/socksys.c kernel-source-2.6.16/abi/svr4/socksys.c
8775 --- kernel-source-2.6.16.orig/abi/svr4/socksys.c 1970-01-01 10:00:00.000000000 +1000
8776 +++ kernel-source-2.6.16/abi/svr4/socksys.c 2006-04-27 18:50:24.000000000 +1000
8779 + * socksys.c - SVR4 /dev/socksys emulation
8781 + * Copyright (c) 1994-1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
8782 + * Copyright (c) 2001 Caldera Deutschland GmbH
8783 + * Copyright (c) 2001 Christoph Hellwig
8788 +#include <linux/config.h>
8789 +#include <linux/module.h>
8791 +#include <linux/types.h>
8792 +#include <linux/errno.h>
8793 +#include <linux/fs.h>
8794 +#include <linux/fcntl.h>
8795 +#include <linux/major.h>
8796 +#include <linux/kernel.h>
8797 +#include <linux/in.h>
8798 +#include <linux/net.h>
8799 +#include <linux/sched.h>
8800 +#include <linux/signal.h>
8801 +#include <linux/socket.h>
8802 +#include <net/sock.h>
8803 +#include <linux/slab.h>
8804 +#include <linux/mm.h>
8805 +#include <linux/un.h>
8806 +#include <linux/utsname.h>
8807 +#include <linux/time.h>
8808 +#include <linux/termios.h>
8809 +#include <linux/sys.h>
8810 +#include <linux/file.h>
8811 +#include <linux/poll.h>
8812 +#include <linux/capability.h>
8813 +#include <linux/personality.h>
8814 +#include <linux/init.h>
8815 +#include <linux/syscalls.h>
8816 +#include <linux/namei.h>
8818 +#include <asm/uaccess.h>
8820 +#include <abi/stream.h>
8821 +#include <abi/socksys.h>
8822 +#include <abi/svr4/sockio.h>
8823 +#include <abi/svr4/sysent.h>
8824 +#include <abi/tli.h>
8826 +#include <abi/util/map.h>
8827 +#include <abi/util/trace.h>
8828 +#include <abi/util/revalidate.h>
8832 + * External declarations.
8837 + * Forward declarations.
8839 +static int socksys_open(struct inode *ip, struct file *fp);
8840 +#if defined(CONFIG_ABI_XTI)
8841 +static int socksys_release(struct inode *ip, struct file *fp);
8842 +static u_int socksys_poll(struct file *fp, struct poll_table_struct *wait);
8844 +static int socksys_read(struct file *fp, char *buf,
8845 + size_t count, loff_t *ppos);
8846 +static int socksys_write(struct file *fp, const char *buf,
8847 + size_t count, loff_t *ppos);
8850 + * The socksys socket file operations.
8851 + * This gets filled in on module initialization.
8853 +static struct file_operations socksys_socket_fops = {
8858 + * File operations for the user-visible device files.
8860 + * While open the files are handled as sockets.
8862 +static struct file_operations socksys_fops = {
8863 + owner: THIS_MODULE,
8864 + open: socksys_open,
8865 + read: socksys_read,
8866 + write: socksys_write,
8867 +#ifdef CONFIG_ABI_XTI
8868 + poll: socksys_poll,
8869 + release: socksys_release,
8875 +inherit_socksys_funcs(u_int fd, int state)
8879 +#ifdef CONFIG_ABI_XTI
8880 + struct T_private *tp;
8882 + struct socket *sp;
8887 + ip = fp->f_dentry->d_inode;
8890 + * SYSV sockets are BSD like with respect to ICMP errors
8891 + * with UDP rather than RFC conforming. I think.
8893 + sp = SOCKET_I(ip); /* inode -> socket */
8895 + sock_set_flag(sp->sk, SOCK_BSDISM);
8897 + ip->i_mode = 0020000; /* S_IFCHR */
8898 + ip->i_rdev = MKDEV(SOCKSYS_MAJOR, 0);
8900 +#ifdef CONFIG_ABI_XTI
8901 + tp = kmalloc(sizeof(struct T_private), GFP_KERNEL);
8903 + tp->magic = XTI_MAGIC;
8904 + tp->state = state;
8906 + tp->pfirst = NULL;
8909 + fp->private_data = tp;
8912 + fp->f_op = &socksys_socket_fops;
8917 +spx_connect(u_int fd, int spxnum)
8919 + struct sockaddr_un sun;
8923 +#if defined(CONFIG_ABI_TRACE)
8924 + abi_trace(ABI_TRACE_SOCKSYS,
8925 + "SPX: %u choose service %d\n", fd, spxnum);
8929 + * Rather than use an explicit path to the X :0 server
8930 + * socket we should use the given number to look up a path
8931 + * name to use (we can't rely on servers registering their
8932 + * sockets either - for one thing we don't emulate that yet
8933 + * and for another thing different OS binaries do things in
8934 + * different ways but all must interoperate).
8935 + * I suggest putting the mapping in, say, /dev/spx.map/%d
8936 + * where each file is a symlink containing the path of the
8937 + * socket to use. Then we can just do a readlink() here to
8938 + * get the pathname.
8939 + * Hey, this is what we do here now!
8941 + sun.sun_family = AF_UNIX;
8942 + sprintf(sun.sun_path, "/dev/spx.map/%u", spxnum);
8946 + err = sys_readlink(sun.sun_path, sun.sun_path, strlen(sun.sun_path));
8949 + if (err == -ENOENT) {
8950 +#if defined(CONFIG_ABI_TRACE)
8951 + abi_trace(ABI_TRACE_SOCKSYS,
8952 + "SPX: %u no symlink \"%s\", try X :0\n",
8953 + fd, sun.sun_path);
8955 + strcpy(sun.sun_path, "/tmp/.X11-unix/X0");
8956 + } else if (err < 0) {
8957 +#if defined(CONFIG_ABI_TRACE)
8958 + abi_trace(ABI_TRACE_SOCKSYS,
8959 + "SPX: readlink failed with %d\n", err);
8963 + sun.sun_path[err] = '\0';
8966 + newfd = sys_socket(AF_UNIX, SOCK_STREAM, 0);
8970 +#if defined(CONFIG_ABI_TRACE)
8971 + abi_trace(ABI_TRACE_SOCKSYS,
8972 + "SPX: %u got no UNIX domain socket (err=%d)\n",
8978 +#if defined(CONFIG_ABI_TRACE)
8979 + abi_trace(ABI_TRACE_SOCKSYS,
8980 + "SPX: %u got a UNIX domain socket\n", fd);
8984 + err = sys_connect(newfd, (struct sockaddr *)&sun, sizeof(struct sockaddr_un));
8988 +#if defined(CONFIG_ABI_TRACE)
8989 + abi_trace(ABI_TRACE_SOCKSYS,
8990 + "SPX: %u connect to \"%s\" failed (err = %d)\n",
8991 + fd, sun.sun_path, err);
8997 +#if defined(CONFIG_ABI_TRACE)
8998 + abi_trace(ABI_TRACE_SOCKSYS,
8999 + "SPX: %u connect to \"%s\"\n",
9000 + fd, sun.sun_path);
9006 + * XTI to Linux protocol table.
9008 +static int inet_prot[16] = {
9009 + IPPROTO_ICMP, IPPROTO_ICMP,
9010 + IPPROTO_IGMP, IPPROTO_IPIP,
9011 + IPPROTO_TCP, IPPROTO_EGP,
9012 + IPPROTO_PUP, IPPROTO_UDP,
9013 + IPPROTO_IDP, IPPROTO_RAW,
9016 +static int inet_type[16] = {
9017 + SOCK_RAW, SOCK_RAW,
9018 + SOCK_RAW, SOCK_RAW,
9019 + SOCK_STREAM, SOCK_RAW,
9020 + SOCK_RAW, SOCK_DGRAM,
9021 + SOCK_RAW, SOCK_RAW,
9026 +xti_connect(struct file *fp, u_int fd, dev_t dev)
9028 + int family, type, prot = 0, i, s;
9031 +#if defined(CONFIG_ABI_TRACE)
9032 + abi_trace(ABI_TRACE_SOCKSYS,
9033 + "XTI: %d get socket for transport end point "
9034 + "(dev = 0x%04x)\n", fd, dev);
9037 + switch ((family = ((MINOR(dev) >> 4) & 0x0f))) {
9039 + type = SOCK_STREAM;
9042 + i = MINOR(dev) & 0x0f;
9043 + type = inet_type[i];
9044 + prot = inet_prot[i];
9053 +#if defined(CONFIG_ABI_TRACE)
9054 + abi_trace(ABI_TRACE_SOCKSYS,
9055 + "XTI: %d socket %d %d %d\n",
9056 + fd, family, type, prot);
9061 + s = sys_socket(family, type, prot);
9068 +socksys_fdinit(int fd, int rw, const char *buf, int *count)
9072 + int sockfd, error = -EINVAL;
9074 +#if defined(CONFIG_ABI_TRACE)
9075 + abi_trace(ABI_TRACE_SOCKSYS, "socksys: fd=%d initializing\n", fd);
9081 + ip = fp->f_dentry->d_inode;
9084 + * Minor = 0 is the socksys device itself. No special handling
9085 + * will be needed as it is controlled by the application
9088 + if (MINOR(ip->i_rdev) == 0)
9092 + * Minor = 1 is the spx device. This is the client side of a
9093 + * streams pipe to the X server. Under SCO and friends
9094 + * the library code messes around setting the connection
9095 + * up itself. We do it ourselves - this means we don't
9096 + * need to worry about the implementation of the server
9097 + * side (/dev/X0R - which must exist but can be a link
9098 + * to /dev/null) nor do we need to actually implement
9101 + if (MINOR(ip->i_rdev) == 1) {
9105 + * It seems early spx implementations were just a
9106 + * quick hack to get X to work. They only supported
9107 + * one destination and connected automatically.
9108 + * Later versions take a single byte write, the
9109 + * value of the byte telling them which destination
9110 + * to connect to. Hence this quick hack to work
9111 + * with both. If the first write is a single byte
9112 + * it's a connect request otherwise we auto-connect
9113 + * to destination 1.
9116 + if (rw == 1 && *count == 1) {
9117 + error = get_user(unit, buf);
9126 + sockfd = spx_connect(fd, unit);
9129 + * Otherwise the high 4 bits specify the address/protocol
9130 + * family (AF_INET, AF_UNIX etc.) and the low 4 bits determine
9131 + * the protocol (IPPROTO_IP, IPPROTO_UDP, IPPROTO_TCP etc.)
9132 + * although not using a one-to-one mapping as the minor number
9133 + * is not big enough to hold everything directly. The socket
9134 + * type is inferrred from the protocol.
9136 + sockfd = xti_connect(fp, fd, ip->i_rdev);
9140 + * Give up if we weren't able to allocate a socket.
9141 + * There is no sense in plying our funny game without a new fd.
9147 + * Redirect operations on the socket fd via our emulation
9148 + * handlers then swap the socket fd and the original fd,
9149 + * discarding the original fd.
9151 + inherit_socksys_funcs(sockfd, TS_UNBND);
9153 +#if defined(CONFIG_ABI_TRACE)
9154 + abi_trace(ABI_TRACE_SOCKSYS, "XTI: %d -> %d\n", fd, sockfd);
9157 + sys_dup2(sockfd, fd);
9158 + sys_close(sockfd);
9167 +socksys_open(struct inode *ip, struct file *fp)
9169 +#if defined(CONFIG_ABI_TRACE)
9170 + abi_trace(ABI_TRACE_SOCKSYS,
9171 + "socksys: fp=0x%p, ip=0x%p opening\n", fp, ip);
9176 +#ifdef CONFIG_ABI_XTI
9178 +socksys_release(struct inode *ip, struct file *fp)
9183 + * Not being a socket is not an error - it is probably
9184 + * just the pseudo device transport provider.
9186 + if (!ip || !S_ISSOCK(ip->i_mode))
9189 + if (fp->private_data) {
9190 + struct T_primsg *it;
9192 + it = ((struct T_private *)fp->private_data)->pfirst;
9194 + struct T_primsg *tmp = it;
9198 + kfree(fp->private_data);
9200 + error = socket_file_ops.release(ip, fp);
9202 +#if defined(CONFIG_ABI_TRACE)
9203 + abi_trace(ABI_TRACE_SOCKSYS, "socksys: %p closed\n", fp);
9209 +socksys_poll(struct file *fp, struct poll_table_struct *wait)
9211 + struct inode *ip = fp->f_dentry->d_inode;
9215 + * If this is a timod transport end point and there
9216 + * is a control message queued we have readable data.
9218 + if (ip && S_ISSOCK(ip->i_mode) && MINOR(ip->i_rdev) != 1) {
9219 + if (Priv(fp) && Priv(fp)->pfirst) {
9220 + if (Priv(fp)->pfirst->pri == MSG_HIPRI)
9227 + return (mask | socket_file_ops.poll(fp, wait));
9232 +socksys_read(struct file *fp, char *buf, size_t count, loff_t *ppos)
9236 + if (S_ISSOCK(fp->f_dentry->d_inode->i_mode))
9239 + for (fd = 0; fd < files_fdtable(current->files)->max_fdset; fd++) {
9240 + if (fcheck(fd) == fp) {
9241 + error = socksys_fdinit(fd, 0, NULL, NULL);
9246 + return fp->f_op->read(fp, buf, count, ppos);
9254 +socksys_write(struct file *fp, const char *buf, size_t count, loff_t *ppos)
9258 + if (S_ISSOCK(fp->f_dentry->d_inode->i_mode))
9261 + for (fd = 0; fd < files_fdtable(current->files)->max_fdset; fd++) {
9262 + if (fcheck(fd) == fp) {
9263 + error = socksys_fdinit(fd, 1, buf, &count);
9270 + printk("count=%d\n", count);
9271 + return fp->f_op->write(fp, buf, count, ppos);
9280 + * Get a socket but replace the socket file
9281 + * operations with our own so we can do the
9282 + * right thing for ioctls.
9285 +socksys_socket(u_long *sp)
9290 + get_user(x, ((u_long *)sp)+0);
9291 + put_user(map_value(current_thread_info()->exec_domain->af_map, x, 0), sp+0);
9292 + get_user(x, ((u_long *)sp)+1);
9293 + put_user(map_value(current_thread_info()->exec_domain->socktype_map, x, 0), sp+1);
9295 + fd = sys_socketcall(SYS_SOCKET, sp);
9297 + inherit_socksys_funcs(fd, TS_UNBND);
9302 +socksys_accept(u_long *sp)
9306 + fd = sys_socketcall(SYS_ACCEPT, sp);
9308 + inherit_socksys_funcs(fd, TS_DATA_XFER);
9313 +socksys_getipdomain(u_long *sp)
9319 + ulptr = (u_long *)&name;
9320 + error = get_user(*ulptr, (char *)(sp+0));
9324 + get_user(len, sp+1);
9328 + down_read(&uts_sem);
9329 + if (access_ok(VERIFY_WRITE, name, len)) {
9331 + for (p = system_utsname.nodename; *p && *p != '.'; p++)
9336 + p = system_utsname.domainname;
9338 + if (strcmp(p, "(none)")) {
9339 + for (; *p && len > 0; p++,len--) {
9340 + __put_user(*p, name);
9344 + __put_user('\0', name);
9349 + up_read(&uts_sem);
9354 +socksys_setipdomain(u_long *sp)
9357 + int error, len, togo;
9358 + unsigned long *ulptr;
9360 + if (!capable(CAP_SYS_ADMIN))
9363 + ulptr = (u_long *)&name;
9364 + error = get_user(*ulptr, (char *)(sp+0));
9368 + error = get_user(len, sp+1);
9372 + down_write(&uts_sem);
9373 + togo = __NEW_UTS_LEN;
9374 + for (p = system_utsname.nodename; *p && *p != '.'; p++,togo--)
9380 + if (len <= togo) {
9381 + while (len-- > 0) {
9382 + get_user(*p, name);
9389 + up_write(&uts_sem);
9394 +socksys_setreugid(int cmd, u_long *sp)
9399 + error = get_user(ruid, sp+0);
9403 + error = get_user(euid, sp+1);
9407 + return (cmd == SSYS_SO_SETREUID) ?
9408 + sys_setreuid16(ruid, euid) :
9409 + sys_setregid16(ruid, euid);
9413 + * Get a socketpair but replace the socket file
9414 + * operations with our own so we can do the
9415 + * right thing for ioctls.
9418 +socksys_socketpair(u_long *sp)
9423 + int pairin[2], pairout[2];
9427 + * The first two arguments are file descriptors
9428 + * of sockets which have already been opened
9429 + * and should now be connected back to back.
9431 + error = get_user(pairin[0], sp+0);
9433 + error = get_user(pairin[1], sp+1);
9437 + fp = fget(pairin[0]);
9440 + ip = fp->f_dentry->d_inode;
9442 + fput(fp); /* this looks boguos */
9443 + if (!ip || !S_ISSOCK(ip->i_mode))
9448 + * XXX Do we need to close these here?
9449 + * XXX If we fail to connect them should they be open?
9451 + sys_close(pairin[0]);
9452 + sys_close(pairin[1]);
9456 + error = sys_socketpair(AF_UNIX, SOCKET_I(ip)->type, 0, pairout);
9462 + if (pairout[0] != pairin[0]) {
9463 + sys_dup2(pairout[0], pairin[0]);
9464 + sys_close(pairout[0]);
9467 + if (pairout[1] != pairin[1]) {
9468 + sys_dup2(pairout[1], pairin[1]);
9469 + sys_close(pairout[1]);
9472 + inherit_socksys_funcs(pairin[0], TS_DATA_XFER);
9473 + inherit_socksys_funcs(pairin[1], TS_DATA_XFER);
9478 +socksys_syscall(u_long *sp)
9481 + unsigned long *ulptr;
9483 + error = get_user(cmd, sp);
9488 +#if defined(CONFIG_ABI_TRACE)
9489 + if (abi_traced(ABI_TRACE_SOCKSYS)) {
9490 + u_long a0, a1, a2, a3, a4, a5;
9491 + static const char * const cmd_map[] = {
9492 + "", "accept", "bind", "connect", "getpeername",
9493 + "getsockname", "getsockopt", "listen", "recv",
9494 + "recvfrom", "send", "sendto", "setsockopt", "shutdown",
9495 + "socket", "select", "getipdomain", "setipdomain",
9496 + "adjtime", "setreuid", "setregid", "gettimeofday",
9497 + "settimeofday", "getitimer", "setitimer",
9498 + "recvmsg", "sendmsg", "sockpair"
9501 + get_user(a0, sp+0);
9502 + get_user(a1, sp+1);
9503 + get_user(a2, sp+2);
9504 + get_user(a3, sp+3);
9505 + get_user(a4, sp+4);
9506 + get_user(a5, sp+5);
9508 + __abi_trace("socksys: %s (%d) "
9509 + "<0x%lx,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx>\n",
9511 + cmd < sizeof(cmd_map) / sizeof(cmd_map[0]))
9512 + ? cmd_map[cmd] : "???", cmd,
9513 + a0, a1, a2, a3, a4, a5);
9518 + case SSYS_SO_SOCKET:
9519 + return socksys_socket(sp);
9520 + case SSYS_SO_ACCEPT:
9521 + return socksys_accept(sp);
9522 + case SSYS_SO_BIND:
9523 + return sys_socketcall(SYS_BIND, sp);
9524 + case SSYS_SO_CONNECT:
9525 + return sys_socketcall(SYS_CONNECT, sp);
9526 + case SSYS_SO_GETPEERNAME:
9527 + return sys_socketcall(SYS_GETPEERNAME, sp);
9528 + case SSYS_SO_GETSOCKNAME:
9529 + return sys_socketcall(SYS_GETSOCKNAME, sp);
9530 + case SSYS_SO_GETSOCKOPT:
9531 + return abi_do_getsockopt((u_long *)sp);
9532 + case SSYS_SO_LISTEN:
9533 + return sys_socketcall(SYS_LISTEN, sp);
9534 + case SSYS_SO_RECV:
9535 + if ((error = sys_socketcall(SYS_RECV, sp)) == -EAGAIN)
9536 + return -EWOULDBLOCK;
9538 + case SSYS_SO_RECVFROM:
9539 + if ((error = sys_socketcall(SYS_RECVFROM, sp)) == -EAGAIN)
9540 + return -EWOULDBLOCK;
9542 + case SSYS_SO_SEND:
9543 + if ((error = sys_socketcall(SYS_SEND, sp)) == -EAGAIN)
9544 + error = -EWOULDBLOCK;
9546 + case SSYS_SO_SENDTO:
9547 + if ((error = sys_socketcall(SYS_SENDTO, sp)) == -EAGAIN)
9548 + error = -EWOULDBLOCK;
9550 + case SSYS_SO_SETSOCKOPT:
9551 + return abi_do_setsockopt(sp);
9552 + case SSYS_SO_SHUTDOWN:
9553 + return sys_socketcall(SYS_SHUTDOWN, sp);
9554 + case SSYS_SO_GETIPDOMAIN:
9555 + return socksys_getipdomain(sp);
9556 + case SSYS_SO_SETIPDOMAIN:
9557 + return socksys_setipdomain(sp);
9558 + case SSYS_SO_SETREUID:
9559 + case SSYS_SO_SETREGID:
9560 + return socksys_setreugid(cmd, sp);
9561 + case SSYS_SO_GETTIME:
9562 + case SSYS_SO_SETTIME:
9564 + struct timeval *tv;
9565 + struct timezone *tz;
9567 + ulptr = (unsigned long *)&tv;
9568 + if ((error = get_user(*ulptr, sp+0)))
9570 + ulptr = (unsigned long *)&tz;
9571 + if ((error = get_user(*ulptr, sp+1)))
9573 + return (cmd == SSYS_SO_GETTIME)
9574 + ? sys_gettimeofday(tv, tz)
9575 + : sys_settimeofday(tv, tz);
9578 + case SSYS_SO_GETITIMER:
9581 + struct itimerval *value;
9583 + ulptr = (unsigned long *)&which;
9584 + if ((error = get_user(*ulptr, sp+0)))
9586 + ulptr = (unsigned long *)&value;
9587 + if ((error = get_user(*ulptr, sp+1)))
9589 + return sys_getitimer(which, value);
9591 + case SSYS_SO_SETITIMER:
9594 + struct itimerval *value, *ovalue;
9596 + ulptr = (unsigned long *)&which;
9597 + if ((error = get_user(*ulptr, sp+0)))
9599 + ulptr = (unsigned long *)&value;
9600 + if ((error = get_user(*ulptr, sp+1)))
9602 + ulptr = (unsigned long *)&ovalue;
9603 + if ((error = get_user(*ulptr, sp+2)))
9605 + return sys_setitimer(which, value, ovalue);
9609 + case SSYS_SO_SELECT:
9611 + * This may be wrong? I don't know how to trigger
9612 + * this case. Select seems to go via the Xenix
9613 + * select entry point.
9615 + return sys_select(sp);
9618 + case SSYS_SO_ADJTIME:
9622 + * These appear in SCO 3.2v5. I assume that the format of
9623 + * a msghdr is identical with Linux. I have not checked.
9625 + case SSYS_SO_RECVMSG:
9626 + if ((error = sys_socketcall(SYS_RECVMSG, sp)) == -EAGAIN)
9627 + error = -EWOULDBLOCK;
9629 + case SSYS_SO_SENDMSG:
9630 + if ((error = sys_socketcall(SYS_SENDMSG, sp)) == -EAGAIN)
9631 + error = -EWOULDBLOCK;
9633 + case SSYS_SO_SOCKPAIR:
9634 + return socksys_socketpair(sp);
9641 +socksys_getdomainname(caddr_t arg)
9643 + struct domnam_args dn;
9647 + if (copy_from_user(&dn, arg, sizeof(struct domnam_args)))
9650 + down_read(&uts_sem);
9651 + if (access_ok(VERIFY_WRITE, dn.name, dn.namelen)) {
9653 + for (p = system_utsname.domainname; *p && dn.namelen > 0; p++) {
9654 + __put_user(*p, dn.name);
9658 + __put_user('\0', dn.name);
9662 + up_read(&uts_sem);
9667 +socksys_setdomainname(caddr_t arg)
9669 + struct domnam_args dn;
9671 + if (copy_from_user(&dn, arg, sizeof(struct domnam_args)))
9673 + return sys_setdomainname(dn.name, dn.namelen);
9677 + * I think this was used before symlinks were added
9678 + * to the base SCO OS?
9681 +socksys_lstat(caddr_t arg)
9683 + struct lstat_args st;
9685 + if (copy_from_user(&st, arg, sizeof(struct lstat_args)))
9687 + return svr4_lstat(st.fname, st.statb);
9691 +socksys_getfh(caddr_t arg)
9693 + struct getfh_args gf;
9694 + struct nameidata nd;
9697 + if (!capable(CAP_SYS_ADMIN))
9700 + if (copy_from_user(&gf, arg, sizeof(struct getfh_args)))
9703 + if (!access_ok(VERIFY_WRITE, gf.fhp, sizeof(fhandle_t)))
9706 + error = user_path_walk(gf.fname, &nd);
9710 + error = do_revalidate(nd.dentry);
9712 + struct inode *ip = nd.dentry->d_inode;
9714 + __put_user(ip->i_rdev, &gf.fhp->fh.fsid);
9715 + __put_user(ip->i_ino, &gf.fhp->fh.fno);
9716 + __put_user(0L, &gf.fhp->fh.fgen);
9717 + __put_user(ip->i_rdev, &gf.fhp->fh.ex_fsid);
9718 + __put_user(ip->i_ino, &gf.fhp->fh.ex_fno);
9719 + __put_user(0L, &gf.fhp->fh.ex_fgen);
9722 + path_release(&nd);
9727 +socksys_getpeername(int fd, caddr_t arg)
9729 + struct sockaddr uaddr;
9734 + addrlen = sizeof(struct sockaddr);
9736 + if (!access_ok(VERIFY_WRITE, arg, addrlen))
9741 + error = sys_getpeername(fd, &uaddr, &addrlen);
9745 + if (copy_to_user(arg, &uaddr, addrlen))
9751 +socksys_getsockname(int fd, caddr_t arg)
9753 + struct sockaddr uaddr;
9758 + addrlen = sizeof(struct sockaddr);
9760 + if (!access_ok(VERIFY_WRITE, arg, addrlen))
9765 + error = sys_getsockname(fd, &uaddr, &addrlen);
9769 + if (copy_to_user(arg, &uaddr, addrlen))
9775 +socksys_gifonep(caddr_t data)
9777 + return -EOPNOTSUPP;
9781 +socksys_sifonep(caddr_t data)
9784 + struct svr4_ifreq *ifr = (struct svr4_ifreq *)data;
9786 + printk("SIOCSIFONEP (spsize = %x, spthresh = %x) not supported\n",
9787 + ifr->svr4_ifr_onepacket.spsize,
9788 + ifr->svr4_ifr_onepacket.spthresh);
9790 + return -EOPNOTSUPP;
9794 +abi_ioctl_socksys(int fd, unsigned int cmd, caddr_t arg)
9800 + * Strictly the ip domain and nis domain are separate and
9801 + * distinct under SCO but Linux only has the one domain.
9803 + case NIOCGETDOMNAM:
9804 + return socksys_getdomainname(arg);
9805 + case NIOCSETDOMNAM:
9806 + return socksys_setdomainname(arg);
9808 + return socksys_lstat(arg);
9809 + case NIOCOLDGETFH:
9811 + return socksys_getfh(arg);
9814 + case NIOCCLNTHAND:
9815 + case NIOCEXPORTFS:
9818 + case SSYS_SIOCSOCKSYS: /* Pseudo socket syscall */
9819 + case SVR4_SIOCSOCKSYS:
9820 + return socksys_syscall((u_long *)arg);
9822 + case SSYS_SIOCSHIWAT: /* set high watermark */
9823 + case SVR4_SIOCSHIWAT:
9824 + case SSYS_SIOCSLOWAT: /* set low watermark */
9825 + case SVR4_SIOCSLOWAT:
9827 + * Linux doesn't support them but lie anyway
9828 + * or some things take it as fatal (why?)
9830 + * FIXME: actually we can do this now...
9833 + case SSYS_SIOCGHIWAT: /* get high watermark */
9834 + case SVR4_SIOCGHIWAT:
9835 + case SSYS_SIOCGLOWAT: /* get low watermark */
9836 + case SVR4_SIOCGLOWAT:
9838 + * Linux doesn't support them but lie anyway
9839 + * or some things take it as fatal (why?)
9841 + * FIXME: actually we can do this now...
9843 + if (!access_ok(VERIFY_WRITE, arg, sizeof(u_long)))
9845 + put_user(0, (u_long *)arg);
9847 + case SSYS_SIOCATMARK: /* at oob mark? */
9848 + case SVR4_SIOCATMARK:
9849 + return sys_ioctl(fd, SIOCATMARK, (long)arg);
9851 + case SSYS_SIOCSPGRP: /* set process group */
9852 + case SVR4_SIOCSPGRP:
9853 + return sys_ioctl(fd, SIOCSPGRP, (long)arg);
9854 + case SSYS_SIOCGPGRP: /* get process group */
9855 + case SVR4_SIOCGPGRP:
9856 + return sys_ioctl(fd, SIOCGPGRP, (long)arg);
9859 + case SSYS_FIONREAD: /* BSD compatibilty */
9860 + error = sys_ioctl(fd, TIOCINQ, (long)arg);
9861 +#if defined(CONFIG_ABI_TRACE)
9862 + if (!error && abi_traced(ABI_TRACE_SOCKSYS)) {
9865 + get_user(n, (u_long *)arg);
9866 + __abi_trace("socksys: %d FIONREAD "
9867 + "found %lu bytes ready\n",
9872 + case SSYS_FIONBIO: /* BSD compatibilty */
9873 + return sys_ioctl(fd, FIONBIO, (long)arg);
9874 + case SSYS_FIOASYNC: /* BSD compatibilty */
9875 + return sys_ioctl(fd, FIOASYNC, (long)arg);
9876 + case SSYS_SIOCADDRT: /* add route */
9877 + case SVR4_SIOCADDRT:
9878 + return sys_ioctl(fd, SIOCADDRT, (long)arg);
9879 + case SSYS_SIOCDELRT: /* delete route */
9880 + case SVR4_SIOCDELRT:
9881 + return sys_ioctl(fd, SIOCDELRT, (long)arg);
9882 + case SSYS_SIOCSIFADDR: /* set ifnet address */
9883 + case SVR4_SIOCSIFADDR:
9884 + return sys_ioctl(fd, SIOCSIFADDR, (long)arg);
9885 + case SSYS_SIOCGIFADDR: /* get ifnet address */
9886 + case SVR4_SIOCGIFADDR:
9887 + return sys_ioctl(fd, SIOCGIFADDR, (long)arg);
9888 + case SSYS_SIOCSIFDSTADDR: /* set p-p address */
9889 + case SVR4_SIOCSIFDSTADDR:
9890 + return sys_ioctl(fd, SIOCSIFDSTADDR, (long)arg);
9891 + case SSYS_SIOCGIFDSTADDR: /* get p-p address */
9892 + case SVR4_SIOCGIFDSTADDR:
9893 + return sys_ioctl(fd, SIOCGIFDSTADDR, (long)arg);
9894 + case SSYS_SIOCSIFFLAGS: /* set ifnet flags */
9895 + case SVR4_SIOCSIFFLAGS:
9896 + return sys_ioctl(fd, SIOCSIFFLAGS, (long)arg);
9897 + case SSYS_SIOCGIFFLAGS: /* get ifnet flags */
9898 + case SVR4_SIOCGIFFLAGS:
9900 + case SVRX_SIOCGIFFLAGS:
9902 + return sys_ioctl(fd, SIOCGIFFLAGS, (long)arg);
9903 + case SSYS_SIOCGIFCONF: /* get ifnet list */
9904 + case SVR4_SIOCGIFCONF:
9906 + case SVRX_SIOCGIFCONF:
9908 + return sys_ioctl(fd, SIOCGIFCONF, (long)arg);
9909 + case SSYS_SIOCGIFBRDADDR: /* get broadcast addr */
9910 + case SVR4_SIOCGIFBRDADDR:
9911 + return sys_ioctl(fd, SIOCGIFBRDADDR, (long)arg);
9912 + case SSYS_SIOCSIFBRDADDR: /* set broadcast addr */
9913 + case SVR4_SIOCSIFBRDADDR:
9914 + return sys_ioctl(fd, SIOCSIFBRDADDR, (long)arg);
9915 + case SSYS_SIOCGIFNETMASK: /* get net addr mask */
9916 + case SVR4_SIOCGIFNETMASK:
9917 + return sys_ioctl(fd, SIOCGIFNETMASK, (long)arg);
9918 + case SSYS_SIOCSIFNETMASK: /* set net addr mask */
9919 + return sys_ioctl(fd, SIOCSIFNETMASK, (long)arg);
9920 + case SSYS_SIOCGIFMETRIC: /* get IF metric */
9921 + case SVR4_SIOCGIFMETRIC:
9922 + return sys_ioctl(fd, SIOCGIFMETRIC, (long)arg);
9923 + case SSYS_SIOCSIFMETRIC: /* set IF metric */
9924 + case SVR4_SIOCSIFMETRIC:
9925 + return sys_ioctl(fd, SIOCSIFMETRIC, (long)arg);
9926 + case SSYS_SIOCSARP: /* set arp entry */
9927 + case SVR4_SIOCSARP:
9928 + return sys_ioctl(fd, SIOCSARP, (long)arg);
9929 + case SSYS_SIOCGARP: /* get arp entry */
9930 + case SVR4_SIOCGARP:
9931 + return sys_ioctl(fd, SIOCGARP, (long)arg);
9932 + case SSYS_SIOCDARP: /* delete arp entry */
9933 + case SVR4_SIOCDARP:
9934 + return sys_ioctl(fd, SIOCDARP, (long)arg);
9935 + case SSYS_SIOCGENADDR: /* Get ethernet addr */
9936 + case SVR4_SIOCGENADDR:
9937 + return sys_ioctl(fd, SIOCGIFHWADDR, (long)arg);
9938 + case SSYS_SIOCSIFMTU: /* get if_mtu */
9939 + case SVR4_SIOCSIFMTU:
9940 + return sys_ioctl(fd, SIOCSIFMTU, (long)arg);
9941 + case SSYS_SIOCGIFMTU: /* set if_mtu */
9942 + case SVR4_SIOCGIFMTU:
9943 + return sys_ioctl(fd, SIOCGIFMTU, (long)arg);
9945 + case SSYS_SIOCGETNAME: /* getsockname */
9946 + case SVR4_SIOCGETNAME:
9947 + return socksys_getsockname(fd, arg);
9948 + case SSYS_SIOCGETPEER: /* getpeername */
9949 + case SVR4_SIOCGETPEER:
9950 + return socksys_getpeername(fd, arg);
9952 + case SSYS_IF_UNITSEL: /* set unit number */
9953 + case SVR4_IF_UNITSEL:
9954 + case SSYS_SIOCXPROTO: /* empty proto table */
9955 + case SVR4_SIOCXPROTO:
9957 + case SSYS_SIOCIFDETACH: /* detach interface */
9958 + case SVR4_SIOCIFDETACH:
9959 + case SSYS_SIOCGENPSTATS: /* get ENP stats */
9960 + case SVR4_SIOCGENPSTATS:
9962 + case SSYS_SIOCSIFNAME: /* set interface name */
9963 + case SVR4_SIOCSIFNAME:
9965 + case SSYS_SIOCPROTO: /* link proto */
9966 + case SVR4_SIOCPROTO:
9967 + case SSYS_SIOCX25XMT:
9968 + case SVR4_SIOCX25XMT:
9969 + case SSYS_SIOCX25RCV:
9970 + case SVR4_SIOCX25RCV:
9971 + case SSYS_SIOCX25TBL:
9972 + case SVR4_SIOCX25TBL:
9974 + case SSYS_SIOCGIFONEP: /* get one-packet params */
9975 + return socksys_gifonep(arg);
9976 + case SSYS_SIOCSIFONEP: /* set one-packet params */
9977 + return socksys_sifonep(arg);
9980 + printk(KERN_DEBUG "%d iBCS: socksys: %d: ioctl 0x%x with argument 0x%p requested\n",
9981 + current->pid, fd, cmd, arg);
9993 + if ((ret = register_chrdev(SOCKSYS_MAJOR, "socksys", &socksys_fops))) {
9994 + printk(KERN_ERR "abi: unable register socksys char major\n");
9998 + fops_get(&socket_file_ops);
9999 + socksys_socket_fops = socket_file_ops;
10000 +#ifdef CONFIG_ABI_XTI
10001 + socksys_socket_fops.release = socksys_release;
10002 + socksys_socket_fops.poll = socksys_poll;
10007 +static void __exit
10008 +socksys_exit(void)
10010 + fops_put(&socket_file_ops);
10011 + unregister_chrdev(SOCKSYS_MAJOR, "socksys");
10014 +module_init(socksys_init);
10015 +module_exit(socksys_exit);
10017 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
10018 +EXPORT_SYMBOL(abi_ioctl_socksys);
10019 +EXPORT_SYMBOL(socksys_syscall);
10021 diff -Nur kernel-source-2.6.16.orig/abi/svr4/stat.c kernel-source-2.6.16/abi/svr4/stat.c
10022 --- kernel-source-2.6.16.orig/abi/svr4/stat.c 1970-01-01 10:00:00.000000000 +1000
10023 +++ kernel-source-2.6.16/abi/svr4/stat.c 2006-04-27 18:50:24.000000000 +1000
10026 + * Copyright (c) 2001 Caldera Deutschland GmbH.
10027 + * Copyright (c) 2001 Christoph Hellwig.
10028 + * All rights reserved.
10030 + * This program is free software; you can redistribute it and/or modify
10031 + * it under the terms of the GNU General Public License as published by
10032 + * the Free Software Foundation; either version 2 of the License, or
10033 + * (at your option) any later version.
10035 + * This program is distributed in the hope that it will be useful,
10036 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10037 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10038 + * GNU General Public License for more details.
10040 + * You should have received a copy of the GNU General Public License
10041 + * along with this program; if not, write to the Free Software
10042 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10048 + * SVR4 stat & friends support.
10050 +#include <linux/kernel.h>
10051 +#include <linux/fs.h>
10052 +#include <linux/sched.h>
10053 +#include <linux/file.h>
10054 +#include <linux/string.h>
10055 +#include <linux/module.h>
10056 +#include <asm/uaccess.h>
10058 +#include <abi/svr4/types.h>
10059 +#include <abi/svr4/stat.h>
10061 +#include <abi/util/stat.h>
10062 +#include <abi/util/trace.h>
10065 +enum {SVR4_stat = 1, SVR4_xstat = 2};
10068 +report_svr4_stat(struct kstat *stp, struct svr4_stat *bufp)
10070 + struct svr4_stat buf;
10072 + memset(&buf, 0, sizeof(struct svr4_stat));
10075 + buf.st_dev = linux_to_svr4_o_dev_t(stp->dev);
10076 + buf.st_ino = linux_to_svr4_o_ino_t(stp->ino);
10077 + buf.st_mode = stp->mode;
10078 + buf.st_nlink = stp->nlink;
10079 + buf.st_uid = linux_to_svr4_o_uid_t(stp->uid);
10080 + buf.st_gid = linux_to_svr4_o_gid_t(stp->gid);
10081 + buf.st_rdev = linux_to_svr4_o_dev_t(stp->rdev);
10083 + if (stp->size > MAX_NON_LFS)
10084 + return -EOVERFLOW; /* XXX: what to return for SVR4?? */
10086 + buf.st_size = stp->size;
10088 + buf.st_atime = stp->atime.tv_sec;
10089 + buf.st_mtime = stp->mtime.tv_sec;
10090 + buf.st_ctime = stp->ctime.tv_sec;
10092 + if (copy_to_user(bufp, &buf, sizeof(struct svr4_stat)))
10098 +report_svr4_xstat(struct kstat *stp, struct svr4_xstat *bufp)
10100 + struct svr4_xstat buf;
10102 + memset(&buf, 0, sizeof(struct svr4_xstat));
10105 + buf.st_dev = linux_to_svr4_dev_t(stp->dev);
10106 + buf.st_ino = linux_to_svr4_ino_t(stp->ino);
10107 + buf.st_mode = stp->mode;
10108 + buf.st_nlink = stp->nlink;
10109 + buf.st_uid = linux_to_svr4_uid_t(stp->uid);
10110 + buf.st_gid = linux_to_svr4_gid_t(stp->gid);
10111 + buf.st_rdev = linux_to_svr4_dev_t(stp->rdev);
10113 + if (stp->size > MAX_NON_LFS)
10114 + return -EOVERFLOW; /* XXX: what to return for SVR4?? */
10116 + buf.st_size = stp->size;
10118 + buf.st_atim.tv_sec = stp->atime.tv_sec;
10119 + buf.st_atim.tv_usec = stp->atime.tv_nsec / 1000;
10120 + buf.st_mtim.tv_sec = stp->mtime.tv_sec;
10121 + buf.st_mtim.tv_usec = stp->mtime.tv_nsec / 1000;
10122 + buf.st_ctim.tv_sec = stp->ctime.tv_sec;
10123 + buf.st_ctim.tv_usec = stp->ctime.tv_nsec / 1000;
10125 + buf.st_blksize = stp->blksize;
10126 + buf.st_blocks = stp->blocks;
10128 + if (copy_to_user(bufp, &buf, sizeof(struct svr4_xstat)))
10134 +svr4_stat(char *filename, struct svr4_stat *bufp)
10139 + error = vfs_stat(filename, &st);
10141 + error = report_svr4_stat(&st, bufp);
10146 +svr4_lstat(char *filename, struct svr4_stat *bufp)
10151 + error = vfs_lstat(filename, &st);
10153 + error = report_svr4_stat(&st, bufp);
10158 +svr4_fstat(int fd, struct svr4_stat *bufp)
10163 + error = vfs_fstat(fd, &st);
10165 + error = report_svr4_stat(&st, bufp);
10170 +svr4_xstat(int vers, char *filename, void *bufp)
10175 + error = vfs_stat(filename, &st);
10181 + return report_svr4_stat(&st, bufp);
10183 + return report_svr4_xstat(&st, bufp);
10186 +#if defined(CONFIG_ABI_TRACE)
10187 + abi_trace(ABI_TRACE_API, "xstat version %d not supported\n", vers);
10193 +svr4_lxstat(int vers, char *filename, void *bufp)
10198 + error = vfs_lstat(filename, &st);
10204 + return report_svr4_stat(&st, bufp);
10206 + return report_svr4_xstat(&st, bufp);
10209 +#if defined(CONFIG_ABI_TRACE)
10210 + abi_trace(ABI_TRACE_API, "lxstat version %d not supported\n", vers);
10216 +svr4_fxstat(int vers, int fd, void *bufp)
10221 + error = vfs_fstat(fd, &st);
10227 + return report_svr4_stat(&st, bufp);
10229 + return report_svr4_xstat(&st, bufp);
10232 +#if defined(CONFIG_ABI_TRACE)
10233 + abi_trace(ABI_TRACE_API, "fxstat version %d not supported\n", vers);
10238 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
10239 +EXPORT_SYMBOL(report_svr4_stat);
10240 +EXPORT_SYMBOL(report_svr4_xstat);
10241 +EXPORT_SYMBOL(svr4_fstat);
10242 +EXPORT_SYMBOL(svr4_fxstat);
10243 +EXPORT_SYMBOL(svr4_lstat);
10244 +EXPORT_SYMBOL(svr4_lxstat);
10245 +EXPORT_SYMBOL(svr4_stat);
10246 +EXPORT_SYMBOL(svr4_xstat);
10248 diff -Nur kernel-source-2.6.16.orig/abi/svr4/statvfs.c kernel-source-2.6.16/abi/svr4/statvfs.c
10249 --- kernel-source-2.6.16.orig/abi/svr4/statvfs.c 1970-01-01 10:00:00.000000000 +1000
10250 +++ kernel-source-2.6.16/abi/svr4/statvfs.c 2006-04-27 18:50:24.000000000 +1000
10253 + * Copyright (c) 2001 Caldera Deutschland GmbH.
10254 + * Copyright (c) 2001 Christoph Hellwig.
10255 + * All rights reserved.
10257 + * This program is free software; you can redistribute it and/or modify
10258 + * it under the terms of the GNU General Public License as published by
10259 + * the Free Software Foundation; either version 2 of the License, or
10260 + * (at your option) any later version.
10262 + * This program is distributed in the hope that it will be useful,
10263 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10264 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10265 + * GNU General Public License for more details.
10267 + * You should have received a copy of the GNU General Public License
10268 + * along with this program; if not, write to the Free Software
10269 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10275 + * SVR4 statvfs/fstatvfs support.
10277 +#include <linux/kernel.h>
10278 +#include <linux/fs.h>
10279 +#include <linux/statfs.h>
10280 +#include <linux/mount.h>
10281 +#include <linux/sched.h>
10282 +#include <linux/file.h>
10283 +#include <linux/string.h>
10284 +#include <linux/namei.h>
10285 +#include <linux/module.h>
10286 +#include <asm/uaccess.h>
10289 +struct svr4_statvfs {
10290 + u_int32_t f_bsize;
10291 + u_int32_t f_frsize;
10292 + u_int32_t f_blocks;
10293 + u_int32_t f_bfree;
10294 + u_int32_t f_bavail;
10295 + u_int32_t f_files;
10296 + u_int32_t f_free;
10298 + char f_basetype[16];
10299 + u_int32_t f_flag;
10300 + u_int32_t f_namemax;
10302 + u_int32_t f_filler[16];
10306 +report_statvfs(struct vfsmount *mnt, struct inode *ip, struct svr4_statvfs *bufp)
10308 + struct svr4_statvfs buf;
10309 + struct kstatfs s;
10312 + error = vfs_statfs(mnt->mnt_sb, &s);
10316 + memset(&buf, 0, sizeof(struct svr4_statvfs));
10318 + buf.f_bsize = s.f_bsize;
10319 + buf.f_frsize = s.f_bsize;
10320 + buf.f_blocks = s.f_blocks;
10321 + buf.f_bfree = s.f_bfree;
10322 + buf.f_bavail = s.f_bavail;
10323 + buf.f_files = s.f_files;
10324 + buf.f_free = s.f_ffree;
10325 + buf.f_sid = ip->i_sb->s_dev;
10327 + /* Get the name of the filesystem */
10328 + strcpy(buf.f_basetype, ip->i_sb->s_type->name);
10330 + /* Check for a few flags statvfs wants but statfs doesn't have. */
10331 + if (IS_RDONLY(ip))
10333 + if (mnt->mnt_flags & MNT_NOSUID)
10336 + buf.f_namemax = s.f_namelen;
10338 + if (copy_to_user(bufp, &buf, sizeof(struct svr4_statvfs)))
10344 +svr4_statvfs(char *filename, struct svr4_statvfs *bufp)
10346 + struct nameidata nd;
10349 + error = user_path_walk(filename, &nd);
10351 + error = report_statvfs(nd.mnt, nd.dentry->d_inode, bufp);
10352 + path_release(&nd);
10358 +svr4_fstatvfs(int fd, struct svr4_statvfs *bufp)
10361 + int error = -EBADF;
10365 + error = report_statvfs(fp->f_vfsmnt,
10366 + fp->f_dentry->d_inode, bufp);
10372 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
10373 +EXPORT_SYMBOL(svr4_statvfs);
10374 +EXPORT_SYMBOL(svr4_fstatvfs);
10376 diff -Nur kernel-source-2.6.16.orig/abi/svr4/stream.c kernel-source-2.6.16/abi/svr4/stream.c
10377 --- kernel-source-2.6.16.orig/abi/svr4/stream.c 1970-01-01 10:00:00.000000000 +1000
10378 +++ kernel-source-2.6.16/abi/svr4/stream.c 2006-04-27 18:50:24.000000000 +1000
10381 + * Copyright 1994,1995 Mike Jagdis (jaggy@purplet.demon.co.uk)
10386 +#include <linux/config.h>
10387 +#include <linux/errno.h>
10388 +#include <linux/ptrace.h>
10389 +#include <linux/sched.h>
10390 +#include <linux/file.h>
10391 +#include <linux/fs.h>
10392 +#include <linux/module.h>
10393 +#include <asm/uaccess.h>
10395 +#include <asm/abi_machdep.h>
10396 +#include <abi/tli.h>
10399 +#if !defined(CONFIG_ABI_XTI) && !defined(CONFIG_ABI_SPX)
10400 +# define timod_getmsg(fd, ino, is_pmsg, regs) 0
10401 +# define timod_putmsg(fd, ino, is_pmsg, regs) 0
10405 + * Check if the inode belongs to /dev/spx.
10407 +#define IS_SPX(ip) ((MAJOR((ip)->i_rdev) == 30 && MINOR((ip)->i_rdev) == 1))
10411 +svr4_getmsg(struct pt_regs *regs)
10414 + struct inode *ip;
10416 + int error = -EBADF;
10418 + fd = (int)get_syscall_parameter(regs, 0);
10421 + ip = fp->f_dentry->d_inode;
10422 + if (S_ISSOCK(ip->i_mode))
10423 + error = timod_getmsg(fd, ip, 0, regs);
10430 +svr4_putmsg(struct pt_regs *regs)
10433 + struct inode *ip;
10435 + int error = -EBADF;
10437 + fd = (int)get_syscall_parameter(regs, 0);
10440 + ip = fp->f_dentry->d_inode;
10441 + if (S_ISSOCK(ip->i_mode) || IS_SPX(ip))
10442 + error = timod_putmsg(fd, ip, 0, regs);
10448 +#ifdef CONFIG_ABI_XTI
10450 +svr4_getpmsg(struct pt_regs *regs)
10453 + struct inode *ip;
10455 + int error = -EBADF;
10457 + fd = (int)get_syscall_parameter(regs, 0);
10460 + ip = fp->f_dentry->d_inode;
10461 + if (S_ISSOCK(ip->i_mode))
10462 + error = timod_getmsg(fd, ip, 1, regs);
10469 +svr4_putpmsg(struct pt_regs *regs)
10472 + struct inode *ip;
10474 + int error = -EBADF;
10476 + fd = (int)get_syscall_parameter(regs, 0);
10479 + ip = fp->f_dentry->d_inode;
10480 + if (S_ISSOCK(ip->i_mode) || IS_SPX(ip))
10481 + error = timod_putmsg(fd, ip, 1, regs);
10486 +#endif /* CONFIG_ABI_XTI */
10488 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
10489 +EXPORT_SYMBOL(svr4_getmsg);
10490 +EXPORT_SYMBOL(svr4_getpmsg);
10491 +EXPORT_SYMBOL(svr4_putmsg);
10492 +EXPORT_SYMBOL(svr4_putpmsg);
10494 diff -Nur kernel-source-2.6.16.orig/abi/svr4/svr4.c kernel-source-2.6.16/abi/svr4/svr4.c
10495 --- kernel-source-2.6.16.orig/abi/svr4/svr4.c 1970-01-01 10:00:00.000000000 +1000
10496 +++ kernel-source-2.6.16/abi/svr4/svr4.c 2006-04-27 18:50:24.000000000 +1000
10499 + * Copyright (C) 1995 Mike Jagdis
10504 +#include <linux/types.h>
10505 +#include <linux/errno.h>
10506 +#include <linux/sched.h>
10507 +#include <linux/kernel.h>
10508 +#include <linux/mm.h>
10509 +#include <linux/stddef.h>
10510 +#include <linux/unistd.h>
10511 +#include <linux/ptrace.h>
10512 +#include <linux/fcntl.h>
10513 +#include <linux/time.h>
10514 +#include <linux/fs.h>
10515 +#include <linux/statfs.h>
10516 +#include <linux/sys.h>
10517 +#include <linux/slab.h>
10518 +#include <linux/personality.h>
10519 +#include <linux/syscalls.h>
10520 +#include <linux/module.h>
10521 +#include <asm/uaccess.h>
10523 +#include <asm/abi_machdep.h>
10524 +#include <abi/svr4/sigset.h>
10525 +#include <abi/svr4/siginfo.h>
10527 +#include <abi/util/trace.h>
10531 + * Interactive SVR4's /bin/sh calls access(... 011) but Linux returns
10532 + * EINVAL if the access mode has any other bits than 007 set.
10536 +svr4_access(char *path, int mode)
10538 + return sys_access(path, mode & 007);
10543 + SVR4_CLD_EXITED = 1,
10544 + SVR4_CLD_KILLED = 2,
10545 + SVR4_CLD_DUMPED = 3,
10546 + SVR4_CLD_TRAPPED = 4,
10547 + SVR4_CLD_STOPPED = 5,
10548 + SVR4_CLD_CONTINUED = 6
10552 +svr4_waitid(int idtype, int id, struct svr4_siginfo *infop, int options)
10554 + long result, kopt;
10555 + mm_segment_t old_fs;
10558 + switch (idtype) {
10559 + case 0: /* P_PID */
10563 + case 1: /* P_PGID */
10567 + case 7: /* P_ALL */
10576 + if (!access_ok(VERIFY_WRITE, infop,
10577 + sizeof(struct svr4_siginfo)))
10582 + if (options & 0100) kopt |= WNOHANG;
10583 + if (options & 4) kopt |= WUNTRACED;
10585 + old_fs = get_fs();
10586 + set_fs(get_ds());
10587 + result = sys_wait4(pid, &status, kopt, NULL);
10593 + unsigned long op, st;
10595 + put_user(current_thread_info()->exec_domain->signal_map[SIGCHLD],
10596 + &infop->si_signo);
10598 + &infop->_data._proc._pid);
10600 + if ((status & 0xff) == 0) {
10601 + /* Normal exit. */
10602 + op = SVR4_CLD_EXITED;
10603 + st = status >> 8;
10604 + } else if ((status & 0xff) == 0x7f) {
10606 + st = (status & 0xff00) >> 8;
10607 + op = (st == SIGSTOP || st == SIGTSTP)
10608 + ? SVR4_CLD_STOPPED
10609 + : SVR4_CLD_CONTINUED;
10610 + st = current_thread_info()->exec_domain->signal_invmap[st];
10612 + st = (status & 0xff00) >> 8;
10613 + op = (status & 0200)
10614 + ? SVR4_CLD_DUMPED
10615 + : SVR4_CLD_KILLED;
10616 + st = current_thread_info()->exec_domain->signal_invmap[st];
10618 + put_user(op, &infop->si_code);
10619 + put_user(st, &infop->_data._proc._pdata._cld._status);
10625 +svr4_seteuid(int uid)
10627 + return sys_setreuid16(-1, uid);
10631 +svr4_setegid(int gid)
10633 + return sys_setregid16(-1, gid);
10636 +/* POSIX.1 names */
10637 +#define _PC_LINK_MAX 1
10638 +#define _PC_MAX_CANON 2
10639 +#define _PC_MAX_INPUT 3
10640 +#define _PC_NAME_MAX 4
10641 +#define _PC_PATH_MAX 5
10642 +#define _PC_PIPE_BUF 6
10643 +#define _PC_NO_TRUNC 7
10644 +#define _PC_VDISABLE 8
10645 +#define _PC_CHOWN_RESTRICTED 9
10646 +/* POSIX.4 names */
10647 +#define _PC_ASYNC_IO 10
10648 +#define _PC_PRIO_IO 11
10649 +#define _PC_SYNC_IO 12
10652 +svr4_pathconf(char *path, int name)
10655 + case _PC_LINK_MAX:
10656 + /* Although Linux headers define values on a per
10657 + * filesystem basis there is no way to access
10658 + * these without hard coding fs information here
10659 + * so for now we use a bogus value.
10663 + case _PC_MAX_CANON:
10664 + return MAX_CANON;
10666 + case _PC_MAX_INPUT:
10667 + return MAX_INPUT;
10669 + case _PC_PATH_MAX:
10672 + case _PC_PIPE_BUF:
10675 + case _PC_CHOWN_RESTRICTED:
10676 + /* We should really think about this and tell
10681 + case _PC_NO_TRUNC:
10682 + /* Not sure... It could be fs dependent? */
10685 + case _PC_VDISABLE:
10688 + case _PC_NAME_MAX: {
10689 + struct statfs buf;
10692 + mm_segment_t old_fs;
10694 + p = getname(path);
10695 + error = PTR_ERR(p);
10696 + if (!IS_ERR(p)) {
10697 + old_fs = get_fs();
10698 + set_fs (get_ds());
10699 + error = sys_statfs(p, &buf);
10703 + return buf.f_namelen;
10713 +svr4_fpathconf(int fildes, int name)
10716 + case _PC_LINK_MAX:
10717 + /* Although Linux headers define values on a per
10718 + * filesystem basis there is no way to access
10719 + * these without hard coding fs information here
10720 + * so for now we use a bogus value.
10724 + case _PC_MAX_CANON:
10725 + return MAX_CANON;
10727 + case _PC_MAX_INPUT:
10728 + return MAX_INPUT;
10730 + case _PC_PATH_MAX:
10733 + case _PC_PIPE_BUF:
10736 + case _PC_CHOWN_RESTRICTED:
10737 + /* We should really think about this and tell
10742 + case _PC_NO_TRUNC:
10743 + /* Not sure... It could be fs dependent? */
10746 + case _PC_VDISABLE:
10749 + case _PC_NAME_MAX: {
10750 + struct statfs buf;
10752 + mm_segment_t old_fs;
10754 + old_fs = get_fs();
10755 + set_fs (get_ds());
10756 + error = sys_fstatfs(fildes, &buf);
10759 + return buf.f_namelen;
10768 +svr4_sigpending(int which_routine, svr4_sigset_t *set)
10770 + /* Solaris multiplexes on this one */
10771 + /* Which routine has the actual routine that should be called */
10773 + switch (which_routine){
10774 + case 1: /* sigpending */
10775 + printk ("iBCS/Intel: sigpending not implemented\n");
10778 + case 2: /* sigfillset */
10779 + set->setbits [0] = ~0;
10780 + set->setbits [1] = 0;
10781 + set->setbits [2] = 0;
10782 + set->setbits [3] = 0;
10788 +typedef void svr4_ucontext_t;
10791 +svr4_setcontext(svr4_ucontext_t *c, struct pt_regs *regs)
10793 + printk (KERN_DEBUG "Getting context\n");
10798 +svr4_getcontext(svr4_ucontext_t *c, struct pt_regs *regs)
10800 + printk (KERN_DEBUG "Setting context\n");
10805 +svr4_context(struct pt_regs *regs)
10807 + int context_fn = get_syscall_parameter (regs, 0);
10808 + struct svr4_ucontext_t *uc = (void *) get_syscall_parameter (regs, 1);
10810 + switch (context_fn){
10811 + case 0: /* getcontext */
10812 + return svr4_getcontext (uc, regs);
10814 + case 1: /* setcontext */
10815 + return svr4_setcontext (uc, regs);
10820 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
10821 +EXPORT_SYMBOL(svr4_context);
10822 +EXPORT_SYMBOL(svr4_fpathconf);
10823 +EXPORT_SYMBOL(svr4_pathconf);
10824 +EXPORT_SYMBOL(svr4_setegid);
10825 +EXPORT_SYMBOL(svr4_seteuid);
10826 +EXPORT_SYMBOL(svr4_sigpending);
10827 +EXPORT_SYMBOL(svr4_waitid);
10829 diff -Nur kernel-source-2.6.16.orig/abi/svr4/sysconf.c kernel-source-2.6.16/abi/svr4/sysconf.c
10830 --- kernel-source-2.6.16.orig/abi/svr4/sysconf.c 1970-01-01 10:00:00.000000000 +1000
10831 +++ kernel-source-2.6.16/abi/svr4/sysconf.c 2006-04-27 18:50:24.000000000 +1000
10834 + * sysconf.c - sysv sysconf(2) and sysconfig(2) emulation
10836 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
10841 +#include <linux/module.h>
10842 +#include <linux/errno.h>
10843 +#include <linux/sched.h>
10844 +#include <linux/kernel.h>
10845 +#include <linux/mm.h>
10846 +#include <linux/stddef.h>
10847 +#include <linux/limits.h>
10848 +#include <linux/unistd.h>
10849 +#include <linux/ptrace.h>
10850 +#include <linux/fcntl.h>
10851 +#include <linux/smp.h>
10852 +#include <linux/swap.h>
10853 +#include <linux/fs.h>
10854 +#include <linux/sys.h>
10855 +#include <asm/uaccess.h>
10856 +#include <asm/system.h>
10858 +#include <abi/svr4/sysconf.h>
10859 +#include <abi/util/trace.h>
10862 +/* The sysconf() call is supposed to give applications access to various
10863 + * kernel parameters. According to SCO's man page this a POSIX mandated
10864 + * function. Perhaps it should be moved across as a native Linux call?
10866 + * N.B. SCO only has sysconf in the Xenix group. Therefore this is based
10867 + * on the Xenix spec. Is SVR4 the same? Wyse Unix V.3.2.1A doesn't have
10868 + * sysconf documented at all.
10870 + * N.B. 0-7 are required (by who?). Other values may be defined for
10871 + * various systems but there appears no guarantee that they match across
10872 + * platforms. Thus, unless we can identify what system the executable
10873 + * was compiled for, we probably prefer to have extensions fail. Hell,
10874 + * nothing important is going to use this obscure stuff anyway...
10876 +#define _SC_ARG_MAX 0
10877 +#define _SC_CHILD_MAX 1
10878 +#define _SC_CLK_TCK 2
10879 +#define _SC_NGROUPS_MAX 3
10880 +#define _SC_OPEN_MAX 4
10881 +#define _SC_JOB_CONTROL 5
10882 +#define _SC_SAVED_IDS 6
10883 +#define _SC_VERSION 7
10885 +#define _SC_PAGESIZE 11
10886 +#define _SCO_SC_PAGESIZE 34
10889 +/* This is an SVR4 system call that is undocumented except for some
10890 + * hints in a header file. It appears to be a forerunner to the
10891 + * POSIX sysconf() call.
10893 +int svr4_sysconfig(int name)
10896 + case _CONFIG_NGROUPS:
10897 + /* From limits.h */
10898 + return (NGROUPS_MAX);
10900 + case _CONFIG_CHILD_MAX:
10901 + /* From limits.h */
10902 + return (CHILD_MAX);
10904 + case _CONFIG_OPEN_FILES:
10905 + /* From limits.h */
10906 + return (OPEN_MAX);
10908 + case _CONFIG_POSIX_VER:
10909 + /* The version of the POSIX standard we conform
10910 + * to. SCO defines _POSIX_VERSION as 198808L
10911 + * sys/unistd.h. What are we? We are 199009L.
10913 + return (199009L);
10915 + case _CONFIG_PAGESIZE:
10916 + return (PAGE_SIZE);
10918 + case _CONFIG_CLK_TCK:
10921 + case _CONFIG_XOPEN_VER:
10924 + case _CONFIG_NACLS_MAX:
10927 + case _CONFIG_NPROC:
10928 + return 4000; /* max_threads */
10930 + case _CONFIG_NENGINE:
10931 + case _CONFIG_NENGINE_ONLN:
10932 + return (num_online_cpus());
10934 + case _CONFIG_TOTAL_MEMORY:
10935 + return (max_mapnr << (PAGE_SHIFT-10));
10937 + case _CONFIG_USEABLE_MEMORY:
10938 + case _CONFIG_GENERAL_MEMORY:
10939 + return (max_mapnr << (PAGE_SHIFT-10));
10940 +/* return ((unsigned long) (nr_free_pages()) << (PAGE_SHIFT-10)); */
10942 + case _CONFIG_DEDICATED_MEMORY:
10945 + case _CONFIG_NCGS_CONF:
10946 + case _CONFIG_NCGS_ONLN:
10947 + case _CONFIG_MAX_ENG_PER_CG:
10948 + return 1; /* no NUMA-Q support on Linux yet */
10949 + /* well, there is. we lie anyway --hch */
10951 + case _CONFIG_CACHE_LINE:
10952 + return 32; /* XXX is there a more accurate way? */
10954 + case _CONFIG_KERNEL_VM:
10957 + case _CONFIG_ARG_MAX:
10958 + /* From limits.h */
10959 + return (ARG_MAX);
10962 +#if defined(CONFIG_ABI_TRACE)
10963 + abi_trace(ABI_TRACE_API, "unsupported sysconfig call %d\n", name);
10969 +int ibcs_sysconf(int name)
10972 + case _SC_ARG_MAX:
10973 + /* From limits.h */
10974 + return (ARG_MAX);
10976 + case _SC_CHILD_MAX:
10977 + /* From limits.h */
10978 + return (CHILD_MAX);
10980 + case _SC_CLK_TCK:
10983 + case _SC_NGROUPS_MAX:
10984 + /* From limits.h */
10985 + return (NGROUPS_MAX);
10987 + case _SC_OPEN_MAX:
10988 + /* From limits.h */
10989 + return (OPEN_MAX);
10991 + case _SC_JOB_CONTROL:
10994 + case _SC_SAVED_IDS:
10997 + case _SC_PAGESIZE:
10998 + case _SCO_SC_PAGESIZE:
10999 + return PAGE_SIZE;
11001 + case _SC_VERSION:
11002 + /* The version of the POSIX standard we conform
11003 + * to. SCO defines _POSIX_VERSION as 198808L
11004 + * sys/unistd.h. What are we?
11006 + return (198808L);
11009 +#if defined(CONFIG_ABI_TRACE)
11010 + abi_trace(ABI_TRACE_API, "unsupported sysconf call %d\n", name);
11015 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
11016 +EXPORT_SYMBOL(ibcs_sysconf);
11017 +EXPORT_SYMBOL(svr4_sysconfig);
11019 diff -Nur kernel-source-2.6.16.orig/abi/svr4/sysfs.c kernel-source-2.6.16/abi/svr4/sysfs.c
11020 --- kernel-source-2.6.16.orig/abi/svr4/sysfs.c 1970-01-01 10:00:00.000000000 +1000
11021 +++ kernel-source-2.6.16/abi/svr4/sysfs.c 2006-04-27 18:50:24.000000000 +1000
11024 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
11029 +#include <linux/module.h>
11030 +#include <linux/personality.h>
11031 +#include <linux/sched.h>
11032 +#include <linux/syscalls.h>
11033 +#include <asm/uaccess.h>
11035 +#include <abi/util/trace.h>
11038 + * The kernel sysfs() code is almost all we need but, apparently,
11039 + * the SCO (at least) sysfs() will also accept a "magic number"
11040 + * as an index argument and will return the name of the relevant
11041 + * file system. Since Linux doesn't have any concept of fs magic
11042 + * numbers outside the file system code themselves there is no
11043 + * clean way to do it in the kernel. There isn't a clean way to
11044 + * to it here either but it needs to be done somehow :-(.
11053 +svr4_sysfs(int cmd, int arg1, int arg2)
11055 + if (cmd == GETFSIND)
11056 + return sys_sysfs(cmd, arg1, arg2);
11058 + if (cmd == GETNFSTYP)
11059 + return sys_sysfs(cmd, arg1, arg2);
11061 + if (cmd == GETFSTYP) {
11062 + char *buf = (char *)arg2;
11065 + if (arg1 & 0x80000000)
11066 + arg1 &= 0x0000ffff;
11067 + if (arg1 >= 0 && arg1 < sys_sysfs(GETNFSTYP,0,0))
11068 + return sys_sysfs(cmd, arg1-1, arg2);
11071 + * Kludge alert! Hardcoded known magic numbers!
11074 + case 0xef53: case 0xffffef53:
11075 + case 0xef51: case 0xffffef51:
11077 + * Some SCO programs (i.e. Informix Dynamic
11078 + * Server are using this to detect "real"
11079 + * filesystems by checking type names :-(.
11082 + if (is_cur_personality(PER_SCOSVR3))
11083 + error = copy_to_user(buf, "HTFS", 5);
11085 + error = copy_to_user(buf, "ext2", 5);
11088 + error = copy_to_user(buf, "ext", 4);
11090 + case 0x9660: case 0xffff9660:
11091 + error = copy_to_user(buf, "iso9660", 8);
11094 + error = copy_to_user(buf, "msdos", 6);
11097 + error = copy_to_user(buf, "nfs", 4);
11099 + case 0x9fa0: case 0xffff9fa0:
11100 + error = copy_to_user(buf, "proc", 5);
11103 + case 0xe849: case 0xffffe849:
11104 + error = copy_to_user(buf, "hpfs", 5);
11106 + case 0x137f: /* original */
11107 + case 0x138f: /* original + 30 char names */
11108 + case 0x2468: /* V2 */
11109 + case 0x2478: /* V2 + 30 char names */
11110 + error = copy_to_user(buf, "minix", 6);
11113 + error = copy_to_user(buf, "ncpfs", 6);
11116 + error = copy_to_user(buf, "smbfs", 6);
11119 + error = copy_to_user(buf, "ufs", 4);
11121 + case 0x012fd16d: case 0xffffd16d:
11122 + error = copy_to_user(buf, "xiafs", 6);
11124 + case 0x012ff7b3+1: case 0xfffff7b3+1:
11125 + error = copy_to_user(buf, "xenix", 6);
11127 + case 0x012ff7b3+2: case 0xfffff7b3+2:
11128 + case 0x012ff7b3+3: case 0xfffff7b3+3:
11129 + error = copy_to_user(buf, "sysv", 5);
11131 + case 0x012ff7b3+4: case 0xfffff7b3+4:
11132 + error = copy_to_user(buf, "coherent", 9);
11135 + error = copy_to_user(buf, "", 1);
11144 +#if defined(CONFIG_ABI_TRACE)
11145 + abi_trace(ABI_TRACE_API, "unsupported sysfs call %d\n", cmd);
11150 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
11151 +EXPORT_SYMBOL(svr4_sysfs);
11153 diff -Nur kernel-source-2.6.16.orig/abi/svr4/sysi86.c kernel-source-2.6.16/abi/svr4/sysi86.c
11154 --- kernel-source-2.6.16.orig/abi/svr4/sysi86.c 1970-01-01 10:00:00.000000000 +1000
11155 +++ kernel-source-2.6.16/abi/svr4/sysi86.c 2006-04-27 18:50:24.000000000 +1000
11158 + * Copyright 1994,1995 Mike Jagdis <jaggy@purplet.demon.co.uk>
11159 + * Copyright 2002 Caldera Deutschland GmbH
11164 +#include <linux/sched.h>
11165 +#include <linux/kernel.h>
11166 +#include <linux/ptrace.h>
11167 +#include <linux/syscalls.h>
11168 +#include <linux/mm.h>
11169 +#include <linux/module.h>
11170 +#include <asm/uaccess.h>
11172 +#include <abi/util/trace.h>
11176 + * The sysi86() call is used for machine specific functions. Only the
11177 + * most basic are implemented here.
11179 +#define SI86SWPI 1 /* General swap functions. */
11180 +#define SI86SYM 2 /* Get symbol table */
11181 +#define SI86CONF 4 /* Get configuration table */
11182 +#define SI86BOOT 5 /* Get timestamp and name of program
11185 +#define SI86DMM 7 /* Double-map data segment for
11186 + * read/write/execute support
11188 +#define SI86AUTO 9 /* Was an auto-config boot done? */
11189 +#define SI86EDT 10 /* Copy contents of EDT to user */
11190 +#define SI86SWAP 12 /* Declare swap space */
11191 +#define SI86FPHW 40 /* what (if any?) floating-point hardware */
11192 +# define FP_NO 0 /* No fp at all */
11193 +# define FP_SW 1 /* using emulator */
11194 +# define FP_HW 2 /* using hardware */
11195 +# define FP_287 2 /* using a 287 */
11196 +# define FP_387 3 /* using a 387 */
11197 +#define GRNON 52 /* set green light to solid on state */
11198 +#define GRNFLASH 53 /* start green light flashing */
11199 +#define STIME 54 /* set internal time */
11200 +#define SETNAME 56 /* rename the system */
11201 +#define RNVR 58 /* read NVRAM */
11202 +#define WNVR 59 /* write NVRAM */
11203 +#define RTODC 60 /* read time of day clock */
11204 +#define CHKSER 61 /* check soft serial number */
11205 +#define SI86NVPRT 62 /* print an xtra_nvr structure */
11206 +#define SANUPD 63 /* sanity update of kernel buffers */
11207 +#define SI86KSTR 64 /* make a copy of a kernel string */
11208 +#define SI86MEM 65 /* return the memory size of system */
11209 +#define SI86TODEMON 66 /* Transfer control to firmware. */
11210 +#define SI86CCDEMON 67 /* Control character access to demon. */
11211 +#define SI86CACHE 68 /* Turn cache on and off. */
11212 +#define SI86DELMEM 69 /* Delete available memory for testing. */
11213 +#define SI86ADDMEM 70 /* Add back deleted memory. */
11214 +/* 71 through 74 reserved for VPIX */
11215 +#define SI86V86 71 /* V86 system calls (see v86.h) */
11216 +#define SI86SLTIME 72 /* Set local time correction */
11217 +#define SI86DSCR 75 /* Set a segment or gate descriptor */
11218 +#define RDUBLK 76 /* Read U Block */
11219 +/* #ifdef MERGE386 */
11220 +/* NFA entry point */
11221 +#define SI86NFA 77 /* make nfa_sys system call */
11222 +#define SI86VM86 81
11223 +#define SI86VMENABLE 82
11224 +/* #endif MERGE386 */
11225 +#define SI86VM86 81
11226 +#define SI86VMENABLE 82
11227 +#define SI86LIMUSER 91 /* liscense interface */
11228 +#define SI86RDID 92 /* ROM BIOS Machid ID */
11229 +#define SI86RDBOOT 93 /* Bootable Non-SCSI Hard Disk */
11230 +/* Merged Product defines */
11231 +#define SI86SHFIL 100 /* map a file into addr space of a proc */
11232 +#define SI86PCHRGN 101 /* make globally visible change to a region */
11233 +#define SI86BADVISE 102 /* badvise subcommand - see below for */
11234 + /* badvise subfunction definitions */
11235 +#define SI86SHRGN 103 /* enable/disable XENIX small model shared */
11236 + /* data context switching */
11237 +#define SI86CHIDT 104 /* set user level int 0xf0, ... 0xff handlers */
11238 +#define SI86EMULRDA 105 /* remove special emulator read access */
11239 +#define SI86GETPIPE 106 /* return the pipe filesystem */
11240 +#define SI86SETPIPE 107 /* set the pipe filesystem */
11241 +#define SI86SETPIPE_NM 108 /* set the pipe filesystem -non mountable */
11242 +#define SI86GETNPIPE 109 /* get # of pipe filesystems */
11243 +#define SI86GETPIPE_ALL 110 /* get data on all of pipe filesystems */
11244 +#define SI86POPPIPE 111 /* pop pipe file system off stack */
11245 +#define SI86APM 112 /* get APM information passed by boot(HW) */
11246 +#define SI86TIMECHG 113 /* get time before/after last timechange */
11247 +#define SI86GETFEATURES 114 /* get os features vector */
11249 +/* The SI86BADVISE command is used to set Xenix behaviour. */
11250 +#define SI86B_SET 0x0100 /* Set badvise bits */
11251 +#define SI86B_GET 0x0200 /* Get badvise bits */
11252 +#define SI86B_LOCK 0x0001 /* XENIX advisory locking bit */
11253 +#define SI86B_PRE_SV 0x0008 /* follow pre-System V x.out behavior */
11254 +#define SI86B_XOUT 0x0010 /* follow XENIX x.out behavior */
11255 +#define SI86B_XSDSWTCH 0x0080 /* XENIX small model shared data */
11256 + /* context switching enabled */
11259 + * The SI86DSCR subcommand of the sysi86() system call
11260 + * sets a segment or gate descriptor in the kernel.
11261 + * The following descriptor types are accepted:
11262 + * - executable and data segments in the LDT at DPL 3
11263 + * - a call gate in the GDT at DPL 3 that points to a segment in the LDT
11264 + * The request structure declared below is used to pass the values
11265 + * to be placed in the descriptor. A pointer to the structure is
11266 + * passed as the second argument of the system call.
11267 + * If acc1 is zero, the descriptor is cleared.
11270 + uint32_t sel; /* descriptor selector */
11271 + uint32_t bo; /* segment base or gate offset */
11272 + uint32_t ls; /* segment limit or gate selector */
11273 + uint32_t acc1; /* access byte 5 */
11274 + uint32_t acc2; /* access bits in byte 6 or gate count */
11279 +svr4_sysi86(int cmd, void *arg1, int arg2)
11284 + * If we remove the 'static' from the definition
11285 + * of fpu_error in linux/init/main.c we can tell
11286 + * whether we are using hardware or software at
11287 + * least. For now let's lie...
11288 + * (actually SCO Unix 3.4 gives me -1...)
11290 + return put_user(FP_387, (unsigned long *)arg1);
11293 + * Set the system time. The argument is a long,
11294 + * sys_stime() expects a pointer to a long...
11296 + return sys_stime(arg1);
11299 + * The name is required to be string of no more
11300 + * than 7 characters. We don't get passed the
11301 + * length so we are depending upon the current
11302 + * implementation of sys_sethostname() here.
11304 + return sys_sethostname(arg1, 7);
11308 + * Returns the size of physical memory.
11310 + struct sysinfo i;
11313 + return (i.totalram << PAGE_SHIFT);
11319 + if (copy_from_user(&s, arg1, sizeof(struct ssd)))
11322 + printk("SI86DSCR(%x,%x,%x,%x,%x)\n",
11323 + s.sel, s.bo, s.ls, s.acc1, s.acc2);
11327 +#if defined(CONFIG_ABI_TRACE)
11328 + abi_trace(ABI_TRACE_API, "unsupported sysi86 subcall %d\n", cmd);
11334 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
11335 +EXPORT_SYMBOL(svr4_sysi86);
11337 diff -Nur kernel-source-2.6.16.orig/abi/svr4/sysinfo.c kernel-source-2.6.16/abi/svr4/sysinfo.c
11338 --- kernel-source-2.6.16.orig/abi/svr4/sysinfo.c 1970-01-01 10:00:00.000000000 +1000
11339 +++ kernel-source-2.6.16/abi/svr4/sysinfo.c 2006-04-27 18:50:24.000000000 +1000
11342 + * Copyright (C) 1995 Eric Youngdale
11347 +#include <linux/module.h>
11348 +#include <linux/version.h>
11349 +#include <linux/compile.h>
11350 +#include <linux/mm.h>
11351 +#include <linux/errno.h>
11352 +#include <linux/sched.h>
11353 +#include <linux/utsname.h>
11354 +#include <asm/uaccess.h>
11356 +#include <abi/util/trace.h>
11359 +#define __O_SI_SYSNAME 1 /* return name of operating system */
11360 +#define __O_SI_HOSTNAME 2 /* return name of node */
11361 +#define SI_RELEASE 3 /* return release of operating system */
11362 +#define SI_VERSION 4 /* return version field of utsname */
11363 +#define __O_SI_MACHINE 5 /* return kind of machine */
11364 +#define __O_SI_ARCHITECTURE 6 /* return instruction set arch */
11365 +#define SI_HW_SERIAL 7 /* return hardware serial number */
11366 +#define __O_SI_HW_PROVIDER 8 /* return hardware manufacturer */
11367 +#define SI_SRPC_DOMAIN 9 /* return secure RPC domain */
11368 +#define SI_INITTAB_NAME 10 /* return name of inittab file used */
11369 +#define SI_ARCHITECTURE 100 /* return instruction set arch */
11370 +#define SI_BUSTYPES 101 /* return list of bus types */
11371 +#define SI_HOSTNAME 102 /* return fully-qualified node name */
11372 +#define SI_HW_PROVIDER 103 /* return hardware manufacturer */
11373 +#define SI_KERNEL_STAMP 104 /* return kernel generation timestamp */
11374 +#define SI_MACHINE 105 /* return kind of machine */
11375 +#define SI_OS_BASE 106 /* return base operating system */
11376 +#define SI_OS_PROVIDER 107 /* return operating system provider */
11377 +#define SI_SYSNAME 108 /* return name of operating system */
11378 +#define SI_USER_LIMIT 109 /* return maximum number of users */
11382 +int svr4_sysinfo(int cmd, char * buf, long count)
11384 + char * return_string;
11385 + static unsigned int serial_number = 0;
11390 + return_string = NULL;
11393 + case __O_SI_SYSNAME:
11395 + return_string = system_utsname.sysname;
11397 + case __O_SI_HOSTNAME:
11398 + case SI_HOSTNAME:
11399 + return_string = system_utsname.nodename;
11402 + return_string = "2";
11405 + return_string = system_utsname.release;
11408 + case __O_SI_MACHINE:
11409 + return_string = system_utsname.machine;
11411 + case __O_SI_ARCHITECTURE:
11412 + case SI_ARCHITECTURE:
11413 + return_string = "IA32"; /* XXX: this seems wrong, the name ia32 is very new ... -- ch */
11415 + case SI_BUSTYPES:
11416 + return_string = "PCI ISA";
11418 + case __O_SI_HW_PROVIDER:
11419 + case SI_HW_PROVIDER:
11420 + return_string = "Generic AT";
11422 + case SI_KERNEL_STAMP:
11423 + return_string = UTS_VERSION;
11425 + case SI_INITTAB_NAME:
11426 + return_string = "/etc/inittab";
11428 + case SI_HW_SERIAL:
11429 + if(serial_number == 0)
11430 + serial_number = 0xdeadbeef;
11431 + sprintf(buffer,"%8.8x", serial_number);
11432 + return_string = buffer;
11435 + return_string = "Linux";
11437 + case SI_OS_PROVIDER:
11438 + return_string = "LBT"; /* someone's initials ? */
11440 + case SI_SRPC_DOMAIN:
11441 + return_string = system_utsname.domainname;
11443 + case SI_USER_LIMIT:
11444 + /* have you seen a Linux box with more than 500000 users? */
11445 + return_string = "500000";
11448 +#if defined(CONFIG_ABI_TRACE)
11449 + abi_trace(ABI_TRACE_API,
11450 + "unsupported sysinfo call %d\n", cmd);
11455 + if (!return_string)
11458 + down_read(&uts_sem);
11459 + slen = (count < strlen(return_string) + 1 ? count : strlen(return_string) + 1);
11460 + error = copy_to_user(buf, return_string, slen);
11461 + up_read(&uts_sem);
11463 + return error ? -EFAULT : slen;
11466 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
11467 +EXPORT_SYMBOL(svr4_sysinfo);
11469 diff -Nur kernel-source-2.6.16.orig/abi/svr4/tapeio.c kernel-source-2.6.16/abi/svr4/tapeio.c
11470 --- kernel-source-2.6.16.orig/abi/svr4/tapeio.c 1970-01-01 10:00:00.000000000 +1000
11471 +++ kernel-source-2.6.16/abi/svr4/tapeio.c 2006-04-27 18:50:24.000000000 +1000
11475 +#include <linux/errno.h>
11476 +#include <linux/kernel.h>
11477 +#include <linux/mtio.h>
11478 +#include <linux/syscalls.h>
11479 +#include <asm/uaccess.h>
11483 +svr4_tape_ioctl(int fd, u_int cmd, caddr_t data)
11487 + struct mtop mtop;
11489 + mtop.mt_count = 1;
11491 + switch (cmd & 0xff) {
11492 + case 1: /* MT_RETEN */
11493 + mtop.mt_op = MTRETEN;
11495 + case 2: /* MT_REWIND */
11496 + mtop.mt_op = MTREW;
11498 + case 3: /* MT_ERASE */
11499 + mtop.mt_op = MTERASE;
11501 + case 4: /* MT_WFM */
11502 + mtop.mt_op = MTWEOF;
11504 + case 5: /* MT_RESET */
11505 + mtop.mt_op = MTRESET;
11507 + case 7: /* T_SFF */
11508 + mtop.mt_op = MTFSF;
11510 + case 8: /* T_SBF */
11511 + mtop.mt_op = MTBSF;
11513 + case 9: /* T_LOAD */
11514 + mtop.mt_op = MTLOAD;
11516 + case 10: /* MT_UNLOAD */
11517 + mtop.mt_op = MTOFFL;
11519 + case 15: /* T_WRBLKLEN */
11520 + mtop.mt_op = MTLOCK;
11521 + mtop.mt_count = (int)data;
11523 + case 16: /* T_PREVMV */
11524 + mtop.mt_op = MTLOCK;
11526 + case 17: /* T_ALLOMV */
11527 + mtop.mt_op = MTUNLOCK;
11529 + case 20: /* T_EOD */
11530 + mtop.mt_op = MTEOM;
11531 + mtop.mt_count = (int)data;
11533 + case 21: /* T_SSFB */
11534 + mtop.mt_op = MTBSFM;
11535 + mtop.mt_count = (int)data;
11537 + case 22: /* T_SSFF */
11538 + mtop.mt_op = MTFSFM;
11539 + mtop.mt_count = (int)data;
11541 + case 24: /* T_STD */
11542 + mtop.mt_op = MTSETDENSITY;
11543 + mtop.mt_count = (int)data;
11547 + case 6: /* T_STATUS */
11548 + case 14: /* T_RDBLKLEN */
11549 + case 18: /* T_SBB */
11550 + case 19: /* T_SFB */
11551 + case 23: /* T_STS */
11554 + printk (KERN_ERR "iBCS: SYSV tape ioctl func=%d arg=%x unsupported\n",
11555 + cmd & 0xff, (int)data);
11560 + set_fs(get_ds());
11561 + error = sys_ioctl(fd, MTIOCTOP, (long)&mtop);
11565 diff -Nur kernel-source-2.6.16.orig/abi/svr4/termios.c kernel-source-2.6.16/abi/svr4/termios.c
11566 --- kernel-source-2.6.16.orig/abi/svr4/termios.c 1970-01-01 10:00:00.000000000 +1000
11567 +++ kernel-source-2.6.16/abi/svr4/termios.c 2006-04-27 18:50:24.000000000 +1000
11571 +#include <linux/kernel.h>
11572 +#include <linux/unistd.h>
11573 +#include <linux/termios.h>
11574 +#include <linux/syscalls.h>
11575 +#include <asm/uaccess.h>
11577 +#include <abi/svr4/ioctl.h>
11578 +#include <abi/svr4/termios.h>
11582 +svr_to_linux_termio(int fd, int op, struct svr_termio *it)
11590 + if (!access_ok(VERIFY_READ, it, sizeof(struct svr_termio)))
11594 + set_fs(get_ds());
11595 + error = sys_ioctl(fd, TCGETA, (long)&t);
11601 + /* Save things we may need later. */
11603 + lflag = t.c_lflag;
11605 + /* Copy the entire structure then fix up as necessary. */
11606 + if (copy_from_user(&t, it, sizeof(struct svr_termio)))
11609 + /* If ICANON isn't set then we've been given VMIN in place
11612 + if (!(t.c_lflag & 0000002)) {
11613 + t.c_cc[6] = t.c_cc[4];
11617 + if (t.c_cflag & 0100000) /* CRTSFL - SCO only? */
11618 + t.c_cflag |= CRTSCTS;
11619 + t.c_cflag &= ~0170000; /* LOBLK|CTSFLOW|RTSFLOW|CRTSFL */
11621 + set_fs(get_ds());
11622 + error = sys_ioctl(fd, op, (long)&t);
11629 +linux_to_svr_termio(int fd, struct svr_termio *it)
11635 + if (!access_ok(VERIFY_WRITE, it, sizeof(struct svr_termio)))
11639 + set_fs(get_ds());
11640 + error = sys_ioctl(fd, TCGETA, (long)&t);
11646 + /* If ICANON isn't set then we substitute VEOF with VMIN. */
11647 + if (!(t.c_lflag & 0000002))
11648 + t.c_cc[4] = t.c_cc[6];
11650 + /* Copy to the user supplied structure. */
11651 + if (copy_to_user(it, &t, sizeof(struct svr_termio)))
11657 +svr4_to_linux_termios(int fd, int op, struct svr4_termios *it)
11659 + struct termios t;
11661 + u_short lflag, r;
11662 + char svr4_cc[SVR4_NCCS];
11665 + if (!access_ok(VERIFY_READ, it, sizeof(struct svr4_termios)))
11669 + set_fs(get_ds());
11670 + error = sys_ioctl(fd, TCGETS, (long)&t);
11676 + __get_user(t.c_iflag, &it->c_iflag);
11677 + t.c_iflag &= ~0100000; /* DOSMODE */
11679 + __get_user(t.c_oflag, &it->c_oflag);
11680 + __get_user(t.c_cflag, &it->c_cflag);
11682 + if (t.c_cflag & 0100000) /* CRTSFL - SCO only? */
11683 + t.c_cflag |= CRTSCTS;
11685 + t.c_cflag &= ~0170000; /* LOBLK|CTSFLOW|RTSFLOW|CRTSFL */
11687 + lflag = t.c_lflag;
11688 + t.c_lflag &= ~0100777;
11689 + __get_user(r, &it->c_lflag);
11692 + if ((t.c_lflag & 0100000))
11693 + sys_ioctl(fd, TIOCEXCL, 0);
11695 + sys_ioctl(fd, TIOCNXCL, 0);
11697 + t.c_lflag &= ~0100000;
11698 + t.c_lflag |= (t.c_lflag & 0000400) << 7; /* Move IEXTEN */
11699 + t.c_lflag &= ~0000400;
11700 + t.c_lflag |= (t.c_lflag & 0001000) >> 1; /* Move TOSTOP */
11701 + t.c_lflag &= ~0001000;
11702 + t.c_lflag |= (lflag & 0001000); /* Restore ECHOCTL */
11704 + if (copy_from_user(svr4_cc, &it->c_cc, SVR4_NCCS))
11707 + t.c_cc[0] = svr4_cc[0];
11708 + t.c_cc[1] = svr4_cc[1];
11709 + t.c_cc[2] = svr4_cc[2];
11710 + t.c_cc[3] = svr4_cc[3];
11711 + t.c_cc[7] = svr4_cc[7];
11712 + t.c_cc[8] = svr4_cc[8];
11713 + t.c_cc[9] = svr4_cc[9];
11714 + t.c_cc[10] = svr4_cc[10];
11715 + t.c_cc[12] = svr4_cc[12];
11716 + t.c_cc[13] = svr4_cc[13];
11717 + t.c_cc[14] = svr4_cc[14];
11718 + t.c_cc[15] = svr4_cc[15];
11719 + t.c_cc[16] = svr4_cc[16];
11721 + if (t.c_lflag & ICANON) {
11722 + t.c_cc[4] = svr4_cc[4];
11723 + t.c_cc[11] = svr4_cc[5];
11725 + t.c_cc[5] = svr4_cc[5];
11726 + t.c_cc[6] = svr4_cc[4];
11727 + t.c_cc[11] = svr4_cc[6];
11730 + set_fs(get_ds());
11731 + error = sys_ioctl(fd, op, (long)&t);
11738 +linux_to_svr4_termios(int fd, int op, struct svr4_termios *it)
11740 + struct termios t;
11741 + char svr4_cc[SVR4_NCCS];
11745 + if (!access_ok(VERIFY_WRITE, it, sizeof(struct svr4_termios)))
11749 + set_fs(get_ds());
11750 + error = sys_ioctl(fd, op, (long)&t);
11756 + put_user(t.c_iflag & 0017777, &it->c_iflag);
11757 + put_user(t.c_oflag & 0177777, &it->c_oflag);
11759 + if (t.c_cflag & CRTSCTS)
11760 + t.c_cflag |= 0100000; /* CRTSFL - SCO only? */
11761 + put_user(t.c_cflag & 0177777, &it->c_cflag);
11763 + t.c_lflag &= ~0001000;
11764 + t.c_lflag |= (t.c_lflag & 0000400) << 1;
11765 + t.c_lflag &= ~0000400;
11766 + t.c_lflag |= (t.c_lflag & 0100000) >> 7;
11767 + t.c_lflag &= ~0100000;
11768 + put_user(t.c_lflag & 0001777, &it->c_lflag);
11770 + svr4_cc[0] = t.c_cc[0];
11771 + svr4_cc[1] = t.c_cc[1];
11772 + svr4_cc[2] = t.c_cc[2];
11773 + svr4_cc[3] = t.c_cc[3];
11774 + svr4_cc[6] = t.c_cc[16];
11775 + svr4_cc[7] = t.c_cc[7];
11776 + svr4_cc[8] = t.c_cc[8];
11777 + svr4_cc[9] = t.c_cc[9];
11778 + svr4_cc[10] = t.c_cc[10];
11779 + svr4_cc[11] = t.c_cc[10];
11780 + svr4_cc[12] = t.c_cc[12];
11781 + svr4_cc[13] = t.c_cc[13];
11782 + svr4_cc[14] = t.c_cc[14];
11783 + svr4_cc[15] = t.c_cc[15];
11785 + if (t.c_lflag & ICANON) {
11786 + svr4_cc[4] = t.c_cc[4];
11787 + svr4_cc[5] = t.c_cc[11];
11789 + svr4_cc[4] = t.c_cc[6];
11790 + svr4_cc[5] = t.c_cc[5];
11793 + if (copy_to_user(&it->c_cc, svr4_cc, SVR4_NCCS))
11800 +svr4_term_ioctl(int fd, u_int cmd, caddr_t data)
11803 + case 1: /* TCGETA (TIOC|1) */
11804 + return linux_to_svr_termio(fd,
11805 + (struct svr_termio *)data);
11806 + case 2: /* TCSETA (TIOC|2) */
11807 + return svr_to_linux_termio(fd, TCSETA,
11808 + (struct svr_termio *)data);
11809 + case 3: /* TCSETAW (TIOC|3) */
11810 + return svr_to_linux_termio(fd, TCSETAW,
11811 + (struct svr_termio *)data);
11812 + case 4: /* TCSETAF (TIOC|4) */
11813 + return svr_to_linux_termio(fd, TCSETAF,
11814 + (struct svr_termio *)data);
11815 + case 5: /* TCSBRK (TIOC|5) */
11816 + return sys_ioctl(fd, TCSBRK, (long)data);
11817 + case 6: /* TCXONC (TIOC|6) */
11818 + return sys_ioctl(fd, TCXONC, (long)data);
11819 + case 7: /* TCFLSH (TIOC|7) */
11820 + return sys_ioctl(fd, TCFLSH, (long)data);
11821 + /* This group appear in SVR4 but not SVR3 (SCO). */
11822 + case 8: /* TIOCKBON */
11823 + case 9: /* TIOCKBOF */
11824 + case 10: /* KBENABLED */
11827 + /* This set is used by SVR4 for termios ioctls. */
11828 + case 13: /* TCGETS */
11829 + return linux_to_svr4_termios(fd, TCGETS,
11830 + (struct svr4_termios *)data);
11831 + case 14: /* TCSETS */
11832 + return svr4_to_linux_termios(fd, TCSETS,
11833 + (struct svr4_termios *)data);
11834 + case 15: /* TCSETSW */
11835 + return svr4_to_linux_termios(fd, TCSETSW,
11836 + (struct svr4_termios *)data);
11837 + case 16: /* TCSETSF */
11838 + return svr4_to_linux_termios(fd, TCSETSF,
11839 + (struct svr4_termios *)data);
11841 + /* These two are specific to ISC. */
11842 + case 20: /* TCSETPGRP (TIOC|20) set pgrp of tty */
11843 + return sys_ioctl(fd, TIOCSPGRP, (long)data);
11844 + case 21: /* TCGETPGRP (TIOC|21) get pgrp of tty */
11845 + return sys_ioctl(fd, TIOCGPGRP, (long)data);
11847 + case 34: /* TCGETSC (TIOC|34) ioctl for scancodes */
11848 + return 0x04; /* Translates scancode to ascii */
11849 + case 35: /* TCSETSC (TIOC|35) ioctl for scancodes */
11852 + case 103: /* TIOCSWINSZ (TIOC|103) */
11853 + return sys_ioctl(fd, TIOCSWINSZ, (long)data);
11854 + case 104: /* TIOCGWINSZ (TIOC|104) */
11855 + return sys_ioctl(fd, TIOCGWINSZ, (long)data);
11857 + case 118: /* TIOCSPGRP (TIOC|118) set pgrp of tty */
11858 + return sys_ioctl(fd, TIOCSPGRP, (long)data);
11859 + case 119: /* TIOCGPGRP (TIOC|119) get pgrp of tty */
11860 + return sys_ioctl(fd, TIOCGPGRP, (long)data);
11862 + case 32: /* TCDSET (TIOC|32) */
11863 + case 33: /* RTS_TOG (TIOC|33) 386 - "RTS" toggle define 8A1 protocol */
11865 + case 120: /* TIOSETSAK (TIOC|120) set SAK sequence for tty */
11866 + case 121: /* TIOGETSAK (TIOC|121) get SAK sequence for tty */
11867 + printk(KERN_ERR "iBCS: termio ioctl %d unimplemented\n", cmd);
11871 + printk(KERN_ERR "iBCS: termio ioctl %d unsupported\n", cmd);
11876 + unsigned short x_hflag;
11877 + unsigned short x_cflag;
11878 + unsigned short x_rflag[5];
11879 + unsigned short x_sflag;
11882 +#define RTSXOFF 0x0001
11883 +#define CTSXON 0x0002
11886 +svr4_termiox_ioctl(int fd, u_int cmd, caddr_t data)
11888 + struct termios t;
11889 + struct termiox tx;
11893 + if (cmd < 1 || cmd > 4)
11896 + if (!access_ok(cmd == 1 ? VERIFY_WRITE : VERIFY_READ,
11897 + data, sizeof(struct termiox)))
11901 + set_fs(get_ds());
11902 + error = sys_ioctl(fd, TCGETS, (long)&t);
11908 + if (cmd == 1) { /* TCGETX */
11909 + memset(&tx, '\0', sizeof(struct termiox));
11910 + if (t.c_cflag & CRTSCTS)
11911 + tx.x_hflag = RTSXOFF|CTSXON;
11912 + if (copy_to_user(data, &tx, sizeof(struct termiox)))
11917 + if (copy_from_user(&tx, data, sizeof(struct termiox)))
11920 + if ((tx.x_hflag != 0 && tx.x_hflag != (RTSXOFF|CTSXON))
11921 + || tx.x_cflag || tx.x_rflag[0] || tx.x_rflag[1]
11922 + || tx.x_rflag[2] || tx.x_rflag[3] || tx.x_rflag[4]
11927 + t.c_cflag |= CRTSCTS;
11929 + t.c_cflag &= (~CRTSCTS);
11932 + set_fs(get_ds());
11934 + case 2: /* TCSETX */
11935 + error = sys_ioctl(fd, TCSETS, (long)&t);
11937 + case 3: /* TCSETXW */
11938 + error = sys_ioctl(fd, TCSETSW, (long)&t);
11940 + case 4: /* TCSETXF */
11941 + error = sys_ioctl(fd, TCSETSF, (long)&t);
11948 +#define BSD_NCCS 20
11949 +struct bsd_termios {
11950 + unsigned long c_iflag;
11951 + unsigned long c_oflag;
11952 + unsigned long c_cflag;
11953 + unsigned long c_lflag;
11954 + unsigned char c_cc[BSD_NCCS];
11958 +static unsigned long speed_map[] = {
11959 + 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400,
11960 + 4800, 9600, 19200, 38400
11963 +static unsigned long
11964 +bsd_to_linux_speed(unsigned long s)
11977 + for (i=0; i<sizeof(speed_map)/sizeof(speed_map[0]); i++)
11978 + if (s <= speed_map[i])
11983 +static unsigned long
11984 +linux_to_bsd_speed(unsigned long s)
11991 + if (s == B115200)
11994 + return speed_map[s];
12001 +bsd_to_linux_termios(int fd, int op, struct bsd_termios *it)
12003 + struct termios t;
12004 + mm_segment_t old_fs;
12005 + unsigned long temp;
12006 + char bsd_cc[BSD_NCCS];
12009 + if (!access_ok(VERIFY_READ, it, sizeof(struct bsd_termios)))
12012 + old_fs = get_fs();
12013 + set_fs(get_ds());
12014 + error = sys_ioctl(fd, TCGETS, (long)&t);
12019 + __get_user(t.c_iflag, &it->c_iflag);
12020 + t.c_iflag = (t.c_iflag & ~0xc00)
12021 + | ((t.c_iflag & 0x400) << 1)
12022 + | ((t.c_iflag & 0x800) >> 1);
12024 + get_user(temp, &it->c_oflag);
12025 + t.c_oflag = (t.c_oflag & ~0x1805)
12027 + | ((temp & 2) << 1)
12028 + | ((temp & 4) << 10)
12029 + | ((temp & 4) << 9);
12031 + get_user(temp, &it->c_cflag);
12032 + t.c_cflag = (t.c_cflag & ~0xfff)
12033 + | ((temp & 0xff00) >> 4);
12034 + if (t.c_cflag & 0x30000)
12035 + t.c_cflag |= 020000000000;
12036 + t.c_cflag |= bsd_to_linux_speed(({long s; get_user(s, &it->c_ospeed); s;}))
12037 + | (bsd_to_linux_speed(({long s; get_user(s, &it->c_ispeed); s;})) << 16);
12039 + get_user(temp, &it->c_lflag);
12040 + t.c_lflag = (t.c_lflag & ~0157663)
12041 + | ((temp & 1) << 12)
12042 + | ((temp & 0x46) << 3)
12043 + | ((temp & 0x420) << 5)
12044 + | ((temp & 0x180) >> 7)
12045 + | ((temp & 0x400000) >> 14)
12046 + | ((temp & 0x2800000) >> 11)
12047 + | ((temp & 0x80000000) >> 24);
12049 + if (copy_from_user(bsd_cc, &it->c_cc, BSD_NCCS))
12052 + t.c_cc[VEOF] = bsd_cc[0];
12053 + t.c_cc[VEOL] = bsd_cc[1];
12054 + t.c_cc[VEOL2] = bsd_cc[2];
12055 + t.c_cc[VERASE] = bsd_cc[3];
12056 + t.c_cc[VWERASE] = bsd_cc[4];
12057 + t.c_cc[VKILL] = bsd_cc[5];
12058 + t.c_cc[VREPRINT] = bsd_cc[6];
12059 + t.c_cc[VSWTC] = bsd_cc[7];
12060 + t.c_cc[VINTR] = bsd_cc[8];
12061 + t.c_cc[VQUIT] = bsd_cc[9];
12062 + t.c_cc[VSUSP] = bsd_cc[10];
12063 +/* t.c_cc[VDSUSP] = bsd_cc[11];*/
12064 + t.c_cc[VSTART] = bsd_cc[12];
12065 + t.c_cc[VSTOP] = bsd_cc[13];
12066 + t.c_cc[VLNEXT] = bsd_cc[14];
12067 + t.c_cc[VDISCARD] = bsd_cc[15];
12068 + t.c_cc[VMIN] = bsd_cc[16];
12069 + t.c_cc[VTIME] = bsd_cc[17];
12070 +/* t.c_cc[VSTATUS] = bsd_cc[18];*/
12072 + set_fs(get_ds());
12073 + error = sys_ioctl(fd, op, (long)&t);
12081 +linux_to_bsd_termios(int fd, int op, struct bsd_termios *it)
12083 + struct termios t;
12084 + char bsd_cc[BSD_NCCS];
12085 + mm_segment_t old_fs;
12088 + if (!access_ok(VERIFY_WRITE, it, sizeof(struct bsd_termios)))
12091 + old_fs = get_fs();
12092 + set_fs(get_ds());
12093 + error = sys_ioctl(fd, op, (long)&t);
12098 + put_user((t.c_iflag & 0777)
12099 + | ((t.c_iflag & 02000) >> 1)
12100 + | ((t.c_iflag & 010000) >> 2)
12101 + | ((t.c_iflag & 020000) >> 4),
12104 + put_user((t.c_oflag & 1)
12105 + | ((t.c_oflag & 04) >> 1)
12106 + | ((t.c_oflag & 014000) == 014000 ? 4 : 0),
12109 + put_user((t.c_cflag & ~020000007777)
12110 + | ((t.c_cflag & 0xff0) << 4)
12111 + | ((t.c_cflag & 020000000000) ? 0x30000 : 0),
12114 + put_user(linux_to_bsd_speed(t.c_cflag & CBAUD), &it->c_ospeed);
12115 + if ((t.c_cflag & CIBAUD) != 0)
12116 + put_user(linux_to_bsd_speed((t.c_cflag & CIBAUD) >> 16),
12119 + put_user(linux_to_bsd_speed(t.c_cflag & CBAUD),
12122 + put_user((t.c_lflag & 07777626010)
12123 + | ((t.c_lflag & 03) << 7)
12124 + | ((t.c_lflag & 01160) >> 3)
12125 + | ((t.c_lflag & 0400) << 14)
12126 + | ((t.c_lflag & 02000) >> 4)
12127 + | ((t.c_lflag & 04000) >> 11)
12128 + | ((t.c_lflag & 010000) << 11)
12129 + | ((t.c_lflag & 040000) << 15)
12130 + | ((t.c_lflag & 0100000) >> 5),
12133 + bsd_cc[0] = t.c_cc[VEOF];
12134 + bsd_cc[1] = t.c_cc[VEOL];
12135 + bsd_cc[2] = t.c_cc[VEOL2];
12136 + bsd_cc[3] = t.c_cc[VERASE];
12137 + bsd_cc[4] = t.c_cc[VWERASE];
12138 + bsd_cc[5] = t.c_cc[VKILL];
12139 + bsd_cc[6] = t.c_cc[VREPRINT];
12140 + bsd_cc[7] = t.c_cc[VSWTC];
12141 + bsd_cc[8] = t.c_cc[VINTR];
12142 + bsd_cc[9] = t.c_cc[VQUIT];
12143 + bsd_cc[10] = t.c_cc[VSUSP];
12144 + bsd_cc[11] = t.c_cc[VSUSP];
12145 + bsd_cc[12] = t.c_cc[VSTART];
12146 + bsd_cc[13] = t.c_cc[VSTOP];
12147 + bsd_cc[14] = t.c_cc[VLNEXT];
12148 + bsd_cc[15] = t.c_cc[VDISCARD];
12149 + bsd_cc[16] = t.c_cc[VMIN];
12150 + bsd_cc[17] = t.c_cc[VTIME];
12151 + bsd_cc[18] = 0; /* t.c_cc[VSTATUS]; */
12154 + if (copy_to_user(&it->c_cc, bsd_cc, BSD_NCCS))
12163 +struct v7_sgttyb {
12164 + unsigned char sg_ispeed;
12165 + unsigned char sg_ospeed;
12166 + unsigned char sg_erase;
12167 + unsigned char sg_kill;
12171 +struct v7_tchars {
12180 +struct v7_ltchars {
12190 +int bsd_ioctl_termios(int fd, unsigned int func, void *data)
12192 + switch (func & 0xff) {
12193 + case 0: { /* TIOCGETD */
12194 + unsigned long ldisc;
12195 + mm_segment_t old_fs;
12198 + if (!access_ok(VERIFY_WRITE, data,
12199 + sizeof(unsigned short)))
12202 + old_fs = get_fs();
12203 + set_fs(get_ds());
12204 + error = sys_ioctl(fd, TIOCGETD, (long)&ldisc);
12207 + put_user(ldisc, (unsigned short *)data);
12210 + case 1: { /* TIOCSETD */
12211 + unsigned long ldisc;
12212 + mm_segment_t old_fs;
12215 + if (!access_ok(VERIFY_READ, data,
12216 + sizeof(unsigned short)))
12219 + get_user(ldisc, (unsigned short *)data);
12220 + old_fs = get_fs();
12221 + set_fs(get_ds());
12222 + error = sys_ioctl(fd, TIOCSETD, (long)&ldisc);
12227 + case 2: { /* TIOCHPCL */
12229 + mm_segment_t old_fs;
12230 + struct termios t;
12232 + old_fs = get_fs();
12233 + set_fs(get_ds());
12234 + error = sys_ioctl(fd, TCGETS, (long)&t);
12240 + t.c_cflag |= HUPCL;
12242 + t.c_cflag &= ~HUPCL;
12244 + old_fs = get_fs();
12245 + set_fs(get_ds());
12246 + error = sys_ioctl(fd, TCSETS, (long)&t);
12251 + case 8: { /* TIOCGETP */
12253 + mm_segment_t old_fs;
12254 + struct termios t;
12255 + struct v7_sgttyb sg;
12257 + if (!access_ok(VERIFY_WRITE, data, sizeof(sg)))
12260 + old_fs = get_fs();
12261 + set_fs(get_ds());
12262 + error = sys_ioctl(fd, TCGETS, (long)&t);
12267 + sg.sg_ispeed = sg.sg_ospeed = 0;
12268 + sg.sg_erase = t.c_cc[VERASE];
12269 + sg.sg_kill = t.c_cc[VKILL];
12271 + /* Old - became TANDEM instead.
12272 + * ((t.c_cflag & HUPCL) >> 10)
12275 +/* O_ODDP */ ((t.c_cflag & PARODD) >> 3)
12276 +/* O_EVENP */ | ((t.c_cflag & PARENB) >> 1)
12277 +/* LITOUT */ | ((t.c_cflag & OPOST) ? 0 : 0x200000)
12278 +/* O_CRMOD */ | ((t.c_oflag & ONLCR) << 2)
12279 +/* O_NL1|O_VTDELAY */ | (t.c_oflag & (NL1|VTDLY))
12280 +/* O_TBDELAY */ | ((t.c_oflag & TABDLY) ? 02000 : 0)
12281 +/* O_CRDELAY */ | ((t.c_oflag & CRDLY) << 3)
12282 +/* O_BSDELAY */ | ((t.c_oflag & BSDLY) << 2)
12283 +/* O_ECHO|O_LCASE */ | (t.c_lflag & (XCASE|ECHO))
12284 + | ((t.c_lflag & ICANON)
12285 +/* O_CBREAK or O_RAW */ ? 0 : ((t.c_lflag & ISIG) ? 0x02 : 0x20))
12286 + /* Incomplete... */
12289 + if (copy_to_user(data, &sg, sizeof(sg)))
12294 + case 9: /* TIOCSETP */
12295 + case 10: { /* TIOCSETN */
12297 + mm_segment_t old_fs;
12298 + struct termios t;
12299 + struct v7_sgttyb sg;
12301 + if (!access_ok(VERIFY_READ, data, sizeof(sg)))
12303 + if (copy_from_user(&sg, data, sizeof(sg)))
12306 + old_fs = get_fs();
12307 + set_fs(get_ds());
12308 + error = sys_ioctl(fd, TCGETS, (long)&t);
12313 + t.c_cc[VERASE] = sg.sg_erase;
12314 + t.c_cc[VKILL] = sg.sg_kill;
12315 + t.c_iflag = ICRNL | IXON;
12317 + t.c_lflag = ISIG | ICANON;
12318 + if (sg.sg_flags & 0x02) /* O_CBREAK */
12319 + t.c_lflag &= (~ICANON);
12320 + if (sg.sg_flags & 0x08) /* O_ECHO */
12321 + t.c_lflag |= ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN;
12322 + if (sg.sg_flags & 0x10) /* O_CRMOD */
12323 + t.c_oflag |= OPOST|ONLCR;
12324 + if (sg.sg_flags & 0x20) { /* O_RAW */
12326 + t.c_lflag &= ~(ISIG|ICANON);
12328 + if (sg.sg_flags & 0x200000) /* LITOUT */
12329 + t.c_oflag &= (~OPOST);
12330 + if (!(t.c_lflag & ICANON)) {
12331 + t.c_cc[VMIN] = 1;
12332 + t.c_cc[VTIME] = 0;
12335 + old_fs = get_fs();
12336 + set_fs(get_ds());
12337 + error = sys_ioctl(fd, TCSETS, (long)&t);
12342 + case 17: { /* TIOCSETC */
12344 + mm_segment_t old_fs;
12345 + struct termios t;
12346 + struct v7_tchars tc;
12348 + if (!access_ok(VERIFY_READ, data, sizeof(tc)))
12350 + if (copy_from_user(&tc, data, sizeof(tc)))
12353 + old_fs = get_fs();
12354 + set_fs(get_ds());
12355 + error = sys_ioctl(fd, TCGETS, (long)&t);
12360 + t.c_cc[VINTR] = tc.t_intrc;
12361 + t.c_cc[VQUIT] = tc.t_quitc;
12362 + t.c_cc[VSTART] = tc.t_startc;
12363 + t.c_cc[VSTOP] = tc.t_stopc;
12364 + t.c_cc[VEOF] = tc.t_eofc;
12365 + t.c_cc[VEOL2] = tc.t_brkc;
12367 + old_fs = get_fs();
12368 + set_fs(get_ds());
12369 + error = sys_ioctl(fd, TCSETS, (long)&t);
12374 + case 18: { /* TIOCGETC */
12376 + mm_segment_t old_fs;
12377 + struct termios t;
12378 + struct v7_tchars tc;
12380 + if (!access_ok(VERIFY_WRITE, data, sizeof(tc)))
12383 + old_fs = get_fs();
12384 + set_fs(get_ds());
12385 + error = sys_ioctl(fd, TCGETS, (long)&t);
12390 + tc.t_intrc = t.c_cc[VINTR];
12391 + tc.t_quitc = t.c_cc[VQUIT];
12392 + tc.t_startc = t.c_cc[VSTART];
12393 + tc.t_stopc = t.c_cc[VSTOP];
12394 + tc.t_eofc = t.c_cc[VEOF];
12395 + tc.t_brkc = t.c_cc[VEOL2];
12397 + if (copy_to_user(data, &tc, sizeof(tc)))
12402 + case 116: { /* TIOCGLTC */
12404 + mm_segment_t old_fs;
12405 + struct termios t;
12406 + struct v7_ltchars tc;
12408 + if (!access_ok(VERIFY_WRITE, data, sizeof(tc)))
12411 + old_fs = get_fs();
12412 + set_fs(get_ds());
12413 + error = sys_ioctl(fd, TCGETS, (long)&t);
12418 + tc.t_suspc = t.c_cc[VSUSP];
12419 + tc.t_dsuspc = t.c_cc[VSUSP];
12420 + tc.t_rprntc = t.c_cc[VREPRINT];
12421 + tc.t_flushc = t.c_cc[VEOL2];
12422 + tc.t_werasc = t.c_cc[VWERASE];
12423 + tc.t_lnextc = t.c_cc[VLNEXT];
12425 + if (copy_to_user(data, &tc, sizeof(tc)))
12430 + case 117: { /* TIOCSLTC */
12432 + mm_segment_t old_fs;
12433 + struct termios t;
12434 + struct v7_ltchars tc;
12436 + if (!access_ok(VERIFY_READ, data, sizeof(tc)))
12438 + if (copy_from_user(&tc, data, sizeof(tc)))
12441 + old_fs = get_fs();
12442 + set_fs(get_ds());
12443 + error = sys_ioctl(fd, TCGETS, (long)&t);
12448 + t.c_cc[VSUSP] = tc.t_suspc;
12449 + t.c_cc[VEOL2] = tc.t_dsuspc;
12450 + t.c_cc[VREPRINT] = tc.t_rprntc;
12451 + t.c_cc[VEOL2] = tc.t_flushc;
12452 + t.c_cc[VWERASE] = tc.t_werasc;
12453 + t.c_cc[VLNEXT] = tc.t_lnextc;
12455 + old_fs = get_fs();
12456 + set_fs(get_ds());
12457 + error = sys_ioctl(fd, TCSETS, (long)&t);
12462 + case 13: /* TIOEXCL */
12463 + return sys_ioctl(fd, TIOCEXCL, (long)data);
12465 + case 14: /* TIOCNXCL */
12466 + return sys_ioctl(fd, TIOCNXCL, (long)data);
12468 + case 16: /* TIOCFLUSH */
12469 + return sys_ioctl(fd, TCFLSH, (long)data);
12472 + /* ISC (maybe SVR4 in general?) has some extensions over
12473 + * the sgtty stuff. So do later BSDs. Needless to say they
12474 + * both have different extensions.
12476 + case 20: /* TCSETPGRP (TIOC|20) set pgrp of tty */
12477 + return bsd_to_linux_termios(fd, TCSETS, data);
12479 + case 21: /* TCGETPGRP (TIOC|21) get pgrp of tty */
12480 + return bsd_to_linux_termios(fd, TCSETSW, data);
12482 + case 19: /* TIOCGETA */
12483 + return linux_to_bsd_termios(fd, TCGETS, data);
12485 + case 22: /* TIOCSETAF */
12486 + return bsd_to_linux_termios(fd, TCSETSF, data);
12488 + case 26: /* TIOCGETD */
12489 + return sys_ioctl(fd, TIOCGETD, (long)data);
12491 + case 27: /* TIOCSETD */
12492 + return sys_ioctl(fd, TIOCSETD, (long)data);
12494 + case 97: /* TIOCSCTTY */
12495 + return sys_ioctl(fd, TIOCSCTTY, (long)data);
12497 + case 103: /* TIOCSWINSZ */
12498 + return sys_ioctl(fd, TIOCSWINSZ, (long)data);
12500 + case 104: /* TIOCGWINSZ */
12501 + return sys_ioctl(fd, TIOCGWINSZ, (long)data);
12503 + case 113: /* TIOCNOTTY */
12504 + return sys_ioctl(fd, TIOCNOTTY, (long)data);
12506 + case 118: /* TIOCSPGRP */
12507 + return sys_ioctl(fd, TIOCSPGRP, (long)data);
12509 + case 119: /* TIOCGPGRP */
12510 + return sys_ioctl(fd, TIOCGPGRP, (long)data);
12512 + case 123: /* TIOCSBRK */
12513 + return sys_ioctl(fd, TCSBRK, (long)data);
12515 + case 124: /* TIOCLGET */
12516 + case 125: /* TIOCLSET */
12520 + case 3: /* TIOCMODG */
12521 + case 4: /* TIOCMODS */
12522 + case 94: /* TIOCDRAIN */
12523 + case 95: /* TIOCSIG */
12524 + case 96: /* TIOCEXT */
12525 + case 98: /* TIOCCONS */
12526 + case 102: /* TIOCUCNTL */
12527 + case 105: /* TIOCREMOTE */
12528 + case 106: /* TIOCMGET */
12529 + case 107: /* TIOCMBIC */
12530 + case 108: /* TIOCMBIS */
12531 + case 109: /* TIOCMSET */
12532 + case 110: /* TIOCSTART */
12533 + case 111: /* TIOCSTOP */
12534 + case 112: /* TIOCPKT */
12535 + case 114: /* TIOCSTI */
12536 + case 115: /* TIOCOUTQ */
12537 + case 120: /* TIOCCDTR */
12538 + case 121: /* TIOCSDTR */
12539 + case 122: /* TIOCCBRK */
12543 + printk(KERN_ERR "BSD/V7: terminal ioctl 0x%08lx unsupported\n",
12544 + (unsigned long)func);
12548 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
12549 +EXPORT_SYMBOL(bsd_ioctl_termios);
12550 +EXPORT_SYMBOL(svr4_term_ioctl);
12552 diff -Nur kernel-source-2.6.16.orig/abi/svr4/timod.c kernel-source-2.6.16/abi/svr4/timod.c
12553 --- kernel-source-2.6.16.orig/abi/svr4/timod.c 1970-01-01 10:00:00.000000000 +1000
12554 +++ kernel-source-2.6.16/abi/svr4/timod.c 2006-04-27 18:50:24.000000000 +1000
12557 + * Copyright 1995, 1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
12562 +#include <linux/config.h>
12563 +#include <linux/types.h>
12564 +#include <linux/errno.h>
12565 +#include <linux/fs.h>
12566 +#include <linux/ptrace.h>
12567 +#include <linux/sched.h>
12568 +#include <linux/kernel.h>
12569 +#include <linux/slab.h>
12570 +#include <linux/mm.h>
12571 +#include <linux/fcntl.h>
12572 +#include <linux/socket.h>
12573 +#include <linux/in.h>
12574 +#include <linux/un.h>
12575 +#include <linux/file.h>
12576 +#include <linux/personality.h>
12577 +#include <linux/poll.h>
12578 +#include <linux/syscalls.h>
12579 +#include <asm/uaccess.h>
12581 +#include <net/sock.h>
12583 +#include <asm/abi_machdep.h>
12584 +#include <abi/stream.h>
12585 +#include <abi/tli.h>
12587 +#include <abi/svr4/ioctl.h>
12588 +#include <abi/util/trace.h>
12592 + * Check if the inode belongs to /dev/socksys.
12594 +#define IS_SOCKSYS(ip) (MAJOR((ip)->i_rdev) == SOCKSYS_MAJOR)
12598 +timod_getmsg(int fd, struct inode *ip, int pmsg, struct pt_regs *regs)
12600 + struct strbuf ctl, *ctlp, dat, *datp;
12601 + int flags, *flagsp, *bandp;
12604 + ctlp = (struct strbuf *)get_syscall_parameter(regs, 1);
12605 + datp = (struct strbuf *)get_syscall_parameter(regs, 2);
12608 + bandp = (int *)get_syscall_parameter(regs, 3);
12609 + flagsp = (int *)get_syscall_parameter(regs, 4);
12611 + flagsp = (int *)get_syscall_parameter (regs, 3);
12614 + if (copy_from_user(&ctl, ctlp, sizeof(ctl)))
12616 + if ((error = put_user(-1, &ctlp->len)))
12622 + if (copy_from_user(&dat, datp, sizeof(dat)))
12624 + if ((error = put_user(-1, &datp->len)))
12629 + if ((error = get_user(flags, flagsp)))
12632 +#ifdef CONFIG_ABI_SPX
12633 + if (IS_SOCKSYS(ip) && MINOR(ip->i_rdev) == 1) {
12635 +#if defined(CONFIG_ABI_TRACE)
12636 + abi_trace(ABI_TRACE_STREAMS,
12637 + "SPX: getmsg offers descriptor %d\n", fd);
12640 + if ((error = put_user(fd, ctl.buf)))
12642 + if ((error = put_user(4, &ctlp->len)))
12647 +#endif /* CONFIG_ABI_SPX */
12649 +#ifdef CONFIG_ABI_XTI
12650 + if (flags == 0 || flags == MSG_HIPRI ||
12651 + flags == MSG_ANY || flags == MSG_BAND) {
12655 + error = do_getmsg(fd, regs, ctl.buf, ctl.maxlen, &ctlp->len,
12656 + dat.buf, dat.maxlen, &datp->len, &flags);
12660 + error = put_user(flags, flagsp);
12664 +#if defined(CONFIG_ABI_TRACE)
12665 + abi_trace(ABI_TRACE_STREAMS,
12666 + "XTI: getmsg flags value bad (%d) for %d\n",
12668 +#endif /* CONFIG_ABI_TRACE */
12669 +#endif /* CONFIG_ABI_XTI */
12675 +timod_putmsg(int fd, struct inode *ip, int pmsg, struct pt_regs *regs)
12677 + struct strbuf ctl, *ctlp, dat, *datp;
12681 + ctlp = (struct strbuf *)get_syscall_parameter(regs, 1);
12682 + datp = (struct strbuf *)get_syscall_parameter(regs, 2);
12684 + band = get_syscall_parameter(regs, 3);
12685 + flags = get_syscall_parameter(regs, 4);
12687 + flags = get_syscall_parameter(regs, 3);
12690 + if (copy_from_user(&ctl, ctlp, sizeof(ctl)))
12692 + if (ctl.len < 0 && flags)
12700 + if (copy_from_user(&dat, datp, sizeof(dat)))
12707 +#ifdef CONFIG_ABI_SPX
12708 + if (IS_SOCKSYS(ip) && MINOR(ip->i_rdev) == 1) {
12711 + if (ctl.len != 4)
12714 + error = get_user(newfd, ctl.buf);
12718 +#if defined(CONFIG_ABI_TRACE)
12719 + abi_trace(ABI_TRACE_STREAMS,
12720 + "SPX: putmsg on %d dups descriptor %d\n",
12723 + error = sys_dup2(newfd, fd);
12725 + return (error < 0 ? error : 0);
12727 +#endif /* CONFIG_ABI_SPX */
12729 +#ifdef CONFIG_ABI_XTI
12730 + return do_putmsg(fd, regs, ctl.buf, ctl.len,
12731 + dat.buf, dat.len, flags);
12737 +stream_fdinsert(struct pt_regs *regs, int fd, struct strfdinsert *arg)
12739 + struct strfdinsert sfd;
12741 + if (copy_from_user(&sfd, arg, sizeof(sfd)))
12744 +#if defined(CONFIG_ABI_TRACE)
12745 + abi_trace(ABI_TRACE_STREAMS,
12746 + "%u fdinsert: flags=%ld, fildes=%u, offset=%d\n",
12747 + fd, sfd.flags, sfd.fildes, sfd.offset);
12749 +#ifdef CONFIG_ABI_XTI
12750 + return do_putmsg(fd, regs, sfd.ctlbuf.buf, sfd.ctlbuf.len,
12751 + sfd.datbuf.buf, sfd.datbuf.len, sfd.fildes);
12756 diff -Nur kernel-source-2.6.16.orig/abi/svr4/ulimit.c kernel-source-2.6.16/abi/svr4/ulimit.c
12757 --- kernel-source-2.6.16.orig/abi/svr4/ulimit.c 1970-01-01 10:00:00.000000000 +1000
12758 +++ kernel-source-2.6.16/abi/svr4/ulimit.c 2006-04-27 18:50:24.000000000 +1000
12761 + * Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
12762 + * First stab at ulimit
12764 + * April 9 1994, corrected file size passed to/from setrlimit/getrlimit
12765 + * -- Graham Adams (gadams@ddrive.demon.co.uk)
12771 +#include <linux/module.h>
12772 +#include <linux/errno.h>
12773 +#include <linux/sched.h>
12774 +#include <linux/kernel.h>
12775 +#include <linux/unistd.h>
12776 +#include <linux/fs.h>
12777 +#include <linux/resource.h>
12778 +#include <linux/syscalls.h>
12779 +#include <asm/uaccess.h>
12781 +#include <abi/util/trace.h>
12785 + * Arguments to ulimit - it's one of the stupid multipled calls...
12787 +#define U_GETFSIZE (1) /* get max file size in blocks */
12788 +#define U_SETFSIZE (2) /* set max file size in blocks */
12789 +#define U_GETMEMLIM (3) /* get process size limit */
12790 +#define U_GETMAXOPEN (4) /* get max open files for this process */
12791 +#define U_GTXTOFF (64) /* get text offset */
12794 + * Define nominal block size parameters.
12796 +#define ULIM_BLOCKSIZE_BITS 9 /* block size = 512 */
12797 +#define ULIM_MAX_BLOCKSIZE (INT_MAX >> ULIM_BLOCKSIZE_BITS)
12801 +svr4_ulimit (int cmd, int val)
12805 + return (current->signal->rlim[RLIMIT_FSIZE].rlim_cur)
12806 + >> ULIM_BLOCKSIZE_BITS;
12809 + if ((val > ULIM_MAX_BLOCKSIZE) || (val < 0))
12811 + val <<= ULIM_BLOCKSIZE_BITS;
12812 + if (val > current->signal->rlim[RLIMIT_FSIZE].rlim_max) {
12813 + if (!capable(CAP_SYS_RESOURCE))
12815 + current->signal->rlim[RLIMIT_FSIZE].rlim_max = val;
12817 + current->signal->rlim[RLIMIT_FSIZE].rlim_cur = val;
12820 + case U_GETMEMLIM:
12821 + return current->signal->rlim[RLIMIT_DATA].rlim_cur;
12823 + case U_GETMAXOPEN:
12824 + return current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
12827 +#if defined(CONFIG_ABI_TRACE)
12828 + abi_trace(ABI_TRACE_API, "unsupported ulimit call %d\n", cmd);
12835 + * getrlimit/setrlimit args.
12837 +#define U_RLIMIT_CPU 0
12838 +#define U_RLIMIT_FSIZE 1
12839 +#define U_RLIMIT_DATA 2
12840 +#define U_RLIMIT_STACK 3
12841 +#define U_RLIMIT_CORE 4
12842 +#define U_RLIMIT_NOFILE 5
12843 +#define U_RLIMIT_AS 6
12847 +svr4_getrlimit(int cmd, void *val)
12850 + case U_RLIMIT_CPU:
12851 + cmd = RLIMIT_CPU;
12853 + case U_RLIMIT_FSIZE:
12854 + cmd = RLIMIT_FSIZE;
12856 + case U_RLIMIT_DATA:
12857 + cmd = RLIMIT_DATA;
12859 + case U_RLIMIT_STACK:
12860 + cmd = RLIMIT_STACK;
12862 + case U_RLIMIT_CORE:
12863 + cmd = RLIMIT_CORE;
12865 + case U_RLIMIT_NOFILE:
12866 + cmd = RLIMIT_NOFILE;
12868 + case U_RLIMIT_AS:
12875 + return sys_getrlimit(cmd, val);
12879 +svr4_setrlimit(int cmd, void *val)
12882 + case U_RLIMIT_CPU:
12883 + cmd = RLIMIT_CPU;
12885 + case U_RLIMIT_FSIZE:
12886 + cmd = RLIMIT_FSIZE;
12888 + case U_RLIMIT_DATA:
12889 + cmd = RLIMIT_DATA;
12891 + case U_RLIMIT_STACK:
12892 + cmd = RLIMIT_STACK;
12894 + case U_RLIMIT_CORE:
12895 + cmd = RLIMIT_CORE;
12897 + case U_RLIMIT_NOFILE:
12898 + cmd = RLIMIT_NOFILE;
12900 + case U_RLIMIT_AS:
12907 + return sys_getrlimit(cmd, val);
12910 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
12911 +EXPORT_SYMBOL(svr4_getrlimit);
12912 +EXPORT_SYMBOL(svr4_setrlimit);
12913 +EXPORT_SYMBOL(svr4_ulimit);
12915 diff -Nur kernel-source-2.6.16.orig/abi/svr4/utsname.c kernel-source-2.6.16/abi/svr4/utsname.c
12916 --- kernel-source-2.6.16.orig/abi/svr4/utsname.c 1970-01-01 10:00:00.000000000 +1000
12917 +++ kernel-source-2.6.16/abi/svr4/utsname.c 2006-04-27 18:50:24.000000000 +1000
12920 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
12921 + * Copyright (C) 1994 Eric Youngdale.
12926 +#include <linux/mm.h>
12927 +#include <linux/sched.h>
12928 +#include <linux/utsname.h>
12929 +#include <linux/module.h>
12930 +#include <asm/uaccess.h>
12933 +struct v7_utsname {
12935 + char nodename[9];
12941 +#define SVR4_NMLN 257
12942 +struct svr4_utsname {
12943 + char sysname[SVR4_NMLN];
12944 + char nodename[SVR4_NMLN];
12945 + char release[SVR4_NMLN];
12946 + char version[SVR4_NMLN];
12947 + char machine[SVR4_NMLN];
12950 +// this function and macro design is from arch/sparc64/solaris/misc.c
12951 +static int __set_utsfield(char __user *to, int to_size,
12952 + const char *from, int from_size,
12955 + int len = min(from_size, to_size);
12958 + if (copy_to_user(to, from, len))
12961 + off = len < to_size? len: len - 1;
12963 + const char *p = strnchr(from, len, '.');
12964 + if (p) off = p - from;
12967 + if (__put_user('\0', to + off))
12973 +#define set_utsfield(to, from, dotchop) \
12974 + __set_utsfield((to), sizeof(to), \
12975 + (from), sizeof(from), \
12978 +int v7_utsname(unsigned long addr)
12981 + struct v7_utsname *it = (struct v7_utsname *)addr;
12983 + down_read(&uts_sem);
12984 + if (access_ok(VERIFY_WRITE, it, sizeof (struct v7_utsname))) {
12985 + error |= set_utsfield(it->sysname, system_utsname.nodename, 1);
12986 + error |= set_utsfield(it->nodename, system_utsname.nodename, 1);
12987 + error |= set_utsfield(it->release, system_utsname.release, 0);
12988 + error |= set_utsfield(it->version, system_utsname.version, 0);
12989 + error |= set_utsfield(it->machine, system_utsname.machine, 0);
12991 + up_read(&uts_sem);
12996 +int abi_utsname(unsigned long addr)
12999 + struct svr4_utsname *it = (struct svr4_utsname *)addr;
13001 + down_read(&uts_sem);
13002 + if (access_ok(VERIFY_WRITE, it, sizeof (struct svr4_utsname))) {
13003 + error |= set_utsfield(it->sysname, system_utsname.sysname, 0);
13004 + error |= set_utsfield(it->nodename, system_utsname.nodename, 0);
13005 + error |= set_utsfield(it->release, system_utsname.release, 0);
13006 + error |= set_utsfield(it->version, system_utsname.version, 0);
13007 + error |= set_utsfield(it->machine, system_utsname.machine, 0);
13009 + up_read(&uts_sem);
13014 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
13015 +EXPORT_SYMBOL(abi_utsname);
13016 +EXPORT_SYMBOL(v7_utsname);
13018 diff -Nur kernel-source-2.6.16.orig/abi/svr4/xti.c kernel-source-2.6.16/abi/svr4/xti.c
13019 --- kernel-source-2.6.16.orig/abi/svr4/xti.c 1970-01-01 10:00:00.000000000 +1000
13020 +++ kernel-source-2.6.16/abi/svr4/xti.c 2006-04-27 18:50:24.000000000 +1000
13023 + * Copyright 1995, 1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
13028 +#include <linux/config.h>
13029 +#include <linux/types.h>
13030 +#include <linux/errno.h>
13031 +#include <linux/fs.h>
13032 +#include <linux/ptrace.h>
13033 +#include <linux/sched.h>
13034 +#include <linux/kernel.h>
13035 +#include <linux/slab.h>
13036 +#include <linux/mm.h>
13037 +#include <linux/fcntl.h>
13038 +#include <linux/socket.h>
13039 +#include <linux/in.h>
13040 +#include <linux/un.h>
13041 +#include <linux/file.h>
13042 +#include <linux/personality.h>
13043 +#include <linux/poll.h>
13044 +#include <linux/syscalls.h>
13045 +#include <asm/uaccess.h>
13047 +#include <net/sock.h>
13049 +#include <abi/stream.h>
13050 +#include <abi/tli.h>
13052 +#include <abi/socksys.h> /* for socksys_fdinit */
13054 +#include <abi/svr4/sockio.h>
13055 +#include <abi/util/trace.h>
13056 +#include <abi/util/errno.h>
13060 + * This is because TLI and XTI options buffers are incompatible and there
13061 + * is no clear way to detect which format we are dealing with here.
13062 + * Existing systems appear to have TLI options management implemented
13063 + * but return TNOTSUPPORT for XTI requests.
13065 +#if defined(CONFIG_ABI_XTI_OPTMGMT) && defined(CONFIG_ABI_TLI_OPTMGMT)
13066 +# error "unable to support _both_ TLI and XTI option management"
13070 +#if defined(CONFIG_ABI_TRACE)
13071 +static char *const xti_tab[] = {
13072 + "T_CONN_REQ", "T_CONN_RES",
13073 + "T_DISCON_REQ", "T_DATA_REQ",
13074 + "T_EXDATA_REQ", "T_INFO_REQ",
13075 + "T_BIND_REQ", "T_UNBIND_REQ",
13076 + "T_UNITDATA_REQ", "T_OPTMGMT_REQ",
13077 + "T_ORDREL_REQ","T_CONN_IND",
13078 + "T_CONN_CON", "T_DISCON_IND",
13079 + "T_DATA_IND", "T_EXDATA_IND",
13080 + "T_INFO_ACK", "T_BIND_ACK",
13081 + "T_ERROR_ACK","T_OK_ACK",
13082 + "T_UNITDATA_IND", "T_UDERROR_IND",
13083 + "T_OPTMGMT_ACK", "T_ORDREL_IND"
13085 +static char xti_unknown[] = "<unknown>";
13090 + if (n < 0 || n >= ARRAY_SIZE(xti_tab))
13091 + return xti_unknown;
13092 + return xti_tab[n];
13097 +#define timod_mkctl(len) kmalloc(sizeof(struct T_primsg)-sizeof(long)+len, \
13102 +timod_socket_wakeup(struct file *fp)
13104 + struct socket *sock;
13106 + sock = SOCKET_I(fp->f_dentry->d_inode);
13107 + wake_up_interruptible(&sock->wait);
13109 + read_lock(&sock->sk->sk_callback_lock);
13110 + if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
13111 + __kill_fasync(sock->fasync_list, SIGIO, POLL_IN);
13112 + read_unlock(&sock->sk->sk_callback_lock);
13117 +timod_ok(int fd, int prim)
13120 + struct T_primsg *it;
13121 + struct T_ok_ack *ok;
13123 +#if defined(CONFIG_ABI_TRACE)
13124 + abi_trace(ABI_TRACE_STREAMS, "TI: %u ok ack prim=%d\n", fd, prim);
13128 + it = timod_mkctl(sizeof(struct T_ok_ack));
13132 + ok = (struct T_ok_ack *)&it->type;
13133 + ok->PRIM_type = T_OK_ACK;
13134 + ok->CORRECT_prim = prim;
13136 + it->pri = MSG_HIPRI;
13137 + it->length = sizeof(struct T_ok_ack);
13138 + it->next = Priv(fp)->pfirst;
13140 + Priv(fp)->pfirst = it;
13141 + if (!Priv(fp)->plast)
13142 + Priv(fp)->plast = it;
13143 + timod_socket_wakeup(fp);
13147 +timod_error(int fd, int prim, int terr, int uerr)
13150 + struct T_primsg *it;
13151 + struct T_error_ack *err;
13153 +#if defined(CONFIG_ABI_TRACE)
13154 + abi_trace(ABI_TRACE_STREAMS, "TI: %u error prim=%d, TLI=%d, UNIX=%d\n",
13155 + fd, prim, terr, uerr);
13159 + it = timod_mkctl(sizeof(struct T_error_ack));
13163 + err = (struct T_error_ack *)&it->type;
13164 + err->PRIM_type = T_ERROR_ACK;
13165 + err->ERROR_prim = prim;
13166 + err->TLI_error = terr;
13167 + err->UNIX_error = iABI_errors(uerr);
13169 + it->pri = MSG_HIPRI;
13170 + it->length = sizeof(struct T_error_ack);
13171 + it->next = Priv(fp)->pfirst;
13173 + Priv(fp)->pfirst = it;
13174 + if (!Priv(fp)->plast)
13175 + Priv(fp)->plast = it;
13176 + timod_socket_wakeup(fp);
13180 +#if defined(CONFIG_ABI_XTI_OPTMGMT) || defined(CONFIG_ABI_TLI_OPTMGMT)
13182 + * XXX: this function is a _horrible_ mess.
13185 +timod_optmgmt(int fd, struct pt_regs * regs, int flag,
13186 + char * opt_buf, int opt_len, int do_ret)
13188 + struct file * fp = fcheck(fd);
13189 + char *ret_buf, *ret_base;
13190 + u_long old_esp, *tsp;
13191 + int is_tli, error, failed;
13192 + int ret_len, ret_space;
13194 + if (opt_buf && opt_len > 0) {
13195 + if (!access_ok(VERIFY_READ, opt_buf, opt_len))
13201 + * We should be able to detect the difference between
13202 + * TLI and XTI requests at run time?
13204 + is_tli = CONFIG_ABI_TLI_OPTMGMT;
13206 + if (!do_ret && (!opt_buf || opt_len <= 0))
13210 + * Grab some space on the user stack to work with. We need 6 longs
13211 + * to build an argument frame for [gs]etsockopt calls. We also
13212 + * need space to build the return buffer. This will be at least
13213 + * as big as the given options buffer but the given options
13214 + * buffer may not include space for option values so we allow two
13215 + * longs for each option multiple of the option header size
13216 + * and hope that big options will not exhaust our space and
13217 + * trash the stack.
13219 + ret_space = 1024 + opt_len
13220 + + 2*sizeof(long)*(opt_len / (is_tli ? sizeof(struct opthdr) : sizeof(struct t_opthdr)));
13221 + ret_buf = ret_base = (char *)(regs->esp - ret_space);
13224 + old_esp = regs->esp;
13225 + regs->esp -= ret_space + 6*sizeof(long);
13226 + tsp = (unsigned long *)(regs->esp);
13227 + if (!access_ok(VERIFY_WRITE, tsp, 6*sizeof(long))) {
13228 + regs->esp = old_esp;
13234 +#ifndef CONFIG_ABI_TLI_OPTMGMT
13236 + printk(KERN_WARNING
13237 + "%d iBCS: TLI optmgmt requested but not supported\n",
13242 + while (opt_len >= sizeof(struct opthdr)) {
13243 + struct opthdr opt;
13245 +#if defined(CONFIG_ABI_TRACE)
13246 + abi_trace(ABI_TRACE_STREAMS, "TLI optmgmt opt_len=%d, "
13247 + "ret_buf=0x%08lx, ret_len=%d, ret_space=%d\n",
13248 + opt_len, (unsigned long)ret_buf,
13249 + ret_len, ret_space);
13252 + if (copy_from_user(&opt, opt_buf, sizeof(struct opthdr)))
13255 + /* Idiot check... */
13256 + if (opt.len > opt_len) {
13257 + failed = TBADOPT;
13261 + if (abi_traced(ABI_TRACE_STREAMS)) {
13263 + get_user(v, (unsigned long *)(opt_buf+sizeof(struct opthdr)));
13264 +#if defined(CONFIG_ABI_TRACE)
13265 + __abi_trace("TLI optmgmt fd=%d, level=%ld, "
13266 + "name=%ld, value=%ld\n",
13267 + fd, opt.level, opt.name, v);
13271 + /* Check writable space in the return buffer. */
13272 + if (!access_ok(VERIFY_WRITE, ret_buf, sizeof(struct opthdr))) {
13273 + failed = TSYSERR;
13278 + * T_NEGOTIATE means try and set it.
13279 + * T_DEFAULT means get the default value.
13280 + * (return the current for now)
13281 + * T_CHECK means get the current value.
13284 + if (flag == T_NEGOTIATE) {
13285 + put_user(fd, tsp);
13286 + put_user(opt.level, tsp+1);
13287 + put_user(opt.name, tsp+2);
13288 + put_user((int)(opt_buf+sizeof(struct opthdr)), tsp+3);
13289 + put_user(opt.len, tsp+4);
13290 + error = abi_do_setsockopt(tsp);
13293 +#if defined(CONFIG_ABI_TRACE)
13294 + abi_trace(ABI_TRACE_STREAMS,
13295 + "setsockopt failed: %d\n", error);
13297 + failed = TBADOPT;
13304 + put_user(fd, tsp);
13305 + put_user(opt.level, tsp+1);
13306 + put_user(opt.name, tsp+2);
13307 + put_user((int)(ret_buf+sizeof(struct opthdr)), tsp+3);
13308 + put_user((int)(tsp+5), tsp+4);
13309 + put_user(ret_space, tsp+5);
13310 + error = abi_do_getsockopt(tsp);
13313 +#if defined(CONFIG_ABI_TRACE)
13314 + abi_trace(ABI_TRACE_STREAMS,
13315 + "getsockopt failed: %d\n", error);
13317 + failed = TBADOPT;
13321 + get_user(len, tsp+5);
13322 + if (copy_to_user(ret_buf, &opt, sizeof(opt)))
13325 + &((struct opthdr *)opt_buf)->len);
13326 + ret_space -= sizeof(struct opthdr) + len;
13327 + ret_len += sizeof(struct opthdr) + len;
13328 + ret_buf += sizeof(struct opthdr) + len;
13331 + opt_len -= sizeof(struct opthdr) + opt.len;
13332 + opt_buf += sizeof(struct opthdr) + opt.len;
13334 +#endif /* CONFIG_ABI_TLI_OPTMGMT */
13335 +#ifndef CONFIG_ABI_XTI_OPTMGMT
13337 + printk(KERN_WARNING
13338 + "%d iBCS: XTI optmgmt requested but not supported\n",
13342 + else while (opt_len >= sizeof(struct t_opthdr)) {
13343 + struct t_opthdr opt;
13345 + if (copy_from_user(&opt, opt_buf, sizeof(struct t_opthdr)))
13347 + if (opt.len > opt_len) {
13352 + if (abi_traced(ABI_TRACE_STREAMS)) {
13354 + get_user(v, (unsigned long *)(opt_buf+sizeof(struct t_opthdr)));
13355 +#if defined(CONFIG_ABI_TRACE)
13356 + __abi_trace("XTI optmgmt fd=%d, level=%ld, "
13357 + "name=%ld, value=%ld\n",
13358 + fd, opt.level, opt.name, v);
13362 + /* Check writable space in the return buffer. */
13363 + if (!access_ok(VERIFY_WRITE, ret_buf, sizeof(struct t_opthdr))) {
13369 + * T_NEGOTIATE means try and set it.
13370 + * T_CHECK means see if we could set it.
13371 + * (so we just set it for now)
13372 + * T_DEFAULT means get the default value.
13373 + * (return the current for now)
13374 + * T_CURRENT means get the current value (SCO xti.h has
13375 + * no T_CURRENT???).
13378 + if (flag == T_NEGOTIATE || flag == T_CHECK) {
13379 + put_user(fd, tsp);
13380 + put_user(opt.level, tsp+1);
13381 + put_user(opt.name, tsp+2);
13382 + put_user((int)(opt_buf+sizeof(struct t_opthdr)), tsp+3);
13383 + put_user(opt.len-sizeof(struct t_opthdr), tsp+4);
13384 + error = abi_do_setsockopt(tsp);
13387 + put_user(fd, tsp);
13388 + put_user(opt.level, tsp+1);
13389 + put_user(opt.name, tsp+2);
13390 + put_user((int)(ret_buf+sizeof(struct t_opthdr)), tsp+3);
13391 + put_user((int)(tsp+5), tsp+4);
13392 + put_user(ret_space, tsp+5);
13393 + error = abi_do_getsockopt(tsp);
13396 + get_user(len, tsp+5);
13397 + /* FIXME: opt.status should be set... */
13398 + if (copy_to_user(ret_buf, &opt, sizeof(opt)))
13400 + put_user(len+sizeof(struct t_opthdr),
13401 + &((struct t_opthdr *)opt_buf)->len);
13402 + ret_space -= sizeof(struct t_opthdr) + len;
13403 + ret_len += sizeof(struct t_opthdr) + len;
13404 + ret_buf += sizeof(struct t_opthdr) + len;
13409 + opt_len -= opt.len;
13410 + opt_buf += opt.len;
13412 +#endif /* CONFIG_ABI_XTI_OPTMGMT */
13415 + /* If there is left over data the supplied options buffer was
13416 + * formatted incorrectly. But we might have done some work so
13417 + * we must fall through and return an acknowledgement I think.
13420 + regs->esp = old_esp;
13426 + struct T_primsg *it;
13429 + timod_error(fd, T_OPTMGMT_REQ, failed, -error);
13430 + regs->esp = old_esp;
13434 +#if defined(CONFIG_ABI_TRACE)
13435 + abi_trace(ABI_TRACE_STREAMS,
13436 + "optmgmt returns %d bytes, failed=%d\n",
13437 + ret_len, failed);
13440 + /* Convert the return buffer in the user stack to a
13442 + * message and queue it.
13444 + it = timod_mkctl(sizeof(struct T_optmgmt_ack) + ret_len);
13446 + struct T_optmgmt_ack *ack
13447 + = (struct T_optmgmt_ack *)&it->type;
13448 + ack->PRIM_type = T_OPTMGMT_ACK;
13449 + ack->OPT_length = ret_len;
13450 + ack->OPT_offset = sizeof(struct T_optmgmt_ack);
13451 + ack->MGMT_flags = (failed ? T_FAILURE : flag);
13452 + if (copy_from_user(((char *)ack)+sizeof(struct T_optmgmt_ack),
13453 + ret_base, ret_len))
13455 + it->pri = MSG_HIPRI;
13456 + it->length = sizeof(struct T_optmgmt_ack) + ret_len;
13457 + it->next = Priv(fp)->pfirst;
13458 + Priv(fp)->pfirst = it;
13459 + if (!Priv(fp)->plast)
13460 + Priv(fp)->plast = it;
13461 + timod_socket_wakeup(fp);
13465 + regs->esp = old_esp;
13469 +#else /* no CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
13472 +timod_optmgmt(int fd, struct pt_regs * regs, int flag,
13473 + char * opt_buf, int opt_len, int do_ret)
13478 +#endif /* CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
13480 +#define T_PRIV(fp) Priv(fp)
13483 +timod_update_socket(int fd, struct file * fp, struct pt_regs * regs)
13485 + struct socket * sock;
13486 + struct T_private * priv;
13487 + struct T_primsg * it;
13488 + struct T_conn_ind * ind;
13489 + u_long old_esp, * tsp, alen;
13490 + u_short oldflags;
13493 + sock = SOCKET_I(fp->f_dentry->d_inode);
13494 + priv = T_PRIV(fp);
13497 + * If this a SOCK_STREAM and is in the TS_WRES_CIND state
13498 + * we are supposed to be looking for an incoming connection.
13500 + if (sock->type != SOCK_STREAM || priv->state != TS_WRES_CIND)
13503 + old_esp = regs->esp;
13504 + regs->esp -= 1024;
13505 + tsp = (unsigned long *)regs->esp;
13506 + if (!access_ok(VERIFY_WRITE, tsp,
13507 + 3*sizeof(long)+sizeof(struct sockaddr))) {
13508 + regs->esp = old_esp;
13513 + put_user(fd, tsp);
13514 + put_user((unsigned long)(tsp+4), tsp+1);
13515 + put_user((unsigned long)(tsp+3), tsp+2);
13516 + put_user(sizeof(struct sockaddr), tsp+3);
13519 + * We don't want to block in the accept(). Any
13520 + * blocking necessary must be handled earlier.
13522 + oldflags = fp->f_flags;
13523 + fp->f_flags |= O_NONBLOCK;
13524 + error = sys_socketcall(SYS_ACCEPT, tsp);
13525 + fp->f_flags = oldflags;
13530 + /* The new fd needs to be fixed up
13531 + * with the iBCS file functions and a
13532 + * timod state block.
13534 + inherit_socksys_funcs(error, TS_DATA_XFER);
13536 + /* Generate a T_CONN_IND and queue it. */
13537 + get_user(alen, tsp+3);
13538 + it = timod_mkctl(sizeof(struct T_conn_ind) + alen);
13540 + /* Oops, just drop the connection I guess. */
13541 + sys_close(error);
13545 + ind = (struct T_conn_ind *)&it->type;
13546 + ind->PRIM_type = T_CONN_IND;
13547 + ind->SRC_length = alen;
13548 + ind->SRC_offset = sizeof(struct T_conn_ind);
13549 + ind->OPT_length = ind->OPT_offset = 0;
13550 + ind->SEQ_number = error;
13552 + if (copy_from_user(((char *)ind)+sizeof(struct T_conn_ind), tsp+4, alen))
13555 + it->pri = MSG_HIPRI;
13557 + it->length = sizeof(struct T_conn_ind) + alen;
13558 + it->next = Priv(fp)->pfirst;
13559 + Priv(fp)->pfirst = it;
13560 + if (!Priv(fp)->plast)
13561 + Priv(fp)->plast = it;
13562 + timod_socket_wakeup(fp);
13565 + regs->esp = old_esp;
13572 +do_getmsg(int fd, struct pt_regs *regs, char *ctl_buf,
13573 + int ctl_maxlen, int *ctl_len, char *dat_buf,
13574 + int dat_maxlen, int *dat_len, int *flags_p)
13578 + unsigned long *tsp;
13579 + unsigned short oldflags;
13580 + struct T_unitdata_ind udi;
13581 + struct file *filep;
13584 + * It may not be obvious but we are always holding an fget(fd)
13585 + * at this point so we can use fcheck(fd) rather than fget...fput.
13587 + filep = fcheck(fd);
13589 + if (!Priv(filep) && Priv(filep)->magic != XTI_MAGIC) {
13590 + printk("putmsg on non-STREAMS fd %d by %s\n",fd, current->comm);
13594 +#if defined(CONFIG_ABI_TRACE)
13595 + abi_trace(ABI_TRACE_STREAMS,
13596 + "getmsg %d, 0x%lx[%d], 0x%lx[%d], %x\n",
13597 + fd, (u_long)ctl_buf, ctl_maxlen,
13598 + (u_long)dat_buf, dat_maxlen, *flags_p);
13602 + * We need some user space to build syscall argument vectors
13603 + * later. Set it up now and page it in if necessary. This will
13604 + * avoid (most?) potential blocking after the select().
13606 + old_esp = regs->esp;
13607 + regs->esp -= 1024;
13608 + tsp = (unsigned long *)regs->esp;
13609 + regs->esp = old_esp;
13610 + if (!access_ok(VERIFY_WRITE, tsp, 6*sizeof(long)))
13614 + * If the TEP is not non-blocking we must test for
13615 + * something to do. We don't necessarily know what order
13616 + * events will be happening on the socket so we have to
13617 + * watch for evrything at once.
13618 + * N.B. If we weren't asked for data we should only be looking
13619 + * for connection requests. There are socket type issues to
13622 + if (!(filep->f_flags & O_NONBLOCK)) {
13623 + struct poll_wqueues wait_queue;
13624 + poll_table *wait;
13625 + unsigned long mask = (POLLIN | POLLRDNORM | POLLHUP | POLLERR);
13627 + if (*flags_p == MSG_HIPRI)
13630 + poll_initwait(&wait_queue);
13631 + wait = &wait_queue.pt;
13634 + * N.B. We need to be sure to recheck after a schedule()
13635 + * so that when we proceed it is because there is
13636 + * something to do and nothing else can get there
13639 + while (!(filep->f_op->poll(filep, wait) & mask)
13640 + && !signal_pending(current)) {
13641 + current->state = TASK_INTERRUPTIBLE;
13646 + current->state = TASK_RUNNING;
13647 + poll_freewait(&wait_queue);
13649 + if (signal_pending(current))
13653 + if (ctl_maxlen >= 0 && !Priv(filep)->pfirst)
13654 + timod_update_socket(fd, filep, regs);
13657 + * If we were asked for a control part and there is an outstanding
13658 + * message queued as a result of some other operation we'll
13661 + if (ctl_maxlen >= 0 && Priv(filep)->pfirst) {
13662 + int l = ctl_maxlen <= Priv(filep)->pfirst->length
13663 + ? ctl_maxlen : Priv(filep)->pfirst->length;
13664 + if (!access_ok(VERIFY_WRITE, ctl_buf, l))
13667 +#if defined(CONFIG_ABI_TRACE)
13668 + abi_trace(ABI_TRACE_STREAMS,
13669 + "priority message %ld %s\n",
13670 + Priv(filep)->pfirst->type,
13671 + xti_prim(Priv(filep)->pfirst->type));
13674 + if (copy_to_user(ctl_buf, ((char *)&Priv(filep)->pfirst->type)
13675 + + Priv(filep)->offset, l))
13677 + put_user(l, ctl_len);
13678 + if (dat_maxlen >= 0)
13679 + put_user(0, dat_len);
13680 + *flags_p = Priv(filep)->pfirst->pri;
13681 + Priv(filep)->pfirst->length -= l;
13683 +#if defined(CONFIG_ABI_TRACE)
13684 + if (abi_traced(ABI_TRACE_STREAMS) && ctl_buf && l > 0) {
13687 + for (i = 0; i < l && i < 64; i += 4) {
13690 + get_user(v, (u_long *)(ctl_buf + i));
13691 + __abi_trace("ctl: 0x%08lx\n", v);
13694 + __abi_trace("ctl: ...\n");
13698 + if (Priv(filep)->pfirst->length) {
13699 + Priv(filep)->offset += l;
13701 +#if defined(CONFIG_ABI_TRACE)
13702 + abi_trace(ABI_TRACE_STREAMS,
13703 + "MORECTL %d bytes",
13704 + Priv(filep)->pfirst->length);
13708 + struct T_primsg *it = Priv(filep)->pfirst;
13709 + Priv(filep)->pfirst = it->next;
13710 + if (!Priv(filep)->pfirst)
13711 + Priv(filep)->plast = NULL;
13713 + Priv(filep)->offset = 0;
13720 + /* If we weren't asked for data there is nothing more to do. */
13721 + if (dat_maxlen <= 0) {
13722 + if (dat_maxlen == 0)
13723 + put_user(0, dat_len);
13724 + if (ctl_maxlen >= 0)
13725 + put_user(0, ctl_len);
13729 + /* If the select() slept we may have had our temp space paged
13730 + * out. The re-verify_area is only really needed for pre-486
13731 + * chips which don't handle write faults from kernel mode.
13733 + regs->esp = (unsigned long)tsp;
13734 + if (!access_ok(VERIFY_WRITE, tsp, 6*sizeof(long))) {
13735 + regs->esp = old_esp;
13738 + put_user(fd, tsp);
13739 + put_user((unsigned long)dat_buf, tsp+1);
13740 + put_user((dat_maxlen < 0 ? 0 : dat_maxlen), tsp+2);
13741 + put_user(0, tsp+3);
13742 + if (ctl_maxlen > (int)sizeof(udi) && Priv(filep)->state == TS_IDLE) {
13743 + put_user((unsigned long)ctl_buf+sizeof(udi), tsp+4);
13744 + put_user(ctl_maxlen-sizeof(udi), ctl_len);
13745 + put_user((int)ctl_len, tsp+5);
13747 + put_user(0, tsp+4);
13748 + put_user(0, ctl_len);
13749 + put_user((int)ctl_len, tsp+5);
13752 + /* We don't want to block in the recvfrom(). Any blocking is
13753 + * handled by the select stuff above.
13755 + oldflags = filep->f_flags;
13756 + filep->f_flags |= O_NONBLOCK;
13757 + error = sys_socketcall(SYS_RECVFROM, tsp);
13758 + filep->f_flags = oldflags;
13760 + regs->esp = old_esp;
13764 + && ctl_maxlen > (int)sizeof(udi)
13765 + && Priv(filep)->state == TS_IDLE) {
13766 + udi.PRIM_type = T_UNITDATA_IND;
13767 + get_user(udi.SRC_length, ctl_len);
13768 + udi.SRC_offset = sizeof(udi);
13769 + udi.OPT_length = udi.OPT_offset = 0;
13770 + if (copy_to_user(ctl_buf, &udi, (int)sizeof(udi)))
13772 + put_user(sizeof(udi)+udi.SRC_length, ctl_len);
13774 +#if defined(CONFIG_ABI_TRACE)
13775 + if (abi_traced(ABI_TRACE_STREAMS) &&
13776 + ctl_buf && udi.SRC_length > 0) {
13777 + char * buf = ctl_buf + sizeof(udi);
13780 + for (i = 0; i < udi.SRC_length &&
13781 + i < 64; i += 4) {
13784 + get_user(v, (u_long *)(buf+i));
13785 + __abi_trace("dat: 0x%08lx\n", v);
13787 + if (i != udi.SRC_length)
13788 + __abi_trace("dat: ...\n");
13793 + put_user(0, ctl_len);
13795 + put_user(error, dat_len);
13802 +do_putmsg(int fd, struct pt_regs *regs, char *ctl_buf, int ctl_len,
13803 + char *dat_buf, int dat_len, int flags)
13805 + struct file *filep;
13806 + int error, terror;
13807 + unsigned long cmd;
13809 + /* It may not be obvious but we are always holding an fget(fd)
13810 + * at this point so we can use fcheck(fd) rather than fget...fput.
13812 + filep = fcheck(fd);
13814 + if (!Priv(filep) && Priv(filep)->magic != XTI_MAGIC) {
13815 + printk("putmsg on non-STREAMS fd %d by %s\n",fd, current->comm);
13819 +#if defined(CONFIG_ABI_TRACE)
13820 + if (abi_traced(ABI_TRACE_STREAMS)) {
13822 + __abi_trace("putmsg %d, 0x%lx[%d], 0x%lx[%d], %x\n",
13823 + fd, (u_long)ctl_buf, ctl_len,
13824 + (u_long)dat_buf, dat_len, flags);
13826 + get_user(v, ctl_buf);
13827 + __abi_trace("putmsg prim: %ld %s\n", v, xti_prim(v));
13829 + if (ctl_buf && ctl_len > 0) {
13832 + for (i = 0; i < ctl_len && i < 64; i += 4) {
13835 + get_user(v, (u_long *)(ctl_buf + i));
13836 + __abi_trace("ctl: 0x%08lx\n", v);
13838 + if (i != ctl_len)
13839 + __abi_trace("ctl: ...\n");
13842 + if (dat_buf && dat_len > 0) {
13845 + for (i = 0; i < dat_len && i < 64; i += 4) {
13848 + get_user(v, (u_long *)(dat_buf + i));
13849 + __abi_trace("dat: 0x%08lx\n", v);
13851 + if (i != dat_len)
13852 + __abi_trace("dat: ...");
13857 + error = get_user(cmd, (unsigned long *)ctl_buf);
13862 + case T_BIND_REQ: {
13863 + struct T_bind_req req;
13865 + unsigned long *tsp;
13867 +#if defined(CONFIG_ABI_TRACE)
13868 + abi_trace(ABI_TRACE_STREAMS, "%u bind req\n", fd);
13870 + if (!access_ok(VERIFY_READ, ctl_buf, sizeof(req)))
13873 + if (Priv(filep)->state != TS_UNBND) {
13874 + timod_error(fd, T_BIND_REQ, TOUTSTATE, 0);
13878 + old_esp = regs->esp;
13879 + regs->esp -= 1024;
13880 + tsp = (unsigned long *)(regs->esp);
13881 + if (!access_ok(VERIFY_WRITE, tsp, 3*sizeof(long))) {
13882 + timod_error(fd, T_BIND_REQ, TSYSERR, -EFAULT);
13883 + regs->esp = old_esp;
13887 + if (copy_from_user(&req, ctl_buf, sizeof(req)))
13889 + if (req.ADDR_offset && req.ADDR_length) {
13890 + struct sockaddr_in *sin;
13891 + unsigned short family;
13893 +#if 1 /* Wheee... Kludge time... */
13894 + sin = (struct sockaddr_in *)(ctl_buf
13895 + + req.ADDR_offset);
13896 + get_user(family, &sin->sin_family);
13898 + /* Sybase seems to have set up the address
13899 + * struct with sa->sa_family = htons(AF_?)
13900 + * which is bollocks. I have no idea why it
13901 + * apparently works on SCO?!?
13903 + if (family && !(family & 0x00ff))
13904 + put_user(ntohs(family), &sin->sin_family);
13907 + put_user(fd, tsp);
13908 + put_user((unsigned long)ctl_buf
13909 + + req.ADDR_offset, tsp+1);
13910 + /* For TLI/XTI the length may be the 8 *used*
13911 + * bytes, for (IP?) sockets it must be the 16
13912 + * *total* bytes in a sockaddr_in.
13914 + put_user(req.ADDR_length == 8
13915 + ? 16 : req.ADDR_length,
13917 + error = sys_socketcall(SYS_BIND, tsp);
13920 + if (req.CONIND_number) {
13922 +#if defined(CONFIG_ABI_TRACE)
13923 + abi_trace(ABI_TRACE_STREAMS,
13924 + "%u listen backlog=%lu\n",
13925 + fd, req.CONIND_number);
13928 + put_user(fd, tsp);
13929 + put_user(req.CONIND_number, tsp+1);
13930 + sys_socketcall(SYS_LISTEN, tsp);
13931 + Priv(filep)->state = TS_WRES_CIND;
13933 + Priv(filep)->state = TS_IDLE;
13940 + regs->esp = old_esp;
13943 + struct T_primsg *it;
13944 + it = timod_mkctl(ctl_len);
13946 + struct T_bind_ack *ack = (struct T_bind_ack *)&it->type;
13947 + if (copy_from_user(ack, ctl_buf, ctl_len))
13949 + ack->PRIM_type = T_BIND_ACK;
13950 + it->pri = MSG_HIPRI;
13951 + it->length = ctl_len;
13953 + timod_ok(fd, T_BIND_REQ);
13954 + Priv(filep)->plast->next = it;
13955 + Priv(filep)->plast = it;
13961 + terror = TOUTSTATE;
13968 + case -EADDRNOTAVAIL:
13969 + case -EADDRINUSE:
13970 + terror = TNOADDR;
13974 + terror = TSYSERR;
13977 + timod_error(fd, T_BIND_REQ, terror, -error);
13980 + case T_CONN_RES: {
13981 + struct T_conn_res *res = (struct T_conn_res *)ctl_buf;
13982 + unsigned int conn_fd;
13984 + error = get_user(conn_fd, &res->SEQ_number);
13988 +#if defined(CONFIG_ABI_TRACE)
13989 + abi_trace(ABI_TRACE_STREAMS,
13990 + "%u accept: conn fd=%u, use fd=%u\n",
13991 + fd, conn_fd, flags);
13994 + if (conn_fd != flags) {
13995 + error = sys_dup2(conn_fd, flags);
13996 + sys_close(conn_fd);
14000 + timod_ok(fd, T_CONN_RES);
14003 + case T_CONN_REQ: {
14004 + struct T_conn_req req;
14006 + unsigned short oldflags;
14007 + unsigned long *tsp;
14008 + struct T_primsg *it;
14009 + struct sockaddr_in *sin;
14010 + unsigned short family;
14012 +#if defined(CONFIG_ABI_TRACE)
14013 + abi_trace(ABI_TRACE_STREAMS, "%u connect req\n", fd);
14015 + if (!access_ok(VERIFY_READ, ctl_buf, sizeof(req)))
14018 + if (Priv(filep)->state != TS_UNBND
14019 + && Priv(filep)->state != TS_IDLE) {
14020 + timod_error(fd, T_CONN_REQ, TOUTSTATE, 0);
14024 + old_esp = regs->esp;
14025 + regs->esp -= 1024;
14026 + tsp = (unsigned long *)(regs->esp);
14027 + if (!access_ok(VERIFY_WRITE, tsp, 3*sizeof(long))) {
14028 + timod_error(fd, T_CONN_REQ, TSYSERR, -EFAULT);
14029 + regs->esp = old_esp;
14032 + if (copy_from_user(&req, ctl_buf, sizeof(req)))
14034 + put_user(fd, tsp);
14035 + put_user((unsigned long)ctl_buf + req.DEST_offset, tsp+1);
14036 + /* For TLI/XTI the length may be the 8 *used*
14037 + * bytes, for (IP?) sockets it must be the 16
14038 + * *total* bytes in a sockaddr_in.
14040 + put_user(req.DEST_length == 8
14041 + ? 16 : req.DEST_length,
14044 +#if 1 /* Wheee... Kludge time... */
14045 + sin = (struct sockaddr_in *)(ctl_buf
14046 + + req.DEST_offset);
14047 + get_user(family, &sin->sin_family);
14049 + /* Sybase seems to have set up the address
14050 + * struct with sa->sa_family = htons(AF_?)
14051 + * which is bollocks. I have no idea why it
14052 + * apparently works on SCO?!?
14054 + if (family && !(family & 0x00ff)) {
14055 + family = ntohs(family);
14056 + put_user(family, &sin->sin_family);
14059 + /* Sheesh... ISC telnet seems to give the port
14060 + * number low byte first as I expected but the
14061 + * X programs seem to be giving high byte first.
14062 + * One is broken of course but clearly both
14063 + * should work. No, I don't understand this
14064 + * either but I can at least try...
14065 + * A better solution would be for you to change
14066 + * the definition of xserver0 in ISC's /etc/services
14067 + * but then it wouldn't work out of the box...
14069 + if (is_cur_personality(PER_SVR4) && family == AF_INET) {
14070 + get_user(family, &sin->sin_port);
14071 + if (family == 0x1770)
14072 + put_user(htons(family),
14076 + /* FIXME: We should honour non-blocking mode
14077 + * here but that means that the select probe
14078 + * needs to know that if select returns ok and
14079 + * we are in T_OUTCON we have a connection
14080 + * completion. This isn't so bad but the real
14081 + * problem is that the connection acknowledgement
14082 + * is supposed to contain the destination
14085 + oldflags = filep->f_flags;
14086 + filep->f_flags &= ~O_NONBLOCK;
14087 + error = sys_socketcall(SYS_CONNECT, tsp);
14088 + filep->f_flags = oldflags;
14089 + regs->esp = old_esp;
14092 + struct T_conn_con *con;
14094 + it = timod_mkctl(ctl_len);
14097 + it->length = ctl_len;
14098 + con = (struct T_conn_con *)&it->type;
14099 + if (copy_from_user(con, ctl_buf, ctl_len))
14101 + con->PRIM_type = T_CONN_CON;
14102 + Priv(filep)->state = TS_DATA_XFER;
14104 + struct T_discon_ind *dis;
14106 +#if defined(CONFIG_ABI_TRACE)
14107 + abi_trace(ABI_TRACE_STREAMS,
14108 + "%u connect failed (errno=%d)\n",
14112 + it = timod_mkctl(sizeof(struct T_discon_ind));
14115 + it->length = sizeof(struct T_discon_ind);
14116 + dis = (struct T_discon_ind *)&it->type;
14117 + dis->PRIM_type = T_DISCON_IND;
14118 + dis->DISCON_reason = iABI_errors(-error);
14119 + dis->SEQ_number = 0;
14121 + timod_ok(fd, T_CONN_REQ);
14124 + Priv(filep)->plast->next = it;
14125 + Priv(filep)->plast = it;
14129 + case T_DISCON_REQ: {
14130 + struct T_discon_req *req;
14132 + req = (struct T_discon_req *)ctl_buf;
14133 + error = get_user(fd, &req->SEQ_number);
14137 +#if defined(CONFIG_ABI_TRACE)
14138 + abi_trace(ABI_TRACE_STREAMS, "disconnect %u\n", fd);
14140 + /* Fall through... */
14142 + case T_ORDREL_REQ: {
14147 + case T_DATA_REQ: {
14149 + unsigned long *tsp;
14151 +#if defined(CONFIG_ABI_TRACE)
14152 + abi_trace(ABI_TRACE_STREAMS, "%u data req\n", fd);
14155 + if (Priv(filep)->state != TS_DATA_XFER) {
14159 + old_esp = regs->esp;
14160 + regs->esp -= 1024;
14161 + tsp = (unsigned long *)(regs->esp);
14162 + if (!access_ok(VERIFY_WRITE, tsp, 6*sizeof(long))) {
14163 + regs->esp = old_esp;
14166 + put_user(fd, tsp);
14167 + put_user((unsigned long)dat_buf, tsp+1);
14168 + put_user(dat_len, tsp+2);
14169 + put_user(0, tsp+3);
14170 + error = sys_socketcall(SYS_SEND, tsp);
14171 + regs->esp = old_esp;
14175 + case T_UNITDATA_REQ: {
14176 + struct T_unitdata_req req;
14178 + unsigned long *tsp;
14180 +#if defined(CONFIG_ABI_TRACE)
14181 + abi_trace(ABI_TRACE_STREAMS, "%u unitdata req\n", fd);
14183 + if (!access_ok(VERIFY_READ, ctl_buf, sizeof(req)))
14186 + if (Priv(filep)->state != TS_IDLE
14187 + && Priv(filep)->state != TS_DATA_XFER) {
14188 + timod_error(fd, T_UNITDATA_REQ, TOUTSTATE, 0);
14192 + old_esp = regs->esp;
14193 + regs->esp -= 1024;
14194 + tsp = (unsigned long *)(regs->esp);
14195 + if (!access_ok(VERIFY_WRITE, tsp, 6*sizeof(long))) {
14196 + timod_error(fd, T_UNITDATA_REQ, TSYSERR, -EFAULT);
14197 + regs->esp = old_esp;
14200 + put_user(fd, tsp);
14201 + put_user((unsigned long)dat_buf, tsp+1);
14202 + put_user(dat_len, tsp+2);
14203 + put_user(0, tsp+3);
14204 + if (copy_from_user(&req, ctl_buf, sizeof(req)))
14206 + if (req.DEST_length > 0) {
14207 + put_user((unsigned long)(ctl_buf+req.DEST_offset), tsp+4);
14208 + put_user(req.DEST_length, tsp+5);
14209 + error = sys_socketcall(SYS_SENDTO, tsp);
14210 + regs->esp = old_esp;
14213 + error = sys_socketcall(SYS_SEND, tsp);
14214 + regs->esp = old_esp;
14218 + case T_UNBIND_REQ:
14219 + Priv(filep)->state = TS_UNBND;
14220 + timod_ok(fd, T_UNBIND_REQ);
14223 + case T_OPTMGMT_REQ: {
14224 + struct T_optmgmt_req req;
14226 +#if defined(CONFIG_ABI_TRACE)
14227 + abi_trace(ABI_TRACE_STREAMS, "%u optmgmt req\n", fd);
14229 + if (!access_ok(VERIFY_READ, ctl_buf, sizeof(req)))
14231 + if (copy_from_user(&req, ctl_buf, sizeof(req)))
14234 + return timod_optmgmt(fd, regs, req.MGMT_flags,
14235 + req.OPT_offset > 0
14236 + ? ctl_buf+req.OPT_offset
14243 +#if defined(CONFIG_ABI_TRACE)
14244 + if (abi_traced(ABI_TRACE_STREAMS))
14247 + if (ctl_buf && ctl_len > 0) {
14250 + for (i = 0; i < ctl_len && i < 32; i += 4) {
14253 + get_user(v, (u_long *)(ctl_buf + i));
14254 + __abi_trace("ctl: 0x%08lx\n", v);
14256 + if (i != ctl_len)
14257 + __abi_trace("ctl: ...\n");
14259 + if (dat_buf && dat_len > 0) {
14261 + for (i = 0; i < dat_len && i < 32; i += 4) {
14264 + get_user(v, (u_long *)(dat_buf + i));
14265 + __abi_trace("dat: 0x%08lx\n", v);
14267 + if (i != dat_len)
14268 + __abi_trace("dat: ...\n");
14275 +/* this function needs to be cleaned up badly. --hch */
14277 +timod_ioctl(struct pt_regs *regs,
14278 + int fd, unsigned int func, void *arg, int len, int *len_p)
14280 + struct file *filep;
14281 + struct inode *ino;
14286 + filep = fget(fd);
14290 + if (!access_ok(VERIFY_WRITE, len_p, sizeof(int))) {
14292 + return (-EFAULT << 8) | TSYSERR;
14295 + ino = filep->f_dentry->d_inode;
14297 + /* SCO/SVR3 starts at 100, ISC/SVR4 starts at 140. */
14298 + switch (func >= 140 ? func-140 : func-100) {
14299 + case 0: /* TI_GETINFO */
14301 + struct T_info_ack it;
14304 +#if defined(CONFIG_ABI_TRACE)
14305 + abi_trace(ABI_TRACE_STREAMS, "%u getinfo\n", fd);
14307 + /* The pre-SVR4 T_info_ack structure didn't have
14308 + * the PROVIDER_flag on the end.
14310 + if (!access_ok(VERIFY_WRITE, arg,
14312 + ? sizeof(struct T_info_ack)
14313 + : sizeof(struct T_info_ack)-sizeof(long))) {
14315 + return (-EFAULT << 8) | TSYSERR;
14318 + __get_user(v, &((struct T_info_req *)arg)->PRIM_type);
14319 + if (v != T_INFO_REQ) {
14321 + return (EINVAL << 8) | TSYSERR;
14324 + it.PRIM_type = T_INFO_ACK;
14325 + it.CURRENT_state = Priv(filep)->state;
14326 + it.CDATA_size = -2;
14327 + it.DDATA_size = -2;
14328 + it.OPT_size = -1;
14329 + it.TIDU_size = 16384;
14330 + switch ((MINOR(ino->i_rdev)>>4) & 0x0f) {
14332 + it.ADDR_size = sizeof(struct sockaddr_un);
14335 + it.ADDR_size = sizeof(struct sockaddr_in);
14338 + /* Uh... dunno... play safe(?) */
14339 + it.ADDR_size = 1024;
14342 + switch (SOCKET_I(ino)->type) {
14343 + case SOCK_STREAM:
14344 + it.ETSDU_size = 1;
14345 + it.TSDU_size = 0;
14346 + it.SERV_type = 2;
14349 + it.ETSDU_size = -2;
14350 + it.TSDU_size = 16384;
14351 + it.SERV_type = 3;
14357 + /* The pre-SVR4 T_info_ack structure didn't have
14358 + * the PROVIDER_flag on the end.
14360 + if (func == 140) {
14361 + it.PROVIDER_flag = 0;
14362 + if (copy_to_user(arg, &it, sizeof(it)))
14364 + put_user(sizeof(it), len_p);
14367 + if (copy_to_user(arg, &it, sizeof(it)-sizeof(long)))
14369 + put_user(sizeof(it)-sizeof(long), len_p);
14373 + case 2: /* TI_BIND */
14378 +#if defined(CONFIG_ABI_TRACE)
14379 + abi_trace(ABI_TRACE_STREAMS, "%u bind\n", fd);
14381 + error = do_putmsg(fd, regs, arg, len,
14385 + return (-error << 8) | TSYSERR;
14388 + /* Get the response. This should be either
14389 + * T_OK_ACK or T_ERROR_ACK.
14392 + error = do_getmsg(fd, regs,
14398 + return (-error << 8) | TSYSERR;
14401 + get_user(prim, (unsigned long *)arg);
14402 + if (prim == T_ERROR_ACK) {
14403 + unsigned long a, b;
14405 + get_user(a, ((unsigned long *)arg)+3);
14406 + get_user(b, ((unsigned long *)arg)+2);
14407 + return (a << 8) | b;
14409 + if (prim != T_OK_ACK) {
14414 + /* Get the response to the bind request. */
14416 + error = do_getmsg(fd, regs,
14422 + return (-error << 8) | TSYSERR;
14427 + case 3: /* TI_UNBIND */
14428 + if (Priv(filep)->state != TS_IDLE) {
14430 + return TOUTSTATE;
14432 + Priv(filep)->state = TS_UNBND;
14436 + case 1: { /* TI_OPTMGMT */
14437 +#if defined(CONFIG_ABI_XTI_OPTMGMT) || defined(CONFIG_ABI_TLI_OPTMGMT)
14441 +#if defined(CONFIG_ABI_TRACE)
14442 + abi_trace(ABI_TRACE_STREAMS, "%u optmgmt\n", fd);
14444 + error = do_putmsg(fd, regs, arg, len,
14448 + return (-error << 8) | TSYSERR;
14451 + /* Get the response to the optmgmt request. */
14453 + error = do_getmsg(fd, regs,
14458 + /* If there is excess data in the response
14459 + * our buffer is too small which implies
14460 + * the application is broken. SO_LINGER
14461 + * is a common fault. Because it works
14462 + * on other systems we attempt to recover
14463 + * by discarding the excess.
14465 + struct T_primsg *it = Priv(filep)->pfirst;
14466 + Priv(filep)->pfirst = it->next;
14467 + if (!Priv(filep)->pfirst)
14468 + Priv(filep)->plast = NULL;
14470 + Priv(filep)->offset = 0;
14472 +#if defined(CONFIG_ABI_TRACE)
14473 + abi_trace(ABI_TRACE_STREAMS,
14474 + "excess discarded\n");
14481 + return (-error << 8) | TSYSERR;
14483 + __get_user(prim, (unsigned long *)arg);
14484 + if (prim == T_ERROR_ACK) {
14485 + unsigned long a, b;
14486 + __get_user(a, ((unsigned long *)arg)+3);
14487 + __get_user(b, ((unsigned long *)arg)+2);
14488 + return (a << 8) | b;
14492 +#else /* no CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
14494 + return TNOTSUPPORT;
14495 +#endif /* CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
14498 + case 4: /* TI_GETMYNAME */
14499 + case 5: /* TI_SETPEERNAME */
14500 + case 6: /* TI_GETMYNAME */
14501 + case 7: /* TI_SETPEERNAME */
14505 +#if defined(CONFIG_ABI_TRACE)
14506 + abi_trace(ABI_TRACE_STREAMS,
14507 + "STREAMS timod op %d not supported\n", func);
14510 + return TNOTSUPPORT;
14515 +svr4_sockmod_ioctl(int fd, u_int cmd, caddr_t data)
14518 + struct inode *ip;
14525 + ip = fp->f_dentry->d_inode;
14526 + if (MAJOR(ip->i_rdev) == SOCKSYS_MAJOR) {
14527 + error = socksys_fdinit(fd, 0, NULL, NULL);
14534 + ip = fp->f_dentry->d_inode;
14538 + case 101: { /* SI_GETUDATA */
14540 + int tidusize, addrsize, optsize, etsdusize;
14541 + int servtype, so_state, so_options;
14542 + } *it = (void *)data;
14544 +#if defined(CONFIG_ABI_TRACE)
14545 + abi_trace(ABI_TRACE_STREAMS, "%u getudata\n", fd);
14547 + if (!access_ok(VERIFY_WRITE, it, sizeof(*it))) {
14549 + return (-EFAULT << 8) | TSYSERR;
14552 + __put_user(16384, &it->tidusize);
14553 + __put_user(sizeof(struct sockaddr), &it->addrsize);
14554 + __put_user(-1, &it->optsize);
14555 + __put_user(0, &it->so_state);
14556 + __put_user(0, &it->so_options);
14558 + switch (SOCKET_I(ip)->type) {
14559 + case SOCK_STREAM:
14560 + __put_user(1, &it->etsdusize);
14561 + __put_user(2, &it->servtype);
14564 + __put_user(-2, &it->etsdusize);
14565 + __put_user(3, &it->servtype);
14572 + case 102: /* SI_SHUTDOWN */
14573 + case 103: /* SI_LISTEN */
14574 + case 104: /* SI_SETMYNAME */
14575 + case 105: /* SI_SETPEERNAME */
14576 + case 106: /* SI_GETINTRANSIT */
14577 + case 107: /* SI_TCL_LINK */
14578 + case 108: /* SI_TCL_UNLINK */
14582 +#if defined(CONFIG_ABI_TRACE)
14583 + abi_trace(ABI_TRACE_STREAMS,
14584 + "STREAMS sockmod op %d not supported\n", cmd);
14587 + return TNOTSUPPORT;
14590 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
14591 +EXPORT_SYMBOL(svr4_sockmod_ioctl);
14593 diff -Nur kernel-source-2.6.16.orig/abi/util/Makefile kernel-source-2.6.16/abi/util/Makefile
14594 --- kernel-source-2.6.16.orig/abi/util/Makefile 1970-01-01 10:00:00.000000000 +1000
14595 +++ kernel-source-2.6.16/abi/util/Makefile 2006-04-27 18:50:24.000000000 +1000
14598 +abi-util-objs := stat.o plist.o
14600 +obj-$(CONFIG_ABI_UTIL) += abi-util.o
14602 +abi-util.o: $(abi-util-objs)
14603 + $(LD) -r -o $@ $(abi-util-objs)
14604 diff -Nur kernel-source-2.6.16.orig/abi/util/plist.c kernel-source-2.6.16/abi/util/plist.c
14605 --- kernel-source-2.6.16.orig/abi/util/plist.c 1970-01-01 10:00:00.000000000 +1000
14606 +++ kernel-source-2.6.16/abi/util/plist.c 2006-04-27 18:50:24.000000000 +1000
14610 +#include <linux/string.h>
14611 +#include <linux/fs.h>
14612 +#include <linux/slab.h> /* needed by putname macro */
14613 +#include <linux/sched.h> /* needed by current-> in __abi_trace() macro */
14614 +#include <linux/module.h>
14616 +#include <abi/util/trace.h>
14619 +#if defined(CONFIG_ABI_TRACE)
14621 +print_string(char *buf, char *str)
14625 + tmp = getname(str);
14626 + if (!IS_ERR(tmp)) {
14627 + /* we are debugging, we don't need to see it all */
14629 + sprintf(buf, "\"%s\"", tmp);
14634 +void plist(char *name, char *args, int *list)
14636 + char buf[512], *p = buf;
14640 + switch (*args++) {
14642 + sprintf(p, "%d", *list++);
14645 + sprintf(p, "0%o", *list++);
14648 + sprintf(p, "%p", (void *)(*list++));
14652 + sprintf(p, "0x%x", *list++);
14655 + print_string(p, (char *)(*list++));
14658 + sprintf(p, "?%c%c?", '%', args[-1]);
14670 + __abi_trace("%s(%s)\n", name, buf);
14673 +#if CONFIG_ABI_LCALL7 == m
14674 +EXPORT_SYMBOL(plist);
14676 +#endif /* CONFIG_ABI_TRACE */
14677 diff -Nur kernel-source-2.6.16.orig/abi/util/stat.c kernel-source-2.6.16/abi/util/stat.c
14678 --- kernel-source-2.6.16.orig/abi/util/stat.c 1970-01-01 10:00:00.000000000 +1000
14679 +++ kernel-source-2.6.16/abi/util/stat.c 2006-04-27 18:50:24.000000000 +1000
14682 + * Mostly ripped from Al Viro's stat-a-AC9-10 patch, 2001 Christoph Hellwig.
14687 +#include <linux/module.h> /* needed to shut up modprobe */
14688 +#include <linux/fs.h>
14689 +#include <linux/stat.h>
14690 +#include <linux/sched.h>
14691 +#include <linux/file.h>
14692 +#include <linux/namei.h>
14694 +#include <abi/util/revalidate.h>
14695 +#include <abi/util/stat.h>
14698 +MODULE_DESCRIPTION("Linux-ABI helper routines");
14699 +MODULE_AUTHOR("Christoph Hellwig, ripped from kernel sources/patches");
14700 +MODULE_LICENSE("GPL");
14702 +#if 0 /* LINUXABI_OBSOLETE */
14703 +int getattr_full(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
14705 + struct inode *inode = dentry->d_inode;
14706 + stat->dev = inode->i_rdev;
14707 + stat->ino = inode->i_ino;
14708 + stat->mode = inode->i_mode;
14709 + stat->nlink = inode->i_nlink;
14710 + stat->uid = inode->i_uid;
14711 + stat->gid = inode->i_gid;
14712 + stat->rdev = inode->i_rdev;
14713 + stat->atime = inode->i_atime;
14714 + stat->mtime = inode->i_mtime;
14715 + stat->ctime = inode->i_ctime;
14716 + stat->size = inode->i_size;
14717 + stat->blocks = inode->i_blocks;
14718 + stat->blksize = inode->i_blksize;
14723 + * Use minix fs values for the number of direct and indirect blocks. The
14724 + * count is now exact for the minix fs except that it counts zero blocks.
14725 + * Everything is in units of BLOCK_SIZE until the assignment to
14728 +int getattr_minix(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
14730 + struct inode *inode = dentry->d_inode;
14731 + unsigned int blocks, indirect;
14733 + stat->dev = inode->i_rdev;
14734 + stat->ino = inode->i_ino;
14735 + stat->mode = inode->i_mode;
14736 + stat->nlink = inode->i_nlink;
14737 + stat->uid = inode->i_uid;
14738 + stat->gid = inode->i_gid;
14739 + stat->rdev = inode->i_rdev;
14740 + stat->atime = inode->i_atime;
14741 + stat->mtime = inode->i_mtime;
14742 + stat->ctime = inode->i_ctime;
14743 + stat->size = inode->i_size;
14745 +#define I_B (BLOCK_SIZE / sizeof(unsigned short))
14747 + blocks = (stat->size + BLOCK_SIZE - 1) >> BLOCK_SIZE_BITS;
14748 + if (blocks > D_B) {
14749 + indirect = (blocks - D_B + I_B - 1) / I_B;
14750 + blocks += indirect;
14751 + if (indirect > 1) {
14752 + indirect = (indirect - 1 + I_B - 1) / I_B;
14753 + blocks += indirect;
14754 + if (indirect > 1)
14758 + stat->blocks = (BLOCK_SIZE / 512) * blocks;
14759 + stat->blksize = BLOCK_SIZE;
14763 +int vfs_stat(char *filename, struct kstat *stat)
14765 + struct nameidata nd;
14768 + error = user_path_walk(filename, &nd);
14772 + error = do_revalidate(nd.dentry);
14774 + struct inode *inode = nd.dentry->d_inode;
14775 + if (!inode->i_blksize)
14776 + error = getattr_minix(nd.mnt, nd.dentry, stat);
14778 + error = getattr_full(nd.mnt, nd.dentry, stat);
14779 + path_release(&nd);
14785 +int vfs_lstat(char *filename, struct kstat *stat)
14787 + struct nameidata nd;
14790 + error = user_path_walk_link(filename, &nd);
14794 + error = do_revalidate(nd.dentry);
14796 + struct inode *inode = nd.dentry->d_inode;
14797 + if (!inode->i_blksize)
14798 + error = getattr_minix(nd.mnt, nd.dentry, stat);
14800 + error = getattr_full(nd.mnt, nd.dentry, stat);
14801 + path_release(&nd);
14807 +int vfs_fstat(int fd, struct kstat *stat)
14809 + struct file *file = fget(fd);
14815 + error = do_revalidate(file->f_dentry);
14817 + struct inode *inode = file->f_dentry->d_inode;
14818 + if (!inode->i_blksize)
14819 + error = getattr_minix(file->f_vfsmnt, file->f_dentry, stat);
14821 + error = getattr_full(file->f_vfsmnt, file->f_dentry, stat);
14827 diff -Nur kernel-source-2.6.16.orig/abi/uw7/access.c kernel-source-2.6.16/abi/uw7/access.c
14828 --- kernel-source-2.6.16.orig/abi/uw7/access.c 1970-01-01 10:00:00.000000000 +1000
14829 +++ kernel-source-2.6.16/abi/uw7/access.c 2006-04-27 18:50:24.000000000 +1000
14832 + * abi/uw7/access.c - support for UnixWare access(2) system call.
14834 + * We handle the non-POSIX EFF_ONLY_OK/EX_OK flags.
14835 + * This software is under GPL.
14838 +#include <linux/errno.h>
14839 +#include <linux/sched.h>
14840 +#include <linux/syscalls.h>
14841 +#include <linux/dcache.h>
14842 +#include <linux/namei.h>
14843 +#include <asm/uaccess.h>
14845 +#include <abi/util/revalidate.h>
14851 +#define DBG(x...) printk(x)
14856 +#define UW7_R_OK 004
14857 +#define UW7_W_OK 002
14858 +#define UW7_X_OK 001
14859 +#define UW7_F_OK 000
14860 +#define UW7_EFF_ONLY_OK 010
14861 +#define UW7_EX_OK 020
14863 +#define UW7_MODE_MSK (UW7_R_OK|UW7_W_OK|UW7_X_OK|UW7_F_OK|UW7_EFF_ONLY_OK|UW7_EX_OK)
14865 +int uw7_access(char * filename, int mode)
14867 + struct nameidata nd;
14870 + DBG(KERN_ERR "UW7[%d]: access(%p,%o)\n", current->pid, filename, mode);
14872 + if (mode & ~UW7_MODE_MSK)
14875 + if (mode & UW7_EX_OK) {
14876 + error = user_path_walk(filename, &nd);
14878 + error = do_revalidate(nd.dentry);
14880 + path_release(&nd);
14883 + if (!S_ISREG(nd.dentry->d_inode->i_mode)) {
14884 + path_release(&nd);
14887 + path_release(&nd);
14889 + mode &= ~UW7_EX_OK;
14890 + mode |= UW7_X_OK;
14892 + if (mode & UW7_EFF_ONLY_OK) {
14893 + uid_t old_uid = current->uid, old_gid = current->gid;
14895 + current->uid = current->euid;
14896 + current->gid = current->egid;
14897 + mode &= ~UW7_EFF_ONLY_OK;
14898 + error = sys_access(filename, mode);
14899 + current->uid = old_uid;
14900 + current->gid = old_gid;
14902 + error = sys_access(filename, mode);
14906 diff -Nur kernel-source-2.6.16.orig/abi/uw7/context.c kernel-source-2.6.16/abi/uw7/context.c
14907 --- kernel-source-2.6.16.orig/abi/uw7/context.c 1970-01-01 10:00:00.000000000 +1000
14908 +++ kernel-source-2.6.16/abi/uw7/context.c 2006-04-27 18:50:24.000000000 +1000
14911 + * abi/uw7/context.c
14913 + * This software is under GPL
14917 +#include <linux/ptrace.h>
14918 +#include <linux/errno.h>
14919 +#define __KERNEL_SYSCALLS__
14920 +#include <linux/unistd.h>
14921 +#include <linux/syscalls.h>
14922 +#include <asm/uaccess.h>
14924 +#include <asm/abi_machdep.h>
14925 +#include <abi/uw7/context.h>
14929 +uw7_sigaltstack(const uw7_stack_t *uw7_ss, uw7_stack_t *uw7_oss)
14931 + stack_t ss, oss, *ssp = NULL, *ossp = NULL;
14933 + mm_segment_t old_fs;
14936 + if (!access_ok(VERIFY_READ, uw7_ss, sizeof(uw7_stack_t)))
14938 + __get_user(ss.ss_sp, &uw7_ss->ss_sp);
14939 + __get_user(ss.ss_size, &uw7_ss->ss_size);
14940 + __get_user(ss.ss_flags, &uw7_ss->ss_flags);
14945 + if (!access_ok(VERIFY_WRITE, uw7_oss, sizeof(uw7_stack_t)))
14947 + __get_user(oss.ss_sp, &uw7_oss->ss_sp);
14948 + __get_user(oss.ss_size, &uw7_oss->ss_size);
14949 + __get_user(oss.ss_flags, &uw7_oss->ss_flags);
14953 + old_fs = get_fs();
14954 + set_fs(get_ds());
14955 + error = sys_sigaltstack(ssp, ossp);
14959 + __put_user(ossp->ss_sp, &uw7_oss->ss_sp);
14960 + __put_user(ossp->ss_size, &uw7_oss->ss_size);
14961 + __put_user(ossp->ss_flags, &uw7_oss->ss_flags);
14967 +getcontext(uw7_context_t * uc, struct pt_regs * regs)
14969 + uw7_context_t tmp = { 0 };
14971 + return copy_to_user(uc, &tmp, sizeof(uw7_context_t)) ? -EFAULT : 0;
14975 +getxcontext(uw7_context_t * uc, struct pt_regs * regs)
14981 +setcontext(uw7_context_t * uc, struct pt_regs * regs)
14983 + if (!uc) /* SVR4 says setcontext(NULL) => exit(0) */
14989 +uw7_context(struct pt_regs * regs)
14991 + int fcn = get_syscall_parameter(regs, 0);
14992 + uw7_context_t * uc = (uw7_context_t *) get_syscall_parameter(regs, 1);
14995 + case UW7_GETCONTEXT:
14996 + return getcontext(uc, regs);
14998 + case UW7_GETXCONTEXT:
14999 + return getxcontext(uc, regs);
15001 + case UW7_SETCONTEXT:
15002 + return setcontext(uc, regs);
15006 diff -Nur kernel-source-2.6.16.orig/abi/uw7/ioctl.c kernel-source-2.6.16/abi/uw7/ioctl.c
15007 --- kernel-source-2.6.16.orig/abi/uw7/ioctl.c 1970-01-01 10:00:00.000000000 +1000
15008 +++ kernel-source-2.6.16/abi/uw7/ioctl.c 2006-04-27 18:50:24.000000000 +1000
15011 + * abi/uw7/ioctl.c - Support for UnixWare 7.x ioctl(2) system call.
15013 + * This module provides a function uw7_ioctl() which is called indirectly
15014 + * via uw7_funcs[] array, see abi/uw7/funcs.c.
15015 + * This software is under GPL
15018 +#include <linux/errno.h>
15019 +#include <linux/sched.h>
15020 +#include <linux/syscalls.h>
15021 +#include <linux/termios.h>
15022 +#include <asm/uaccess.h>
15024 +#include <asm/abi_machdep.h>
15026 +#include <abi/uw7/termbits.h>
15027 +#include <abi/uw7/termios.h>
15028 +#include <abi/svr4/ioctl.h>
15034 +#define DBG(x...) printk(x)
15040 +static int tioc_tcgets(int fd, struct uw7_termios * tios);
15041 +static int tioc_tcsets(int fd, int lnx_cmd, struct uw7_termios * tios);
15042 +static int ioctl_T(int fd, unsigned int cmd, void * arg);
15045 +int uw7_ioctl(struct pt_regs * regs)
15048 + unsigned int cmd, class;
15051 + fd = (int)get_syscall_parameter(regs, 0);
15052 + cmd = (unsigned int)get_syscall_parameter(regs, 1);
15053 + arg = (void *)get_syscall_parameter(regs, 2);
15054 + class = cmd >> 8;
15058 + return ioctl_T(fd, cmd, arg);
15060 + return __svr4_ioctl(regs, fd, cmd, arg);
15064 +static int tioc_tcsets(int fd, int lnx_cmd, struct uw7_termios * tios)
15066 + struct termios t;
15067 + struct uw7_termios tmp = {0, };
15068 + mm_segment_t old_fs;
15071 + DBG(KERN_ERR "UW7[%d]: tioc_tcsets(%d,%x,%p)\n",
15072 + current->pid, fd, lnx_cmd, tios);
15074 + if (!access_ok(VERIFY_READ, tios, sizeof(struct uw7_termios)))
15077 + old_fs = get_fs();
15078 + set_fs(get_ds());
15079 + error = sys_ioctl(fd, TCGETS, (long)&t);
15084 + if (copy_from_user(&tmp, tios, sizeof(struct uw7_termios)))
15086 + t.c_iflag = tmp.c_iflag & ~UW7_DOSMODE;
15087 + t.c_oflag = tmp.c_oflag;
15088 + t.c_cflag = tmp.c_cflag;
15089 + t.c_lflag = tmp.c_lflag & ~UW7_DEFECHO;
15090 + if (tmp.c_lflag & UW7_FLUSHO)
15091 + t.c_lflag |= FLUSHO;
15093 + t.c_lflag &= ~FLUSHO;
15096 + "UW7[%d]: iflag: %lx->%lx, oflag: %lx->%lx, cflag: %lx->%lx, lflag: %lx->%lx\n",
15097 + current->pid, tmp.c_iflag, t.c_iflag, tmp.c_oflag, t.c_oflag,
15098 + tmp.c_cflag, t.c_cflag, tmp.c_lflag, t.c_lflag);
15100 + t.c_cc[VINTR] = tmp.c_cc[UW7_VINTR];
15101 + t.c_cc[VQUIT] = tmp.c_cc[UW7_VQUIT];
15102 + t.c_cc[VERASE] = tmp.c_cc[UW7_VERASE];
15103 + t.c_cc[VKILL] = tmp.c_cc[UW7_VKILL];
15104 + t.c_cc[VEOL2] = tmp.c_cc[UW7_VEOL2];
15105 + t.c_cc[VSWTC] = tmp.c_cc[UW7_VSWTCH];
15106 + t.c_cc[VSTART] = tmp.c_cc[UW7_VSTART];
15107 + t.c_cc[VSTOP] = tmp.c_cc[UW7_VSTOP];
15108 + t.c_cc[VSUSP] = tmp.c_cc[UW7_VSUSP];
15109 + t.c_cc[VREPRINT] = tmp.c_cc[UW7_VREPRINT];
15110 + t.c_cc[VDISCARD] = tmp.c_cc[UW7_VDISCARD];
15111 + t.c_cc[VWERASE] = tmp.c_cc[UW7_VWERASE];
15112 + t.c_cc[VLNEXT] = tmp.c_cc[UW7_VLNEXT];
15113 + if (t.c_lflag & ICANON) {
15114 + t.c_cc[VEOF] = tmp.c_cc[UW7_VEOF];
15115 + t.c_cc[VEOL] = tmp.c_cc[UW7_VEOL];
15117 + t.c_cc[VMIN] = tmp.c_cc[UW7_VMIN];
15118 + t.c_cc[VTIME] = tmp.c_cc[UW7_VTIME];
15119 + t.c_cc[VEOL] = tmp.c_cc[UW7_VEOL2];
15125 + "VINTR: %x->%x, VQUIT: %x->%x, VERASE: %x->%x, VKILL: %x->%x\n"
15126 + "VEOL2: %x->%x\n",
15127 + current->pid, tmp.c_cc[UW7_VINTR], t.c_cc[VINTR],
15128 + tmp.c_cc[UW7_VQUIT], t.c_cc[VQUIT],
15129 + tmp.c_cc[UW7_VERASE], t.c_cc[VERASE],
15130 + tmp.c_cc[UW7_VKILL], t.c_cc[VKILL],
15131 + tmp.c_cc[UW7_VEOL2], t.c_cc[VEOL2]);
15133 + old_fs = get_fs();
15134 + set_fs(get_ds());
15135 + error = sys_ioctl(fd, lnx_cmd, (long)&t);
15140 +static int tioc_tcgets(int fd, struct uw7_termios * tios)
15142 + struct termios t;
15143 + struct uw7_termios tmp = { 0 };
15144 + mm_segment_t old_fs;
15147 + DBG(KERN_ERR "UW7[%d]: tioc_tcgets(%d,%p)\n", current->pid, fd, tios);
15149 + old_fs = get_fs();
15150 + set_fs(get_ds());
15151 + error = sys_ioctl(fd, TCGETS, (long)&t);
15156 + tmp.c_iflag = UW7_IFLAG_MSK & (t.c_iflag & ~UW7_DOSMODE);
15157 + tmp.c_oflag = UW7_OFLAG_MSK & t.c_oflag;
15158 + tmp.c_cflag = UW7_CFLAG_MSK & t.c_cflag;
15159 + tmp.c_lflag = UW7_LFLAG_MSK & (t.c_lflag & ~UW7_DEFECHO);
15160 + if (t.c_lflag & FLUSHO)
15161 + tmp.c_lflag |= UW7_FLUSHO;
15163 + tmp.c_lflag &= ~UW7_FLUSHO;
15166 + "UW7[%d]: iflag: %lx->%lx, oflag: %lx->%lx, cflag: %lx->%lx, lflag: %lx->%lx\n",
15167 + current->pid, tmp.c_iflag, t.c_iflag, tmp.c_oflag, t.c_oflag,
15168 + tmp.c_cflag, t.c_cflag, tmp.c_lflag, t.c_lflag);
15170 + if (t.c_lflag & ICANON) {
15171 + tmp.c_cc[UW7_VEOF] = t.c_cc[VEOF];
15172 + tmp.c_cc[UW7_VEOL] = t.c_cc[VEOL];
15174 + tmp.c_cc[UW7_VMIN] = t.c_cc[VMIN];
15175 + tmp.c_cc[UW7_VTIME] = t.c_cc[VTIME];
15178 + tmp.c_cc[UW7_VINTR] = t.c_cc[VINTR];
15179 + tmp.c_cc[UW7_VQUIT] = t.c_cc[VQUIT];
15180 + tmp.c_cc[UW7_VERASE] = t.c_cc[VERASE];
15181 + tmp.c_cc[UW7_VKILL] = t.c_cc[VKILL];
15182 + tmp.c_cc[UW7_VEOL2] = t.c_cc[VEOL2];
15183 + tmp.c_cc[UW7_VSWTCH] = t.c_cc[VSWTC];
15184 + tmp.c_cc[UW7_VSTART] = t.c_cc[VSTART];
15185 + tmp.c_cc[UW7_VSTOP] = t.c_cc[VSTOP];
15186 + tmp.c_cc[UW7_VSUSP] = tmp.c_cc[UW7_VDSUSP] = t.c_cc[VSUSP];
15187 + tmp.c_cc[UW7_VREPRINT] = t.c_cc[VREPRINT];
15188 + tmp.c_cc[UW7_VDISCARD] = t.c_cc[VDISCARD];
15189 + tmp.c_cc[UW7_VWERASE] = t.c_cc[VWERASE];
15190 + tmp.c_cc[UW7_VLNEXT] = t.c_cc[VLNEXT];
15192 + return copy_to_user(tios, &tmp, sizeof(struct uw7_termios)) ? -EFAULT : 0;
15195 +static int ioctl_T(int fd, unsigned int cmd, void * arg)
15197 + DBG(KERN_ERR "ioctl_T(%d,%x,%p)\n", fd, cmd, arg);
15201 + return sys_ioctl(fd, TCSBRK, (long)arg);
15204 + return sys_ioctl(fd, TCXONC, (long)arg);
15207 + return sys_ioctl(fd, TCFLSH, (long)arg);
15209 + case UW7_TIOCSWINSZ:
15210 + return sys_ioctl(fd, TIOCSWINSZ, (long)arg);
15212 + case UW7_TIOCGWINSZ:
15213 + return sys_ioctl(fd, TIOCGWINSZ, (long)arg);
15216 + return tioc_tcgets(fd, arg);
15219 + return tioc_tcsets(fd, TCSETS, arg);
15221 + case UW7_TCSETSW:
15222 + return tioc_tcsets(fd, TCSETSW, arg);
15224 + case UW7_TCSETSF:
15225 + return tioc_tcsets(fd, TCSETSF, arg);
15229 diff -Nur kernel-source-2.6.16.orig/abi/uw7/lfs.c kernel-source-2.6.16/abi/uw7/lfs.c
15230 --- kernel-source-2.6.16.orig/abi/uw7/lfs.c 1970-01-01 10:00:00.000000000 +1000
15231 +++ kernel-source-2.6.16/abi/uw7/lfs.c 2006-04-27 18:50:24.000000000 +1000
15234 + * Copyright (c) 1999 Tigran Aivazian.
15235 + * Copyright (c) 2001 Christoph Hellwig.
15236 + * All rights reserved.
15238 + * This program is free software; you can redistribute it and/or modify
15239 + * it under the terms of the GNU General Public License as published by
15240 + * the Free Software Foundation; either version 2 of the License, or
15241 + * (at your option) any later version.
15243 + * This program is distributed in the hope that it will be useful,
15244 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15245 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15246 + * GNU General Public License for more details.
15248 + * You should have received a copy of the GNU General Public License
15249 + * along with this program; if not, write to the Free Software
15250 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15256 + * Support for the UnixWare 7.x LFS (Large File Summit) syscalls.
15258 +#include <linux/sched.h>
15259 +#include <linux/file.h>
15260 +#include <linux/fs.h>
15261 +#include <linux/statfs.h>
15262 +#include <linux/kernel.h>
15263 +#include <linux/unistd.h>
15264 +#include <linux/syscalls.h>
15265 +#include <linux/namei.h>
15266 +#include <asm/uaccess.h>
15268 +#include <abi/uw7/resource.h>
15269 +#include <abi/uw7/statvfs.h>
15273 + * The UnixWare 7 truncate64/fruncate64 syscalls are the same as in
15274 + * Linux, but we can't easily handle long long syscall parameters for
15275 + * lcall7, thus we have to fake two 32bit arguments instead.
15277 + * XXX: if do_sys_truncate/do_sys_ftruncate in fs/open.c were exported
15278 + * we could get rid of one function call.
15281 +uw7_truncate64(const char *filename, u_int len, u_int len_hi)
15283 + return sys_truncate64(filename, (len | (loff_t)len_hi << 32));
15287 +uw7_ftruncate64(int fd, u_int len, u_int len_hi)
15289 + return sys_ftruncate64(fd, (len | (loff_t)len_hi << 32));
15293 + * The SVR4 statvfs is basically our statfs, but of course only
15297 +cp_uw7_statvfs64(struct super_block *sbp, struct kstatfs *srcp,
15298 + struct uw7_statvfs64 *dstp)
15300 + struct uw7_statvfs64 tmp;
15302 + memset(&tmp, 0, sizeof(struct uw7_statvfs64));
15304 + tmp.f_bsize = srcp->f_bsize;
15305 + tmp.f_frsize = srcp->f_bsize;
15306 + tmp.f_blocks = srcp->f_blocks;
15307 + tmp.f_bfree = srcp->f_bfree;
15308 + tmp.f_bavail = srcp->f_bavail;
15309 + tmp.f_files = srcp->f_files;
15310 + tmp.f_ffree = srcp->f_ffree;
15311 + tmp.f_favail = srcp->f_ffree;
15312 + tmp.f_fsid = sbp->s_dev;
15314 + strcpy(tmp.f_basetype, sbp->s_type->name);
15316 + tmp.f_namemax = srcp->f_namelen;
15318 + if (copy_to_user(dstp, &tmp, sizeof(struct uw7_statvfs64)))
15324 +uw7_statvfs64(char *filename, struct uw7_statvfs64 *stvfsp)
15326 + struct nameidata nd;
15329 + error = user_path_walk(filename, &nd);
15331 + struct super_block *sbp = nd.dentry->d_inode->i_sb;
15332 + struct kstatfs tmp;
15334 + error = vfs_statfs(sbp, &tmp);
15335 + if (!error && cp_uw7_statvfs64(sbp, &tmp, stvfsp))
15337 + path_release(&nd);
15345 +uw7_fstatvfs64(int fd, struct uw7_statvfs64 *stvfsp)
15348 + int error = -EBADF;
15352 + struct super_block *sbp = fp->f_dentry->d_inode->i_sb;
15353 + struct kstatfs tmp;
15355 + error = vfs_statfs(sbp, &tmp);
15356 + if (!error && cp_uw7_statvfs64(sbp, &tmp, stvfsp))
15364 +static __inline__ int
15365 +uw7_rlim64_to_user(int resource, struct uw7_rlim64 *rlimp)
15367 + struct rlimit *lxrlim = current->signal->rlim + resource;
15368 + struct uw7_rlim64 rlim;
15370 + rlim.rlim_cur = lxrlim->rlim_cur;
15371 + rlim.rlim_max = lxrlim->rlim_max;
15373 + if (copy_to_user(rlimp, &rlim, sizeof(struct uw7_rlim64)))
15379 +uw7_getrlimit64(int resource, struct uw7_rlim64 *rlimp)
15381 + if (resource > ARRAY_SIZE(uw7_to_linux_rlimit))
15384 + return (uw7_rlim64_to_user(uw7_to_linux_rlimit[resource], rlimp));
15387 +static __inline__ int
15388 +uw7_check_rlimit64(int resource, const struct uw7_rlim64 *rlimp,
15389 + struct rlimit *lxrlimp)
15391 + if ((rlimp->rlim_cur > RLIM_INFINITY) ||
15392 + (rlimp->rlim_max > RLIM_INFINITY))
15393 + return -EPERM; /* XXX: actually this is wrong */
15395 + if (((rlimp->rlim_cur > lxrlimp->rlim_max) ||
15396 + (rlimp->rlim_max > lxrlimp->rlim_max)) &&
15397 + !capable(CAP_SYS_RESOURCE))
15400 + if (resource == RLIMIT_NOFILE &&
15401 + (rlimp->rlim_cur > NR_OPEN || rlimp->rlim_max > NR_OPEN))
15408 +uw7_setrlimit64(int resource, const struct uw7_rlim64 *rlimp)
15410 + struct rlimit *lxrlim = current->signal->rlim + resource;
15411 + struct uw7_rlim64 rlim;
15413 + if (resource > ARRAY_SIZE(uw7_to_linux_rlimit))
15415 + if (copy_from_user(&rlim, rlimp, sizeof(struct uw7_rlim64)))
15417 + if (uw7_check_rlimit64(resource, &rlim, lxrlim))
15420 + /* XXX: this is non-atomic. */
15421 + lxrlim->rlim_cur = rlim.rlim_cur;
15422 + lxrlim->rlim_max = rlim.rlim_max;
15428 + * 64bit lseek for UnixWare.
15431 +uw7_lseek64(int fd, u_int off, u_int off_hi, int orig)
15436 + if (off_hi == (u_int)-1)
15439 + err = sys_llseek(fd, (off_t) off_hi, off, &result, orig);
15442 + return (long)result; /* XXX: how does UnixWare return large results? */
15446 + * The UnixWare 7 pread64/pwrite64 syscalls are the same as in Linux,
15447 + * but we can't easily handle long long syscall parameters for lcall7,
15448 + * thus we have to fake two 32bit arguments instead.
15451 +uw7_pread64(int fd, char *bufp, int count, u_int pos, u_int pos_hi)
15453 + return sys_pread64(fd, bufp, count, (pos | (loff_t)pos_hi << 32));
15457 +uw7_pwrite64(int fd, char *bufp, int count, u_int pos, u_int pos_hi)
15459 + return sys_pwrite64(fd, bufp, count, (pos | (loff_t)pos_hi << 32));
15463 + * Unlike Linux UnixWare 7 does not simply add O_LARGEFILE to flags in
15464 + * libc, so we have to do it.
15465 + * We call sys_open directly as sys_creat is just yet another wrapper.
15467 +#define UW7_CREAT64_FLAGS \
15468 + (O_LARGEFILE | O_CREAT | O_WRONLY | O_TRUNC)
15470 +uw7_creat64(const char *filename, int mode)
15472 + return sys_open(filename, UW7_CREAT64_FLAGS, mode);
15474 diff -Nur kernel-source-2.6.16.orig/abi/uw7/mac.c kernel-source-2.6.16/abi/uw7/mac.c
15475 --- kernel-source-2.6.16.orig/abi/uw7/mac.c 1970-01-01 10:00:00.000000000 +1000
15476 +++ kernel-source-2.6.16/abi/uw7/mac.c 2006-04-27 18:50:24.000000000 +1000
15479 + * abi/uw7/mac.c - mldmode(2) and friends.
15481 + * This software is under GPL
15484 +#include <linux/sched.h>
15485 +#include <linux/errno.h>
15490 +#define DBG(x...) printk(x)
15495 +#define UW7_MLD_REAL 1
15496 +#define UW7_MLD_VIRT 0
15497 +#define UW7_MLD_QUERY 2
15499 +int uw7_mldmode(int mldmode)
15501 + switch (mldmode) {
15502 + case UW7_MLD_REAL:
15503 + DBG(KERN_ERR "UW7[%d]: mldmode(MLD_REAL)\n", current->pid);
15506 + case UW7_MLD_VIRT:
15507 + DBG(KERN_ERR "UW7[%d]: mldmode(MLD_VIRT)\n", current->pid);
15510 + case UW7_MLD_QUERY:
15511 + DBG(KERN_ERR "UW7[%d]: mldmode(MLD_QUERY)\n", current->pid);
15512 + return UW7_MLD_REAL;
15519 diff -Nur kernel-source-2.6.16.orig/abi/uw7/Makefile kernel-source-2.6.16/abi/uw7/Makefile
15520 --- kernel-source-2.6.16.orig/abi/uw7/Makefile 1970-01-01 10:00:00.000000000 +1000
15521 +++ kernel-source-2.6.16/abi/uw7/Makefile 2006-04-27 18:50:24.000000000 +1000
15524 +abi-uw7-objs := access.o context.o ioctl.o lfs.o mac.o \
15525 + misc.o mmap.o stat.o sysent.o
15527 +obj-$(CONFIG_ABI_UW7) += abi-uw7.o
15529 +abi-uw7.o: $(abi-uw7-objs)
15530 + $(LD) -r -o $@ $(abi-uw7-objs)
15531 diff -Nur kernel-source-2.6.16.orig/abi/uw7/misc.c kernel-source-2.6.16/abi/uw7/misc.c
15532 --- kernel-source-2.6.16.orig/abi/uw7/misc.c 1970-01-01 10:00:00.000000000 +1000
15533 +++ kernel-source-2.6.16/abi/uw7/misc.c 2006-04-27 18:50:24.000000000 +1000
15536 + * abi/uw7/misc.c - various UW7 system calls.
15538 + * This software is under GPL
15541 +#include <linux/errno.h>
15542 +#include <linux/kernel.h>
15543 +#include <linux/sched.h>
15544 +#include <linux/file.h>
15545 +#include <linux/syscalls.h>
15546 +#include <asm/uaccess.h>
15549 +int uw7_sleep(int seconds)
15551 + struct timespec t;
15552 + mm_segment_t old_fs;
15555 + t.tv_sec = seconds;
15557 + old_fs = get_fs();
15558 + set_fs(get_ds());
15559 + error = sys_nanosleep(&t, NULL);
15564 +#define UW7_MAXUID 60002
15566 +int uw7_seteuid(int uid)
15568 + if (uid < 0 || uid > UW7_MAXUID)
15570 + return sys_setreuid16(-1, uid);
15573 +int uw7_setegid(int gid)
15575 + if (gid < 0 || gid > UW7_MAXUID)
15577 + return sys_setreuid16(-1, gid);
15580 +/* can't call sys_pread64() directly because off is 32bit on UW7 */
15581 +int uw7_pread(unsigned int fd, char * buf, int count, long off)
15583 + return sys_pread64(fd, buf, count, (loff_t)off);
15586 +/* can't call sys_pwrite64() directly because off is 32bit on UW7 */
15587 +int uw7_pwrite(unsigned int fd, char * buf, int count, long off)
15589 + return sys_pwrite64(fd, buf, count, (loff_t)off);
15592 +int uw7_stty(int fd, int cmd)
15597 +int uw7_gtty(int fd, int cmd)
15601 diff -Nur kernel-source-2.6.16.orig/abi/uw7/mmap.c kernel-source-2.6.16/abi/uw7/mmap.c
15602 --- kernel-source-2.6.16.orig/abi/uw7/mmap.c 1970-01-01 10:00:00.000000000 +1000
15603 +++ kernel-source-2.6.16/abi/uw7/mmap.c 2006-04-27 18:50:24.000000000 +1000
15606 + * Copyright (c) 1999 Tigran Aivazian.
15607 + * Copyright (c) 2001 Christoph Hellwig.
15608 + * All rights reserved.
15610 + * This program is free software; you can redistribute it and/or modify
15611 + * it under the terms of the GNU General Public License as published by
15612 + * the Free Software Foundation; either version 2 of the License, or
15613 + * (at your option) any later version.
15615 + * This program is distributed in the hope that it will be useful,
15616 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15617 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15618 + * GNU General Public License for more details.
15620 + * You should have received a copy of the GNU General Public License
15621 + * along with this program; if not, write to the Free Software
15622 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15628 + * Support for mmap on UnixWare 7.
15630 +#include <linux/mm.h>
15631 +#include <linux/errno.h>
15632 +#include <linux/file.h>
15633 +#include <linux/mman.h>
15635 +#include <asm/uaccess.h>
15638 +/* the other MAP_XXX values are the same as on Linux/i386 */
15639 +#define UW7_MAP_ANONYMOUS 0x100
15642 +uw7_mmap64(u_long addr, size_t len, int prot, int flags,
15643 + int fd, u_int off, u_int off_hi)
15645 + loff_t off64 = (off | ((loff_t)off_hi << 32));
15646 + u_long pgoff = (off64 >> PAGE_SHIFT);
15647 + int error = -EBADF;
15648 + struct file *fp = NULL;
15650 + if ((off64 + PAGE_ALIGN(len)) < off64)
15653 + if (!(off64 & ~PAGE_MASK))
15656 + if (flags & UW7_MAP_ANONYMOUS) {
15657 + flags |= MAP_ANONYMOUS;
15658 + flags &= ~UW7_MAP_ANONYMOUS;
15661 + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
15662 + if (!(flags & MAP_ANONYMOUS)) {
15663 + if (!(fp = fget(fd)))
15667 + down_write(¤t->mm->mmap_sem);
15668 + error = do_mmap_pgoff(fp, addr, len, prot, flags, pgoff);
15669 + up_write(¤t->mm->mmap_sem);
15676 diff -Nur kernel-source-2.6.16.orig/abi/uw7/stat.c kernel-source-2.6.16/abi/uw7/stat.c
15677 --- kernel-source-2.6.16.orig/abi/uw7/stat.c 1970-01-01 10:00:00.000000000 +1000
15678 +++ kernel-source-2.6.16/abi/uw7/stat.c 2006-04-27 18:50:24.000000000 +1000
15681 + * Copyright (c) 2001 Christoph Hellwig.
15682 + * All rights reserved.
15684 + * This program is free software; you can redistribute it and/or modify
15685 + * it under the terms of the GNU General Public License as published by
15686 + * the Free Software Foundation; either version 2 of the License, or
15687 + * (at your option) any later version.
15689 + * This program is distributed in the hope that it will be useful,
15690 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15691 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15692 + * GNU General Public License for more details.
15694 + * You should have received a copy of the GNU General Public License
15695 + * aint32_t with this program; if not, write to the Free Software
15696 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15702 + * UnixWare 7.x xstat support.
15704 +#include <linux/kernel.h>
15705 +#include <linux/fs.h>
15706 +#include <linux/sched.h>
15707 +#include <linux/file.h>
15708 +#include <linux/string.h>
15709 +#include <asm/uaccess.h>
15711 +#include <abi/uw7/types.h>
15712 +#include <abi/uw7/stat.h>
15713 +#include <abi/svr4/stat.h>
15715 +#include <abi/util/trace.h>
15716 +#include <abi/util/stat.h>
15719 +enum {SVR4_stat = 1, SVR4_xstat = 2, UW7_stat64 = 4};
15722 +report_uw7_stat64(struct kstat *stp, struct uw7_stat64 *bufp)
15724 + struct uw7_stat64 buf;
15726 + memset(&buf, 0, sizeof(struct uw7_stat64));
15728 + buf.st_dev = linux_to_uw7_dev_t(stp->dev);
15729 + buf.st_ino = linux_to_uw7_ino_t(stp->ino);
15730 + buf.st_mode = stp->mode;
15731 + buf.st_nlink = stp->nlink;
15732 + buf.st_uid = linux_to_uw7_uid_t(stp->uid);
15733 + buf.st_gid = linux_to_uw7_gid_t(stp->gid);
15734 + buf.st_rdev = linux_to_uw7_dev_t(stp->rdev);
15735 + buf.st_size = stp->size;
15737 + buf.st_atime.tv_sec = stp->atime.tv_sec;
15738 + buf.st_mtime.tv_sec = stp->mtime.tv_sec;
15739 + buf.st_ctime.tv_sec = stp->ctime.tv_sec;
15741 + buf.st_blksize = stp->blksize;
15742 + buf.st_blocks = stp->blocks;
15744 + strcpy(buf.st_fstype, "ext2");
15746 + if (copy_to_user(bufp, &buf, sizeof(struct uw7_stat64)))
15752 +uw7_xstat(int vers, char *filename, void *bufp)
15757 + error = vfs_stat(filename, &st);
15763 + return report_svr4_stat(&st, bufp);
15765 + return report_svr4_xstat(&st, bufp);
15767 + return report_uw7_stat64(&st, bufp);
15770 +#if defined(CONFIG_ABI_TRACE)
15771 + abi_trace(ABI_TRACE_API, "xstat version %d not supported\n", vers);
15777 +uw7_lxstat(int vers, char *filename, void *bufp)
15782 + error = vfs_lstat(filename, &st);
15788 + return report_svr4_stat(&st, bufp);
15790 + return report_svr4_xstat(&st, bufp);
15792 + return report_uw7_stat64(&st, bufp);
15795 +#if defined(CONFIG_ABI_TRACE)
15796 + abi_trace(ABI_TRACE_API, "lxstat version %d not supported\n", vers);
15802 +uw7_fxstat(int vers, int fd, void *bufp)
15807 + error = vfs_fstat(fd, &st);
15813 + return report_svr4_stat(&st, bufp);
15815 + return report_svr4_xstat(&st, bufp);
15817 + return report_uw7_stat64(&st, bufp);
15820 +#if defined(CONFIG_ABI_TRACE)
15821 + abi_trace(ABI_TRACE_API, "fxstat version %d not supported\n", vers);
15825 diff -Nur kernel-source-2.6.16.orig/abi/uw7/sysent.c kernel-source-2.6.16/abi/uw7/sysent.c
15826 --- kernel-source-2.6.16.orig/abi/uw7/sysent.c 1970-01-01 10:00:00.000000000 +1000
15827 +++ kernel-source-2.6.16/abi/uw7/sysent.c 2006-04-27 18:50:24.000000000 +1000
15830 + * Copyright (c) 1999 Tigran Aivazian.
15831 + * Copyright (c) 2000, 2001 Christoph Hellwig.
15832 + * All rights reserved.
15834 + * This program is free software; you can redistribute it and/or modify
15835 + * it under the terms of the GNU General Public License as published by
15836 + * the Free Software Foundation; either version 2 of the License, or
15837 + * (at your option) any later version.
15839 + * This program is distributed in the hope that it will be useful,
15840 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15841 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15842 + * GNU General Public License for more details.
15844 + * You should have received a copy of the GNU General Public License
15845 + * along with this program; if not, write to the Free Software
15846 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15852 + * UnixWare 7/OpenUnix 8 personality switch.
15855 +#include <linux/config.h>
15856 +#include <linux/module.h>
15857 +#include <linux/init.h>
15858 +#include <linux/kernel.h>
15859 +#include <linux/personality.h>
15860 +#include <linux/syscalls.h>
15861 +#include <linux/socket.h>
15862 +#include <linux/net.h>
15863 +#include <asm/uaccess.h>
15865 +#include <abi/signal.h>
15867 +#include <abi/svr4/sysent.h>
15868 +#include <abi/uw7/sysent.h>
15870 +#include <abi/util/errno.h>
15871 +#include <abi/util/sysent.h>
15872 +#include <abi/util/socket.h>
15874 +MODULE_DESCRIPTION("UnixWare7/OpenUnix8 personality");
15875 +MODULE_AUTHOR("Tigran Aivazian, Christoph Hellwig");
15876 +MODULE_LICENSE("GPL");
15880 + * We could remove some of the long identity mapped runs but at the
15881 + * expense of extra comparisons for each mapping at run time...
15883 +static u_char uw7_err_table[] = {
15884 +/* 0 - 9 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
15885 +/* 10 - 19 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
15886 +/* 20 - 29 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
15887 +/* 30 - 39 */ 30, 31, 32, 33, 34, 45, 78, 46, 89, 93,
15888 +/* 40 - 49 */ 90, 90, 35, 36, 37, 38, 39, 40, 41, 42,
15889 +/* 50 - 59 */ 43, 44, 50, 51, 52, 53, 54, 55, 56, 57,
15890 +/* 60 - 69 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
15891 +/* 70 - 79 */ 70, 71, 74, 76, 77, 79, 80, 81, 82, 83,
15892 +/* 80 - 89 */ 84, 85, 86, 87, 88, 91, 92, 94, 95, 96,
15893 +/* 90 - 99 */ 97, 98, 99, 120, 121, 122, 123, 124, 125, 126,
15894 +/* 100 - 109 */ 127, 128, 129, 130, 131, 132, 133, 134, 143, 144,
15895 +/* 110 - 119 */ 145, 146, 147, 148, 149, 150, 22, 135, 137, 138,
15896 +/* 120 - 122 */ 139, 140, 28
15900 + * Map Linux RESTART* values (512,513,514) to EINTR
15902 +static u_char lnx_err_table[] = {
15903 +/* 512 - 514 */ EINTR, EINTR, EINTR
15906 +struct map_segment uw7_err_map[] = {
15907 + { 0, 0+sizeof(uw7_err_table)-1, uw7_err_table },
15908 + { 512, 512+sizeof(lnx_err_table)-1, lnx_err_table },
15912 +static long linux_to_uw7_signals[NSIGNALS+1] = {
15913 +/* 0 - 3 */ 0, IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT,
15914 +/* 4 - 7 */ IBCS_SIGILL, IBCS_SIGTRAP, IBCS_SIGABRT, -1,
15915 +/* 8 - 11 */ IBCS_SIGFPE, IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV,
15916 +/* 12 - 15 */ IBCS_SIGUSR2, IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM,
15917 +/* 16 - 19 */ IBCS_SIGSEGV, IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP,
15918 +/* 20 - 23 */ IBCS_SIGTSTP, IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGURG,
15919 +/* 24 - 27 */ IBCS_SIGGXCPU, IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF,
15920 +/* 28 - 31 */ IBCS_SIGWINCH, IBCS_SIGIO, IBCS_SIGPWR, -1,
15924 +static long uw7_to_linux_signals[NSIGNALS+1] = {
15925 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
15926 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGUNUSED,
15927 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGUNUSED, SIGSEGV,
15928 +/* 12 - 15 */ SIGUNUSED, SIGPIPE, SIGALRM, SIGTERM,
15929 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
15930 +/* 20 - 23 */ SIGWINCH, SIGURG, SIGPOLL, SIGSTOP,
15931 +/* 24 - 27 */ SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU,
15932 +/* 28 - 31 */ SIGVTALRM, SIGPROF, SIGXCPU, SIGXFSZ,
15936 +static char uw7_socktype[] = {
15945 +static struct map_segment uw7_socktype_map[] = {
15946 + { 1, 6, uw7_socktype },
15950 +static struct map_segment uw7_sockopt_map[] = {
15951 + { 0x0001, 0x0001, (char *)SO_DEBUG },
15952 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
15953 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
15954 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
15955 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
15956 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
15957 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
15958 + { 0x0080, 0x0080, (char *)SO_LINGER },
15959 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
15960 + { 0x0200, 0x0200, (char *)SO_ORDREL },
15961 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
15962 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
15963 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
15964 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
15965 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
15966 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
15967 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
15968 + { 0x1007, 0x1007, (char *)SO_ERROR },
15969 + { 0x1008, 0x1008, (char *)SO_TYPE },
15970 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
15974 +static struct map_segment uw7_af_map[] = {
15980 +static struct sysent uw7_syscall_table[] = {
15981 +/* 0 */ { abi_syscall, Fast, "syscall", "" },
15982 +/* 2 */ { sys_exit, 1, "exit", "d" },
15983 +/* 3 */ { abi_fork, Spl, "fork", "" },
15984 +/* 4 */ { abi_read, 3, "read", "dpd" },
15985 +/* 5 */ { sys_write, 3, "write", "dpd" },
15986 +/* 6 */ { svr4_open, 3, "open", "soo" },
15987 +/* 7 */ { sys_close, 1, "close", "d" },
15988 +/* 8 */ { abi_wait, Spl, "wait", "xxx" },
15989 +/* 9 */ { sys_creat, 2, "creat", "so" },
15990 +/* 10 */ { sys_link, 2, "link", "ss" },
15991 +/* 11 */ { sys_unlink, 1, "unlink", "s" },
15992 +/* 12 */ { abi_exec, Spl, "exec", "sxx" },
15993 +/* 13 */ { sys_chdir, 1, "chdir", "s" },
15994 +/* 14 */ { abi_time, 0, "time", "" },
15995 +/* 15 */ { svr4_mknod, 3, "mknod", "soo" },
15996 +/* 16 */ { sys_chmod, 2, "chmod", "so" },
15997 +/* 17 */ { sys_chown, 3, "chown", "sdd" },
15998 +/* 18 */ { abi_brk, 1, "brk/break", "x" },
15999 +/* 19 */ { svr4_stat, 2, "stat", "sp" },
16000 +/* 21 */ { sys_lseek, 3, "seek/lseek", "ddd" },
16001 +/* 20 */ { abi_getpid, Spl, "getpid", "" },
16002 +/* 21 */ { 0, Ukn, "mount", "" },
16003 +/* 22 */ { sys_umount, 1, "umount", "s" },
16004 +/* 23 */ { sys_setuid, 1, "setuid", "d" },
16005 +/* 24 */ { abi_getuid, Spl, "getuid", "" },
16006 +/* 25 */ { sys_stime, 1, "stime", "d" },
16007 +/* 26 */ { 0, 4, "ptrace", "" },
16008 +/* 27 */ { sys_alarm, 1, "alarm", "d" },
16009 +/* 28 */ { svr4_fstat, 2, "fstat", "dp" },
16010 +/* 21 */ { sys_pause, 0, "pause", "" },
16011 +/* 30 */ { sys_utime, 2, "utime", "xx" },
16012 +/* 31 */ { uw7_stty, 2, "stty", "dd" },
16013 +/* 32 */ { uw7_gtty, 2, "gtty", "dd" },
16014 +/* 33 */ { uw7_access, 2, "access", "so" },
16015 +/* 34 */ { sys_nice, 1, "nice", "d" },
16016 +/* 35 */ { svr4_statfs, 4, "statfs", "spdd" },
16017 +/* 36 */ { sys_sync, 0, "sync", "" },
16018 +/* 37 */ { abi_kill, 2, "kill", "dd" },
16019 +/* 38 */ { svr4_fstatfs, 4, "fstatfs", "dpdd" },
16020 +/* 39 */ { abi_procids, Spl, "procids", "d" },
16021 +/* 40 */ { 0, Ukn, "cxenix", "" },
16022 +/* 41 */ { sys_dup, 1, "dup", "d" },
16023 +/* 42 */ { abi_pipe, Spl, "pipe", "" },
16024 +/* 43 */ { sys_times, 1, "times", "p" },
16025 +/* 44 */ { 0, 4, "", "" },
16026 +/* 45 */ { 0, Ukn, "plock", "" },
16027 +/* 46 */ { sys_setgid, 1, "setgid", "d" },
16028 +/* 47 */ { abi_getgid, Spl, "getgid", "" },
16029 +/* 48 */ { abi_sigfunc, Fast, "sigfunc", "xxx" },
16030 +/* 49 */ { svr4_msgsys, Spl, "msgsys", "dxddd" },
16031 +/* 50 */ { svr4_sysi86, 3, "sysi86/sys3b", "d" },
16032 +/* 51 */ { sys_acct, 1, "acct/sysacct", "x" },
16033 +/* 52 */ { svr4_shmsys, Fast, "shmsys", "ddxo" },
16034 +/* 53 */ { svr4_semsys, Spl, "semsys", "dddx" },
16035 +/* 54 */ { uw7_ioctl, Spl, "ioctl", "dxx" },
16036 +/* 55 */ { 0, 3, "uadmin", "xxx" },
16037 +/* 56 */ { 0, Ukn, "unimpl/exch", "" },
16038 +/* 57 */ { v7_utsname, 1, "utsys", "x" },
16039 +/* 58 */ { sys_fsync, 1, "fsync", "d" },
16040 +/* 59 */ { abi_exec, Spl, "execv", "spp" },
16041 +/* 60 */ { sys_umask, 1, "umask", "o" },
16042 +/* 61 */ { sys_chroot, 1, "chroot", "s" },
16043 +/* 62 */ { svr4_fcntl, 3, "fcntl", "dxx" },
16044 +/* 63 */ { svr4_ulimit, 2, "ulimit", "xx" },
16047 + * 64-69 were reserved for the UNIX PC, and are now use for NUMA calls.
16049 +/* 64 */ { 0, Ukn, "cg_ids", "" },
16050 +/* 65 */ { 0, Ukn, "cg_processors","" },
16051 +/* 66 */ { 0, Ukn, "cg_info", "" },
16052 +/* 67 */ { 0, Ukn, "cg_bind", "" },
16053 +/* 68 */ { 0, Ukn, "cg_current", "" },
16054 +/* 69 */ { 0, Ukn, "cg_memloc", "" },
16055 +/* 70 */ { 0, Ukn, "unimpl/advfs", "" },
16056 +/* 71 */ { 0, Ukn, "unimpl/unadvfs","" },
16057 +/* 72 */ { 0, Ukn, "unimpl/rmount","" },
16058 +/* 73 */ { 0, Ukn, "unimpl/rumount","" },
16059 +/* 74 */ { 0, Ukn, "unimpl/rfstart","" },
16060 +/* 75 */ { 0, Ukn, "unimpl 75", "" },
16061 +/* 76 */ { 0, Ukn, "unimpl/rdebug","" },
16062 +/* 77 */ { 0, Ukn, "unimpl/rfstop","" },
16063 +/* 78 */ { 0, Ukn, "rfsys", "" },
16064 +/* 89 */ { sys_rmdir, 1, "rmdir", "s" },
16065 +/* 80 */ { sys_mkdir, 2, "mkdir", "so" },
16066 +/* 81 */ { svr4_getdents, 3, "getdents", "dxd" },
16067 +/* 82 */ { 0, Ukn, "unimpl/libattach","" },
16068 +/* 83 */ { 0, Ukn, "unimpl/libdetach","" },
16069 +/* 84 */ { svr4_sysfs, 3, "sysfs", "dxx" },
16070 +/* 85 */ { svr4_getmsg, Spl, "getmsg", "dxxx" },
16071 +/* 86 */ { svr4_putmsg, Spl, "putmsg", "dxxd" },
16072 +/* 87 */ { sys_poll, 3, "poll", "xdd" },
16073 +/* 88 */ { svr4_lstat, 2, "lstat", "sp" },
16074 +/* 89 */ { sys_symlink, 2, "symlink", "ss" },
16075 +/* 90 */ { sys_readlink, 3, "readlink", "spd" },
16076 +/* 91 */ { sys_setgroups, 2, "setgroups", "dp" },
16077 +/* 92 */ { sys_getgroups, 2, "getgroups", "dp" },
16078 +/* 93 */ { sys_fchmod, 2, "fchmod", "do" },
16079 +/* 94 */ { sys_fchown, 3, "fchown", "ddd" },
16080 +/* 95 */ { abi_sigprocmask, 3, "sigprocmask", "dxx" },
16081 +/* 96 */ { abi_sigsuspend, Spl, "sigsuspend", "x" },
16082 +/* 97 */ { uw7_sigaltstack, 2, "sigaltstack", "xx" },
16083 +/* 98 */ { abi_sigaction, 3, "sigaction", "dxx" },
16084 +/* 99 */ { svr4_sigpending, 2, "sigpending", "dp" },
16085 +/* 100 */ { uw7_context, Spl, "ucontext", "" },
16086 +/* 101 */ { 0, Ukn, "evsys", "" },
16087 +/* 102 */ { 0, Ukn, "evtrapret", "" },
16088 +/* 103 */ { svr4_statvfs, 2, "statvfs", "sp" },
16089 +/* 104 */ { svr4_fstatvfs, 2, "fstatvfs", "dp" },
16090 +/* 105 */ { 0, Ukn, "reserved 105", "" },
16091 +/* 106 */ { 0, Ukn, "nfssys", "" },
16092 +/* 107 */ { svr4_waitid, 4, "waitid", "ddxd" },
16093 +/* 108 */ { 0, 3, "sigsendsys", "ddd" },
16094 +/* 109 */ { svr4_hrtsys, Spl, "hrtsys", "xxx" },
16095 +/* 110 */ { 0, 3, "acancel", "dxd" },
16096 +/* 111 */ { 0, Ukn, "async", "" },
16097 +/* 112 */ { 0, Ukn, "priocntlsys", "" },
16098 +/* 113 */ { svr4_pathconf, 2, "pathconf", "sd" },
16099 +/* 114 */ { 0, 3, "mincore", "xdx" },
16100 +/* 115 */ { svr4_mmap, 6, "mmap", "xxxxdx"},
16101 +/* 116 */ { sys_mprotect, 3, "mprotect", "xdx" },
16102 +/* 117 */ { sys_munmap, 2, "munmap", "xd" },
16103 +/* 118 */ { svr4_fpathconf, 2, "fpathconf", "dd" },
16104 +/* 119 */ { abi_fork, Spl, "vfork", "" },
16105 +/* 120 */ { sys_fchdir, 1, "fchdir", "d" },
16106 +/* 121 */ { sys_readv, 3, "readv", "dxd" },
16107 +/* 122 */ { sys_writev, 3, "writev", "dxd" },
16108 +/* 123 */ { uw7_xstat, 3, "xstat", "dsx" },
16109 +/* 124 */ { uw7_lxstat, 3, "lxstat", "dsx" },
16110 +/* 125 */ { uw7_fxstat, 3, "fxstat", "ddx" },
16111 +/* 126 */ { svr4_xmknod, 4, "xmknod", "dsox" },
16112 +/* 127 */ { 0, Spl, "syslocal", "d" },
16113 +/* 128 */ { svr4_getrlimit, 2, "setrlimit", "dx" },
16114 +/* 129 */ { svr4_setrlimit, 2, "getrlimit", "dx" },
16115 +/* 130 */ { sys_lchown, 3, "lchown", "sdd" },
16116 +/* 131 */ { 0, Ukn, "memcntl", "" },
16117 +#if defined(CONFIG_ABI_XTI)
16118 +/* 132 */ { svr4_getpmsg, 5, "getpmsg", "dxxxx" },
16119 +/* 133 */ { svr4_putpmsg, 5, "putpmsg", "dxxdd" },
16121 +/* 132 */ { 0, 5, "getpmsg", "dxxxx" },
16122 +/* 133 */ { 0, 5, "putpmsg", "dxxdd" },
16124 +/* 134 */ { sys_rename, 2, "rename", "ss" },
16125 +/* 135 */ { abi_utsname, 1, "uname", "x" },
16126 +/* 136 */ { uw7_setegid, 1, "setegid", "d" },
16127 +/* 137 */ { svr4_sysconfig, 1, "sysconfig", "d" },
16128 +/* 138 */ { 0, Ukn, "adjtime", "" },
16129 +/* 139 */ { svr4_sysinfo, 3, "systeminfo", "dsd" },
16130 +/* 140 */ { socksys_syscall, 1, "socksys_syscall","x" },
16131 +/* 141 */ { uw7_seteuid, 1, "seteuid", "d" },
16132 +/* 142 */ { 0, Ukn, "unimpl 142", "" },
16133 +/* 143 */ { 0, Ukn, "keyctl", "" },
16134 +/* 144 */ { 0, 2, "secsys", "dx" },
16135 +/* 145 */ { 0, 4, "filepriv", "sdxd" },
16136 +/* 146 */ { 0, 3, "procpriv", "dxd" },
16137 +/* 147 */ { 0, 3, "devstat", "sdx" },
16138 +/* 148 */ { 0, 5, "aclipc", "ddddx" },
16139 +/* 149 */ { 0, 3, "fdevstat", "ddx" },
16140 +/* 150 */ { 0, 3, "flvlfile", "ddx" },
16141 +/* 151 */ { 0, 3, "lvlfile", "sdx" },
16142 +/* 152 */ { 0, Ukn, "sendv", "" },
16143 +/* 153 */ { 0, 2, "lvlequal", "xx" },
16144 +/* 154 */ { 0, 2, "lvlproc", "dx" },
16145 +/* 155 */ { 0, Ukn, "unimpl 155", "" },
16146 +/* 156 */ { 0, 4, "lvlipc", "dddx" },
16147 +/* 157 */ { 0, 4, "acl", "sddx" },
16148 +/* 158 */ { 0, Ukn, "auditevt", "" },
16149 +/* 159 */ { 0, Ukn, "auditctl", "" },
16150 +/* 160 */ { 0, Ukn, "auditdmp", "" },
16151 +/* 161 */ { 0, Ukn, "auditlog", "" },
16152 +/* 162 */ { 0, Ukn, "auditbuf", "" },
16153 +/* 163 */ { 0, 2, "lvldom", "xx" },
16154 +/* 164 */ { 0, Ukn, "lvlvfs", "" },
16155 +/* 165 */ { 0, 2, "mkmld", "so" },
16156 +/* 166 */ { uw7_mldmode, 1, "mldmode", "d" },
16157 +/* 167 */ { 0, 2, "secadvise", "xx" },
16158 +/* 168 */ { 0, Ukn, "online", "" },
16159 +/* 169 */ { sys_setitimer, 3, "setitimer", "dxx" },
16160 +/* 170 */ { sys_getitimer, 2, "getitimer", "dx" },
16161 +/* 171 */ { sys_gettimeofday, 2, "gettimeofday", "xx" },
16162 +/* 172 */ { sys_settimeofday, 2, "settimeofday", "xx" },
16163 +/* 173 */ { 0, Ukn, "lwpcreate", "" },
16164 +/* 174 */ { 0, Ukn, "lwpexit", "" },
16165 +/* 175 */ { 0, Ukn, "lwpwait", "" },
16166 +/* 176 */ { 0, Ukn, "lwpself", "" },
16167 +/* 177 */ { 0, Ukn, "lwpinfo", "" },
16168 +/* 178 */ { 0, Ukn, "lwpprivate", "" },
16169 +/* 179 */ { 0, Ukn, "processorbind","" },
16170 +/* 180 */ { 0, Ukn, "processorexbind","" },
16171 +/* 181 */ { 0, Ukn, "unimpl 181", "" },
16172 +/* 182 */ { 0, Ukn, "sendv64", "" },
16173 +/* 183 */ { 0, Ukn, "prepblock", "" },
16174 +/* 184 */ { 0, Ukn, "block", "" },
16175 +/* 185 */ { 0, Ukn, "rdblock", "" },
16176 +/* 186 */ { 0, Ukn, "unblock", "" },
16177 +/* 187 */ { 0, Ukn, "cancelblock", "" },
16178 +/* 188 */ { 0, Ukn, "unimpl 188", "" },
16179 +/* 189 */ { uw7_pread, 4, "pread", "dsdd" },
16180 +/* 190 */ { uw7_pwrite, 4, "pwrite", "dsdd" },
16181 +/* 191 */ { sys_truncate, 2, "truncate", "sd" },
16182 +/* 192 */ { sys_ftruncate, 2, "ftruncate", "dd" },
16183 +/* 193 */ { 0, Ukn, "lwpkill", "" },
16184 +/* 194 */ { 0, Ukn, "sigwait", "" },
16185 +/* 195 */ { abi_fork, Spl, "fork1", "" },
16186 +/* 196 */ { abi_fork, Spl, "forkall", "" },
16189 + * 197-202 are for loadable kernel module support.
16191 +/* 197 */ { 0, Ukn, "modload", "" },
16192 +/* 198 */ { 0, Ukn, "moduload", "" },
16193 +/* 199 */ { 0, Ukn, "modpath", "" },
16194 +/* 200 */ { 0, Ukn, "modstat", "" },
16195 +/* 201 */ { 0, Ukn, "modadm", "" },
16196 +/* 202 */ { 0, Ukn, "getksym", "" },
16198 +/* 203 */ { 0, Ukn, "lwpsuspend", "" },
16199 +/* 204 */ { 0, Ukn, "lwpcontinue", "" },
16200 +/* 205 */ { 0, Ukn, "priocntllst", "" },
16201 +/* 206 */ { uw7_sleep, 1, "sleep", "d" },
16204 + * 207-209 are for post/wait synchronisation.
16206 +/* 207 */ { 0, Ukn, "lwp_sema_wait","" },
16207 +/* 208 */ { 0, Ukn, "lwp_sema_post","" },
16208 +/* 209 */ { 0, Ukn, "lwp_sema_trywait","" },
16210 +/* 210 */ { 0, Ukn, "reserved 210", "" },
16211 +/* 211 */ { 0, Ukn, "unused 211", "" },
16212 +/* 212 */ { 0, Ukn, "unused 212", "" },
16213 +/* 213 */ { 0, Ukn, "unused 213", "" },
16214 +/* 214 */ { 0, Ukn, "unused 214", "" },
16215 +/* 215 */ { 0, Ukn, "unused 215", "" },
16218 + * 216-226 are for LFS (Large File Summit) support
16220 +/* 216 */ { uw7_fstatvfs64, 2, "fstatvfs64", "dp" },
16221 +/* 217 */ { uw7_statvfs64, 2, "statvfs64", "sp" },
16222 +/* 218 */ { uw7_ftruncate64, 3, "ftruncate64", "sdd" },
16223 +/* 219 */ { uw7_truncate64, 3, "truncate64", "ddd" },
16224 +/* 220 */ { uw7_getrlimit64, 2, "getrlimit64", "dp" },
16225 +/* 221 */ { uw7_setrlimit64, 2, "setrlimit64", "dp" },
16226 +/* 222 */ { uw7_lseek64, 4, "lseek64", "dddd" },
16227 +/* 223 */ { uw7_mmap64, 7, "mmap64", "xxxxdxx"},
16228 +/* 224 */ { uw7_pread64, 5, "pread64", "dsddd" },
16229 +/* 225 */ { uw7_pwrite64, 5, "pwrite64", "dsddd" },
16230 +/* 226 */ { uw7_creat64, 2, "creat64", "so" },
16232 +/* 227 */ { 0, Ukn, "dshmsys", "" },
16233 +/* 228 */ { 0, Ukn, "invlpg", "" },
16236 + * 229-234 are used for SSI clustering (Nonstop cluster)
16238 +/* 229 */ { 0, Ukn, "rfork1", "" },
16239 +/* 230 */ { 0, Ukn, "rforkall", "" },
16240 +/* 231 */ { 0, Ukn, "rexecve", "" },
16241 +/* 232 */ { 0, Ukn, "migrate", "" },
16242 +/* 233 */ { 0, Ukn, "kill3", "" },
16243 +/* 234 */ { 0, Ukn, "ssisys", "" },
16246 + * 235-248 are for kernel-based sockets (Yeah, SVR5 finally got sockets)
16248 +/* 235 */ { 0, Ukn, "xaccept", "" },
16249 +/* 236 */ { 0, Ukn, "xbind", "" },
16250 +/* 237 */ { 0, Ukn, "xbindresvport","" },
16251 +/* 238 */ { 0, Ukn, "xconnect", "" },
16252 +/* 239 */ { 0, Ukn, "xgetsockaddr", "" },
16253 +/* 240 */ { 0, Ukn, "xgetsockopt", "" },
16254 +/* 241 */ { 0, Ukn, "xlisten", "" },
16255 +/* 242 */ { 0, Ukn, "xrecvmsg", "" },
16256 +/* 243 */ { 0, Ukn, "xsendmsg", "" },
16257 +/* 244 */ { 0, Ukn, "xsetsockaddr", "" },
16258 +/* 245 */ { 0, Ukn, "xsetsockopt", "" },
16259 +/* 246 */ { 0, Ukn, "xshutdown", "" },
16260 +/* 247 */ { 0, Ukn, "xsocket", "" },
16261 +/* 248 */ { 0, Ukn, "xsocketpair", "" },
16263 +/* 249 */ { 0, Ukn, "unused 249", "" },
16264 +/* 250 */ { 0, Ukn, "unused 250", "" },
16269 +uw7_lcall7(int segment, struct pt_regs *regs)
16271 + int sysno = regs->eax & 0xff;
16273 + if (sysno >= ARRAY_SIZE(uw7_syscall_table))
16274 + set_error(regs, iABI_errors(-EINVAL));
16276 + lcall7_dispatch(regs, &uw7_syscall_table[sysno], 1);
16279 +static struct exec_domain uw7_exec_domain = {
16280 + name: "UnixWare 7",
16281 + handler: uw7_lcall7,
16282 + pers_low: 14 /* PER_UW7 */,
16283 + pers_high: 14 /* PER_UW7 */,
16284 + signal_map: uw7_to_linux_signals,
16285 + signal_invmap: linux_to_uw7_signals,
16286 + err_map: uw7_err_map,
16287 + socktype_map: uw7_socktype_map,
16288 + sockopt_map: uw7_sockopt_map,
16289 + af_map: uw7_af_map,
16290 + module: THIS_MODULE
16296 + return register_exec_domain(&uw7_exec_domain);
16299 +static void __exit
16302 + unregister_exec_domain(&uw7_exec_domain);
16305 +module_init(init_uw7);
16306 +module_exit(cleanup_uw7);
16307 diff -Nur kernel-source-2.6.16.orig/abi/wyse/Makefile kernel-source-2.6.16/abi/wyse/Makefile
16308 --- kernel-source-2.6.16.orig/abi/wyse/Makefile 1970-01-01 10:00:00.000000000 +1000
16309 +++ kernel-source-2.6.16/abi/wyse/Makefile 2006-04-27 18:50:24.000000000 +1000
16312 +abi-wyse-objs := sysent.o ptrace.o socket.o
16314 +obj-$(CONFIG_ABI_WYSE) += abi-wyse.o
16316 +abi-wyse.o: $(abi-wyse-objs)
16317 + $(LD) -r -o $@ $(abi-wyse-objs)
16318 diff -Nur kernel-source-2.6.16.orig/abi/wyse/ptrace.c kernel-source-2.6.16/abi/wyse/ptrace.c
16319 --- kernel-source-2.6.16.orig/abi/wyse/ptrace.c 1970-01-01 10:00:00.000000000 +1000
16320 +++ kernel-source-2.6.16/abi/wyse/ptrace.c 2006-04-27 18:50:24.000000000 +1000
16323 + * ptrace.c - Wyse V/386 ptrace(2) support.
16325 + * Copyright (c) 1995 Mike Jagdis (jaggy@purplet.demon.co.uk)
16331 + * This file is nearly identical to abi/sco/ptrace.c, please keep it in sync.
16333 +#include <linux/module.h>
16334 +#include <linux/errno.h>
16335 +#include <linux/sched.h>
16336 +#include <linux/ptrace.h>
16337 +#include <linux/kernel.h>
16338 +#include <linux/mm.h>
16339 +#include <linux/personality.h>
16340 +#include <linux/user.h>
16341 +#define __KERNEL_SYSCALLS__
16342 +#include <linux/unistd.h>
16344 +#include <asm/uaccess.h>
16346 +#include <abi/signal.h>
16347 +#include <abi/util/trace.h>
16351 +#define U(X) ((unsigned long)&((struct user *)0)->X)
16354 +static unsigned long wysev386_to_linux_reg[NREGS] = {
16355 + U(regs.es), U(regs.ds), U(regs.edi), U(regs.esi),
16356 + U(regs.ebp), U(regs.esp),
16357 + U(regs.ebx), U(regs.edx), U(regs.ecx), U(regs.eax),
16358 + U(signal /* Trap */),
16359 + U(reserved /* ERR */),
16360 + U(regs.eip), U(regs.cs),
16362 + U(regs.esp /* UESP */),
16364 + U(regs.fs), U(regs.gs)
16367 +static const char *regnam[] = {
16368 + "EBX", "ECX", "EDX", "ESI", "EDI", "EBP", "EAX",
16369 + "DS", "ES", "FS", "GS", "ORIG_EAX", "EIP", "CS",
16370 + "EFL", "UESP", "SS"
16375 +wyse_ptrace(int req, int pid, u_long addr, u_long data)
16380 + * Slight variations between iBCS and Linux codes.
16382 + if (req == PTRACE_ATTACH)
16384 + else if (req == PTRACE_DETACH)
16387 + if (req == 3 || req == 6) {
16388 + /* get offset of u_ar0 */
16389 + if (addr == 0x1292)
16392 + /* remap access to the registers. */
16393 + if ((addr & 0xff00) == 0x4000) { /* Registers */
16394 + addr = (addr & 0xff) >> 2;
16395 + if (addr > NREGS)
16397 + addr = wysev386_to_linux_reg[addr];
16403 + if (req == 7 && data > 0) {
16404 + if (data > NSIGNALS)
16406 + data = current_thread_info()->exec_domain->signal_map[data];
16409 + if (req == 1 || req == 2 || req == 3) {
16410 + mm_segment_t old_fs = get_fs();
16413 + set_fs(get_ds());
16414 + error = sys_ptrace(req, pid, addr, (long)&res);
16421 +#if defined(CONFIG_ABI_TRACE)
16422 + if (req == 3 || req == 6) {
16423 + abi_trace(ABI_TRACE_API, "%ld [%s] = 0x%08lx\n",
16424 + addr >> 2, (addr >> 2) < ARRAY_SIZE(regnam) ?
16425 + regnam[addr >> 2] : "???",
16426 + req == 3 ? res : data);
16430 + if (req == 1 || req == 2 || req == 3)
16433 + return sys_ptrace(req, pid, addr, data);
16435 diff -Nur kernel-source-2.6.16.orig/abi/wyse/socket.c kernel-source-2.6.16/abi/wyse/socket.c
16436 --- kernel-source-2.6.16.orig/abi/wyse/socket.c 1970-01-01 10:00:00.000000000 +1000
16437 +++ kernel-source-2.6.16/abi/wyse/socket.c 2006-04-27 18:50:24.000000000 +1000
16440 + * Copyright (c) 1994,1996 Mike Jagdis.
16441 + * Copyright (c) 2001 Christoph Hellwig.
16442 + * All rights reserved.
16444 + * This program is free software; you can redistribute it and/or modify
16445 + * it under the terms of the GNU General Public License as published by
16446 + * the Free Software Foundation; either version 2 of the License, or
16447 + * (at your option) any later version.
16449 + * This program is distributed in the hope that it will be useful,
16450 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16451 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16452 + * GNU General Public License for more details.
16454 + * You should have received a copy of the GNU General Public License
16455 + * along with this program; if not, write to the Free Software
16456 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16463 + * BSD-style socket support for Wyse/V386.
16465 +#include <linux/net.h>
16466 +#include <linux/personality.h>
16467 +#include <linux/syscalls.h>
16468 +#include <linux/utsname.h>
16469 +#include <linux/signal.h>
16470 +#include <linux/wait.h>
16471 +#include <linux/socket.h>
16472 +#include <linux/net.h>
16473 +#include <asm/uaccess.h>
16475 +#include <abi/util/map.h>
16476 +#include <abi/util/socket.h>
16477 +#include <abi/wyse/sysent.h>
16480 +int wyse_gethostname(char *name, int len)
16485 + down_read(&uts_sem);
16486 + if (!access_ok(VERIFY_WRITE, name, len)) {
16489 + for (p = system_utsname.nodename; *p && len; p++,len--) {
16490 + __put_user(*p, name);
16493 + __put_user('\0', name);
16495 + up_read(&uts_sem);
16499 +int wyse_getdomainname(char *name, int len)
16504 + down_read(&uts_sem);
16505 + if (!access_ok(VERIFY_WRITE, name, len)) {
16508 + for (p = system_utsname.domainname; *p && len; p++,len--) {
16509 + __put_user(*p, name);
16512 + __put_user('\0', name);
16514 + up_read(&uts_sem);
16518 +int wyse_wait3(int *loc)
16523 + pid = sys_wait4(-1, loc, WNOHANG, 0);
16527 + get_user(res, (unsigned long *)loc);
16529 + if ((res & 0xff) == 0x7f) {
16530 + int sig = (res >> 8) & 0xff;
16532 + sig = current_thread_info()->exec_domain->signal_map[sig];
16533 + res = (res & (~0xff00)) | (sig << 8);
16534 + put_user(res, (unsigned long *)loc);
16535 + } else if (res && res == (res & 0xff)) {
16536 + res = current_thread_info()->exec_domain->signal_map[res & 0x7f];
16537 + put_user(res, (unsigned long *)loc);
16543 +int wyse_socket(int family, int type, int protocol)
16545 + family = map_value(current_thread_info()->exec_domain->af_map, family, 0);
16546 + type = map_value(current_thread_info()->exec_domain->socktype_map, family, 0);
16548 + return sys_socket(family, type, protocol);
16551 +int wyse_setsockopt(int fd, int level, int optname, char *optval, int optlen)
16554 + case 0: /* IPPROTO_IP aka SOL_IP */
16555 + if (--optname == 0)
16557 + if (optname > 4) {
16559 + if (optname <= 33)
16561 + if (optname < 32 || optname > 36)
16566 + level = SOL_SOCKET;
16567 + optname = map_value(current_thread_info()->exec_domain->sockopt_map, optname, 0);
16568 + switch (optname) {
16571 + * SO_LINGER takes a struct linger as the argument
16572 + * but some code uses an int and expects to get
16573 + * away without an error. Sigh...
16575 + if (optlen == sizeof(int))
16579 + * The following are not currently implemented under Linux
16580 + * so we must fake them in reasonable ways.
16581 + * (Only SO_PROTOTYPE is documented in SCO's man page).
16583 + case SO_PROTOTYPE:
16585 + case SO_SNDTIMEO:
16586 + case SO_RCVTIMEO:
16587 + return -ENOPROTOOPT;
16589 + case SO_USELOOPBACK:
16590 + case SO_SNDLOWAT:
16591 + case SO_RCVLOWAT:
16595 + * The following are not currenty implemented under Linux
16596 + * and probably aren't settable anyway.
16598 + case SO_IMASOCKET:
16599 + return -ENOPROTOOPT;
16605 + * XXX We assume everything else uses the same level and
16606 + * XXX option numbers. This is true for IPPROTO_TCP(/SOL_TCP)
16607 + * XXX and TCP_NDELAY but is known to be incorrect for other
16608 + * XXX potential options :-(.
16613 + return sys_setsockopt(fd, level, optname, optval, optlen);
16616 +int wyse_getsockopt(int fd, int level, int optname, char *optval, int *optlen)
16618 + unsigned int len;
16621 + if (get_user(len,optlen))
16627 + case 0: /* IPPROTO_IP aka SOL_IP */
16628 + if (--optname == 0)
16630 + if (optname > 4) {
16632 + if (optname <= 33)
16634 + if (optname < 32 || optname > 36)
16639 + level = SOL_SOCKET;
16640 + optname = map_value(current_thread_info()->exec_domain->sockopt_map, optname, 0);
16641 + switch (optname) {
16644 + * SO_LINGER takes a struct linger as the argument
16645 + * but some code uses an int and expects to get
16646 + * away without an error. Sigh...
16648 + if (len != sizeof(int))
16654 + * The following are not currently implemented under Linux
16655 + * so we must fake them in reasonable ways.
16656 + * (Only SO_PROTOTYPE is documented in SCO's man page).
16658 + case SO_PROTOTYPE:
16663 + case SO_SNDTIMEO:
16664 + case SO_RCVTIMEO:
16665 + return -ENOPROTOOPT;
16667 + case SO_USELOOPBACK:
16668 + case SO_SNDLOWAT:
16669 + case SO_RCVLOWAT:
16673 + * The following are not currenty implemented under Linux
16674 + * and probably aren't settable anyway.
16676 + case SO_IMASOCKET:
16683 + if (len > sizeof(int))
16684 + len = sizeof(int);
16685 + if (copy_to_user(optval, &val, len))
16687 + if (put_user(len, optlen))
16693 + * XXX We assume everything else uses the same level and
16694 + * XXX option numbers. This is true for IPPROTO_TCP(/SOL_TCP)
16695 + * XXX and TCP_NDELAY but is known to be incorrect for other
16696 + * XXX potential options :-(.
16702 + return sys_getsockopt(fd, level, optname, optval, optlen);
16705 +int wyse_recvfrom(int fd, void *buff, size_t size, unsigned flags,
16706 + struct sockaddr *addr, int *addr_len)
16710 + error = sys_recvfrom(fd, buff, size, flags, addr, addr_len);
16711 + if (error == -EAGAIN)
16712 + error = -EWOULDBLOCK;
16716 +int wyse_recv(int fd, void *buff, size_t size, unsigned flags)
16720 + error = sys_recvfrom(fd, buff, size, flags, NULL, NULL);
16721 + if (error == -EAGAIN)
16722 + error = -EWOULDBLOCK;
16726 +int wyse_sendto(int fd, void *buff, size_t len, unsigned flags,
16727 + struct sockaddr *addr, int addr_len)
16731 + error = sys_sendto(fd, buff, len, flags, addr, addr_len);
16732 + if (error == -EAGAIN)
16733 + error = -EWOULDBLOCK;
16737 +int wyse_send(int fd, void *buff, size_t len, unsigned flags)
16741 + error = sys_sendto(fd, buff, len, flags, NULL, 0);
16742 + if (error == -EAGAIN)
16743 + error = -EWOULDBLOCK;
16746 diff -Nur kernel-source-2.6.16.orig/abi/wyse/sysent.c kernel-source-2.6.16/abi/wyse/sysent.c
16747 --- kernel-source-2.6.16.orig/abi/wyse/sysent.c 1970-01-01 10:00:00.000000000 +1000
16748 +++ kernel-source-2.6.16/abi/wyse/sysent.c 2006-04-27 18:50:24.000000000 +1000
16751 + * Copyright (c) 2001 Christoph Hellwig.
16752 + * All rights reserved.
16754 + * This program is free software; you can redistribute it and/or modify
16755 + * it under the terms of the GNU General Public License as published by
16756 + * the Free Software Foundation; either version 2 of the License, or
16757 + * (at your option) any later version.
16759 + * This program is distributed in the hope that it will be useful,
16760 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16761 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16762 + * GNU General Public License for more details.
16764 + * You should have received a copy of the GNU General Public License
16765 + * along with this program; if not, write to the Free Software
16766 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16773 + * Wyse/V386 personality switch.
16775 +#include <linux/module.h>
16776 +#include <linux/init.h>
16777 +#include <linux/kernel.h>
16778 +#include <linux/personality.h>
16779 +#include <linux/sched.h>
16780 +#include <linux/syscalls.h>
16781 +#include <linux/socket.h>
16782 +#include <linux/net.h>
16783 +#include <asm/uaccess.h>
16785 +#include <abi/svr4/sysent.h>
16786 +#include <abi/wyse/sysent.h>
16788 +#include <abi/signal.h>
16790 +#include <abi/util/errno.h>
16791 +#include <abi/util/sysent.h>
16792 +#include <abi/util/socket.h>
16795 +MODULE_DESCRIPTION("Wyse/V386 personality");
16796 +MODULE_AUTHOR("Christoph Hellwig, partially taken from iBCS");
16797 +MODULE_LICENSE("GPL");
16801 + * local functions
16803 +static void wyse_class_nfs(struct pt_regs *);
16804 +static void wyse_class_tcp(struct pt_regs *);
16808 + * local variables
16810 +static u_char wyse_err_table[] = {
16811 + /* 0 - 9 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
16812 + /* 10 - 19 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
16813 + /* 20 - 29 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
16814 + /* 30 - 39 */ 30, 31, 32, 33, 34, 45, 78, 46, 228, 46,
16815 + /* 40 - 49 */ 22, 231, 227, 200, 37, 38, 39, 40, 41, 42,
16816 + /* 50 - 59 */ 43, 44, 50, 51, 52, 53, 54, 55, 56, 57,
16817 + /* 60 - 69 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
16818 + /* 70 - 79 */ 70, 71, 74, 76, 77, 22, 80, 81, 82, 83,
16819 + /* 80 - 89 */ 84, 85, 86, 87, 22, 4, 22, 233, 203, 204,
16820 + /* 90 - 99 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
16821 + /* 100 - 109 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
16822 + /* 110 - 119 */ 225, 226, 229, 230, 202, 201, 237, 135, 137, 138,
16823 + /* 120 - 122 */ 139, 140, 234
16827 + * Map Linux RESTART* values (512,513,514) to EINTR
16829 +static u_char lnx_err_table[] = {
16830 + /* 512 - 514 */ EINTR, EINTR, EINTR
16833 +static struct map_segment wyse_err_map[] = {
16834 + { 0, 0 + sizeof(wyse_err_table) - 1, wyse_err_table },
16835 + { 512, 512 + sizeof(lnx_err_table) - 1, lnx_err_table },
16839 +static long linux_to_wyse_signals[NSIGNALS+1] = {
16840 +/* 0 - 3 */ 0, IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT,
16841 +/* 4 - 7 */ IBCS_SIGILL, IBCS_SIGTRAP, IBCS_SIGABRT, -1,
16842 +/* 8 - 11 */ IBCS_SIGFPE, IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV,
16843 +/* 12 - 15 */ IBCS_SIGUSR2, IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM,
16844 +/* 16 - 19 */ IBCS_SIGSEGV, IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP,
16845 +/* 20 - 23 */ IBCS_SIGTSTP, IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGURG,
16846 +/* 24 - 27 */ IBCS_SIGGXCPU, IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF,
16847 +/* 28 - 31 */ IBCS_SIGWINCH, IBCS_SIGIO, IBCS_SIGPWR, -1,
16851 +static long wyse_to_linux_signals[NSIGNALS+1] = {
16852 +/* 0 - 3 */ 0, SIGHUP, SIGINT, SIGQUIT,
16853 +/* 4 - 7 */ SIGILL, SIGTRAP, SIGIOT, SIGUNUSED,
16854 +/* 8 - 11 */ SIGFPE, SIGKILL, SIGUNUSED, SIGSEGV,
16855 +/* 12 - 15 */ SIGUNUSED, SIGPIPE, SIGALRM, SIGTERM,
16856 +/* 16 - 19 */ SIGUSR1, SIGUSR2, SIGCHLD, SIGPWR,
16857 +/* 20 - 23 */ SIGWINCH, SIGURG, SIGPOLL, SIGSTOP,
16858 +/* 24 - 27 */ SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU,
16859 +/* 28 - 31 */ SIGVTALRM, SIGPROF, SIGXCPU, SIGXFSZ,
16863 +static char wyse_socktype[] = {
16872 +static struct map_segment wyse_socktype_map[] = {
16873 + { 1, 6, wyse_socktype },
16877 +static struct map_segment wyse_sockopt_map[] = {
16878 + { 0x0001, 0x0001, (char *)SO_DEBUG },
16879 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
16880 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
16881 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
16882 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
16883 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
16884 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
16885 + { 0x0080, 0x0080, (char *)SO_LINGER },
16886 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
16887 + { 0x0200, 0x0200, (char *)SO_ORDREL },
16888 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
16889 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
16890 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
16891 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
16892 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
16893 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
16894 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
16895 + { 0x1007, 0x1007, (char *)SO_ERROR },
16896 + { 0x1008, 0x1008, (char *)SO_TYPE },
16897 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
16901 +static struct map_segment wyse_af_map[] = {
16907 +static struct sysent wyse_nfscall_table[] = {
16908 +/* 0 */ { 0, Ukn, "nfs_svc", "" },
16909 +/* 1 */ { 0, Ukn, "async_daemon", "" },
16910 +/* 2 */ { 0, Ukn, "nfs_getfh", "" },
16911 +/* 3 */ { 0, Ukn, "nfsmount", "" },
16914 +static struct sysent wyse_tcpcall_table[] = {
16915 +/* 0 */ { sys_select, 5, "select", "dxxxx" },
16916 +/* 1 */ { wyse_socket, 3, "socket", "ddd" },
16917 +/* 2 */ { sys_connect, 3, "connect", "dxd" },
16918 +/* 3 */ { sys_accept, 3, "accept", "dxx" },
16919 +/* 4 */ { wyse_send, 4, "send", "dxdd" },
16920 +/* 5 */ { wyse_recv, 4, "recv", "dxdd" },
16921 +/* 6 */ { sys_bind, 3, "bind", "dxd" },
16922 +/* 7 */ { wyse_setsockopt, 5, "setsockopt", "dddxx" },
16923 +/* 8 */ { sys_listen, 2, "listen", "dd" },
16924 +/* 9 */ { 0, 3, "recvmsg", "dxd" },
16925 +/* 10 */ { 0, 3, "sendmsg", "dxd" },
16926 +/* 11 */ { wyse_getsockopt, 5, "getsockopt", "dddxx" },
16927 +/* 12 */ { wyse_recvfrom, 6, "recvfrom", "dxddxd"},
16928 +/* 13 */ { wyse_sendto, 6, "sendto", "dxddxd"},
16929 +/* 14 */ { sys_shutdown, 2, "shutdown", "dd" },
16930 +/* 15 */ { sys_socketpair, 4, "socketpair", "dddx" },
16931 +/* 16 */ { 0, Ukn, "trace", "" },
16932 +/* 17 */ { sys_getpeername, 3, "getpeername", "dxx" },
16933 +/* 18 */ { sys_getsockname, Spl, "getsockname", "dxx" },
16934 +/* 19 */ { wyse_wait3, 1, "wait3", "x" },
16938 +static struct sysent wyse_syscall_table[] = {
16939 +/* 0 */ { abi_syscall, Fast, "syscall", "" },
16940 +/* 1 */ { sys_exit, 1, "exit", "d" },
16941 +/* 2 */ { abi_fork, Spl, "fork", "" },
16942 +/* 3 */ { abi_read, 3, "read", "dpd" },
16943 +/* 4 */ { sys_write, 3, "write", "dpd" },
16944 +/* 5 */ { svr4_open, 3, "open", "soo" },
16945 +/* 6 */ { sys_close, 1, "close", "d" },
16946 +/* 7 */ { abi_wait, Spl, "wait", "xxx" },
16947 +/* 8 */ { sys_creat, 2, "creat", "so" },
16948 +/* 9 */ { sys_link, 2, "link", "ss" },
16949 +/* 10 */ { sys_unlink, 1, "unlink", "s" },
16950 +/* 11 */ { abi_exec, Spl, "exec", "sxx" },
16951 +/* 12 */ { sys_chdir, 1, "chdir", "s" },
16952 +/* 13 */ { abi_time, 0, "time", "" },
16953 +/* 14 */ { svr4_mknod, 3, "mknod", "soo" },
16954 +/* 15 */ { sys_chmod, 2, "chmod", "so" },
16955 +/* 16 */ { sys_chown, 3, "chown", "sdd" },
16956 +/* 17 */ { abi_brk, 1, "brk/break", "x" },
16957 +/* 18 */ { svr4_stat, 2, "stat", "sp" },
16958 +/* 19 */ { sys_lseek, 3, "seek/lseek", "ddd" },
16959 +/* 20 */ { abi_getpid, Spl, "getpid", "" },
16960 +/* 21 */ { 0, Ukn, "mount", "" },
16961 +/* 22 */ { sys_umount, 1, "umount", "s" },
16962 +/* 23 */ { sys_setuid, 1, "setuid", "d" },
16963 +/* 24 */ { abi_getuid, Spl, "getuid", "" },
16964 +/* 25 */ { sys_stime, 1, "stime", "d" },
16965 +/* 26 */ { wyse_ptrace, 4, "ptrace", "xdxx" },
16966 +/* 27 */ { sys_alarm, 1, "alarm", "d" },
16967 +/* 28 */ { svr4_fstat, 2, "fstat", "dp" },
16968 +/* 29 */ { sys_pause, 0, "pause", "" },
16969 +/* 30 */ { sys_utime, 2, "utime", "xx" },
16970 +/* 31 */ { 0, Ukn, "stty", "" }, /* 31 */
16971 +/* 32 */ { 0, Ukn, "gtty", "" },
16972 +/* 33 */ { sys_access, 2, "access", "so" },
16973 +/* 34 */ { sys_nice, 1, "nice", "d" },
16974 +/* 35 */ { svr4_statfs, 4, "statfs", "spdd" },
16975 +/* 36 */ { sys_sync, 0, "sync", "" },
16976 +/* 37 */ { abi_kill, 2, "kill", "dd" },
16977 +/* 38 */ { svr4_fstatfs, 4, "fstatfs", "dpdd" },
16978 +/* 39 */ { abi_procids, Spl, "procids", "d" },
16979 +/* 40 */ { 0, Ukn, "cxenix", "" },
16980 +/* 41 */ { sys_dup, 1, "dup", "d" },
16981 +/* 42 */ { abi_pipe, Spl, "pipe", "" },
16982 +/* 43 */ { sys_times, 1, "times", "p" },
16983 +/* 44 */ { 0, 4, "prof", "xxxx" },
16984 +/* 45 */ { 0, Ukn, "lock/plock", "" },
16985 +/* 46 */ { sys_setgid, 1, "setgid", "d" },
16986 +/* 47 */ { abi_getgid, Spl, "getgid", "" },
16987 +/* 48 */ { abi_sigfunc, Fast, "sigfunc", "xxx" },
16988 +/* 49 */ { svr4_msgsys, Spl, "msgsys", "dxddd" },
16989 +/* 50 */ { svr4_sysi86, 3, "sysi86/sys3b", "d" },
16990 +/* 51 */ { sys_acct, 1, "acct/sysacct", "x" },
16991 +/* 52 */ { svr4_shmsys, Fast, "shmsys", "ddxo" },
16992 +/* 53 */ { svr4_semsys, Spl, "semsys", "dddx" },
16993 +/* 54 */ { svr4_ioctl, Spl, "ioctl", "dxx" },
16994 +/* 55 */ { 0, 3, "uadmin", "xxx" },
16995 +/* 56 */ { 0, Ukn, "?", "" },
16996 +/* 57 */ { v7_utsname, 1, "utsys", "x" },
16997 +/* 58 */ { sys_fsync, 1, "fsync", "d" },
16998 +/* 59 */ { abi_exec, Spl, "execv", "spp" },
16999 +/* 60 */ { sys_umask, 1, "umask", "o" },
17000 +/* 61 */ { sys_chroot, 1, "chroot", "s" },
17001 +/* 62 */ { svr4_fcntl, 3, "fcntl", "dxx" },
17002 +/* 63 */ { svr4_ulimit, 2, "ulimit", "xx" },
17003 +/* 64 */ { 0, Ukn, "?", "" },
17004 +/* 65 */ { 0, Ukn, "?", "" },
17005 +/* 66 */ { 0, Ukn, "?", "" },
17006 +/* 67 */ { 0, Ukn, "?", "" },
17007 +/* 68 */ { 0, Ukn, "?", "" },
17008 +/* 69 */ { 0, Ukn, "?", "" },
17009 +/* 70 */ { 0, Ukn, "advfs", "" },
17010 +/* 71 */ { 0, Ukn, "unadvfs", "" },
17011 +/* 72 */ { 0, Ukn, "rmount", "" },
17012 +/* 73 */ { 0, Ukn, "rumount", "" },
17013 +/* 74 */ { 0, Ukn, "rfstart", "" },
17014 +/* 75 */ { 0, Ukn, "?", "" },
17015 +/* 76 */ { 0, Ukn, "rdebug", "" },
17016 +/* 77 */ { 0, Ukn, "rfstop", "" },
17017 +/* 78 */ { 0, Ukn, "rfsys", "" },
17018 +/* 79 */ { sys_rmdir, 1, "rmdir", "s" },
17019 +/* 80 */ { abi_mkdir, 2, "mkdir", "so" },
17020 +/* 81 */ { svr4_getdents, 3, "getdents", "dxd" },
17021 +/* 82 */ { 0, Ukn, "libattach", "" },
17022 +/* 83 */ { 0, Ukn, "libdetach", "" },
17023 +/* 84 */ { svr4_sysfs, 3, "sysfs", "dxx" },
17024 +/* 85 */ { svr4_getmsg, Spl, "getmsg", "dxxx" },
17025 +/* 86 */ { svr4_putmsg, Spl, "putmsg", "dxxd" },
17026 +/* 87 */ { sys_poll, 3, "poll", "xdd" },
17027 +/* 88 */ { 0, Ukn, "nosys88", "" },
17028 +/* 89 */ { 0, Ukn, "nosys89", "" },
17029 +/* 90 */ { 0, Ukn, "nosys90", "" },
17030 +/* 91 */ { 0, Ukn, "nosys91", "" },
17031 +/* 92 */ { 0, Ukn, "nosys92", "" },
17032 +/* 93 */ { 0, Ukn, "nosys93", "" },
17033 +/* 94 */ { 0, Ukn, "nosys94", "" },
17034 +/* 95 */ { 0, Ukn, "nosys95", "" },
17035 +/* 96 */ { 0, Ukn, "nosys96", "" },
17036 +/* 97 */ { 0, Ukn, "nosys97", "" },
17037 +/* 98 */ { 0, Ukn, "nosys98", "" },
17038 +/* 99 */ { 0, Ukn, "nosys99", "" },
17039 +/* 100 */ { 0, Ukn, "nosys100", "" },
17040 +/* 101 */ { 0, Ukn, "nosys101", "" },
17041 +/* 102 */ { 0, Ukn, "nosys102", "" },
17042 +/* 103 */ { 0, Ukn, "nosys103", "" },
17043 +/* 104 */ { 0, Ukn, "nosys104", "" },
17044 +/* 105 */ { 0, Ukn, "nosys105", "" },
17045 +/* 106 */ { 0, Ukn, "nosys106", "" },
17046 +/* 107 */ { 0, Ukn, "nosys107", "" },
17047 +/* 108 */ { 0, Ukn, "nosys108", "" },
17048 +/* 109 */ { 0, Ukn, "nosys109", "" },
17049 +/* 110 */ { 0, Ukn, "nosys110", "" },
17050 +/* 111 */ { 0, Ukn, "nosys111", "" },
17051 +/* 112 */ { 0, Ukn, "nosys112", "" },
17052 +/* 113 */ { 0, Ukn, "nosys113", "" },
17053 +/* 114 */ { 0, Ukn, "nosys114", "" },
17054 +/* 115 */ { 0, Ukn, "nosys115", "" },
17055 +/* 116 */ { 0, Ukn, "nosys116", "" },
17056 +/* 117 */ { 0, Ukn, "nosys117", "" },
17057 +/* 118 */ { 0, Ukn, "nosys118", "" },
17058 +/* 119 */ { 0, Ukn, "nosys119", "" },
17059 +/* 120 */ { 0, Ukn, "nosys120", "" },
17060 +/* 121 */ { 0, Ukn, "nosys121", "" },
17061 +/* 122 */ { 0, Ukn, "nosys122", "" },
17062 +/* 123 */ { 0, Ukn, "nosys123", "" },
17063 +/* 124 */ { 0, Ukn, "nosys124", "" },
17064 +/* 125 */ { 0, Ukn, "nosys125", "" },
17065 +/* 126 */ { 0, Ukn, "nosys126", "" },
17066 +/* 127 */ { 0, Ukn, "nosys127", "" },
17067 +/* 128 */ { svr4_lstat, 2, "lstat", "sp" },
17068 +/* 129 */ { sys_readlink, 3, "readlink", "spd" },
17069 +/* 130 */ { sys_symlink, 2, "symlink", "ss" },
17070 +/* 131 */ { wyse_class_tcp, Fast, "", "" },
17071 +/* 132 */ { wyse_class_nfs, Fast, "", "" },
17072 +/* 133 */ { wyse_gethostname, 2, "gethostname", "xd" },
17073 +/* 134 */ { sys_sethostname, 2, "sethostname", "sd" },
17074 +/* 135 */ { wyse_getdomainname, 2, "getdomainname","xd" },
17075 +/* 136 */ { sys_setdomainname, 2, "setdomainname","sd" },
17076 +/* 137 */ { 0, Ukn, "?", "" },
17077 +/* 138 */ { sys_setreuid, 2, "setreuid", "dd" },
17078 +/* 139 */ { sys_setregid, 2, "setregid", "dd" },
17082 +wyse_class_nfs(struct pt_regs *regs)
17085 + int sysno = regs->eax >> 8;
17087 + if (sysno >= ARRAY_SIZE(wyse_nfscall_table))
17088 + set_error(regs, iABI_errors(-EINVAL));
17090 + lcall7_dispatch(regs, &wyse_nfscall_table[sysno], 1);
17094 +wyse_class_tcp(struct pt_regs *regs)
17096 + int sysno = regs->eax >> 8;
17098 + if (sysno >= ARRAY_SIZE(wyse_tcpcall_table))
17099 + set_error(regs, iABI_errors(-EINVAL));
17101 + lcall7_dispatch(regs, &wyse_tcpcall_table[sysno], 1);
17105 +wyse_lcall7(int segment, struct pt_regs *regs)
17107 + int sysno = regs->eax & 0xff;
17109 + if (sysno >= ARRAY_SIZE(wyse_syscall_table))
17110 + set_error(regs, iABI_errors(-EINVAL));
17112 + lcall7_dispatch(regs, &wyse_syscall_table[sysno], 1);
17115 +static struct exec_domain wyse_exec_domain = {
17116 + name: "Wyse/386",
17117 + handler: wyse_lcall7,
17118 + pers_low: 4 /* PER_WYSEV386 */,
17119 + pers_high: 4 /* PER_WYSEV386 */,
17120 + signal_map: wyse_to_linux_signals,
17121 + signal_invmap: linux_to_wyse_signals,
17122 + err_map: wyse_err_map,
17123 + socktype_map: wyse_socktype_map,
17124 + sockopt_map: wyse_sockopt_map,
17125 + af_map: wyse_af_map,
17126 + module: THIS_MODULE
17131 +wyse_module_init(void)
17133 + return register_exec_domain(&wyse_exec_domain);
17136 +static void __exit
17137 +wyse_module_exit(void)
17139 + unregister_exec_domain(&wyse_exec_domain);
17142 +module_init(wyse_module_init);
17143 +module_exit(wyse_module_exit);
17144 diff -Nur kernel-source-2.6.16.orig/abi/wyse/syslocal.c kernel-source-2.6.16/abi/wyse/syslocal.c
17145 --- kernel-source-2.6.16.orig/abi/wyse/syslocal.c 1970-01-01 10:00:00.000000000 +1000
17146 +++ kernel-source-2.6.16/abi/wyse/syslocal.c 2006-04-27 18:50:24.000000000 +1000
17149 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
17154 +#include <linux/module.h>
17155 +#include <linux/errno.h>
17156 +#include <asm/uaccess.h>
17158 +#include <abi/util/trace.h>
17162 + * The syslocal() call is used for machine specific functions. For
17163 + * instance on a Wyse 9000 it give information and control of the
17164 + * available processors.
17166 +#define SL_ONLINE 0 /* Turn processor online */
17167 +#define SL_OFFLINE 1 /* Turn processor offline */
17168 +#define SL_QUERY 2 /* Query processor status */
17169 +#define SL_NENG 3 /* Return No. of processors configured */
17170 +#define SL_AFFINITY 4 /* processor binding */
17171 +#define SL_CMC_STAT 7 /* gather CMC performance counters info */
17172 +#define SL_KACC 8 /* make kernel data readable by user */
17173 +#define SL_MACHTYPE 9 /* return machine type (MP/AT) */
17174 +#define SL_BOOTNAME 10 /* return name of booted kernel */
17175 +#define SL_BOOTDEV 11 /* return type of booted device */
17176 +#define SL_UQUERY 12 /* query user status */
17178 +#define SL_MACH_MP 0
17179 +#define SL_MACH_AT 1
17180 +#define SL_MACH_EISA 2
17181 +#define SL_MACH_EMP 3
17185 +wyse_syslocal(struct pt_regs *regp)
17187 + int cmd = get_syscall_parameter(regp, 0);
17194 + case SL_MACHTYPE:
17195 + return (EISA_bus ? SL_MACH_EISA : SL_MACH_AT);
17198 +#if defined(CONFIG_ABI_TRACE)
17199 + abi_trace(ABI_TRACE_UNIMPL, "unsupported syslocal call %d\n", cmd);
17203 diff -Nur kernel-source-2.6.16.orig/arch/i386/kernel/entry.S kernel-source-2.6.16/arch/i386/kernel/entry.S
17204 --- kernel-source-2.6.16.orig/arch/i386/kernel/entry.S 2006-03-20 15:53:29.000000000 +1000
17205 +++ kernel-source-2.6.16/arch/i386/kernel/entry.S 2006-04-27 18:50:24.000000000 +1000
17206 @@ -123,6 +123,39 @@
17211 + pushfl # We get a different stack layout with call
17212 + # gates, which has to be cleaned up later..
17219 + movl EIP(%ebp), %eax # due to call gates, this is eflags, not eip..
17220 + movl CS(%ebp), %edx # this is eip..
17221 + movl EFLAGS(%ebp), %ecx # and this is cs..
17222 + movl %eax,EFLAGS(%ebp) #
17223 + movl %edx,EIP(%ebp) # Now we move them to their "normal" places
17224 + movl %ecx,CS(%ebp) #
17225 + GET_THREAD_INFO_WITH_ESP(%ebp) # GET_THREAD_INFO
17226 + movl TI_exec_domain(%ebp), %edx # Get the execution domain
17227 + call *EXEC_DOMAIN_handler(%edx) # Call the handler for the domain
17230 + jmp resume_userspace
17233 + pushfl # We get a different stack layout with call
17234 + # gates, which has to be cleaned up later..
17243 ENTRY(ret_from_fork)
17246 diff -Nur kernel-source-2.6.16.orig/arch/i386/kernel/i386_ksyms.c kernel-source-2.6.16/arch/i386/kernel/i386_ksyms.c
17247 --- kernel-source-2.6.16.orig/arch/i386/kernel/i386_ksyms.c 2006-04-27 18:29:59.000000000 +1000
17248 +++ kernel-source-2.6.16/arch/i386/kernel/i386_ksyms.c 2006-04-27 18:50:24.000000000 +1000
17250 +#define __KERNEL_SYSCALLS__
17251 +#include <linux/unistd.h>
17252 +#include <linux/syscalls.h>
17253 +#include <asm/signal.h>
17255 #include <linux/config.h>
17256 #include <linux/module.h>
17257 #include <linux/nmi.h>
17259 EXPORT_SYMBOL(strpbrk);
17260 EXPORT_SYMBOL(strstr);
17262 +EXPORT_SYMBOL(sys_modify_ldt);
17263 +EXPORT_SYMBOL(sys_ptrace);
17264 +EXPORT_SYMBOL(sys_ipc);
17265 +EXPORT_SYMBOL(sys_pause);
17266 +EXPORT_SYMBOL(signal_suspend);
17269 extern void FASTCALL( __write_lock_failed(rwlock_t *rw));
17270 extern void FASTCALL( __read_lock_failed(rwlock_t *rw));
17271 diff -Nur kernel-source-2.6.16.orig/arch/i386/kernel/lcall7.c kernel-source-2.6.16/arch/i386/kernel/lcall7.c
17272 --- kernel-source-2.6.16.orig/arch/i386/kernel/lcall7.c 1970-01-01 10:00:00.000000000 +1000
17273 +++ kernel-source-2.6.16/arch/i386/kernel/lcall7.c 2006-04-27 18:50:24.000000000 +1000
17276 + * Copyright (c) 2000,2001 Christoph Hellwig.
17277 + * Copyright (c) 2001 Caldera Deutschland GmbH.
17278 + * All rights resered.
17280 + * This program is free software; you can redistribute it and/or modify
17281 + * it under the terms of the GNU General Public License as published by
17282 + * the Free Software Foundation; either version 2 of the License, or
17283 + * (at your option) any later version.
17285 + * This program is distributed in the hope that it will be useful,
17286 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17287 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17288 + * GNU General Public License for more details.
17290 + * You should have received a copy of the GNU General Public License
17291 + * along with this program; if not, write to the Free Software
17292 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17298 + * Lowlevel handler for lcall7-based syscalls.
17300 +#include <linux/module.h>
17301 +#include <linux/errno.h>
17302 +#include <linux/sched.h>
17303 +#include <linux/kernel.h>
17304 +#include <linux/mm.h>
17305 +#include <linux/ptrace.h>
17306 +#include <linux/init.h>
17307 +#include <linux/personality.h>
17308 +#include <asm/uaccess.h>
17310 +#include <abi/util/errno.h>
17311 +#include <abi/util/trace.h>
17312 +#include <abi/util/sysent.h>
17314 +MODULE_AUTHOR("Christoph Hellwig");
17315 +MODULE_DESCRIPTION("Lowlevel handler for lcall7-based syscalls");
17316 +MODULE_LICENSE("GPL");
17319 +static void get_args(int args[], struct pt_regs *regs, int of, int n)
17323 + for (i = 0; i < n; i++)
17324 + get_user(args[i], ((unsigned long *)regs->esp) + (i+of));
17328 + * lcall7_syscall - indirect syscall for the lcall7 entry point
17330 + * @regs: saved user registers
17332 + * This function implements syscall(2) in kernelspace for the lcall7-
17333 + * based personalities.
17336 +int lcall7_syscall(struct pt_regs *regs)
17338 + __get_user(regs->eax, ((unsigned long *)regs->esp)+1);
17341 + current_thread_info()->exec_domain->handler(-1,regs);
17348 + * lcall7_dispatch - handle lcall7-based syscall entry
17350 + * @regs: saved user registers
17351 + * @ap: syscall table entry
17352 + * @off: argument offset
17354 + * This function handles lcall7-based syscalls after the personality-
17355 + * specific rountine selected the right syscall table entry.
17358 +void lcall7_dispatch(struct pt_regs *regs, struct sysent *ap, int off)
17360 + short nargs = ap->se_nargs;
17361 + int args[8], error;
17363 + if (!ap->se_syscall) /* XXX kludge XXX */
17366 + if (nargs <= ARRAY_SIZE(args))
17367 + get_args(args, regs, off, nargs);
17369 +#if defined(CONFIG_ABI_TRACE)
17370 + if (abi_traced(ABI_TRACE_API)) {
17371 + if (nargs == Spl)
17372 + get_args(args, regs, off, strlen(ap->se_args));
17373 + plist(ap->se_name, ap->se_args, args);
17379 + SYSCALL_PREGS(ap->se_syscall, regs);
17380 + goto show_signals;
17382 + error = SYSCALL_PREGS(ap->se_syscall, regs);
17385 + error = SYSCALL_VOID(ap->se_syscall);
17388 + error = SYSCALL_1ARG(ap->se_syscall, args);
17391 + error = SYSCALL_2ARG(ap->se_syscall, args);
17394 + error = SYSCALL_3ARG(ap->se_syscall, args);
17397 + error = SYSCALL_4ARG(ap->se_syscall, args);
17400 + error = SYSCALL_5ARG(ap->se_syscall, args);
17403 + error = SYSCALL_6ARG(ap->se_syscall, args);
17406 + error = SYSCALL_7ARG(ap->se_syscall, args);
17409 +#if defined(CONFIG_ABI_TRACE)
17410 + abi_trace(ABI_TRACE_UNIMPL,
17411 + "Unsupported ABI function 0x%lx (%s)\n",
17412 + regs->eax, ap->se_name);
17417 + if (error > -ENOIOCTLCMD && error < 0) {
17418 + set_error(regs, iABI_errors(-error));
17420 +#if defined(CONFIG_ABI_TRACE)
17421 + abi_trace(ABI_TRACE_API,
17422 + "%s error return %d/%ld\n",
17423 + ap->se_name, error, regs->eax);
17426 + clear_error(regs);
17427 + set_result(regs, error);
17429 +#if defined(CONFIG_ABI_TRACE)
17430 + abi_trace(ABI_TRACE_API,
17431 + "%s returns %ld (edx:%ld)\n",
17432 + ap->se_name, regs->eax, regs->edx);
17437 +#if defined(CONFIG_ABI_TRACE)
17438 + if (signal_pending(current) && abi_traced(ABI_TRACE_SIGNAL)) {
17439 + unsigned long signr;
17441 + signr = current->pending.signal.sig[0] &
17442 + ~current->blocked.sig[0];
17444 + __asm__("bsf %1,%0\n\t"
17448 + __abi_trace("SIGNAL %lu, queued 0x%08lx\n",
17449 + signr+1, current->pending.signal.sig[0]);
17455 +#if defined(CONFIG_ABI_SYSCALL_MODULES)
17456 +EXPORT_SYMBOL(lcall7_syscall);
17457 +EXPORT_SYMBOL(lcall7_dispatch);
17459 diff -Nur kernel-source-2.6.16.orig/arch/i386/kernel/Makefile kernel-source-2.6.16/arch/i386/kernel/Makefile
17460 --- kernel-source-2.6.16.orig/arch/i386/kernel/Makefile 2006-03-20 15:53:29.000000000 +1000
17461 +++ kernel-source-2.6.16/arch/i386/kernel/Makefile 2006-04-27 18:50:24.000000000 +1000
17463 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
17464 obj-$(CONFIG_X86_NUMAQ) += numaq.o
17465 obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o
17466 +obj-$(CONFIG_ABI_LCALL7) += lcall7.o
17467 obj-$(CONFIG_KPROBES) += kprobes.o
17468 obj-$(CONFIG_MODULES) += module.o
17469 obj-y += sysenter.o vsyscall.o
17470 diff -Nur kernel-source-2.6.16.orig/arch/i386/kernel/signal.c kernel-source-2.6.16/arch/i386/kernel/signal.c
17471 --- kernel-source-2.6.16.orig/arch/i386/kernel/signal.c 2006-03-20 15:53:29.000000000 +1000
17472 +++ kernel-source-2.6.16/arch/i386/kernel/signal.c 2006-04-27 18:50:24.000000000 +1000
17475 sys_sigsuspend(int history0, int history1, old_sigset_t mask)
17477 + return signal_suspend((struct pt_regs *)&history0, mask);
17481 +signal_suspend(struct pt_regs * regs, old_sigset_t mask)
17483 mask &= _BLOCKABLE;
17484 spin_lock_irq(¤t->sighand->siglock);
17485 current->saved_sigmask = current->blocked;
17486 diff -Nur kernel-source-2.6.16.orig/arch/i386/kernel/traps.c kernel-source-2.6.16/arch/i386/kernel/traps.c
17487 --- kernel-source-2.6.16.orig/arch/i386/kernel/traps.c 2006-04-27 18:30:01.000000000 +1000
17488 +++ kernel-source-2.6.16/arch/i386/kernel/traps.c 2006-04-27 18:50:24.000000000 +1000
17490 #include "mach_traps.h"
17492 asmlinkage int system_call(void);
17493 +asmlinkage void lcall7(void);
17494 +asmlinkage void lcall27(void);
17496 struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
17497 { 0, 0 }, { 0, 0 } };
17498 @@ -759,6 +761,27 @@
17499 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
17500 SIGTRAP) == NOTIFY_STOP)
17504 + * Entering the kernel via lcall7 or lcall27 does not clear the TF bit.
17505 + * Leaving it set in kernel code will stop the machine. The first
17506 + * instructions of lcall7 and lcall27 in entry.S save the CPU flags.
17507 + * The saved flags should have the TF bit set, so we ignore this trap.
17509 + if (regs->eip == (unsigned long) &lcall7 ||
17510 + regs->eip == (unsigned long) &lcall27)
17514 + * After having saved the flags, TF will fire the single step trap
17515 + * again. This time TF should be cleared. It will be restored by the
17516 + * iret instruction returning to user mode. This way, the very next
17517 + * instruction after lcall in the user programm will not be stopped at.
17519 + if (regs->eip - 1 == (unsigned long) &lcall7 || /* pushfl is a one-byte op */
17520 + regs->eip - 1 == (unsigned long) &lcall27)
17521 + goto clear_TF_reenable;
17523 /* It's safe to allow irq's after DR6 has been saved */
17524 if (regs->eflags & X86_EFLAGS_IF)
17525 local_irq_enable();
17526 @@ -1096,6 +1119,11 @@
17527 _set_gate(idt_table+n,15,3,addr,__KERNEL_CS);
17530 +static void __init set_call_gate(void *a, void *addr)
17532 + _set_gate(a,12,3,addr,__KERNEL_CS);
17535 static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
17537 _set_gate(idt_table+n,5,0,0,(gdt_entry<<3));
17538 @@ -1164,6 +1192,13 @@
17539 set_system_gate(SYSCALL_VECTOR,&system_call);
17542 + * default LDT is a single-entry callgate to lcall7 for iBCS
17543 + * and a callgate to lcall27 for Solaris/x86 binaries
17545 + set_call_gate(&default_ldt[0],lcall7);
17546 + set_call_gate(&default_ldt[4],lcall27);
17549 * Should be a barrier for any external CPU state.
17552 diff -Nur kernel-source-2.6.16.orig/arch/ia64/ia32/ia32priv.h kernel-source-2.6.16/arch/ia64/ia32/ia32priv.h
17553 --- kernel-source-2.6.16.orig/arch/ia64/ia32/ia32priv.h 2006-03-20 15:53:29.000000000 +1000
17554 +++ kernel-source-2.6.16/arch/ia64/ia32/ia32priv.h 2006-04-27 18:50:24.000000000 +1000
17555 @@ -344,7 +344,7 @@
17558 # define SET_PERSONALITY(EX,IBCS2) \
17559 - (current->personality = (IBCS2) ? PER_SVR4 : PER_LINUX)
17560 + (is_cur_personality((IBCS2)) ? PER_SVR4 : PER_LINUX)
17563 #define IA32_EFLAG 0x200
17564 diff -Nur kernel-source-2.6.16.orig/arch/parisc/kernel/signal.c kernel-source-2.6.16/arch/parisc/kernel/signal.c
17565 --- kernel-source-2.6.16.orig/arch/parisc/kernel/signal.c 2006-03-20 15:53:29.000000000 +1000
17566 +++ kernel-source-2.6.16/arch/parisc/kernel/signal.c 2006-04-27 18:50:24.000000000 +1000
17569 compat_sigset_t newset32;
17571 - if(personality(current->personality) == PER_LINUX32){
17572 + if(is_cur_personality_id(PERID_LINUX32)){
17573 /* XXX: Don't preclude handling different sized sigset_t's. */
17574 if (sigsetsize != sizeof(compat_sigset_t))
17576 @@ -186,7 +186,7 @@
17578 /* Good thing we saved the old gr[30], eh? */
17580 - if(personality(current->personality) == PER_LINUX32){
17581 + if(is_cur_personality_id(PERID_LINUX32)){
17582 DBG(1,"sys_rt_sigreturn: compat_frame->uc.uc_mcontext 0x%p\n",
17583 &compat_frame->uc.uc_mcontext);
17584 // FIXME: Load upper half from register file
17585 @@ -392,7 +392,7 @@
17586 haddr = A(ka->sa.sa_handler);
17587 /* The sa_handler may be a pointer to a function descriptor */
17589 - if(personality(current->personality) == PER_LINUX32) {
17590 + if(is_cur_personality_id(PERID_LINUX32)) {
17592 if (haddr & PA_PLABEL_FDESC) {
17594 @@ -427,19 +427,19 @@
17596 sigframe_size = PARISC_RT_SIGFRAME_SIZE;
17598 - if(personality(current->personality) == PER_LINUX32)
17599 + if(is_cur_personality_id(PERID_LINUX32))
17600 sigframe_size = PARISC_RT_SIGFRAME_SIZE32;
17603 regs->gr[31] = haddr;
17605 - if(personality(current->personality) == PER_LINUX)
17606 + if(is_cur_personality_id(PERID_LINUX))
17607 sigframe_size |= 1;
17610 unsigned long psw = USER_PSW;
17612 - if(personality(current->personality) == PER_LINUX)
17613 + if(is_cur_personality_id(PERID_LINUX))
17617 @@ -464,7 +464,7 @@
17618 regs->gr[26] = sig; /* signal number */
17621 - if(personality(current->personality) == PER_LINUX32){
17622 + if(is_cur_personality_id(PERID_LINUX32)){
17623 regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */
17624 regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */
17626 diff -Nur kernel-source-2.6.16.orig/arch/x86_64/ia32/sys_ia32.c kernel-source-2.6.16/arch/x86_64/ia32/sys_ia32.c
17627 --- kernel-source-2.6.16.orig/arch/x86_64/ia32/sys_ia32.c 2006-04-27 18:30:01.000000000 +1000
17628 +++ kernel-source-2.6.16/arch/x86_64/ia32/sys_ia32.c 2006-04-27 18:50:24.000000000 +1000
17629 @@ -751,12 +751,15 @@
17630 sys32_personality(unsigned long personality)
17633 - if (personality(current->personality) == PER_LINUX32 &&
17635 + if (is_personality_id(PERID_LINUX32) &&
17636 personality == PER_LINUX)
17637 personality = PER_LINUX32;
17638 ret = sys_personality(personality);
17640 if (ret == PER_LINUX32)
17646 @@ -903,7 +906,7 @@
17647 __put_user(0,name->version+__OLD_UTS_LEN);
17649 char *arch = "x86_64";
17650 - if (personality(current->personality) == PER_LINUX32)
17651 + if (is_cur_personality_id(PERID_LINUX32))
17654 __copy_to_user(&name->machine,arch,strlen(arch)+1);
17655 @@ -924,7 +927,7 @@
17656 down_read(&uts_sem);
17657 err=copy_to_user(name, vx_new_utsname(), sizeof (*name));
17659 - if (personality(current->personality) == PER_LINUX32)
17660 + if (is_cur_personality_id(PERID_LINUX32))
17661 err |= copy_to_user(&name->machine, "i686", 5);
17662 return err?-EFAULT:0;
17664 diff -Nur kernel-source-2.6.16.orig/arch/x86_64/kernel/sys_x86_64.c kernel-source-2.6.16/arch/x86_64/kernel/sys_x86_64.c
17665 --- kernel-source-2.6.16.orig/arch/x86_64/kernel/sys_x86_64.c 2006-04-27 18:30:01.000000000 +1000
17666 +++ kernel-source-2.6.16/arch/x86_64/kernel/sys_x86_64.c 2006-04-27 18:50:24.000000000 +1000
17667 @@ -151,7 +151,7 @@
17668 down_read(&uts_sem);
17669 err = copy_to_user(name, vx_new_utsname(), sizeof (*name));
17671 - if (personality(current->personality) == PER_LINUX32)
17672 + if (is_cur_personality_id(PERID_LINUX32))
17673 err |= copy_to_user(&name->machine, "i686", 5);
17674 return err ? -EFAULT : 0;
17676 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/00-INDEX kernel-source-2.6.16/Documentation/abi/00-INDEX
17677 --- kernel-source-2.6.16.orig/Documentation/abi/00-INDEX 1970-01-01 10:00:00.000000000 +1000
17678 +++ kernel-source-2.6.16/Documentation/abi/00-INDEX 2006-04-27 18:50:24.000000000 +1000
17683 + - a list of software that has run succesfull under iBCS
17685 + - a list of people that have contributed to linux-abi or iBCS
17687 + - changelog of linux-abi
17689 + - changelog of the iBCS project (up to 1998)
17691 + - mapping of error codes from Linux to various personalities
17695 + - help on local X interfaces
17697 + - some notes on signal handling
17699 + - an introduction into Linux personality support
17701 + - read this first!
17703 + - the syscall mapping for certain personalities
17705 + - things to be done, leftovers from iBCS
17707 + - autoloading personality modules under Linux-ABI
17709 + - a brief overview of the Linux-ABI modules
17710 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/autoload.txt kernel-source-2.6.16/Documentation/abi/autoload.txt
17711 --- kernel-source-2.6.16.orig/Documentation/abi/autoload.txt 1970-01-01 10:00:00.000000000 +1000
17712 +++ kernel-source-2.6.16/Documentation/abi/autoload.txt 2006-04-27 18:50:24.000000000 +1000
17714 +Autoloading personality modules under Linux-ABI
17716 +Christoph Hellwig, <hch@caldera.de>
17718 +Linux-ABI can automatically load binary format modules (see modules.txt
17719 +for information on what binary format modules are). This file explains
17720 +how to setup a system to automatically load the binary format modules
17723 +Automatic module loading is done in Linux using a facility called 'kmod'
17724 +which is - unlike the name suggests - _not_ a system daemon, but a kernel-
17725 +facility to make userspace upcalls to te module loading program 'modprobe'.
17727 +Linux-ABI uses the function request_module that is exported by kmod to
17728 +request modules for personalities that are currently not available but
17729 +requested by one of the binary fomrat detection heuristics. For a missing
17730 +personality, request_module is called for the module-string
17732 + personality-<personality-number>
17734 +To get the right modules loaded you have to alias these string to the
17735 +actually wanted modules in /etc/modules.conf. To do that you have to know
17736 +which personality number maps to what module. Here is a table for the
17737 +personalities supported by Linux-ABI:
17740 + personalities module
17741 + -----------------------------------
17748 +Below is an example snipplet from modules.conf for such a setup:
17750 +------------------- snip --------------------
17752 +alias personality-1 abi-ibcs
17753 +alias personality-2 abi-ibcs
17754 +alias personality-3 abi-sco
17755 +alias personality-4 abi-wyse
17756 +alias personality-5 abi-ibcs
17757 +alias personality-7 abi-ibcs
17758 +alias personality-13 abi-solaris
17759 +alias personality-14 abi-uw7
17761 +------------------- snip --------------------
17763 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/ChangeLog kernel-source-2.6.16/Documentation/abi/ChangeLog
17764 --- kernel-source-2.6.16.orig/Documentation/abi/ChangeLog 1970-01-01 10:00:00.000000000 +1000
17765 +++ kernel-source-2.6.16/Documentation/abi/ChangeLog 2006-04-27 18:50:24.000000000 +1000
17767 +2002-01-03 Christoph Hellwig <hch@caldera.de>
17769 + linux-abiÂ2.4.17.0
17771 + * rework/cleanup lcall7 syscall handling
17772 + * make sure x.out sections aren't loaded into illegal areas
17773 + * fix SVR4 mmap() to always assume post-SunOS4 behaviour
17775 +2001-11-24 Christoph Hellwig <hch@caldera.de>
17777 + linux-abi-2.4.15.0
17779 + * simplify wyse socket handling, use native syscalls directly where
17780 + possibles else use normal calling conventions
17781 + * fix <linux/syscall.h> compilation for non-i386 machines (Olaf Hering)
17782 + * fix alignment checks in binfmt_xout (based on patch by Joerg Ahrens)
17783 + * rewrite abi_brk: fix (theoretical) races, check for page alignment
17784 + * don't try to take a non-existant lock in xnx_nap, cleanup xnx_nap.
17785 + * fix value reported by sysi86(SI86MEM).
17787 +2001-11-18 Christoph Hellwig <hch@sb.bsdonline.org>
17789 + linux-abi 2.4.14.0
17791 + * small binfmt_xout bugfixes (Joerg Ahrens)
17792 + * move isc into it's own personality
17793 + * make all personalities independant of abi-ibcs
17794 + * merge socket handling into abi-wyse
17796 +2001-10-22 Christoph Hellwig <hch@sb.bsdonline.org>
17798 + linux-abi 2.4.12.0
17800 + * big mmap rewrite
17801 + | correctly check for flags in svr4_mmap
17802 + | use svr4_mmap for the UnixWare personality as well
17803 + | OpenServer has it's own implementation now as it supports
17804 + rather different flags than SVR4 & derivates
17805 + * more header cleanups - all helper routines are now in abi/util/*.h
17807 +2001-10-04 Christoph Hellwig <hch@sb.bsdonline.org>
17809 + linux-abi 2.4.10.0
17811 + * add MODULE_DESCRIPTION/MODULE_AUTHOR/MODULE_LICENSE tags
17812 + * don't use alternate prefix for directories (David Mosberger)
17813 + * fix non-modular buil
17814 + * cleanup stat handling
17815 + | use Alexander Viro's kstat concept
17816 + | all emulations now have their own xstat implementations
17817 + | fixed overflows
17818 + * add full-fledged types.h headers for all peronalities
17820 +2001-08-06 Christoph Hellwig <hch@sb.bsdonline.org>
17822 + linux-abi 2.4.9.0
17824 + * fix missing solaris socket exports
17825 + * move Xenix support from ibcs to sco module,
17826 + make unconditional
17827 + * UnixWare LFS fixes
17828 + * make the actual code work on the Alan Cox tree
17830 +2001-08-06 Christoph Hellwig <hch@sb.bsdonline.org>
17832 + linux-abi 2.4.7.0
17834 + * some final polishing for segmented 286 x.out binaries (Joerg Ahrens)
17835 + * fix SPX handling (again)
17836 + * fix setpgrp and cleanup procids while we're at it
17837 + * update SCO syscall table to match OSR506a
17839 +2001-07-19 Christoph Hellwig <hch@sb.bsdonline.org>
17841 + linux-abi 2.4.6.1
17843 + * rewritten /dev/socksys handling
17844 + * fix more non-x86 breakage (Olaf Hering)
17845 + * port solaris native sockets from sparc64
17846 + * add sysctl support for runtime-tweaking
17847 + * add cxenix to the ibcs sysent table for Xenix/386 (Jürgen Günther)
17848 + * (re)add support for segmented x.out binaries (Joerg Ahrens)
17849 + | I probably broke it while rebasing against -CURRENT
17850 + * reject IRIX binaries on mips32 (David Woodhouse)
17852 +2001-07-09 Christoph Hellwig <hch@sb.bsdonline.org>
17854 + linux-abi 2.4.6.0
17856 + * svr4/signal.c typo fix
17857 + * make cxenix debug printk's less verbose (Christian Lademann)
17858 + * misc small bugfixes (Christian Lademann)
17859 + * compile fixes for !CONFIG_ABI on non-x86 architectures
17861 +2001-06-18 Christoph Hellwig <hch@sb.bsdonline.org>
17863 + linux-abi 2.4.5.1
17865 + * rewrite of abi_sigsuspend() to make it work as expected
17866 + * fix cxenix syscall table
17867 + * actually initialize socksys
17869 +2001-06-09 Christoph Hellwig <hch@sb.bsdonline.org>
17871 + linux-abi 2.4.5.0
17873 + * rewrite of kernel exec_domain support
17874 + * make faking of SCO utsname information configurable
17875 + * get rid of SYS() and sysfunc_p (Arjan van de Ven)
17876 + * fix socket families (Stephan Springl)
17877 + * fix SCO signal mapping (Stephan Springl)
17878 + * fix SCO (and Wyse) error mapping
17879 + * continued source tree restructuring
17881 +2001-04-31 Christoph Hellwig <hch@sb.bsdonline.org>
17883 + linux-abi 2.4.4.0
17885 + * disable tracing by default
17886 + * rewrite of the SYSV IPC code
17887 + * add support for SCO OpenServer 5 ELF binaries
17888 + * fix an error in binfmt_coff that does not clear the return value
17889 + * provide generic template macros for stat and friends
17890 + * start of source tree reorganization
17892 +2001-03-30 Christoph Hellwig <hch@sb.bsdonline.org>
17894 + linux-abi 2.4.3.0
17896 + * fix shared library support for COFF
17897 + * x.out is now supported (again)
17898 + * redo setting of personality based on ELF headers
17899 + * get rid of CONFIG_ABI_TRACE (and a lot of nasty ifdefs)
17900 + * added documentation, mostly from iBCS
17902 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/ChangeLog.ibcs kernel-source-2.6.16/Documentation/abi/ChangeLog.ibcs
17903 --- kernel-source-2.6.16.orig/Documentation/abi/ChangeLog.ibcs 1970-01-01 10:00:00.000000000 +1000
17904 +++ kernel-source-2.6.16/Documentation/abi/ChangeLog.ibcs 2006-04-27 18:50:24.000000000 +1000
17906 +Thu Nov 5 21:45:41 GMT 1998
17908 + * Fixed the bug that lets reads and writes on /dev/socksys
17909 + take out the kernel.
17912 + * Added a kludge around for Sybase isql which appears to
17913 + have initialised a struct sockaddr using:
17914 + sa.sa_family = htons(AF_INET);
17915 + I guess this works on SCO?
17919 +Sat Oct 31 14:15:44 GMT 1998
17921 + * Documentation update.
17923 + * If we are doing a T_BIND_REQ with a null address we can
17924 + ignore the connection backlog. Listening makes no sense
17925 + but some software seems to set it 1 for the hell of it.
17929 +Tue Oct 20 20:34:20 BST 1998
17931 + * Changed the debug messages printed when exec tracing
17932 + sees a pointer error on an arg or env entry. It may not
17933 + be a "real" error. It could be that we just cannot get
17934 + a free page or perhaps the entry is too long for getname().
17935 + Whatever, we do not really care at this point anyway.
17939 +Sat Oct 17 20:24:59 BST 1998
17941 + * Documentation update for today's release.
17945 +Thu Oct 15 21:39:16 BST 1998
17947 + * When checking personality only look at the base personality
17948 + and ignore the flags. There is at least one case I can
17949 + think of, PER_SHORT_INODE, where the personality should
17950 + be considered the same even when the flags are different.
17953 + * Added the location of the kernel source as an option
17954 + in the CONFIG. Hopefully this will make it a little
17955 + more obvious that iBCS is *dependant* on the kernel.
17958 + * Set SO_BSDCOMPAT on sockets. SYSV has BSD handling of
17959 + ICMP errors on UDP sockets rather than RFC conformance.
17964 +Wed Oct 14 22:50:48 BST 1998
17966 + * When using some user stack as temporary work space we
17967 + only leave 1k between the work space and the real user
17968 + stack. This is because Informix Dynamic Server uses
17969 + threads with limited stack space and the idea of dropping
17970 + 16k below what would normally be touched on a SCO system
17971 + worries me a bit.
17975 +Sun Oct 11 11:58:58 BST 1998
17977 + * Changed the Tools Makefile to install mkmnttab in
17978 + /usr/bin. Informix Dynamic Server _requires_ a
17979 + valid /etc/mnttab.
17983 +Sun Oct 11 11:44:58 BST 1998
17985 + * When doing an I_PEEK or I_NREAD STREAMS ioctl we have
17986 + to do a probe on sockets in case we need to generate
17987 + a control message (e.g. T_CONN_IND) which should then
17988 + be offered. This also allows T_CONN_IND messages to be
17989 + returned in several MORECTL divided pieces should it
17990 + ever be necessary. This is required by Informix Dynamic
17991 + Server which does a poll then I_PEEK on a listening
17992 + socket before actually picking up the connection. Dynamic
17993 + Server is system call hell :-).
17996 + * When we do a timod operation via an ioctl there seems
17997 + to be no way to cope if the returned message is larger
17998 + than the original request. We can't expect the app to
17999 + come back for the extra and returning MORECTL to the
18000 + app seems to confuse things. Therefore we just discard
18001 + the excess. This case is required when an app (e.g.
18002 + Informix Dynamic Server) tries to set SO_LINGER using
18003 + an int instead of a struct linger via an ioctl.
18006 + * Added some debug to the poll handler so we can see what
18010 + * More debug message changes.
18013 + * Wrap SO_LINGER handling so we can survive if an int is
18014 + passed instead of s struct linger. It seems that other
18015 + systems do not do such robust error checking as Linux.
18016 + Note that if an int is passed we probably do not do what
18017 + other systems would but at least we don't give unexpected
18018 + errors to broken applications.
18022 +Sat Oct 10 15:58:29 BST 1998
18024 + * Added an entry to Doc/HINTS noting the the Informix
18025 + Dynamic Server install requires an /etc/mnttab.
18028 + * Wrong option length being passed through to setsockopt()
18029 + from the TLI/XTI optmgmt routine.
18032 + * When stating files only map "ext2" to "HTFS" for SCO
18033 + programs - and then only if the filesystem name really
18037 + * SCO has a different value for the _SC_PAGESIZE argument
18038 + to sysconf() than SVR4. Informix wants it to work.
18041 + * Hmmm, Informix Dynamic Server may or may not be looking
18042 + at the major number on a socket. (I _think_ it does
18043 + sometimes). It definitely checks that sockets have
18044 + S_IFCHR set in their file modes though...
18047 + * Changed some debug messages to make it easier to read
18048 + logs when more than one iBCS handled process is running.
18051 + * If we get a STREAMS ioctl on a file descriptor only
18052 + initialize the socksys handler on it if it is not
18053 + already a socket but does belong to the socksys device.
18057 +Thu Oct 8 21:20:43 BST 1998
18059 + * When punting a pseudo device transport provider to a
18060 + socket copy the device numbers between the inodes. This
18061 + is because Informix Dynamic Server stats the pseudo
18062 + device node (/dev/socksys) then stats the socket it
18063 + gets and compares the major numbers. Sheesh...
18066 + * If socksys_close gets something that is not a socket
18067 + it is probably the original pseudo device which was
18068 + opened just for an ioctl or two. This is not an error.
18071 + * Some programs, notably the Informix Dynamic Server
18072 + install program compare the filesystem name from a
18073 + stat or sysfs against their own hard coded list of
18074 + known "real" filesystems. Hence we call "ext2" "HTFS"
18075 + instead for SCO processes.
18078 + * Informix DS also checks the release part of the utsname
18079 + data to make sure it says "3.2v5.0.0". So now the
18080 + utsname struct looks even more like SCO.
18083 + * Only dump the ctl part of messages in timod if
18084 + tracing is enabled.
18087 + * SCO has statvfs in the same place as SVR4 but they have
18088 + added a field slap bang in the middle of the struct to
18089 + allow some inodes to be reserved for root in much the
18090 + same way that some blocks may be reserved.
18094 +Thu Oct 8 20:48:46 BST 1998
18096 + * On timod bind and connect the size of the address is
18097 + allowed to be the _used_ bytes whereas the underlying
18098 + socket functions require the _total_ bytes. This is
18099 + a problem for Sybase.
18103 +Sun Aug 30 21:49:46 BST 1998
18105 + * Changed socksys.c to handle new file_operations struct
18106 + in kernel 2.1.119 and later.
18110 +Sat Aug 22 19:57:01 BST 1998
18112 + * Fixes and additions to user pointer checking in ipc.c
18115 + * Changed some more KERN_ERRs to KERN_DEBUGs in the
18116 + STREAMS ioctl support.
18120 +Fri Aug 21 20:24:32 BST 1998
18122 + * Somehow fchdir had been missed from the main iBCS call
18123 + map even though it had been put in the BSD map. Oops.
18127 +Wed Aug 19 23:12:47 BST 1998
18129 + * ALPHA 2.1 release number 2...
18133 +Wed Aug 19 20:43:09 BST 1998
18135 + * Avoid calling rt_sigaction if the mapped signal number
18136 + is -1. It is not strictly necessary but why bother?
18139 + * Added David Bruce's updated x286emul.
18143 +Mon Aug 17 21:29:53 BST 1998
18145 + * Avoid calling fput with a NULL file pointer.
18149 +Sun Aug 16 17:32:20 BST 1998
18151 + * Fix to copy_{to,from}_user return checking. In many
18152 + cases we do not care because they are behind verify_area
18153 + checks but in some we do - and copy_{to,from}_user
18154 + returns the number of bytes _uncopied_.
18158 +Sat Aug 15 23:39:42 BST 1998
18160 + * Change the flock handling to bounce the flock struct
18161 + through kernel space rather than using an in place
18162 + modification. The assumptions we were making about
18163 + segment registers seem to have become invalid at some
18164 + point. We could go to put_user(get_user()) but moving
18165 + the whole struct is probably more robust. Which is
18166 + faster? I dunno...
18170 +Sat Aug 15 22:30:41 BST 1998
18172 + * Changes to signal functions. Previous code confused old and
18173 + new sigsets and could have lead to memory corruption and
18174 + was likely the cause of signals getting blocked unexpectedly.
18175 + Now we use the rt_sig* and new sigset interface to the
18176 + kernel exclusively (in a few years the old stuff may be
18177 + removed). This does means that a non-Linux program may
18178 + now operate on signals >32 which may not have existed
18179 + (and therefore would have errored) in the native environment.
18180 + This may be considered a bug or a feature as appropriate...
18184 +Mon Jul 20 22:23:14 BST 1998
18186 + * ALPHA 2.1 release...
18190 +Mon Jul 20 20:55:47 BST 1998
18192 + * Added support for I_FDINSERT in the STREAMS/TLI message
18193 + protocol handling. This allows TLI server code to work
18194 + using a _real_ libnsl_s (tested briefly) but will break
18195 + server code using my replacement libnsl_s until I update
18196 + it. (It should probably use an I_FDINSERT simply so it
18197 + can still run under SYSV if ever necessary.)
18200 + * Use TIOCINQ instead of FIONREAD in the STREAMS ioctl handler.
18201 + FIONREAD isn't actually supported on sockets. The socksys
18202 + code already had this right.
18205 + * Do the MOD_INC, MOD_DEC calls for sockets in the inherit
18206 + and release handling only to reduce the opportunity for,
18207 + ah, "oversights".
18211 +Thu Jul 16 22:11:48 BST 1998
18213 + * Finally got round to adding a GNU CopyLeft!
18216 + * Set up an XTI/TLI private state struct on all sockets at
18217 + the same time we plug our own file operations in. This
18218 + costs a small amount of extra memory per socket. However
18219 + this is strictly correct (although unlikely to be actually
18220 + _required_ by anything). It also allows us to set up TEPs
18221 + created by XTI/TLI listen/accept easily so they have a
18222 + chance of working.
18226 + Do not auto-listen in getmsg() - listen() after connect()
18227 + appears to crash some 2.1 kernels(?).
18228 + Change the probe for activity in getmsg() to use the
18229 + new poll handler directly.
18230 + Handle listening TEPs slightly better.
18233 + * Changed a stray KERN_ERR to KERN_DEBUG in ioctl.c
18237 +Fri Jul 3 23:20:37 BST 1998
18239 + * Fixed the initial set up of the argument and environment
18240 + lists which were broken during the change to 2.1 style
18241 + user memory access.
18245 +Mon Jun 29 22:50:11 BST 1998
18247 + * Put kernel_version definition back in emulate.c
18250 + * Change loaders to set start_text, end_text, start_data,
18251 + end_data, start_brk, brk fully.
18255 +Thu Jun 25 21:18:11 BST 1998
18257 + * Added support for the "fat" IPC structures which use
18258 + 32 bit uids, gids etc.
18262 +Wed Jun 24 21:30:09 BST 1998
18264 + * Change suser() checks to use the new capable() calls.
18267 + * Changed the CONFIG default to NOT support Xenix 286. It
18268 + is an ever increasing build problem. It needs a volunteer
18272 + * Add locking around system_utsname data using the uts_sem.
18275 + * Changed to use dentry stuff. Use fget()/fput() to get
18276 + file pointers rather than accessing task fd tables
18277 + directly. Use poll interface for SYSV poll and timod
18278 + blocking checks. Use lock_kernel()/unlock_kernel()
18279 + around stat routines and other namei stuff. Use dput()
18280 + to release dentries obtained with namei(). Other
18281 + incidental fixes to what went before as I noticed them.
18285 +Tue Jun 9 20:02:56 BST 1998
18287 + * More changes for new module conventions.
18290 + * Changed signal stuff to new conventions.
18293 + * Changed getname() calling convention.
18296 + * Changed fs type to mm_segment_t.
18299 + * Changed user VM accesses to use new conventions.
18303 +Sat Jun 6 20:30:00 BST 1998
18305 + * Changed to new module conventions.
18309 +Thu May 28 22:30:45 BST 1998
18311 + * Removed VM_STACK_FLAGS tests.
18314 + * Remove VM_GROWSDOWN tests.
18317 + * Removed MAP_EXECUTABLE tests.
18320 + * Removed MAP_DENYWRITE tests.
18323 + * Removed STACK_TOP tests.
18326 + * Removed FORKNOEXEC tests.
18329 + * Removed INIT_MM tests.
18333 +Mon May 18 22:49:56 BST 1998
18335 + * Fixed xnx_rdchk() return value.
18338 + * The serial number returned in the SCO utsname struct
18339 + can now be set with sco_serial="..." as a module
18340 + option. Some program apparently want to find a real,
18341 + believable serial number there. This should be documented
18342 + somewhere other than here I guess...
18346 +Mon May 18 22:03:49 BST 1998
18348 + * A class 't' ioctl with no arg type stuff in the top
18349 + word is either an SVR4 tape ioctl a Coherent BSD-ish
18354 +Mon Feb 2 22:57:45 GMT 1998
18356 + * Other relatively minor changes to allow compilation
18357 + under glibc (specifically 2.0.6 but it shouldn't
18361 + * Added an explicit -I flag to search /usr/src/linux/include
18362 + since glibc doesn't necessarily require the kernel
18363 + includes to be symlinked under /usr/include.
18366 + * The personality defaults in binfmt_coff should probably
18367 + select short inodes on the assumption that newer stuff
18368 + is likely to be built as ELF anyway. I hope.
18372 +Wed Nov 19 19:28:07 GMT/BST 1997
18374 + * Attempt to work around problems with sign extension
18375 + when programs believe that the fs magic in a sysfs()
18376 + call is short rather than long.
18379 + * Added IPPROTO_IP/SOL_IP option name mapping for
18380 + {get,set}sockopt. This is correct for SCO OS5 and
18381 + hopefully for other SYSV derived Unices. Note that
18382 + SCO OS5 ping still doesn't work because it uses an
18383 + unsigned char for the IP_TTL value whereas Linux
18384 + wants an int - and it objects to getting an error
18385 + return. Apparently POSIX 1003g says IP_TTL should
18386 + be an unsigned char so OS5, or at least its ping,
18387 + is at fault. This probably isn't worth hacking
18388 + around unless someone _really_ needs it.
18392 +Wed Nov 12 22:28:19 GMT/BST 1997
18394 + * Added the SCO-ish syscall shortcut to the socksys
18399 +Fri Nov 7 20:13:05 GMT/BST 1997
18401 + * Oops, I installed the SCO signal tables in the old
18402 + personality mapping but forgot to create a specific
18403 + SCO personality using them.
18407 +Thu Nov 6 08:04:37 GMT/BST 1997
18409 + * No, it really should be USR1 for URG under SCO, not
18410 + USR2. This is according to the SCO Network Programmer's
18411 + documentation. The previous problem was because
18412 + confusion between the SVR4 and SCO/SVR3 requirements
18413 + prevented a SCO program from registering a handler
18414 + for the right signal, I think.
18418 +Wed Nov 5 14:23:22 GMT/BST 1997
18420 + * Created a new signal mapping for SCO and mapped
18421 + Linux SIGURG to SCO SIGUSR2. Also changed the
18422 + plain ibcs mapping for SIGURG back to IBCS_SIGURG.
18423 + Previously I had SIGURG mapped to SIGUSR1 for
18424 + what my subconscious says was a good reason but
18425 + I can't figure out where I got it from. The USR2
18426 + mapping is according to Peter Brueckner - and if
18427 + it works for him...
18431 +Wed Nov 5 09:14:27 GMT/BST 1997
18433 + * Repair the STREAMS based socket code. The new socket
18434 + hashing in 2.0.30 and beyond means the old code no
18435 + longer works. We now delay replacing the fd with
18436 + a socket until the first read, write or ioctl. Since
18437 + the open has completed at this stage and the fd is
18438 + fully initialized we can then use dup() to do the
18439 + fd switch, which should always work. As a side effect
18440 + this allows us to auto-connect an SPX pipe to X :0
18441 + if the first operation is other than a single character
18442 + write - which should allow us to handle v. old SVR3
18443 + X programs side by side with their more modern, and
18444 + common, multi-SPX pipe descendants.
18445 + This does mean that some error returns from an
18446 + open of a TLI special file might be delayed until
18447 + the first operation, however a) these are unlikely
18448 + to occur (they are things like no such protocol)
18449 + and b) most opens of such files are hidden in
18450 + functions like t_open() anyway so if there is a
18451 + problem a simple fix to libnsl to check the first
18452 + ioctl is all that is needed.
18455 + * sysfs() used to enumerate available filesystems seems
18456 + to be 0 based on Linux but 1 based on SYSV.
18460 +Sun Oct 12 00:18:33 GMT/BST 1997
18461 + * Ioctls on the NFS pseudo device need to go via the
18462 + emulation code rather than the native ioctl handler.
18466 +Sat Aug 16 14:56:24 GMT/BST 1997
18468 + * Changed the use of errno in a prototype in ibcs.h to
18469 + avoid possible conflict with an SMP errno definition
18470 + which could get inherited from an include file if we
18475 +Sat Jul 12 01:00:00 GMT/BST 1997
18477 + * Added Xenix locking() modes 5, 6, 7 as per patch from
18478 + David Bruce <admin@hulcote.com> (there were others
18479 + too). I rewrote it to be a bit cleaner but I haven't
18480 + tested it (it's late...). Some one will tell me I guess.
18483 +Fri Jul 11 22:27:13 GMT/BST 1997
18485 + * Added more console ioctl traps to discourage programs
18486 + from trying to do funky stuff with the console without
18487 + logging unsupported ioctl messages.
18490 + * sysfs() can, apparently, map an fs magic number to
18491 + an fs name. We do this outside the kernel sysfs()
18492 + because there seems no clean way to do it. We simply
18493 + have a list of known magic numbers hard coded :-(.
18496 + * Implemented sysconfig(). This is appears to be the SVR4
18497 + forerunner to the POSIX sysconf().
18501 +Tue May 13 20:52:05 GMT/BST 1997
18503 + * Hand off xmknod calls via ibcs_mknod so that we can
18504 + create a directory if that is what the flags imply.
18505 + I have not tested to see if xmknod is allowed to create
18506 + directories - I just noticed it in passing.
18509 + * Added SCO's F_GETHFDO (get highest fd open) fcntl. This is
18510 + used by /bin/csh on SCO OS5 to save a few syscalls.
18514 +Tue May 13 00:10:09 GMT/BST 1997
18516 + * More changes to handle long/short inode environments
18517 + plus more explanation in the code. Are we having fun yet?
18521 +Sat May 10 15:19:39 GMT/BST 1997
18523 + * Added socketpair() to the socksys emulation. This is
18524 + as implemented by SCO OpenServer 5.
18527 + * Change binfmt_coff.c to recognise programs compiled for
18528 + SCO OpenServer 5, programs compiled for SCO 3.2.4 and
18529 + programs compiled under SCO OpenServer 5 but with
18530 + compatibility for ODT3.0. Why? Well, sometimes we
18531 + should be giving long inodes in returns from getdents,
18532 + sometimes short inodes. We don't just want to mask
18533 + off the high part because that can lead to some
18534 + things becoming invisible. We don't want that.
18538 +Fri May 9 23:29:37 GMT/BST 1997
18540 + * Added some more tape ioctls.
18544 +Wed Apr 16 23:12:37 GMT/BST 1997
18546 + * Fix memory leaks in poll.c and change ENOMEM return
18551 +Tue Mar 11 21:29:15 GMT/BST 1997
18553 + * Add {get,set}rlimit to the SYSV personalities.
18557 +Fri Mar 7 21:04:24 GMT/BST 1997
18559 + * Only build x286emul if EMU_X286 is enabled in CONFIG. There
18560 + are many insallations which appear to either not have the
18561 + a.out compiler support or have it installed incorrectly.
18565 +Tue Feb 18 22:04:39 GMT/BST 1997
18567 + * Removed unnecessary and incorrect includes.
18571 +Wed Feb 12 22:03:13 GMT/BST 1997
18573 + * Documentation updates for release.
18577 +Mon Feb 10 22:36:27 GMT/BST 1997
18579 + * Dammit! The inode folding in stat() and getdents() was
18580 + out of step _again_ :-(.
18584 +Sun Jan 5 17:20:20 GMT/BST 1997
18586 + * sysconf(_SC_CLK_TCK) should return the value of HZ.
18589 + * Small clarification to README concerning shared libraries.
18592 + * Removed the bit about UnixWare X binaries not working from
18593 + Doc/HINTS. Now we have STREAMS/TLI emulation this is no
18594 + longer true (and hasn't been for a while).
18598 +Sat Jan 4 19:31:26 GMT/BST 1997
18600 + * If we open() something that is really a socket we close
18601 + it and reopen it using socket(), connect(). This allows
18602 + a Unix domain socket to look like a named pipe which
18603 + enables more SYSV X clients to connect to a local X
18604 + server using the local method (with suitable symlinks
18605 + to map the pathnames).
18609 +Fri Jan 3 22:39:15 GMT/BST 1997
18611 + * Added a (simplistic) implementation of the I_CANPUT SVR4
18615 + * Changed CONFIG.i386 to note that a correct setting of SMP
18616 + is now necessary.
18620 +Wed Oct 2 16:28:39 GMT/BST 1996
18622 + * Intercept mknod() and allow it to create directories. Linux
18623 + doesn't allow this but SYSV does. (What about BSD?)
18627 +Wed Oct 2 15:56:57 GMT/BST 1996
18629 + * Separated out the spx connect code so we can support old,
18630 + single connection spx implementations once we know how to
18634 +Wed Oct 2 15:54:45 GMT/BST 1996
18636 + * At some stage I add some binfmt_elf.c changes that were
18637 + made to the kernel ELF loader in some 2.0.x patch. I forget
18638 + which now but no one should be using the iBCS ELF loader
18639 + currently anyway.
18643 +Fri Aug 23 15:42:04 GMT/BST 1996
18645 + * Moved svr4sig to the right place.
18648 + * Moved error message strings to a separate file so they can
18649 + be shared by emulate.c and solaris.c.
18652 + * CONFIG files now define ARCH to be the CPU architecture. This
18653 + is used to ensure that architecture specific files are only
18654 + used when necessary.
18657 + * Changed the getdents routine in open.c to use the same
18658 + rules for folding 32 bit inodes to 16 as stat and read.
18662 +Mon Aug 19 13:33:42 GMT/BST 1996
18664 + * Correct IPC problem introduced with Sparc changes.
18668 +Fri Aug 9 13:27:49 GMT/BST 1996
18670 + * Fix the inode swapping for /dev/spx and XTI/TLI transports.
18673 + * If a COFF binary doesn't have a .comment section we have no
18674 + way to tell what personality we should be using. Switch to
18675 + SCO anyway - odds on it is.
18679 +Wed Aug 7 14:22:11 GMT/BST 1996
18681 + * On SCO at least lseek on a character or block device
18682 + returns 0 not -ESPIPE.
18683 + -- C.A. Lademann <cal@zls.com>
18685 + * Some problems with /dev/spx and TLI end point handling that
18686 + could leak descriptors, memory and leave the lists of file
18687 + locks in an inconsistent state. Not to mention the fact that
18688 + the socket data in an inode also contains a pointer back to
18689 + the process' file structure. I _think_ I have this sorted
18693 + * Sparc changes broke select. While I was at it I changed it
18694 + to use the newselect Linux call as well. If we build without
18695 + tracing we'll save a few more bytes of code now too.
18699 +Wed Jul 31 14:16:38 GMT/BST 1996
18701 + * Map EAGAIN to EWOULDBLOCK for recv*() and send*() syscalls.
18702 + Linux seems to return EAGAIN. X/Open allows either EAGAIN
18703 + or EWOULDBLOCK. SVR4 and Wyse V/386 specify EWOULDBLOCK in
18704 + their man pages. SCO doesn't admit to non-blocking possibilities
18705 + in their man pages but some code seems to expect only
18710 +Mon Jul 29 16:58:11 GMT/BST 1996
18712 + * Added a CONFIG option for SMP. This is enabled by default.
18713 + I don't think this is a problem for non-SMP systems?
18716 + * Minor change to the SCO error map.
18720 +Fri Jul 26 09:13:43 GMT/BST 1996
18722 + * Updated README and RELEASE
18725 + * Merged Sparc patches from:
18726 + Miguel de Icaza <miguel@roxanne.nuclecu.unam.mx>
18730 +Thu Jul 4 12:24:06 GMT/BST 1996
18732 + * The default is now *not* to build a versioned module. I got
18733 + too many questions about why it wouldn't compile.
18736 + * Fix to binfmt_xout.c when Xenix 286 is emulation is not
18741 +Fri Jun 14 13:36:18 GMT/BST 1996
18743 + * Added code to explicitly fail the SCO LD?MAP ioctls used
18744 + for channel mapping.
18748 +Thu Jun 6 17:21:00 GMT/BST 1996
18750 + * Cleaned up Stephans SCO tape ioctls and added the
18751 + corresponding SVR4 versions (untested).
18755 +Wed Jun 5 10:47:24 GMT/BST 1996
18757 + * Rewritten the Xenix locking() syscall. The previous one
18761 + * Change the read on directory emulation to fold long inodes
18762 + to shorts in the same way as stat and getdents. This may
18763 + help old programs that use stat and read to do a getcwd
18764 + rather than a stat and getdents.
18767 + * Use __get_free_page instead of get_free_page in getdents
18768 + since we don't need the buffer cleared initially (I think).
18772 +Sat Jun 1 09:50:30 MET DST 1996
18773 + * Added some tape ioctrls for SCO to iBCSemul/ioctl.c.
18777 +Fri May 31 08:44:51 GMT/BST 1996
18779 + * Move bsdioctl.c to the main group of source files from
18780 + than the BSD specifics. Just about everything else has
18781 + BSD style sgtty stuff and some seemingly modern code
18782 + actually depends on it (e.g. ISC SVR4 telnet)!
18785 + * Add CONFIG option to build a versioned module.
18788 + * Install the modules in /lib/modules/`uname -r`/misc for
18789 + compatibility with the modules tools.
18792 + * If the requested connection indications in a bind request
18793 + is greater than zero do a listen() if the bind is successful.
18794 + We still also do a listen() if the program selects() on
18795 + a bound but unconnected stream. This may help some broken
18796 + programs. It may also break some broken programs. It's
18797 + debatable whether this should now be in or out.
18800 + * The bit vector mapping used for converting vectors of
18801 + signal flags had an off by one error. The signal maps
18802 + themselves were also one entry short.
18805 + * At some stage I changed the I_SETOWN STREAMS ioctl but
18806 + never committed it?
18810 +Thu May 9 12:51:10 GMT/BST 1996
18812 + * Change to install in /lib/modules/`uname -r`/misc instead
18813 + of /usr/lib/modules for compatibility with the way the
18814 + modules tools have gone.
18818 +Thu Apr 25 12:34:06 GMT/BST 1996
18820 + * Use the CONIND_number in a T_BIND_REQ to decide whether
18821 + or not we should listen() on the socket.
18825 +Mon Apr 22 15:42:47 GMT/BST 1996
18827 + * Added a simple loader that will attempt to pass scripts
18828 + that start with ":" and things that look like simple text
18829 + to /bin/sh. Hopefully this isn't going to conflict with
18830 + magic for other needed formats...
18834 +Fri Mar 29 17:11:35 GMT/BST 1996
18836 + * Committing the all new TLI/XTI options handling. Note that
18837 + TLI and XTI option handling is mutually exclusive at the
18838 + moment. The default is to enable TLI options handling since
18839 + that is what existing SVR3/4 systems use. I haven't found
18840 + one that actually handles X/Open format (they use the
18841 + TNOTSUPPORT cop out) so I don't know how the stack is
18842 + told to use XTI format instead of TLI.
18843 + Note that only SOL_SOCKET/* and SOL_TCP/TCP_NDELAY are
18844 + known to work to any extent at the moment. Others may (or
18845 + may not need mapping) but I can't find the motivation to
18846 + wade through the headers and create yet another table of
18847 + magic numbers. Hopefully everyone just nicked the BSD
18848 + reference code...
18851 + * Some more 1.3.7x changes related to process accounting
18852 + (fork but no exec etc.).
18856 +Wed Mar 20 13:36:07 GMT/BST 1996
18858 + * I seem to have forgotten to add a comment about merging
18859 + changes from mid 1.3.7x kernels.
18863 +Wed Feb 28 14:53:00 GMT/BST 1996
18865 + * Fix to shared library loader in binfmt_aout.c from kernel
18870 +Wed Jan 24 09:58:34 GMT/BST 1996
18872 + * Implemented I_PEEK.
18875 + * Changed I_NREAD to understand that control messages constitute
18880 +Fri Jan 19 11:57:20 GMT/BST 1996
18882 + * Make the socket level connect in timod.c happen synchronously
18883 + always. Allowing the async possibility is a little harder.
18887 +Thu Jan 18 16:06:13 GMT/BST 1996
18889 + * Added (some of) the intial framework for option management.
18890 + This is documented by X/Open but many XTI stacks don't
18891 + seem to implement it. Certainly the man page for t_optmgmt
18892 + in SCO OS5 says it isn't yet implemented. There do seem
18893 + to be programs out there that make options requests though.
18894 + Unfortunately I don't have one right now so this is currently
18895 + disabled and MAY CAUSE KERNEL FAULTS. I don't know...
18899 +Tue Jan 16 12:35:21 GMT/BST 1996
18901 + * Added a slight change to mmap.c. The SVR4 headers describe
18902 + a slight change in functionality which is specified with
18903 + a special flag that is supposedly set by the C library
18904 + interface. I haven't actually seen this flag set by the
18905 + SVR4 dynamic loader (which is the only mmapper I've seen)
18906 + and things seem to work with or without this change. It
18907 + may not be necessary at all?
18911 +Fri Jan 12 14:56:38 GMT/BST 1996
18913 + * Remove trace flag from context() in the callmaps. SVR4's
18914 + /bin/sh seems to use it but doesn't care if it fails.
18917 + * Added the SCO OS5 SI86GETFEATURES request to sysi86(). OS5
18918 + uses this to establish what "features" are available when
18919 + a program starts (i.e. in crt*.o). Currently we just return
18920 + the same vector as OS5 itself. I haven't found what the
18921 + flags mean - but one of them indicates xstat extensions
18922 + which I have added to iBCS.
18925 + * Change .comment parsers in binfmt_coff.c and binfmt_elf.c
18926 + so we only grab a single page (asking for two contiguous
18927 + pages is antisocial) and then roll through the comment
18928 + section in stages.
18931 + * Fixes to binfmt_elf.c and binfmt_aout.c so they compile
18932 + and load with 1.3 kernels.
18936 +Tue Jan 9 14:29:49 GMT/BST 1996
18938 + * Add a kludge to the TLI connect code. For some reason, under
18939 + ISC SVR4, telnet seems to gve the port number in network
18940 + byte order ok but the X programs give it in host byte order.
18941 + One of them is wrong but presumably both work on ISC (I don't
18942 + have the hardware to actually install it). We kludge around
18943 + it here by checking if we are SVR4, AF_INET, port 6000 (host
18944 + order) and, if so, change it to port 6000 (network order).
18945 + This will break anything that wants to make an outgoing
18946 + call to port 28695. There are probably other things that
18947 + expect incorrect port numbers to work but there seems to
18948 + be no easy solution here.
18952 +Fri Jan 5 13:34:43 GMT/BST 1996
18954 + * First draft of code to handle select/poll on transport end
18955 + points correctly. This isn't well tested but should be good
18956 + enough to support normal timod usage.
18960 +Thu Jan 4 13:52:25 GMT/BST 1996
18962 + * TLI changes to get error returns from connects correctly.
18966 +Wed Jan 3 17:06:07 GMT/BST 1996
18968 + * Added a manual page in the Doc directory. This is not
18969 + installed by default.
18972 + * Fixed a problem in the .comment parsers in binfmt_elf.c
18973 + and binfmt_coff.c where a number of pages was passed to
18974 + __get_free_pages() instead of a binary power. This has
18975 + been in release versions of binfmt_coff.c for a long
18976 + time but exactly one person has reported anything that
18977 + might be attributable to it. Strange, since the bug should
18978 + have manifested itself as insidious memory leakage and
18983 +Wed Jan 3 12:16:47 GMT/BST 1996
18985 + * Removed all kernel patches in the Patches directory. None
18986 + should be need for kernels 1.3.50 (or earlier?) and onwards.
18987 + None should be essential for 1.2.13 - although some capability
18988 + is lost notably SCO OpenServer 5 ELF binaries (if the kernel
18989 + ELF loader is present) and BSD a.out binaries.
18992 + * Another fix to termio[s] ioctls to get the control character
18993 + settings right for SVR4. Previously this was just copied
18994 + from the SCO mapping and just never got changed.
18998 +Thu Dec 14 10:41:36 GMT 1995
19000 + * Added basic getpmsg/putpmsg support. It doesn't do anything
19001 + with bands but we don't have anyway to use them.
19005 +Tue Dec 12 09:38:01 GMT 1995
19007 + * First commit of the major TLI rewrite for Eric Sixt. This
19008 + should be enough for normal TCP & UDP clients. It may be
19009 + sufficient for servers as well but this is untested so far.
19010 + The client stuff has been tested with SCO cu, ISC telnet
19011 + and custom test code down to the getmsg/putmsg level. A shared
19012 + libnsl_s is also included. This has the functions needed for
19013 + clients but lacks some needed for servers currently. It has
19014 + been tested on a real SCO system. It could be done better
19015 + (and should be) but for now we are interested in making existing
19016 + programs work rather than handling all the error conditions
19017 + by the book. The library uses SVR3 shared library tools and
19018 + needs to be built on an SVR3 system (I used SCO).
19019 + Included is a rewrite of the /dev/spx kludging (the old didn't
19020 + work if TLI was enabled). This now allows connections to other
19021 + than /tmp/.X11-unix/X0 (if configured) so you can run multiple
19022 + X servers on the VCs and display SCO X programs on all of them.
19023 + The major/minor numbers used for the emulation devices have
19024 + (necessarily) changed. The top level Makefile will (re)create
19025 + them on a "make install" or "make devices".
19026 + Oh yeah, I built stubs for other libraries as well (specifically
19027 + SCO/SecureWare protlib_s) but don't expect it to have any real
19028 + support. If programs _really_ need stuff from there they are
19029 + like to have reduced or completely broken functionality on
19031 + The script I used to generate the skeleton APIs for the
19032 + shared libraries is libs/mkltab if anyone feels the urge to
19033 + look at other libraries...
19036 + * Removed the old quota compile option. It isn't compatible with
19037 + the quota stuff in 1.3.46 and would only cause confusion. This
19038 + means you can't use iBCS if you have the old quota patches
19039 + in a pre-1.3.46 kernel. Tough :-).
19043 +Mon Dec 11 15:14:46 GMT 1995
19045 + * Map I_SETSIG/I_GETSIG to FIOSETOWN/FIOGETOWN and pray...
19048 + * Fixed possible memory leak in COFF & ELF personality recognition
19049 + when the offset/size of the .comments section is invalid. This
19050 + could leak when the .comments section exists but is zero bytes
19055 +Wed Dec 6 11:31:27 GMT 1995
19057 + * A stat of a file must give an inode that matches what we get
19058 + from a read of the directory since code that figures out cwd
19059 + needs the inodes to match. Mind you, if there are several inode
19060 + numbers greater than 65534 in the directory we are going to get
19061 + some strange paths. I don't know if this is fixable properly at
19065 + * Yes it is. We just mask off the high word to get the short
19066 + inode number for the stat structure.
19070 +Thu Nov 30 16:21:32 GMT 1995
19072 + * Fix the SVR4 additions to the V7 terminal ioctls. Add handling
19073 + of TIOC[GS]ETD. Have TIOCL[GS]ET trivially succeed (I can't
19074 + find the documentation for the arguments).
19078 +Wed Nov 29 12:57:42 GMT 1995
19080 + * Changed the guesswork svr4_waitsys to implement the correct
19084 + * Enable the i486-linuxaout option in x286emul/Makefile by
19085 + default. There seem to be significant numbers of people
19086 + using ELF compilers now. This may be a mistake...
19089 + * Fixes to sigsuspend and sigpause in signal.c. The previous
19090 + invocations of the Linux sigsuspend syscall were wrong and
19091 + liable to lead to random freeze ups of programs which used
19092 + sigsuspend() or sigpause().
19096 +Fri Nov 24 11:03:01 GMT 1995
19098 + * Interactive SVR4 seems to be overloading the BSD termio
19099 + ioctls with its own.
19102 + * The SVR4 procid subcodes don't match the SCO ones. Or, at
19103 + least, I seem to remember I got the orignal set from SCO
19104 + and UnixWare and Interactive SVR4 are different (but match
19109 +Thu Nov 23 17:21:56 GMT 1995
19111 + * Interactive SVR4's /bin/sh calls access(..., 011) but Linux
19112 + returns EINVAL if the access mode has any other bits than
19113 + 007 set. So we have to wrap it and mask it :-(.
19117 +Wed Nov 22 10:11:49 GMT 1995
19119 + * Change to binfmt_elf.c to set total_vm value introduced in
19124 +Thu Nov 16 15:02:58 GMT 1995
19126 + * Added support for SCO OpenServer 5 binaries using .comment
19127 + section parsing as with COFF.
19128 + Built a BSD capable a.out loader as part of iBCS.
19129 + The iBCS ELF loader is only used for recognised (using
19130 + .comments) binaries if the standard ELF loader is configured
19131 + in the kernel iBCS is built against. If the ELF loader is
19132 + not configured in the kernel iBCS is built against the iBCS
19133 + ELF loader is used for all ELF binaries. This prevents the
19134 + iBCS module from becoming un-unloadable on ELF based Linux
19136 + Similarly the iBCS a.out loader tries to avoid dealing
19137 + with anything other than BSD binaries for the same reasons.
19138 + This requires a kernel 1.3.42 or greater to allow iBCS
19139 + to insert its loaders into the list before the standard
19140 + kernel ones. Kernels 1.3.39(~) to 1.3.41 have some support
19141 + but there are bugs which will likely prevent you running
19142 + *anything* as soon as iBCS is loaded. Mea culpa. Tough.
19146 +Thu Nov 16 11:00:08 GMT 1995
19148 + * Minor clean up in binfmt_coff.c and fix a minor bug in
19149 + parse_comments that caused it to miss checking a string
19150 + if there was a zero length string in among.
19154 +Fri Nov 10 12:22:05 GMT 1995
19156 + * Changes for latest module bogosities (~1.3.38). We need to
19157 + define __NO_VERSION__ to avoid linux/module.h putting
19158 + a kernel_version in *every* damn file.
19162 +Tue Nov 7 10:55:05 GMT 1995
19164 + * When stealing temp space from the stack we have to actually
19165 + move esp down and then restore it as the 1.3.x kernels add
19166 + a check to trap out of bounds stack accesses. This is not
19167 + tested but I think it only affects the TLI emulation code
19168 + which is disabled by default.
19172 +Mon Oct 9 11:22:29 BST 1995
19174 + * Use kernel readv/writev if available.
19178 +Thu Sep 14 12:21:48 BST 1995
19180 + * Changed references to current->sigaction to allow for the
19181 + changes in kernel patch 1.3.26 which allow sharing of signal
19182 + state between clone processes.
19186 +Mon Sep 4 10:04:22 BST 1995
19187 + Originally: Wed Aug 2 09:57:56 GMT 1995
19189 + * Removed Xenix interrupt bug, created wait() workaround
19190 + for INFORMIX-SQL and built the locking() to fcntl()
19192 + -- Peter <polte@bbtt.com>
19195 +Wed Aug 30 09:19:54 BST 1995
19197 + * Merged kernel patch for binfmt_elf.c from 1.3.21 which sets
19198 + EDX to zero on process start up. See the comment in the code
19203 +Tue Aug 29 08:44:50 BST 1995
19205 + * Workaround. Local X won't work because a putmsg occurs
19206 + after we have already swapped the open descriptor for a
19207 + Unix domain socket. We either need to peek at socket
19208 + internals or actually implement the messages for passing
19209 + file descriptors. This quick fix enables local X connections
19210 + if we build without XTI support.
19214 +Tue Aug 8 11:36:41 BST 1995
19216 + * Fix streams kludging so local X works again (should do
19217 + anyway - it's untested as yet due to hard disk collapse.
19218 + Hopefully someone will tell me if it doesn't work.)
19222 +Mon Jul 31 13:25:58 BST 1995
19224 + * Changes to allow compilation in the presence of a kernel
19225 + built with the quota patches.
19226 + -- Dimitrios Mpougoulias <dbougo@leon.nrcps.ariadne-t.gr>
19229 +Tue Jul 18 09:01:53 BST 1995
19231 + * Fixed timod getinfo ioctl. This functionality should move
19232 + into the message handling as bind has.
19236 +Mon Jul 17 10:16:43 BST 1995
19238 + * Added handling of BSD-ish sgtty ioctls. For some reason the
19239 + SVR4 network programs such as telnet have been modified to
19240 + pushd the ttold STREAMS modules and use sgtty calls instead
19241 + of simply using termio[s]. Don't blame me! :-)
19244 + * Restructuring of timod.c complete. Timod ioctls now use
19245 + message routines to avoid duplicating code.
19249 +Wed Jul 12 14:44:30 BST 1995
19251 + * Made debug output in binfmt_coff.c less verbose. We only
19252 + really care about matched comment strings. If we dump them
19253 + all here we overrun the kernel message buffer and miss
19254 + interesting stuff when the program actually starts running.
19257 + * Changed __get_free_pages in binfmt_coff.c to give the extra
19258 + argument required in 1.3 kernels.
19262 +Tue Jul 4 11:48:27 BST 1995
19264 + * Restructure timod.c ready to rewrite timod_ioctl to use
19265 + putmsg/getmsg rather than reimplementing the same message
19270 +Mon Jul 3 13:41:49 BST 1995
19272 + * Initial TLI support for outgoing TCP and UDP. Merged BSD/Wyse
19273 + socket ioctl handling with the socksys handler. Fixed (some)
19274 + bugs in poll() emulation. Devices in /dev/inet have changed
19275 + to support TLI access. See README for details.
19279 +Tue Jun 27 09:00:02 BST 1995
19281 + * Don't export symbols from iBCS. I'm not sure when register_symtab
19282 + was introduced so we only drop our symbol table in 1.3
19286 + * Added missing brackets in binfmt_elf.c as per kernel
19291 +Thu Jun 22 13:09:49 BST 1995
19293 + * Big step forward with TLI. I now seem to understand what is
19294 + happening when and have enough to do the initial open and
19295 + get info requests. This may one day actually work...
19298 + * Trap EUC ioctls and return EINVAL. We don't do EUC :-).
19301 + * Changes for the 1.3 development kernel. This compiles but is
19302 + as yet untested. It still seems ok with 1.2.10.
19306 +Wed Jun 14 09:15:39 BST 1995
19308 + * Added Eric's protection mapping fixes to binfmt_elf.c
19313 +Fri Jun 9 12:31:53 BST 1995
19315 + * Linux can't stat unmounted filesystems but SCO can (by
19316 + specifying the pathname/fd of a block device and the
19317 + filesystem type. Linux will just stat the filesystem
19318 + that the device node is on (i.e. the root filesystem).
19319 + There isn't much we can do about it. I just lie and
19320 + claim there is 100MB free of 1GB. I hope this won't
19321 + cause too much grief...
19325 +Thu May 18 12:06:50 BST 1995
19327 + * When trying to get an IP domain name don't try the utsname
19328 + domainname if it is "(none)". If we get that far we have to
19329 + give in and return a blank domain name.
19333 +Wed May 17 10:15:42 BST 1995
19335 + * Recheck the socket functions when accept returns a new socket.
19336 + This is pedantic at this stage since we must have had a
19337 + socket initially and the current kernel code isn't likely
19338 + to handle removal and reloading of in use modules. iBCS
19339 + can handle this happening to it though :-).
19342 + * Fix timod faking to correctly return an error if given an
19343 + invalid file descriptor rather than trying to dereference
19344 + a null pointer in kernel mode.
19348 +Tue Apr 25 11:35:43 BST 1995
19350 + * If nap() is given a zero timeout return immediately rather
19351 + than blocking indefinitely. Ensure that SIGALRM is not ignored
19352 + during the pause or we never get woken up by the timeout.
19356 +Mon Apr 24 09:21:30 BST 1995
19358 + * Various documentation updates from Eric.
19362 +Fri Apr 21 14:34:25 BST 1995
19364 + * Fixes to IPC. Now it really *should* work...
19368 +Thu Apr 13 14:03:45 BST 1995
19370 + * Tidy up documentation ready for new release.
19374 +Wed Apr 12 11:07:52 BST 1995
19376 + * Moved to an ELF development system with a GCC 2.6.4 snapshot.
19377 + This pointed out a few signed/unsigned mismatches so I
19378 + fixed them. We also have to ensure that x286emul is built
19379 + as a QMAGIC a.out because it won't work any other way. It
19380 + isn't likely to work any other way unless someone pays for
19381 + for it to be done - it isn't what you might call a "sexy"
19386 +Wed Apr 12 08:53:22 BST 1995
19388 + * Added the kernel patch to handle statically linked SVR4 ELF
19389 + binaries to the Patches directory since it doesn't seem to
19390 + have made any of the 1.2.x patches yet.
19394 +Tue Mar 28 09:55:38 BST 1995
19396 + * Made the ISC specific stuff optional via CONFIG.
19399 + * 1. INTERACTIVE UNIX signal numbers are different from IBCS2.
19400 + I added new signalmaps and exec_domains.
19401 + 2. setpgrp does not deattach the controlling terminal.
19402 + Try the setpgrp test program included here after the patch
19403 + on real SCO or xxxx and Linux/IBCS2.
19404 + 3. sigset behavior is incorrect. Test program also included.
19405 + Short description: signal handlers registered whith sigset
19406 + should run with the signal blocked, and after return
19407 + the handler must be restored, so sa_flags = 0
19408 + is the correct setting.
19409 + Calling sigset should remove the signal from the
19411 + -- Remete Gabor <rg@tomx.elte.hu>
19414 +Fri Mar 24 10:20:57 GMT 1995
19416 + * Set the fragment size to zero for [f]statfs() just to be
19417 + pedantic (SCO does this).
19421 +Tue Mar 21 10:24:14 GMT 1995
19423 + * Fixes to 286 overlay and x.out loader by Don Camp
19424 + <don@funsoft.com>.
19427 + * New code for SVR4 {get,set}groups since SVR4 uses longs
19428 + for gids whereas Linux uses shorts.
19432 +Mon Mar 20 17:06:23 GMT 1995
19434 + * Added code for waitsys(). This is guesswork at this stage
19435 + but appears sufficient for ISC 4.0 ksh to do something
19436 + reasonable in the simplest case.
19440 +Tue Mar 14 09:44:13 GMT 1995
19442 + * Initial implementation of ptrace. This allows programs
19443 + (SCO and Wyse V/386 programs) to access a process'
19444 + registers but actual tracing semantics will be difficult
19445 + to make functional.
19448 + * Alter emulate return to allow return of numbers > 2^^31
19449 + which don't fall in the error code space.
19452 + * Added signal mapping to wait() syscalls.
19455 + * Updated the main README with the vger mailing list details
19456 + and a few other tidy ups.
19460 +Thu Mar 9 10:10:53 GMT 1995
19462 + * Added a load more system calls to the SVR4 tables (these
19463 + match UnixWare at least I think). Some of these may work,
19464 + some are just marked to shut up run time warnings.
19467 + * Increased the size of the buffer used for parsing comment
19468 + sections in binfmt_coff.c to 8k (from 1k). There are
19469 + programs out there that need it.
19473 +Tue Mar 7 16:12:36 GMT 1995
19475 + * More XLI/TLI changes - mostly fixes.
19478 + * Added basic handling of the termiox extension used by SVR4
19479 + to give access to hardware flow control. Only RTS & CTS
19480 + or nothing is allowed because that's all Linux does. The
19481 + same comments as below apply to the status of this.
19484 + * Rework ioctl handling for termios. SCO uses short in a termios
19485 + structure, SVR4 uses longs. The bit shuffling used for SVR4 is
19486 + the same as for SCO - there are known to be some slight
19487 + differences but these are not believed to be critical for
19488 + most things. A large amount of guesswork went in to this.
19489 + One day I may be able to test it...
19493 +Mon Mar 6 12:31:05 GMT 1995
19495 + * Added a -DMODULE to iBCSemul/Makefile to make new style kernel
19500 +Fri Mar 3 15:04:14 GMT 1995
19502 + * Patches from Eric. (Use Eric's [f]statvfs instead of mine).
19506 +Thu Mar 2 11:46:03 GMT 1995
19508 + * Fixed a silly in the handling of SO_IMASOCKET and SO_PROTOTYPE
19509 + plus added a check on the given buffer length.
19512 + * Fixed a silly in the sockopt.inc options mapping.
19516 +Wed Mar 1 14:20:06 GMT 1995
19518 + * Added SVR4 console keyboard mapping and termcap/terminfo
19519 + options to the PROD.Patches directory.
19523 +Mon Feb 27 13:30:17 GMT 1995
19525 + * Added simpleminded implementation of [f]statvfs().
19528 + * [f]statfs() now respects the length argument to allow for
19529 + older/smartass code which uses a smaller buffer size.
19533 +Fri Feb 17 10:33:23 GMT 1995
19535 + * More tidy up, a little more work on TLI/XTI (still nowhere
19536 + near usable), fixed the signal debugging messages so it
19537 + makes more sense.
19541 +Thu Feb 2 12:45:25 GMT 1995
19543 + * Changed the BSD termio ioctl handler to recognise the fact
19544 + that some provide V7 compatibility and may be invoked from
19545 + non-BSD binaries - possibly without BSD size encoding.
19548 + * Changes for 1.1.88. More definitions moved around in the
19549 + Linux header files :-).
19553 +Fri Jan 27 10:12:51 GMT 1995
19555 + * Also mapped new Linux SIGIO to iBCS SIGIO and changed Linux
19556 + SIGURG to map to SIGUSR1 as documented in SCO's TCP/IP
19557 + programmer's guide. Is SVR4 the same? How badly do we care?
19560 + * Had to add a new personality for Xenix binaries since they
19561 + have a different number for SIGPOLL - sigh...
19565 +Mon Jan 23 15:34:01 GMT 1995
19567 + * Changes to includes for 1.1.84.
19570 + * Change to binfmt_elf.c from kernel patch 1.1.84.
19574 +Tue Jan 17 17:10:25 GMT 1995
19576 + * Added tracing of argument and environment vectors passed
19581 +Mon Jan 16 11:34:58 GMT 1995
19583 + * Change socksys.c for 1.1.81. There doesn't seem to be a
19584 + convenient define to test but I intended to roll out
19585 + most of the "magic" define testing for 1.2 to clean
19589 + * Ensure the segment registers are correctly set up when we
19590 + exec a new program - the LDT we may have been using before
19591 + no longer exists.
19595 +Fri Jan 6 11:32:52 GMT 1995
19597 + * Fixed a problem where the Xenix 286 emultor wasn't getting
19598 + the correct return and error codes from lcall7s.
19601 + * Added support for exec() in the Xenix 286 emulator.
19604 + * Made the spin-before-launch trap in binfmt_xout.c settable
19605 + via a trace option, "xout-block". This is used to attach
19606 + gdb to a 286 process to debug the emulator.
19609 + * Fixed a problem with binfmt_xout.c setting the wrong intial
19610 + brk value for impure segmented binaries. The checks for brk
19611 + collisions with mapped space were failing brk changes. Before
19612 + the brk checks were introduced I image we simply trashed
19617 +Thu Jan 5 11:21:51 GMT 1995
19619 + * Added some debug to the STREAMS I_PUSH and I_POP. Also made
19620 + them succeed without actually doing anything. We may be able
19621 + to work round some instances of STREAMS usage one day...
19625 +Wed Jan 4 11:17:14 GMT 1995
19627 + * Change yesterday's mkdir to use getname()/putname() to
19628 + fetch the pathname from user space. I hadn't realised
19629 + these were already in ksyms.c (although how long have they
19630 + been there? This breaks compatibility with older versions
19631 + of the kernel I guess).
19634 + * Implement the NIOC ioctls for getting file handles since
19635 + Oracle's TCP server seems to be wanting to do this for some
19636 + reason (why???). This is a simple implementation that simply
19637 + fills in the device number of the filesystem and the inode
19638 + number of the file. This seems to agree with what SCO is
19639 + doing. I don't know what the "exported" fields are or should be.
19643 +Tue Jan 3 14:31:13 GMT 1995
19645 + * POSIX says that a pathname ending with a '/' means the current
19646 + directory whereas SYSV drops the trailing slash. This is only
19647 + a problem with mkdir() I think.
19651 +Fri Dec 16 16:25:44 GMT 1994
19653 + * Added basic support for Wyse V/386 MPX syslocal().
19657 +Fri Dec 9 09:14:04 GMT 1994
19659 + * Changed eaccess() again. We should always set the uid/gid
19660 + rather than fsuid/fsgid since the Linux access() call is
19661 + getting fsuid/fsgid from the current uid/gid.
19664 + * Don't bother trying to read x.out segments which have no
19665 + data in the executable.
19669 +Thu Dec 8 11:51:06 GMT 1994
19671 + * Only include <linux/segment.h> if <asm/segment.h> hasn't
19672 + defined KERNEL_DS. The header in the linux subdirectory
19673 + was obsoleted in 1.1.69.
19677 +Fri Dec 2 13:50:03 GMT 1994
19679 + * Force QMAGIC format when building x286emul.
19682 + * Patches for 1.1.69.
19686 +Thu Dec 1 13:50:37 GMT 1994
19688 + * Binfmt_xout.c now checks the trace flag to see if debug messages
19689 + should be produced. Trace now has an "xout" option. Trace is
19690 + now a Linux binary which uses a personality() syscall to enable
19691 + emulation so the iBCS trace syscall becomes accessible.
19694 + * Changed binfmt_xout.c to use 0x1020 as the entry point for
19695 + the x286emul kludge overlay. This is the expected value
19696 + for a QMAGIC binary which is the default with the newest
19697 + compiler. Really I think uselib() should return something
19698 + useful but I haven't decided what.
19701 + * Made the schedule() trap (so gdb can be attached before the
19702 + process starts running) in binfmt_xout.c a CONFIG option
19703 + controlled by the XOUT_TRACE setting.
19706 + * Moved the configuration for the optional items out of Makefile
19711 +Wed Nov 30 17:08:05 GMT 1994
19713 + * Fixed a nasty bug in binfmt_coff.c where an extra page was
19714 + being allocated in the bss causing brk() checks in 1.1.64
19715 + and later to fail _in_certain_circumstances_.
19719 +Wed Nov 30 13:58:46 GMT 1994
19721 + * Added support for unpacking ioctls passed via the STREAMS
19722 + interface and forwarding them to the file descriptor. With
19723 + a slight change to socksys so that devices with minor 2 get
19724 + an anonymous dgram socket immediately they are opened this
19725 + allows many more network programs to work. Thanks to an old
19726 + piece of code from Chip Rosenthal for revealing how it all
19727 + worked - it isn't in the documentation :-).
19731 +Wed Nov 30 11:27:56 GMT 1994
19733 + * Fixed handling of brk and BSD sbrk so error returns are
19734 + handled correctly.
19737 +Mon Nov 28 10:48:25 GMT 1994
19739 + * When doing an IPC_STAT on a semaphore force the semaphore
19740 + number to be zero as the kernel code erroneously checks
19745 +Fri Nov 25 14:26:41 GMT 1994
19747 + * Massive rework of ipc.c. The previous one was buggy as hell.
19748 + This one works with all the demo programs from the Wyse V/386
19749 + IPC documentation. Hopefully someone is going to test it with
19750 + some *real* applications!
19754 +Tue Nov 22 09:11:46 GMT 1994
19756 + * Change the TTYDEVTYPE ioctl to say we on a pseudo terminal
19757 + rather than a console. Anything calling this is likely to
19758 + want to try fancy stuff like mapping the console memory
19759 + and playing with I/O ports if it thinks we are on a console.
19763 +Tue Nov 22 09:07:04 GMT 1994
19765 + * Allow direct usage of 57600 and 115200 serial speeds from
19766 + the BSD domain with kernels 1.1.65 and later.
19767 + The mask-and-merge for iBCS<->Linux termios should be checked
19768 + as we tend to try and preserve unmappable bits where there
19769 + is no other conflict. In 99% of cases we won't see a problem
19774 +Mon Nov 21 10:05:19 GMT 1994
19776 + * Slight change to previous patch. Confusion over which struct
19777 + size we should be using for the verify_area plus we need to
19778 + do a VERIFY_WRITE as we will rewrite the data before returning.
19781 + * Changes to ipc.c for reading structures from user space.
19782 + -- Roberto Bagnara <bagnara@di.unipi.it>
19785 +Thu Nov 17 15:24:23 GMT 1994
19787 + * Some of the unused KD ioctls were removed from Linux 1.1.64
19788 + (or was it 63?). Changed vtkd.c accordingly.
19792 +Fri Nov 11 14:15:09 GMT 1994
19794 + * Moved the x286emul overlay to /usr/lib instead of /lib. There
19795 + is no real need for this to be on the root filesystem.
19799 +Mon Nov 7 13:51:55 GMT 1994
19801 + * Added a version of the BSD exec.c patch for Linux 1.1.62.
19804 + * Extended SCO keyboard mapping for new kbd.
19808 +Tue Nov 1 10:57:18 GMT 1994
19810 + * Changed the personality test in the BSD kernel patch. Apparently
19811 + FreeBSD uses a machtype of 134 so it's safer to test for Linux
19816 +Fri Oct 28 11:25:43 GMT 1994
19818 + * General clean up of the configuration options in the Makefile
19819 + and elsewhere. It is now possible to choose which loaders are
19820 + included and whether or not BSD or Xenix 286 emulation is
19824 + * Added the x286emul overlay library. This is still very alpha
19825 + but SCO's /bin/masm seems to do the things expected of it :-).
19829 +Wed Oct 5 17:00:13 BST 1994
19831 + * Fleshed out the F_CHSIZE and F_RDCHK fcntls. I still don't
19832 + know if these are ever used from the user layer.
19836 +Tue Oct 4 13:17:32 BST 1994
19838 + * Fixed the BSD termios mappings. This _looks_ ok from the
19839 + point of view of the NetBSD stty.
19843 +Fri Sep 23 11:08:31 BST 1994
19845 + * Add SCO ODT version of CorelDraw to COMPAT file.
19849 +Thu Sep 22 09:25:04 BST 1994
19851 + * Added the phone numbers of McGraw Hill's order desk to the
19855 + * chsize() was causing a segment error. The callmap entry punted
19856 + to a Linux system call but the argument count was not negative
19857 + resulting in a call to a bad function pointer.
19860 + * Linux doesn't have the l_sysid field in struct flock so we need
19861 + to slide the l_pid field down a word after doing a locking
19866 +Tue Sep 20 10:31:01 BST 1994
19868 + * Added a simplistic implementation of writev since BSD seems
19869 + so keen to use it as much as possible.
19872 + * Fixed the x.out loader (mostly). This requires a minor patch
19873 + to the kernel. Expect this to be put in to the kernel itself
19874 + sometime after 1.1.51. Segment support is still buggy and
19875 + therefore disabled. If programs assume they know what segments
19876 + exist it they are broken anyway!
19880 +Wed Sep 14 11:24:18 BST 1994
19882 + * Added extra fcntl code 14 (used by SVR4 for GETLCK).
19886 +Tue Sep 6 10:58:49 BST 1994
19888 + * Added setting of fsuid/fsgid to the loaders and changed the
19889 + eaccess() function in xnx.c to flip fsuid/fsgid rather than
19890 + uid/gid. If you were having problems with setuid/setgid iBCS
19891 + binaries this is likely to help.
19895 +Mon Sep 5 15:07:06 BST 1994
19897 + * Fixed the bad initialisation of howcnv in signal.c.
19901 +Fri Sep 2 11:01:26 BST 1994
19903 + * Added a little program to the Tools subdirectory which will
19904 + restamp old binaries with the Linux machine type rather than
19905 + zero which is used by BSD. Once this is done you can reliably
19906 + distinguish between BSD and Linux binaries (the current Linux
19907 + linker will set the correct machine type on all new binaries).
19910 + * Updated the BSD patch.
19913 + * Changed binfmt_coff to avoid passing meaningless MAP_DENYWRITE
19914 + and MAP_EXECUTABLE flags to mmap when we are not actually
19915 + mapping from a file. It would probably never be a problem...
19919 +Tue Aug 23 17:21:45 BST 1994
19921 + * Added my device trace stub in case anyone needs to investigate
19922 + and emulate some special device.
19926 +Wed Aug 17 14:06:34 BST 1994
19928 + * Added an extern definition of the formats list needed by
19929 + the 1.0.x hooks. Presumably this went AWOL at some stage?
19933 +Fri Aug 12 09:52:38 BST 1994
19935 + * Slight change to the socksys major allocation. Removed
19936 + redundant error message.
19940 +Wed Aug 10 08:57:32 BST 1994
19942 + * Added the spelling corrections from the 1.1.42 kernel patch.
19946 +Fri Aug 5 10:05:14 BST 1994
19948 + * Added Scott Michel's SCO multiscreen patches.
19951 + * More changes to loaders for latest kernel changes.
19955 +Wed Jul 27 10:59:14 BST 1994
19957 + * Changes for 1.1.36 vm/mprotect.
19961 +Tue Jul 26 14:20:27 BST 1994
19963 + * Tidied up the system call maps a little. ISC is now handled
19964 + by the same maps as SCO.
19968 +Wed Jul 20 12:39:55 BST 1994
19970 + * Removed the lock.patch. This is in the latest kernels.
19973 + * Changed the socksys/SCO utsname stuff to do the right thing
19974 + if we have the hostname set to the fqdn and the domainname
19975 + set to the NIS domain. If hostname is not an fqdn we assume
19976 + we are using the domainname == IP domain convention.
19980 +Wed Jun 29 13:34:34 BST 1994
19982 + * Revised the lock.patch to fix the unlock problem and allow
19983 + locks on devices. This should go to Linus (and probably has).
19986 + * Removed the kernel 1.1.20 patch. This isn't needed as of
19991 +Mon Jun 27 09:26:24 BST 1994
19993 + * Can't use select() for nap() since the Linux select system
19994 + call expects to pull its arguments from the user stack.
19995 + Rewritten nap() using itimers.
19998 + * More fixes from Eric for 1.0 compatibility.
20002 +Fri Jun 24 09:37:50 BST 1994
20004 + * Added a bit about time zones to the HINTS file.
20007 + * First draft of BSD termios mapping. Still buggy. Needs
20008 + work to be useful.
20011 + * Fixed BSD getdirentries() to align dirents on long word
20012 + boundaries. 'ls' now works and 'tcsh' finds and executes
20013 + commands successfully.
20016 + * ibcs_exit should be listed in callmap.inc with arg count 1
20020 +Thu Jun 23 09:48:43 BST 1994
20022 + * Lots more BSD-ish stuff. Commit now for release since there is
20023 + confusion over versions at the moment.
20026 + * List Xess MOTIF spreadsheet in COMPAT file.
20027 + -- Michael K.Johnson <johnsonm@merengue.oit.unc.edu>
20029 + * When slurping in mis-aligned COFF binaries we shouldn't be
20030 + aligning the file offset and virtual address to a page
20034 + * Merged Eric's latest patches for 1.0 compatibility and Linux
20035 + ELF capability. This was done by hand. I think it's perfect...
20039 +Wed Jun 22 14:28:38 BST 1994
20041 + * Many sigsuspend entries in the callmap had argumetn counts
20042 + of 1 instead of Spl. This caused kernel faults.
20045 + * Implemented the ioctls for the pseudo nfs device which under
20046 + SCO is used to get/set the NIS domain. You need to link
20047 + /dev/nfsd to /dev/socksys.
20050 + * The socksys getdomainname() was doing the same write null to
20051 + kernel space instead of user space as the wysev386 version.
20055 +Tue Jun 21 08:54:34 BST 1994
20057 + * Use the map_bitvec() function (added as part of the BSD changes)
20058 + in signal.c. Note that there were quite a few mapping bugs in
20059 + the old code. I think I got them all but few would have been
20060 + triggered by my SCO and Wyse stuff.
20063 + * Snapshot BSD stuff again ready for release.
20066 + * binfmt_coff.c and binfmt_xout.c should be using mmap(NULL,...)
20067 + instead of zeromap_page_range as this will create the vm area
20068 + descriptor as well as mapping the pages. This is needed for
20069 + the verify_area() in 1.1.20 which has tighter checks than
20070 + previous versions.
20073 + * Map stack region as a GROWSDOWN vm area in binfmt_elf.c
20077 +Fri Jun 17 16:42:59 BST 1994
20079 + * Major and on going work to add BSD support (optional - see the
20080 + Makefile). I'm committing this now so I have a current tree
20081 + ready for release when Linus goes to 1.1.20.
20084 + * Wyse get{host,domain}name were using direct assignment to add
20085 + a trailing null instead of put_fs_byte(). Oops...
20088 + * Changes for execution domain support which will be in the main
20089 + kernel as of 1.1.20. This allows easy registration of lcall7
20090 + handlers, binary loaders etc. for different personalities.
20094 +Fri Jun 10 10:12:55 BST 1994
20096 + * Added patch file for kernel locking from Niklas Hallqvist
20097 + <niklas@appli.se>. This (or something very similar) should
20098 + end up in the kernel at some stage.
20101 + * Merged Eric's changes for 1.0 compatibilty - or rather didn't.
20102 + After playing with diff for quite a while I finally realised
20103 + we'd both done exactly the same changes :-). However Eric
20104 + has tested them...
20107 + * Added Brandon's iBCS trace binary from Eric's 1.0 compatibility
20112 +Thu Jun 9 10:22:56 BST 1994
20114 + * Mapped msgsys to ibcs_msgsys in callmap.inc. It existed, we
20115 + just didn't admit it before :-).
20119 +Tue Jun 7 08:50:34 BST 1994
20121 + * Sorted out some more ioctl stuff and added a handler for the
20122 + STREAMS ioctl set. This is needed for I_NREAD (number of
20123 + characters readable). Some SYSV X libraries contain implicit
20124 + assumptions that the X connection is via a STREAM and use
20125 + I_NREAD in preference to BSD/socket FIONREAD.
20128 + * Oh, Jeez... The changes made for the official kernel patches
20129 + completely shafted the 1.0 compatibility. I've remerged the
20130 + previous code with the new code - there may still be some
20131 + things that need pulling back though. At this point I don't
20132 + have a 1.0 kernel tree around to test against.
20135 + * If a COFF program is not correctly aligned disable demand
20136 + paging and resort to slurping the whole lot in at start up.
20139 + * Added missing -I../include to the Tools Makefile.
20143 +Fri Jun 3 11:53:21 BST 1994
20145 + * Added my virtual system tools. A virtualised SCO 3.2.4
20146 + system is usable for real work for me...
20149 + * Added the synchronous ioctl set. This conflicts with the
20150 + SCO 3.2.x (x < 4) ioctl for getting the video map so it should
20151 + be dependent on the file descriptor it is applied to but since
20152 + we don't currently support either...
20156 +Thu Jun 2 17:02:26 BST 1994
20158 + * Added support for FIORDCHK ioctl. SCO says it's there for
20159 + "backward compatibility" but the system programs still
20160 + seem to use it (notably ksh).
20164 +Tue May 31 13:39:34 BST 1994
20166 + * Patches to sysfs.c for 1.0.x compatibility from Tor with
20167 + some extra clean up.
20171 +Fri May 27 09:15:21 BST 1994
20173 + * Ensure we set up signal() handlers as SA_ONESHOT and sigaction()
20174 + handlers as sticky - similar to patch from Remete Gabor.
20177 + * Added the SCO cxenix sigaction extensions. Barely tested...
20180 + * Added the cxenix {get,set}itimer calls discovered on SCO by
20181 + Brandon. Currently these are directly mapped to the Linux
20182 + syscalls. They are undocumented by SCO (as far as we know)
20183 + and untested by us (for now).
20187 +Thu May 26 11:58:18 BST 1994
20189 + * Don't include the 0.0.0.0 to localhost address mapping if we
20190 + are building for 1.1.15+. This is mapped in the kernel as of
20191 + 1.1.6 and since we don't support 1.1 kernels before 15...
20194 + * Type of signal map vectors should be unsigned long not int.
20197 + * Allow tracing to be compiled in to the COFF loader and turned
20198 + on and off with the Tools/trace program.
20201 + * Signal maps moved out to maps/signal.inc. The only special
20202 + mapping that happens is for ISC which has a problem with
20203 + Oracle sending SIGSTOP to its backend when SIGSTOP doesn't
20204 + appear to be defined for ISC. We just map SIGSTOP to 0 so
20205 + it appears to work but does nothing.
20208 + * Changes for 1.1.15. This will not work with kernels between
20209 + 1.1.10 and 1.1.14 inclusive - guaranteed. It should still
20210 + work with the 1.0.x series but has not been tested recently.
20211 + It probably works against 1.1.0 to 1.1.13 inclusive but that
20212 + is purely coincidence - you shouldn't be using old 1.1.x
20213 + kernels as it's a development series.
20217 +Tue May 24 17:27:54 1994 Eric Youngdale (eric@tantalus)
20219 + * binfmt_xout.c: Use linux_binfmt struct, register_binfmt,
20220 + unregister_binfmt as in pl14.
20222 + * binfmt_elf.c, binfmt_xout.c: Likewise.
20224 + * signals.c: Make signals[] and lsignals[] global variables.
20226 + * ibcs/include/ibcs.h: Add prototypes for signals[] and lsignals[].
20229 +Tue May 24 10:37:01 BST 1994
20231 + * Added map entries for the ISC personality to all the maps
20232 + files. Must be more careful adding personalities.
20235 + * Added Oracle to the COMPAT file.
20238 + * Remember the problem with interrupting an Informix 4GL program
20239 + causing it to go psycho because of I/O errors from the tty?
20240 + Well, this doesn't happen with the new tty drivers in 1.1.13.
20241 + I never found why it happened...
20244 + * Noted that the 1.1.11 kernel patches are still ok with 1.1.13.
20248 +Mon May 23 08:50:21 BST 1994
20250 + * Mapped ISC sysconf() to the existing Xenix sysconf(). This
20251 + looks right but isn't checked at all.
20254 + * Added ISC TCSETPGRP and TCGETPGRP ioctl traps.
20258 +Thu May 19 09:26:34 BST 1994
20260 + * Added a bug hunting section to the README.
20263 + * Always access the socket layer by picking up the file operations
20264 + from an open socket descriptor. This removes the need for
20265 + kernel socket functions to be global and should be friendlier
20266 + towards a loadable socket layer one day.
20270 +Mon May 16 10:20:38 BST 1994
20272 + * Always access system calls via the system call table regardless
20273 + of whether we are using a loadable module or linking directly
20274 + to the kernel. This allows other things to be loadable too.
20278 +Wed May 11 13:52:12 BST 1994
20280 + * Added a tip on how to fix X font problems to the HINTS file.
20281 + Other "soft" changes welcome. Does anyone read the ChangeLog?
20284 + * Introduced the PROD.Patches directory and put the WP install
20285 + fixes in there. Documented in COMPAT and README.
20288 + * Added some hints on incompatible shell behaviour.
20292 +Mon May 9 11:07:52 BST 1994
20294 + * Updated the 1.1 patch file for 1.1.11.
20297 + * Additions for Interactive 4.0
20298 + -- Karl Kiniger (ki@kretz.co.at)
20301 +Fri May 6 12:03:00 BST 1994
20303 + * Merged old sysfs.c with the new sysfs.c. The code will now
20304 + work against any kernel - 1.0, 1.1, 1.1.9, 1.1.10...
20308 +Thu May 5 10:39:52 BST 1994
20310 + * Reworked for compatibility with 1.1.10. Kernel patches
20311 + are *not* updated yet. We expect the kernel changes to go
20312 + in to the official distribution any time now...
20316 +Tue May 3 12:03:31 BST 1994
20318 + * Joe/Brad's IPC additions.
20321 +Fri Apr 29 10:06:10 BST 1994
20323 + * Updated the README to explain the difference between sysfs.c
20328 +Wed Apr 27 11:38:52 BST 1994
20330 + * Added mapping of chsize() to ftruncate(). Implemented nap()
20334 + * Further fix to termios mapping for iexten and tostop.
20337 + * Updated the 1.1.? patch. New ksyms.c with fewer symbols plus
20338 + removed all the socket patches. Sockfunc.h is no longer
20339 + required. The 1.0 patch isn't updated but the extra cruft
20340 + that's in there now shouldn't be any problem.
20344 +Tue Apr 26 11:49:07 BST 1994
20346 + * Removed references to linux/sockfunc.h. We seem to have run
20347 + out of internal socket functions to put in it finally.
20350 + * Removed use of socki_lookup(). This just wraps some checks
20351 + around inode->i_socket. We assume the socket layer is stable
20355 + * Access [gs]etsockopt via the socketcall interface.
20358 + * If we have to use our own CFLAGS look in the include directory
20359 + above in case we have been dropped in to the kernel.
20362 + * Grab socket file operations when we create a socket rather
20363 + than linking against them directly. Similar to Eric's
20364 + changes but different...
20368 +Fri Apr 22 11:10:18 BST 1994
20370 + * The 'x' class of ioctls are back to being termios rather
20371 + than termio. The problem was that the field size in iBCS
20372 + termios and Linux termios is different.
20375 + * Added iBCS <-> Linux termios mapping. This is untested and
20376 + probably imperfect at this stage but nothing crashes with
20380 + * The iBCS time() syscall doesn't take an argument, the save,
20381 + if any, is handled in the interface library.
20384 + * Updated the 1.1 kernel patch to be against 1.1.8. It won't
20385 + work with anything less than 1.1.8 but then if you are
20386 + playing with 1.1 you should be playing with the latest...
20387 + This involves a change in the way sysfs() works. If you
20388 + are using 1.0 and have applications that call sysfs()
20389 + (practically none do) then you need to build with sysfs.c.old.
20392 + * The Linux kernel 1.1.8 replaces the static file_systems
20393 + table with a linked list ready for loadable file systems.
20394 + Naturally, I was ready for this... :-(
20398 +Thu Apr 21 10:34:34 BST 1994
20400 + * sysfs.c should be including linux/string.h to get the
20401 + inline string functions rather than needing library
20405 + * Added code to map between Linux termio structs and SCO/iBCS
20406 + termio structs. There are slight differences. Mapping needs
20407 + to be done for termios structs too. Anything that uses termios
20408 + at this stage is likely to ge a nasty shock!
20412 +Tue Apr 19 22:56:55 1994 Eric Youngdale (eric@esp22)
20414 + * ibcs.h: Put declaration of sys_call_table outside of ifdef.
20415 + (So can be compiled into kernel instead as a module).
20418 +Tue Apr 19 10:21:17 BST 1994
20420 + * It looks as though the 'x' class of ioctls should be termio
20421 + ioctls rather than termios. At least this is the case as far
20422 + as SCO 3.2.4 stty appears to be concerned.
20425 + * Avoid copying the entire lock structure backwards and forwards
20426 + just to increment one field in open.c. There could be a problem
20427 + here - SCO has a sysid field *before* the pid field but only
20428 + if _XOPEN_SOURCE or _POSIX_SOURCE is defined at compile time.
20429 + There appears to be no obvious way to know what is being used???
20433 +Mon Apr 18 08:49:37 BST 1994
20435 + * There appear to odd little niceties involved with SYSV which
20436 + depend on system configuration and the way users do things.
20437 + Added a HINTS file with known problems/workarounds.
20440 + * Changed some annoying KERN_ERRs to KERN_DEBUGs in signal.c
20443 + * Watch out for (mis)use of INADDR_ANY instead of localhost
20444 + (primarily by syslog() code?) and replace it with the
20445 + localhost address. We should perhaps do this for sendto()
20446 + as well? (Eric spotted this one on CorelDraw but it's a
20447 + problem with the standard libsocket.c)
20450 + * Processes should be allowed to reduce their file size
20451 + limit but only increase it if they have root privileges.
20454 + * Fixed the bug in [f]statfs where the first two arguments
20455 + to memcpt_tofs() were exchanged (spotted by Eric).
20458 + * SCO seems to like utsys (v7_utsname) to return the same
20459 + thing for sysname and nodename fields just like the SCO
20460 + extended utsname structure has. The SVR4 (abi_utsname)
20461 + return is unknown at this time.
20464 + * Removed comments on IPC from README. It *is* fixed?
20467 + * Fix IPC which was broken by syscall changes. Also fix
20468 + structure mappings.
20469 + -- Joseph L. Portman III <baron@hebron.connected.com>
20472 +Thu Apr 14 11:27:24 BST 1994
20474 + * At some stage SCO managed to build some of their binaries
20475 + with the copyright comment string in quotes so we have a
20476 + new recognition string in the COFF loader. (Seen in uname
20477 + on a 3.2.2 system).
20480 + * If we have tracing compiled in then only give unsupported
20481 + syscall messages if we are tracing the API or the syscall
20482 + in question. This allows us to quieten unsupported but
20483 + unimportant syscalls.
20486 + * Comment on the IPC limitations in the README file.
20489 + * Added implementation of xnx_pathconf(). Actually it doesn't
20490 + look as if we really need it. The Microsoft C compiler seems
20491 + to be misusing it anyway and doesn't even care that it gets
20496 +Wed Apr 13 09:14:50 BST 1994
20498 + * Added handling of TIOC[GS]PGRP.
20501 + * Added implementation of xnx_eaccess(). This is currently
20502 + simpleminded because Linux access() is. My eaccess() may
20506 + * When tracing signal delivery we shouldn't be clearing the
20507 + signal flag after reporting it or the signal is never actually
20508 + delivered. I copied the assembler from the kernel and forgot
20509 + to deleted an opcode...
20512 + * Signal 0 should have been identity mapped so kill 0 works.
20513 + -- Brandon S. Allbery (kf8nh@kf8nh.ampr.org) (bsa@kf8nh.wariat.org)
20515 +Tue Apr 12 14:30:25 BST 1994
20517 + * Corrected file size passed to/from setrlimit/getrlimit
20518 + -- Graham Adams (gadams@ddrive.demon.co.uk)
20521 +Tue Apr 12 11:16:45 BST 1994
20523 + * Added support for an obscure SCO extension that is used
20524 + to get SCO's extended utsname information.
20527 + * Changed ipc.c to always go via the ipc syscall rather than
20528 + direct to internal functions. This should survive if ipc
20529 + isn't in the kernel. It should even do sensible things if
20530 + the ipc module is loaded/unloaded on us.
20533 + * Initial changes to access system calls via sys_call_table
20539 + * Eric's pre-release fixes.
20542 +Wed Mar 30 22:35:28 1994 Eric Youngdale (eric@esp22)
20544 + * ioctl.c: Change 'F' to 'f' for SVr4 FIONREAD ioctl.
20546 + * Makefile: Add svr4.c.
20548 + * svr4.c: New file (sort of - it got lost in shuffle before).
20550 + * include/ibcs/ibcs.h: Include prototypes for abi_uname.
20552 + * maps/callmap.inc: Insert abi_uname in syscall number 135.
20553 + Add sys_rename in slot 134 (emacs v18 requires this).
20556 +Tue Mar 29 23:32:35 1994 Eric Youngdale (eric@esp22)
20558 + * Makefile: Fix so that we do not need uname. Use symbol from
20561 + * README: Update a bit.
20566 + * Preparation for release:
20567 + Tidy up documentation and create CREDITS file from the old
20574 + * Preparation for release:
20575 + Move headers into a subdirectory.
20576 + Move maps into a subdirectory.
20582 + * Changed the COFF loader so that if the filesystem doesn't
20583 + support mmap we read in the whole lot initially and let
20584 + it page to swap if necessary. This is already in the x.out
20585 + loader, it should go in the ELF loader too at some point.
20591 + * Added a loader for x.out i386 small model binaries - i.e 386
20592 + Xenix programs. <=286, non-small model binaries are not
20593 + supported and not likely to be in the near future.
20597 +Wed Mar 23 23:12:54 1994 Eric Youngdale (eric@esp22)
20599 + * Add ioctl for 0x4004667f (FIONREAD) (used by SVr4).
20601 + * map.h (map_segment.map): Make unsigned.
20603 + * hrtsys.c: New file implementing parts of the hrtsys syscall.
20608 + * Add socket value mappings. This meant a general move round
20609 + to tidy things up and group map functions/tables.
20610 + There is a new kernel patch in the Patches directory called
20611 + net.patch which gives us access to the sock_*sockopts
20612 + functions directly.
20618 + * Implementation of poll().
20624 + * Pedantic change to call maps so that IBCS_function contains
20625 + a void * instead of a function pointer - we cast it as
20626 + necessary later in emulate.c. The warnings were annoying me.
20628 + * Moved struct abi_sigaction from signal.c to abi4.h so it is
20629 + available for prototype declarations. Changed prototype for
20630 + abi_sigsuspend to correspond to implementation in signal.c.
20633 + * Reversed out Eric's earlier signal patches and added new ones.
20636 + * Updated trace code and trace control program to be useful.
20637 + Control of tracing individual functions is still not there
20638 + yet - perhaps another day.
20639 + Default trace mode is now none (i.e. only functions with
20640 + the trace flag set are traced). Use the trace program to
20641 + change the trace level.
20644 + * File modes (open/fcntl flags) are different between Linux and
20645 + iBCS so we need to map between them. Open also requires this
20646 + so fcntl.c is now merged with open.c. Failure to set and reset
20647 + non-blocking mode was what was breaking Unipox.
20650 + * Signal handling function changes to map to and from the Linux
20651 + signal set and sigaction flags correctly.
20657 + * Added code to the emulate() function to let us know when we
20658 + are about to process a signal on exit from the syscall.
20661 + * Implemented proctl() as a no-op. It's not really relevent
20665 + * Added argument count and type for eaccess()
20668 + * Have emulate.c return -ENOSYS for unimplemented system calls
20669 + rather than zero.
20672 + * Added Eric's patches to waitpid.
20674 + * Created the ChangeLog!
20675 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/COMPAT kernel-source-2.6.16/Documentation/abi/COMPAT
20676 --- kernel-source-2.6.16.orig/Documentation/abi/COMPAT 1970-01-01 10:00:00.000000000 +1000
20677 +++ kernel-source-2.6.16/Documentation/abi/COMPAT 2006-04-27 18:50:24.000000000 +1000
20679 +C: This file contains details of programs that have been run under
20680 +C: Linux using the iBCS emulator. An entry here is no guarantee that
20681 +C: the program works 100% but does indicate that the major elements
20682 +C: of the program have been unable to exercise bugs in the emulator
20683 +C: unless otherwise noted.
20685 +C: An entry in this file does not necessarily indicate that the vendor
20686 +C: or anyone else actually supports the package under Linux unless
20687 +C: there is a specific entry to that effect.
20689 +C: Please add to this file - new entries, other releases, amendments
20690 +C: to existing entries etc.
20692 +C: The layout of this file is intended to be both easy to browse and
20693 +C: easy to parse, allowing it to be formatted into documents in the
20694 +C: future. This hasn't happened yet though and might never happen :-).
20699 +C: S = Support details
20700 +C: O = Operating system compiled for
20702 +C: R = Release(s) known to work
20703 +C: L = Libraries required
20704 +C: D = Description
20708 +V: Applied Information Systems, Inc. (info@ais.com)
20710 +P: Xess (MOTIF Spreadsheet)
20712 +L: statically linked
20713 +N: A save-disabled demo is available in ftp.uu.net:/vendor/ais/
20714 +N: Get three files: README, gen.tar, and sco.tar.
20715 +N: Don't add a .Z or .gz to the end of the filenames; the files
20716 +N: inside are compressed. ~300K of online documentation is in
20718 +N: If anyone decides to actually *buy* this product, *please*
20719 +N: mention that you will be running it under Linux. I promise
20720 +N: you that you will still get technical support (the majority
20721 +N: of our technical support staff run Linux at home) -- but if
20722 +N: enough people buy the product asking for a Linux version, my
20723 +N: employer will be willing to make the investment. Pass the
20724 +N: word on if you want to see a native-mode, high-quality
20725 +N: spreadsheet for Linux as much as I do...
20726 +N: michaelkjohnson
20727 +T: Michael K.Johnson <johnsonm@merengue.oit.unc.edu>
20731 +P: CorelDraw! 3.0 and friends.
20733 +N: Requires X11, no character versions of these apps.
20734 +N: Everything seems to be statically linked, no extra libs
20735 +N: necessary. I had a few problems with my .xmodmap file
20736 +N: since CorelDraw wants all of the lower function keys to
20737 +N: be mapped to functions in the CorelDraw program. Uses a
20738 +N: networked license manager, it worked fine. My programs
20739 +N: did not install properly due to an install bug. The dir.
20740 +N: that contains the washes.3fx file and others must be hand
20741 +N: changed to mode 777 for CorelChart to work (This from
20742 +N: Corel tech support).
20743 +T: Doug Ledford <gdl297s@cnas.smsu.edu>
20747 +P: Informix SQL Standard Engine
20750 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
20754 +P: Informix SQL Online Dynamic Server
20756 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
20760 +N: INET is reputed to work too but I can't remember who
20768 +L: /shlib/libnsl_s
20769 +N: The version of X.desktop tested is that shipped with
20770 +N: Uniplex Windows. Functionality is at least enough to
20771 +N: support Uniplex Windows.
20772 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
20778 +L: /shlib/libnsl_s
20779 +T: Remete Gabor <rg@tomx.elte.hu>
20783 +P: Tactician Plus (character and X)
20785 +T: Brandon S. Allbery <bsa@kf8nh.wariat.org>
20789 +P: SPSS 5.0 for SCO UNIX
20790 +L: Motif, if you want to use the GUI
20791 +D: Statistical Package for the Social Sciences
20792 +N: SCO's cpio is not compatible with GNU's -- I had to dd all
20793 +N: floppys onto my hd and to concatenate them into one file.
20794 +N: I couldn't test the GUI since I had no Motif available.
20795 +T: Joerg Rade <jr@petz.han.de>
20797 +V: Uniplex Limited
20799 +P: Uniplex / Uniplex Windows
20801 +L: statically linked (Uniplex Windows requires libnsl_s)
20802 +N: Uniplex Windows is implemented using a version of IXI
20803 +N: X.desktop. It is this that requires libnsl_s.
20804 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
20806 +V: V-Systems, Inc.
20808 +P: VSI*FAX (FxServer, FxScript, FxVision) (character and X)
20809 +R: FxServer 2.0.19, FxScript 1.1.05, FxVision 1.0.16
20810 +L: Statically linked
20811 +N: Needs localhost in the X server's access control list
20812 +N: even when using a local X connection.
20813 +N: This has not been tested with a modem connected as I
20814 +N: don't have a Multitech...
20815 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
20821 +T: Mark C. Henderson <mch@sqwest.wimsey.bc.ca>
20823 +V: WordPerfect Corporation
20825 +P: WordPerfect (character and X)
20827 +L: Statically linked
20828 +N: Installation under Linux may require changes to some of
20829 +N: the WP install scripts. See the PROD.Patches/WP file
20832 +N: WP uses a network license manager.
20834 +N: For some reason WP use a partition floppy device rather
20835 +N: than the full block device. Linux does not have this so
20836 +N: you need to use dd to skip the first cylinder (track?)
20837 +N: when loading the floppies under Linux. See the HINTS
20838 +N: file for details.
20840 +N: Fonts appear corrupt. See the HINTS file for a cure.
20841 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
20847 +L: Statically linked - Motif based.
20848 +N: Installation scripts work correctly.
20850 +N: ZMail can use a network license manager or a license file.
20851 +N: Both are known to work.
20853 +N: ZMail is a GUI-based mail program.
20855 +N: You can download the binaries for ZMail via anonymous ftp
20857 +N: You will have to contact Z-Code to obtain an evaluation
20858 +N: license if you wish to try it out.
20859 +T: Eric Youngdale <eric@aib.com>
20860 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/CREDITS kernel-source-2.6.16/Documentation/abi/CREDITS
20861 --- kernel-source-2.6.16.orig/Documentation/abi/CREDITS 1970-01-01 10:00:00.000000000 +1000
20862 +++ kernel-source-2.6.16/Documentation/abi/CREDITS 2006-04-27 18:50:24.000000000 +1000
20864 +A (non-definitive) list of people who appear to have worked on the
20865 +emulator and, in some cases, what they appear to have done.
20867 +This list is in no particular order.
20869 +This list should probably be better maintained :-).
20871 +If anyone feels that they are not properly credited here, send diffs to
20875 +========================================================================
20877 +Brandon S. Allbery <bsa@kf8nh.wariat.org> or <kf8nh@kf8nh.ampr.org>
20879 +Graham Adams <gadams@ddrive.demon.co.uk>
20881 +Tor Arntsen <tor@tss.no> or <tor@spacetec.no>
20882 + Emulator as of pl13
20884 +Philip Balister <balister@vt.edu>
20885 + Emulator as of pl13
20888 +Alfred Longyear <longyear@netcom.com>
20890 + Emulator as of pl12
20891 + Original author of libc_s. COFF version.
20893 +Mike Jagdis <jaggy@purplet.demon.co.uk>
20894 + Changes for loadable module version of the emulator.
20895 + Multi-personality detection and syscall mapping.
20896 + Error code mapping.
20897 + Wyse V/386 socket interface.
20898 + /dev/socksys socket interface.
20899 + /dev/spx to Unix domain socket for local X connections.
20900 + Named pipe to Unix domain socket open kludge.
20901 + XTI/TLI STREAMS based networking interface.
20902 + X.out loader for 386 Xenix binaries.
20904 + Trace dummy device.
20905 + Segment (LDT) mapping for x.out binaries.
20906 + Xenix 286 emulator overlay.
20907 + Current source maintainer and primary developer.
20909 +Joseph L. Portman III <baron@hebron.connected.com>
20910 + Major emulator developer.
20913 +Drew Sullivan <drew@lethe.north.net>
20914 + Past emulator source maintainer.
20916 +Eric Youngdale <eric@aib.com> (prev. <eric@cais.com> & <ericy@gnu.ai.mit.edu>)
20917 + First cut of the emulator.
20918 + ELF loader, plus memory manager and fs/exec.c modifications
20919 + to allow multiple binary formats to be loaded.
20920 + Keeper of the tsx-11 archive.
20921 + libc_s (elf version), plus bugfixes, reorganization, etc.
20922 + SVr4 portions of emulator.
20924 +Karl Kiniger <ki@kretz.co.at>
20925 + Interactive 4.0 binary recognition and special support.
20927 +Remete Gabor <rg@tomx.elte.hu>
20928 + Miscellaneous patches.
20930 +Scott Michel <scottm@intime.com>
20931 + SCO multiscreen ioctls.
20933 +Stephan Riess <Stephan.Riess@Physik.TU-Muenchen.de>
20936 +Peter Polte <peter@cat-productions.de>
20937 + Xenix fcntl() file locking facilities.
20939 +C.A. Lademann <cal@zls.com>
20941 +Miguel de Icaza <miguel@roxanne.nuclecu.unam.mx>
20943 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/Error.map kernel-source-2.6.16/Documentation/abi/Error.map
20944 --- kernel-source-2.6.16.orig/Documentation/abi/Error.map 1970-01-01 10:00:00.000000000 +1000
20945 +++ kernel-source-2.6.16/Documentation/abi/Error.map 2006-04-27 18:50:24.000000000 +1000
20947 +Mapping of error codes from Linux to various personalities. Codes which Linux
20948 +may generate but which can't be mapped directly in a given personality must
20949 +be mapped to the nearest equivalent which may invoke the correct behaviour
20950 +in the application. This is especially true for things like the ERESTART*
20951 +set of error returns!
20955 +The Xenix set was built with reference to an old SCO Xenix manual rather
20956 +than by reference to a real system. It may be incomplete or wrong. If anyone
20957 +has access to the Xenix TCP/IP kit we need to add mappings for the TCP/IP
20960 +Other personalities may need adding. COFF binaries default
20962 +Linux Name Linux ABI SCO Wyse Xenix 386bsd
20964 +EPERM 1 /* Operation not permitted */
20965 +ENOENT 2 /* No such file or directory */
20966 +ESRCH 3 /* No such process */
20967 +EINTR 4 /* Interrupted system call */
20968 +EIO 5 /* I/O error */
20969 +ENXIO 6 /* No such device or address */
20970 +E2BIG 7 /* Arg list too long */
20971 +ENOEXEC 8 /* Exec format error */
20972 +EBADF 9 /* Bad file number */
20973 +ECHILD 10 /* No child processes */
20974 +EAGAIN 11 35 /* Try again */
20975 +ENOMEM 12 /* Out of memory */
20976 +EACCES 13 /* Permission denied */
20977 +EFAULT 14 /* Bad address */
20978 +ENOTBLK 15 /* Block device required */
20979 +EBUSY 16 /* Device or resource busy */
20980 +EEXIST 17 /* File exists */
20981 +EXDEV 18 /* Cross-device link */
20982 +ENODEV 19 /* No such device */
20983 +ENOTDIR 20 /* Not a directory */
20984 +EISDIR 21 /* Is a directory */
20985 +EINVAL 22 /* Invalid argument */
20986 +ENFILE 23 /* File table overflow */
20987 +EMFILE 24 /* Too many open files */
20988 +ENOTTY 25 /* Not a typewriter */
20989 +ETXTBSY 26 /* Text file busy */
20990 +EFBIG 27 /* File too large */
20991 +ENOSPC 28 /* No space left on device */
20992 +ESPIPE 29 /* Illegal seek */
20993 +EROFS 30 /* Read-only file system */
20994 +EMLINK 31 /* Too many links */
20995 +EPIPE 32 /* Broken pipe */
20996 +EDOM 33 /* Math argument out of domain of func */
20997 +ERANGE 34 /* Math result not representable */
20998 +EDEADLK 35 45 45 45 36 11 /* Resource deadlock would occur */
20999 +ENAMETOOLONG 36 78 78 228 EINVAL 63 /* File name too long */
21000 +ENOLCK 37 46 46 46 45 77 /* No record locks available */
21001 +ENOSYS 38 89 89 EINVAL EINVAL 78 /* Function not implemented */
21002 +ENOTEMPTY 39 93 145 231 EINVAL 66 /* Directory not empty */
21003 +ELOOP 40 90 150 227 EINVAL 62 /* Too many symbolic links encountered */
21004 +EWOULDBLOCK EAGAIN 90 90 200 EINVAL 35 /* Operation would block */
21005 +ENOMSG 42 35 35 35 43 ? /* No message of desired type */
21006 +EIDRM 43 36 36 36 44 ? /* Identifier removed */
21007 +ECHRNG 44 37 37 37 EINVAL ? /* Channel number out of range */
21008 +EL2NSYNC 45 38 38 38 EINVAL ? /* Level 2 not synchronized */
21009 +EL3HLT 46 39 39 39 EINVAL ? /* Level 3 halted */
21010 +EL3RST 47 40 40 40 EINVAL ? /* Level 3 reset */
21011 +ELNRNG 48 41 41 41 EINVAL ? /* Link number out of range */
21012 +EUNATCH 49 42 42 42 EINVAL ? /* Protocol driver not attached */
21013 +ENOCSI 50 43 43 43 EINVAL ? /* No CSI structure available */
21014 +EL2HLT 51 44 44 44 EINVAL ? /* Level 2 halted */
21015 +EBADE 52 ? 50 50 EINVAL ? /* Invalid exchange */
21016 +EBADR 53 ? 51 51 EINVAL ? /* Invalid request descriptor */
21017 +EXFULL 54 ? 52 52 EINVAL ? /* Exchange full */
21018 +ENOANO 55 ? 53 53 EINVAL ? /* No anode */
21019 +EBADRQC 56 ? 54 54 EINVAL ? /* Invalid request code */
21020 +EBADSLT 57 ? 55 55 EINVAL ? /* Invalid slot */
21021 +EDEADLOCK 58 ? 56 56 36 11 /* File locking deadlock error */
21022 +EBFONT 59 ? 57 57 EINVAL ? /* Bad font file format */
21023 +ENOSTR 60 EINVAL ? /* Device not a stream */
21024 +ENODATA 61 EINVAL ? /* No data available */
21025 +ETIME 62 EINVAL ? /* Timer expired */
21026 +ENOSR 63 EINVAL ? /* Out of streams resources */
21027 +ENONET 64 EINVAL ? /* Machine is not on the network */
21028 +ENOPKG 65 EINVAL ? /* Package not installed */
21029 +EREMOTE 66 EINVAL 71 /* Object is remote */
21030 +ENOLINK 67 EINVAL ? /* Link has been severed */
21031 +EADV 68 EINVAL ? /* Advertise error */
21032 +ESRMNT 69 EINVAL ? /* Srmount error */
21033 +ECOMM 70 EINVAL ? /* Communication error on send */
21034 +EPROTO 71 ? ? /* Protocol error */
21035 +EMULTIHOP 72 74 74 74 ? ? /* Multihop attempted */
21036 +EDOTDOT 73 76 76 76 ? ? /* RFS specific error */
21037 +EBADMSG 74 77 77 77 ? ? /* Not a data message */
21038 +EOVERFLOW 75 79 EINVAL EINVAL ? ? /* Value too large for defined data type */
21039 +ENOTUNIQ 76 80 80 80 ? ? /* Name not unique on network */
21040 +EBADFD 77 81 81 81 ? ? /* File descriptor in bad state */
21041 +EREMCHG 78 82 82 82 ? ? /* Remote address changed */
21042 +ELIBACC 79 83 83 83 ? ? /* Can not access a needed shared library */
21043 +ELIBBAD 80 84 84 84 ? ? /* Accessing a corrupted shared library */
21044 +ELIBSCN 81 85 85 85 ? ? /* .lib section in a.out corrupted */
21045 +ELIBMAX 82 86 86 86 ? ? /* Attempting to link in too many shared libraries */
21046 +ELIBEXEC 83 87 87 87 ? ? /* Cannot exec a shared library directly */
21047 +EILSEQ 84 88 EINVAL EINVAL ? ? /* Illegal byte sequence */
21048 +ERESTART 85 91 EINTR EINTR ? ? /* Interrupted system call should be restarted */
21049 +ESTRPIPE 86 92 EINVAL EINVAL ? ? /* Streams pipe error */
21050 +EUSERS 87 94 EINVAL 233 ? 68 /* Too many users */
21051 +ENOTSOCK 88 95 93 203 ? 38 /* Socket operation on non-socket */
21052 +EDESTADDRREQ 89 96 94 204 ? 39 /* Destination address required */
21053 +EMSGSIZE 90 97 95 205 ? 40 /* Message too long */
21054 +EPROTOTYPE 91 98 96 206 ? 41 /* Protocol wrong type for socket */
21055 +ENOPROTOOPT 92 99 EINVAL 207 ? 42 /* Protocol not available */
21056 +EPROTONOSUPPORT 93 120 97 208 ? 43 /* Protocol not supported */
21057 +ESOCKTNOSUPPORT 94 121 98 209 ? 44 /* Socket type not supported */
21058 +EOPNOTSUPP 95 122 99 210 ? 45 /* Operation not supported on transport endpoint */
21059 +EPFNOSUPPORT 96 123 100 211 ? 46 /* Protocol family not supported */
21060 +EAFNOSUPPORT 97 124 101 212 ? 47 /* Address family not supported by protocol */
21061 +EADDRINUSE 98 125 102 213 ? 48 /* Address already in use */
21062 +EADDRNOTAVAIL 99 126 103 214 ? 49 /* Cannot assign requested address */
21063 +ENETDOWN 100 127 104 215 ? 50 /* Network is down */
21064 +ENETUNREACH 101 128 105 216 ? 51 /* Network is unreachable */
21065 +ENETRESET 102 129 106 217 ? 52 /* Network dropped connection because of reset */
21066 +ECONNABORTED 103 130 107 218 ? 53 /* Software caused connection abort */
21067 +ECONNRESET 104 131 108 219 ? 54 /* Connection reset by peer */
21068 +ENOBUFS 105 132 63 220 ? 55 /* No buffer space available */
21069 +EISCONN 106 133 110 221 ? 56 /* Transport endpoint is already connected */
21070 +ENOTCONN 107 134 111 222 ? 57 /* Transport endpoint is not connected */
21071 +ESHUTDOWN 108 143 112 223 ? 58 /* Cannot send after transport endpoint shutdown */
21072 +ETOOMANYREFS 109 144 113 224 ? 59 /* Too many references: cannot splice */
21073 +ETIMEDOUT 110 145 114 225 ? 60 /* Connection timed out */
21074 +ECONNREFUSED 111 146 115 226 ? 61 /* Connection refused */
21075 +EHOSTDOWN 112 147 116 229 ? 64 /* Host is down */
21076 +EHOSTUNREACH 113 148 117 230 ? 65 /* No route to host */
21077 +EALREADY 114 149 92 202 ? 37 /* Operation already in progress */
21078 +EINPROGRESS 115 150 91 201 ? 36 /* Operation now in progress */
21079 +ESTALE 116 EINVAL EINVAL 237 ? 70 /* Stale NFS file handle */
21080 +EUCLEAN 117 ? 135 135 35 ? /* Structure needs cleaning */
21081 +ENOTNAM 118 ? 137 137 37 ? /* Not a XENIX named type file */
21082 +ENAVAIL 119 ? 138 138 38 ? /* No XENIX semaphores available */
21083 +EISNAM 120 ? 139 139 39 ? /* Is a named type file */
21084 +EREMOTEIO 121 ? 140 140 EINVAL ? /* Remote I/O error */
21085 +EDQUOT 122 ? ENOSPC 234 ENOSPC 69 /* Quota exceeded */
21087 +ERESTARTSYS 512 EINTR EINTR EINTR EINTR EINTR
21088 +ERESTARTNOINTR 513 EINTR EINTR EINTR EINTR EINTR
21089 +ERESTARTNOHAND 514 EINTR EINTR EINTR EINTR EINTR /* restart if no handler.. */
21090 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/HINTS kernel-source-2.6.16/Documentation/abi/HINTS
21091 --- kernel-source-2.6.16.orig/Documentation/abi/HINTS 1970-01-01 10:00:00.000000000 +1000
21092 +++ kernel-source-2.6.16/Documentation/abi/HINTS 2006-04-27 18:50:24.000000000 +1000
21095 + Cannot determine user name by reference to /etc/passwd. Failure
21096 + to determine the user name causes some programs (notably programs
21097 + built with Informix 4GL) to exit.
21100 + The functions that parse /etc/passwd are sensitive under SCO
21101 + at least. A corrupt line is taken to be the end of the file
21102 + and further entries are ignored. Any line which has a null
21103 + home directory counts as a corrupt line for SCO.
21106 + Ensure that all lines in /etc/passwd have home directories
21107 + specified. Simply edit /etc/passwd with an editor.
21110 +# -----------------------------------------------------------------------
21113 + Cannot connect to X server using local connection.
21116 + Some versions of X libraries seem to require 'localhost' to be
21117 + allowed to connect to the X server even if we aren't using a
21118 + TCP/IP connection. The X libraries used for VSI*FAX require
21119 + this, the X libraries used for WordPerfect don't.
21122 + Explicitly allow 'localhost' to connect to the X server using
21123 + 'xhost localhost'.
21126 +# -----------------------------------------------------------------------
21129 + Installation disks claim to be Unix tar format but they appear
21130 + to be blank MS-DOS format disks!
21133 + Unix provides two floppy devices, the normal floppy devices
21134 + that we all know and love (and which are listed as the Xenix
21135 + compatible devices in the man page) and a second set which
21136 + skips the first track of the disk. For some reason a few vendors
21137 + seem to use this second set when preparing distribution disks.
21138 + WordPerfect seem to do this. Linux currently only supports
21139 + the normal floppy devices.
21142 + You have to skip the first track by hand and read each disk
21143 + individually. Try 'dd if=/dev/fd0 bs=18k skip=1 | tar xfv -'
21144 + for a 3.5" high density disk. Change the 18k to 15k for a
21145 + 5.25" high density disk.
21147 +# -----------------------------------------------------------------------
21150 + A script bombs out with an unexpected EOF looking for "'". This
21151 + only happens on Linux.
21154 + There is a bug in the script which is only a problem on Linux.
21155 + Take the following example:
21157 + count=`ls | wc | awk '{ printf "%05d", $1 }`
21159 + Note the missing "'" at the end of the awk statment. The /bin/sh
21160 + supplied with SCO will assume (in this case correctly) that the
21161 + "'" should have occurred immediately before the closing "`" and
21162 + the expression will succeed. The /bin/sh used with Linux (normally
21163 + bash) does not make this assumption and gives an error message.
21166 + Either fix the script or arrange to have it run by a SYSV shell
21167 + rather than bash.
21169 +# -----------------------------------------------------------------------
21172 + Test complains that a numeric argument is required before -eq, -le
21176 + The GNU shellutils test and the test built in to bash which are
21177 + the versions of test used under Linux do not accept a null
21178 + argument as equivalent to 0 so 'test "" -le 5' will give an error.
21179 + Under SCO a null argument is taken as equivalent to 0 so the
21180 + statement would be evaluated as 'test 0 -le 5'.
21183 + Fix the script to check arguments for validity before using them
21184 + or provide a fixed version of test and ensure that it is used in
21185 + preference to any shell built in.
21187 +# -----------------------------------------------------------------------
21190 + Some X fonts supplied with packages appear corrupt.
21193 + These are probably snf fonts. The XFree86 X server used with
21194 + Linux appears to fail to load some snf fonts silently and displays
21195 + garbage. Pcf fonts work ok and should be used where possible.
21198 + If you only have the snf fonts all you can do is to try asking the
21199 + vendor for pcf versions or the bdf definitions.
21201 + If you have the bdf definitions (WordPerfect ship them) then you
21202 + can build a pcf set using:
21204 + # for bdffn in *.bdf
21206 + > fn=`basename $bdffn .bdf`
21207 + > [ -r $fn.snf ] && mv $fn.snf $fn.snf.old
21208 + > bdftopcf -o $fn.pcf $bdffn
21213 +# -----------------------------------------------------------------------
21216 + Function keys don't work.
21219 + The default sequences for function keys under Linux are "sort of"
21220 + VT10x like whereas you have probably told your application that
21221 + you are running on an ansi or SCO console.
21224 + It is probably best to run as an ansi screen - especially if
21225 + colour is used - so use the "loadkeys" program to load the
21226 + SCO.map keyboard description from the PROD.Patches directory.
21227 + This directory also contains flexible termcap and terminfo
21228 + descriptions which will allow you run permanently with a SCO
21229 + or SVR4-like console.
21231 +# -----------------------------------------------------------------------
21234 + Line drawing characters come out as weird symbols.
21237 + The application believes you are using a console screen with a
21238 + PC character set and is using 8-bit codes rather than escape
21239 + sequences. Linux defaults to an ISO8859-1 character set though.
21242 + Linux can be switched to PC character set mode with the escape
21243 + sequence ESC-(-U. Arrange to have this sequence sent either
21244 + before the application is started or as part of the initialisation
21245 + that the application does. You can restore the ISO character
21246 + set afterwards with ESC-(-K.
21248 +# -----------------------------------------------------------------------
21251 + SYSV binaries see the wrong time zone.
21254 + SYSV binaries establish the time zone from the TZ environment
21255 + variable whereas Linux uses BSD style zoneinfo files generally.
21258 + Set the TZ environment variable to reflect your time zone. Note
21259 + that the zoneinfo mechanism can also use TZ in preference to
21260 + the /usr/lib/zoneinfo/localtime file if you wish. For this to
21261 + work you must have /usr/lib/zoneinfo/posixrules linked to one
21262 + of the US timezone files. The posixrules file defines how the
21263 + zoneinfo functions interpret TZ and this information is only
21264 + found in the US data files. See the documentation for the
21265 + timezone/zoneinfo package for details.
21267 +# -----------------------------------------------------------------------
21270 + BSD binaries don't see the right time zone.
21273 + Although BSD binaries use the same timezone handling method as
21274 + Linux they expect the zoneinfo information in different places.
21279 + # ln -s /usr/lib/zoneinfo /etc/localtime
21280 + # ln -s /usr/lib/zoneinfo /usr/share/zoneinfo
21282 +# -----------------------------------------------------------------------
21285 + BSD binaries complain that they can't find /etc/termcap.
21288 + They may be lying. BSD sometimes uses /usr/share/misc/termcap
21289 + or ~/.termcap (if it exists).
21292 + Either move termcap to /usr/share/misc and make /etc/termcap
21293 + a link to it or make /usr/share/misc/termcap a link to /etc/termcap.
21294 + The use of /usr/share/misc/termcap may be useful in a networked
21296 +# -----------------------------------------------------------------------
21299 + SVr4 binaries cannot locate shared libraries, or fail to start.
21302 + The shared libraries are not in the correct location, or the dynamic
21303 + loader cannot be located by the kernel.
21306 + Put all SVr4 shared libraries in the directory /usr/i486-sysv4/lib.
21307 + Then create two symbolic links:
21309 + ln -s /usr/i486-sysv4/lib/libc.so.1 /usr/lib/libc.so.1
21310 + ln -s /usr/i486-sysv4/lib/ld.so.1 /usr/lib/ld.so.1
21311 +# -----------------------------------------------------------------------
21314 + SVr4 binaries want to access terminfo instead of termcap
21317 + SVr4 traditionally uses something called terminfo instead of
21318 + termcap to specify terminal characteristics.
21321 + The ncurses distribution (available on many fine ftp sites)
21322 + contains a terminfo database. Just install this, and you
21323 + should be all set.
21324 +# -----------------------------------------------------------------------
21327 + The Informix Dynamic Server installation for SCO says
21328 + invalid INFORMIXDIR or insufficient space.
21331 + It wants to scan /etc/mnttab to find all possible
21332 + filesystems. Since Linux uses /etc/mtab instead the
21333 + installation program is under the impression you have
21334 + no filesystems and no space(!).
21337 + Run the perl script Tools/mkmnttab which will build an
21338 + /etc/mnttab from /etc/mtab.
21339 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/Local-X kernel-source-2.6.16/Documentation/abi/Local-X
21340 --- kernel-source-2.6.16.orig/Documentation/abi/Local-X 1970-01-01 10:00:00.000000000 +1000
21341 +++ kernel-source-2.6.16/Documentation/abi/Local-X 2006-04-27 18:50:24.000000000 +1000
21343 +** Local X interface
21345 +The local X interface is simplistic. It assumes only one local X server
21346 +exists and assumes that the pathname of the Unix domain socket for
21347 +local connections is always /tmp/.X11-unix/X0.
21349 + The SCO code opens both /dev/X0R and /dev/spx, writes a single byte
21350 +to /dev/X0R, reads a message from /dev/X0R with getmsg then writes this
21351 +message to /dev/spx with putmsg and closes /dev/X0R. This establishes
21352 +the /dev/spx file descriptor as a connection to the X server listening
21355 + We ignore all activity on the /dev/X0R device (hence it is a link to
21356 +/dev/null), getmsg and putmsg are stubbed so don't do anything and opens
21357 +on the /dev/spx simply replace the open inode with a socket connected
21358 +to the X server's Unix domain socket.
21360 + At some point in the future we will implement a simple minded /dev/X*
21361 +driver that returns some form of id via the getmsg which can then be
21362 +passed to /dev/spx with putmsg and which will allow /dev/spx to connect
21363 +to the relevant X server. This will only happen if someone actually
21364 +*needs* multiple local X servers...
21365 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/modules.txt kernel-source-2.6.16/Documentation/abi/modules.txt
21366 --- kernel-source-2.6.16.orig/Documentation/abi/modules.txt 1970-01-01 10:00:00.000000000 +1000
21367 +++ kernel-source-2.6.16/Documentation/abi/modules.txt 2006-04-27 18:50:24.000000000 +1000
21369 +A brief overview of the Linux-ABI modules
21371 +Christoph Hellwig, <hch@caldera.de>
21373 +Linux-ABI consists of a number of loadable kernel modules (you can also
21374 +compile it directly into the kernel, but no one actually does). This
21375 +document is intended to give a brief overview on the aviable modules
21376 +and how they can be classified in groups.
21379 +=== Binary format modules
21381 +Some of the personalities supported by Linux-ABI use different binary
21382 +formats than the ELF format that is used by Linux native binaries.
21383 +The follwoing binary format modules do exists:
21387 + This modules supports the COFF binary format as used by elder
21388 + SysV-derivate operating systems. It is used by the SVR3,
21389 + SCOSVR3, ISC and Wyse personalities.
21393 + This module is intended for loading X.out binaries generated for
21394 + the Xenix operating system.
21396 +These modules have to be loaded manually before using them.
21400 +=== Personality modules
21402 +Personality modules contain the the personality implementation and are
21403 +thus the hearts of Linux-ABI. Additionally most personality modules
21404 +contain syscalls only used by that particular personality. There are
21405 +a lot of personality modules:
21409 + Support for plain SVR3/SVR4 as specified in iBCS2 or iABI4.
21410 + Additionally this module contains the Xenix and ISC personalities,
21411 + but these should be moved away from here.
21415 + This module implements the SCO Unix 3.x/ODT and OSR5 personalities.
21419 + The Solaris 2 emulator.
21423 + SCO UnixWare 7 / Caldera OpenUnix 8 emulator.
21427 + Support for Wyse V/386 ant it's multiprocessor variant.
21430 +=== Backend modules
21432 +As a lot of the functionality provided by the binary format modules is
21433 +common to more than one of those, most of this functionality is moved to
21434 +backend modules. There are only a few backend modules:
21438 + The machine depandand part of Linux-ABI (in fact currently
21439 + Linux-ABI is i386-specific, but that _will_ change).
21443 + Most of the syscalls used by all or many of the SVR3/SVR4 derivates.
21447 + 4BSD-style socket interface, currently only used by the Wyse
21448 + emulation. This will probably go away.
21449 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/Notes.Signal kernel-source-2.6.16/Documentation/abi/Notes.Signal
21450 --- kernel-source-2.6.16.orig/Documentation/abi/Notes.Signal 1970-01-01 10:00:00.000000000 +1000
21451 +++ kernel-source-2.6.16/Documentation/abi/Notes.Signal 2006-04-27 18:50:24.000000000 +1000
21453 +Drew, Joe, and Brandon.
21455 +This file contains my code for the signal functions. I realized that the
21456 +existing signal functions will not suffice. This module should do the
21457 +proper processing for iBCS signals.
21459 +There are patches to the emulate module offered by Drew in his pl14n code
21460 +release. The Makefile was changed to include the module.
21462 +In addition, I have include a signal.doc file which contains the text from
21463 +my UNIX S5 manual describing the functions used by iBCS. I based the
21464 +emulator code on this document. Please look it over and see if I have
21465 +messed up. I believe it to be correct. However, it never hurts to have
21466 +someone check the work before we can trust it.
21468 +It follows what I believe to be the proper calling sequence for signals. I
21469 +sent a message to the IBSC2 group with the text from the McGraw Hill book
21470 +concerning signals. If you would like a copy of the message, then let me
21473 +Of couse, this could be totally wrong. That is the whole point about
21474 +sending this out to a limited distribution.
21476 +In addition to the processing for the various function requests, you may
21477 +have noticed that the signal _numbers_ must be changed between the values
21478 +used by iBCS and Linux.
21480 +I have had to modify the emulate.c module to export an additional
21481 +procedure (and for emulate.c to use the procedure itself.) In addition, I
21482 +change the branch table to re-direct the signal processing to the signal.c
21485 +I hope that this will help the project when it has been proven workable.
21486 +Please let me know how this turns out -- one way or the other.
21488 +If it does work, then I'll give the final code to Drew to merge into the
21489 +master code. That is unless, Drew, you already have it. :-)
21494 +Al Longyear longyear@netcom.com longyear@sii.com
21495 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/Personality kernel-source-2.6.16/Documentation/abi/Personality
21496 --- kernel-source-2.6.16.orig/Documentation/abi/Personality 1970-01-01 10:00:00.000000000 +1000
21497 +++ kernel-source-2.6.16/Documentation/abi/Personality 2006-04-27 18:50:24.000000000 +1000
21499 +*** Why are multiple personalities necessary?
21501 +Personalities are used to provide the expected set of syscalls and error
21502 +code mapping for non-Linux processes. In theory the set of syscalls and
21503 +error codes should be standardised across all SYSV systems. In practice
21504 +this is the case for SVR4, however SVR3 is a much older code base and
21505 +many vendors have extended it leading to incompatibilities between the
21506 +expected interfaces. Personalities allow us to vary the interface presented
21507 +on a per-process basis thus allowing Linux to run binaries created for
21508 +different vendor's extended SVR3s simultaneously.
21511 +*** How are personalities implemented?
21513 +The per-process task structure contains a field "personality". This defaults
21514 +to 0 for Linux binaries, 1 (SVR4) for ELF binaries and 2 (SVR3) for COFF
21515 +binaries. However when the COFF loader is called on to load a new binary
21516 +it looks at the first 1k of data in each .comment section and compares
21517 +the strings it finds with a built in table. If it finds a match it will
21518 +set the personality appropriately.
21520 + When the application makes a system call the iBCS emulation layer uses
21521 +the personality code in the per-process task structure to determine which
21522 +system call mappings to use to locate the correct function.
21524 + If the function returns an (Linux) error code the iBCS emulation layer
21525 +uses the personality code to determine which error code mappings to use
21526 +to translate the error code in to a value the application will understand.
21529 +*** What personalities are implemented?
21531 +Currently the implemented personalities are SVR4, SVR3 (as a direct
21532 +subset of SVR4), SCO 3.[24] and Wyse V/386 3.2.1. Of these the Wyse
21533 +emulation is the most complete at this time. Rather than using the
21534 +more common streams based TCP/IP stack on their SVR3, Wyse used a BSD
21535 +implementation with a system call interface. Currently the Wyse emulation
21536 +is the only one capable of running non-Linux TCP/IP binaries.
21539 +*** When do I need to add a personality rather than use the default?
21541 +When your applications start failing for inexplicable reasons! Seriously,
21542 +if you have an SVR3 based Unix which does not currently have its own
21543 +personality defined then you should check some things very carefully.
21545 + Firstly compare your system's /usr/include/sys/errno.h with the data
21546 +in the Error.map file. If the values defined in your errno.h do not
21547 +match those in the ABI column then you will need to create a new
21548 +personality in order to map error codes to the correct values.
21550 + Next compare your system's /usr/include/sys.s with the data in the
21551 +Syscall.map file. If there are system calls in your sys.s that don't
21552 +do the same thing as those in the ABI column (other than ones that
21553 +simply aren't implemented on your system) then you will need to create
21554 +a new personality in order to mapp system calls to the correct functions.
21557 +*** How do I add a new personality?
21559 +The first step is to find a way for the COFF loader to recognise your
21560 +binaries as being different. To do this you need to examine the comments
21561 +embedded in a range of binaries, system executables, bought programs of
21562 +various ages and locally compiled programs, using "mcs -p" to list the
21563 +.comments sections. If you don't have "mcs" use "strings" and look for
21564 +version or copyright messages. You are looking for one or more strings
21565 +near the top which uniquely identify the system.
21567 + Once you have your identifying strings you must add a value for the
21568 +new personality to linux/include/linux/personality.h (just use the
21569 +next highest number) and add the strings to the table in the COFF loader
21570 +linux/fs/binfmt_coff.c.
21572 + The next step is to modify the error map. Edit the file errmap.inc and
21573 +look at the end of the file where there is an array of pointers to error
21574 +maps call err_map. There is one entry for each personality. Add a new
21575 +entry to the end for your personality. If your personality is compatible
21576 +with an exising personality you can simply reuse the same error map (see
21577 +the duplicate entries for the SVR4 map which is use for both SVR4 and
21578 +SVR3 personalities), otherwise you must figure out how to create a new
21579 +error mapping. One day it may be documented here :-).
21581 + Next you must modify the syscall mapping. Edit the file callmap.inc
21582 +and look at the end of the file where there is an array containg one
21583 +pointer for each personality. Add a new entry to the end. If your syscalls
21584 +match one of the existing personalities you may reuse the existing map.
21585 +Otherwise you have to build a new one. Again, one day it may be documented
21587 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/README.first kernel-source-2.6.16/Documentation/abi/README.first
21588 --- kernel-source-2.6.16.orig/Documentation/abi/README.first 1970-01-01 10:00:00.000000000 +1000
21589 +++ kernel-source-2.6.16/Documentation/abi/README.first 2006-04-27 18:50:24.000000000 +1000
21591 +First notes on Linux-ABI documentation
21593 +Christoph Hellwig, <hch@caldera.de>
21596 +Please note that most files in this directory are leftovers from iBCS, which is
21597 +dead since 1998. Do not expect this files to uptodate or complete.
21599 +I will update the files and add new onces from time to time.
21603 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/Syscall.map kernel-source-2.6.16/Documentation/abi/Syscall.map
21604 --- kernel-source-2.6.16.orig/Documentation/abi/Syscall.map 1970-01-01 10:00:00.000000000 +1000
21605 +++ kernel-source-2.6.16/Documentation/abi/Syscall.map 2006-04-27 18:50:24.000000000 +1000
21607 +Call ABI SCO 3.2 SCO 3.4 Wyse V/386 3.2.1 386bsd
21626 + 18 stat getfsstat
21637 + 29 pause recvfrom
21639 + 31 stty getpeername
21640 + 32 gtty getsockname
21643 + 35 statfs fchflags
21647 + 39 setpgrp getppid
21653 + 45 lock/plock ktrace
21654 + 46 setgid sigaction
21656 + 48 signal sigprocmask
21657 + 49 msgsys getlogin
21658 + 50 sysi86/sys3b setlogin
21660 + 52 shmsys sigpending
21661 + 53 semsys sigaltstack
21665 + 57 utssys symlink
21671 + 63 ulimit getkerninfo
21672 + 64 ??? getpagesize
21680 + 72 rmount vadvise
21681 + 73 rumount munmap
21682 + 74 rfstart mprotect
21684 + 76 rdebug vhangup
21687 + 79 rmdir getgroups
21688 + 80 mkdir setgroups
21689 + 81 getdents getpgrp
21690 + 82 libattach setpgid
21691 + 83 libdetach setitimer
21694 + 86 putmsg getitimer
21695 + 87 poll gethostname
21696 + 88 lstat --- --- --- sethostname
21697 + 89 symlink --- --- --- getdtablesize
21698 + 90 readlink --- symlink --- dup2
21699 + 91 setgroups --- lstat --- ---
21700 + 92 getgroups --- readlink --- fcntl
21701 + 93 fchmod --- --- --- select
21702 + 94 fchown --- --- --- ---
21703 + 95 sigprocmask --- --- --- fsync
21704 + 96 sigsuspend --- --- --- setpriority
21705 + 97 sigaltstack --- --- --- socket
21706 + 98 sigaction --- --- --- connect
21707 + 99 sigpending --- --- --- accept
21708 +100 context --- --- --- getpriority
21709 +101 evsys --- --- --- send
21710 +102 evtrapret --- --- --- recv
21711 +103 statvfs --- --- --- sigreturn
21712 +104 fstatvfs --- --- --- bind
21713 +105 ??? setsockopt
21714 +106 nfssys --- --- --- listen
21715 +107 waitsys --- --- --- vtimes
21716 +108 sigsendsys --- --- --- sigvec
21717 +109 hrtsys --- --- --- sigblock
21718 +110 acancel --- --- --- sigsetmask
21719 +111 async --- --- --- sigsuspend
21720 +112 priocntlsys --- --- --- sigstack
21721 +113 pathconf --- --- --- recvmsg
21722 +114 mincore --- --- --- sendmsg
21723 +115 mmap --- --- --- vtrace
21724 +116 mprotect --- --- --- gettimeofday
21725 +117 munmap --- --- --- getrusage
21726 +118 fpathconf --- --- --- getsockopt
21727 +119 vfork --- --- --- resuba
21728 +120 fchdir --- --- --- readv
21729 +121 readv --- --- --- writev
21730 +122 writev --- --- --- settimeofday
21731 +123 xstat --- --- --- fchown
21732 +124 lxstat --- --- --- fchmod
21733 +125 fxstat --- --- --- recvfrom
21734 +126 xmknod --- --- --- setreuid
21735 +127 clocal setregid
21736 +128 setrlimit --- --- lstat rename
21737 +129 getrlimit --- --- readlink truncate
21738 +130 lchown --- --- symlink ftruncate
21739 +131 memcntl --- --- --- flock
21740 +132 getpmsg --- --- --- mkfifo
21741 +133 putpmsg --- --- gethostname sendto
21742 +134 rename --- --- sethostname shutdown
21743 +135 uname --- --- getdomainname socketpair
21744 +136 setegid --- --- setdomainname mkdir
21745 +137 sysconfig --- --- --- rmdir
21746 +138 adjtime --- --- setreuid utimes
21747 +139 systeminfo --- --- setregid sigreturn
21749 +141 seteuid --- --- --- getpeername
21750 +142 --- --- --- --- gethostid
21751 +143 --- --- --- --- sethostid
21752 +144 --- --- --- --- getrlimit
21753 +145 --- --- --- --- setrlimit
21754 +146 --- --- --- --- killpg
21755 +147 --- --- --- --- setsid
21756 +148 --- --- --- --- quotactl
21757 +149 --- --- --- --- quota
21758 +150 --- --- --- --- getsockname
21759 +151 --- --- --- ---
21760 +152 --- --- --- ---
21761 +153 --- --- --- ---
21762 +154 --- --- --- ---
21763 +155 --- --- --- --- nfssvc
21764 +156 --- --- --- --- getdirentries
21765 +157 --- --- --- --- statfs
21766 +158 --- --- --- --- fstatfs
21767 +159 --- --- --- ---
21768 +160 --- --- --- --- async_daemon
21769 +161 --- --- --- --- getfh
21770 +162 --- --- --- --- getdomainname
21771 +163 --- --- --- --- setdomainname
21772 +164 --- --- --- --- uname
21773 +165 --- --- --- --- sysarch
21774 +166 --- --- --- ---
21775 +167 --- --- --- ---
21776 +168 --- --- --- ---
21777 +169 --- --- --- --- semsys
21778 +170 --- --- --- --- msgsys
21779 +171 --- --- --- --- shmsys
21780 +172 --- --- --- ---
21781 +173 --- --- --- ---
21782 +174 --- --- --- ---
21783 +175 --- --- --- --- ntp_gettime
21784 +176 --- --- --- --- ntp_adjtime
21785 +177 --- --- --- --- vm_allocate
21786 +178 --- --- --- --- vm_deallocate
21787 +179 --- --- --- --- vm_inherit
21788 +180 --- --- --- --- vm_protect
21789 +181 --- --- --- --- setgid
21790 +182 --- --- --- --- setegid
21791 +183 --- --- --- --- seteuid
21792 diff -Nur kernel-source-2.6.16.orig/Documentation/abi/TODO.ibcs kernel-source-2.6.16/Documentation/abi/TODO.ibcs
21793 --- kernel-source-2.6.16.orig/Documentation/abi/TODO.ibcs 1970-01-01 10:00:00.000000000 +1000
21794 +++ kernel-source-2.6.16/Documentation/abi/TODO.ibcs 2006-04-27 18:50:24.000000000 +1000
21797 + These are leftovers from iBCS, I just removed what is already
21798 + done in linux-abi or isn't relevant for us. --hch
21801 +^Z disconnects but the next read seems to return an error instead
21802 +of blocking? (Fixed?)
21804 +SIOGIFFLAGS seems to get passed an empty string as the interface name
21805 +(ISC ping). What is supposed to be happening?
21807 +If a timod putmsg fails we should set an error status on the socket and
21808 +return it on future calls for strict compatibility. Currently we recover
21809 +from things such as protocol errors rather more than we should.
21811 +Getmsg() - when select returns we may not be the first process to wake
21812 +up and handle the event. So the recvfrom ought to be non-blocking (not
21813 +possible?). If it would block we should go back to the select (unless
21814 +the descriptor is in non-blocking mode). (DONE?)
21816 +How should we go about returning TLOOK? Currently we are only working
21817 +synchronously so it isn't essential yet. It looks like it's all handled
21820 +The T_MORE flag on t_snd() and t_rcv() marks message boundaries. Strictly
21821 +these should be preserved end-to-end. Possible across sockets?
21822 +(X/Open specify that message boundaries shouldn't be relied on with TCP)
21824 +Need I_SETSIG ioctl to enable SIGPOLL on available input etc. Note that
21825 +a control message counts as input. This should interface with poll() too.
21827 +getmsg() returns EINTR if a signal interrupts it but the t_*() functions
21828 +don't seem to propogate this back to the application. Presumably they
21831 +The SCO timod doesn't seem to pay much attention to the TI_* command
21832 +in an ioctl but uses the T_* primitive in the message block. i.e. if
21833 +you have T_BIND_REQ in the message but TI_GETINFO as the ioctl command
21834 +timod will do a bind. Currently we use the TI_* by preference. This
21835 +needs to change to avoid breaking programs that worked on SCO even
21836 +though broken. It shouldn't be _essential_ though as all this is
21837 +normally hidden in libnsl_s so should be consistent.
21839 +Connects are currently forced synchronous. It wouldn't be too much
21840 +to allow them to happen asynchronously but the async confirmation
21841 +is supposed to contain the address we connected to and that is only
21842 +available from the connection request message. Unless we save it
21843 +somewhere or look it up from the socket. Hang on, we have getpeername()
21846 +There are slight semantic differences between O_NDELAY and O_NONBLOCK
21847 +which cause different behaviour on SCO at least. For instance O_NDELAY
21848 +does cause t_connect to work asynchronously but O_NONBLOCK doesn't.
21849 +Under Linux O_NDELAY and O_NONBLOCK are the same. This could cause
21850 +problems at some point I guess...
21852 +Under SCO at least poll and select are different. Poll works on things
21853 +that select can be used on but select cannot necessarily work on things
21854 +that can be polled. Specifically you can poll a transport end point
21855 +but not select on it. Badly written programs could block when they
21856 +wouldn't normally.
21857 diff -Nur kernel-source-2.6.16.orig/fs/binfmt_coff.c kernel-source-2.6.16/fs/binfmt_coff.c
21858 --- kernel-source-2.6.16.orig/fs/binfmt_coff.c 1970-01-01 10:00:00.000000000 +1000
21859 +++ kernel-source-2.6.16/fs/binfmt_coff.c 2006-04-27 18:50:24.000000000 +1000
21862 + * These are the functions used to load COFF IBCS style executables.
21863 + * Information on COFF format may be obtained in either the Intel Binary
21864 + * Compatibility Specification 2 or O'Rilley's book on COFF. The shared
21865 + * libraries are defined only the in the Intel book.
21867 + * This file is based upon code written by Eric Youngdale for the ELF object
21870 + * Author: Al Longyear (longyear@sii.com)
21875 +#include <linux/module.h>
21876 +#include <linux/fs.h>
21877 +#include <linux/stat.h>
21878 +#include <linux/sched.h>
21879 +#include <linux/init.h>
21880 +#include <linux/kernel.h>
21881 +#include <linux/mm.h>
21882 +#include <linux/mman.h>
21883 +#include <linux/a.out.h>
21884 +#include <linux/errno.h>
21885 +#include <linux/signal.h>
21886 +#include <linux/binfmts.h>
21887 +#include <linux/string.h>
21888 +#include <linux/fcntl.h>
21889 +#include <linux/ptrace.h>
21890 +#include <linux/coff.h>
21891 +#include <linux/slab.h>
21892 +#include <linux/personality.h>
21893 +#include <linux/file.h>
21894 +#include <linux/unistd.h>
21895 +#include <linux/syscalls.h>
21896 +#include <asm/uaccess.h>
21899 +#ifndef EXPORT_NO_SYMBOLS
21900 +#define EXPORT_NO_SYMBOLS
21903 +MODULE_DESCRIPTION("Support for the SVR3 COFF binary format");
21904 +MODULE_AUTHOR("Al Longyear, Christoph Hellwig");
21905 +MODULE_LICENSE("GPL");
21907 +EXPORT_NO_SYMBOLS;
21910 +static int coff_load_binary(struct linux_binprm *, struct pt_regs *);
21911 +static int coff_load_shlib(struct file *);
21912 +static int coff_preload_shlibs(struct linux_binprm *, COFF_SCNHDR *, int);
21913 +static int coff_parse_comments(struct file *, COFF_SCNHDR *, long *);
21916 +static struct linux_binfmt coff_format = {
21917 + NULL, THIS_MODULE, coff_load_binary, coff_load_shlib, NULL, PAGE_SIZE
21921 +typedef struct coff_section {
21927 +typedef struct coff_clue {
21928 + short terminal; /* non-zero to stop parsing with this entry */
21929 + short len; /* negative number uses strstr for lookup */
21930 + char *text; /* text to search for */
21931 + u_long mask_and, mask_or;
21936 + * The following table gives clues to the "personality" of the executable
21937 + * which we hope to find in the .comment sections of the binary.
21938 + * The set here may not be comprehensive even for those systems listed.
21939 + * Use 'mcs -p' to list the .comments sections of a binary to see what
21940 + * clues might be there. Or use 'strings' if you don't have mcs.
21942 +static coff_clue coff_clues[] = {
21944 + * Wyse Unix V/386 3.2.1[A].
21946 + {1, 36, "@(#) UNIX System V/386 Release 3.2.1", 0, PER_WYSEV386},
21949 + * SCO Unix V 3.2, 3.2.2, 3.2.4, 3.2.4.2 etc.
21951 + {1, 23, "@(#) crt1.s 1.8 89/05/30", 0, PER_SCOSVR3},
21952 + {1, 16, "@(#)SCO UNIX 3.2", 0, PER_SCOSVR3},
21953 + {1, 18, "\"@(#) SCO UNIX 3.2", 0, PER_SCOSVR3},
21954 + {1, 17, "@(#) SCO UNIX 3.2", 0, PER_SCOSVR3},
21955 + {1, 11, "@(#)SCO 3.2", 0, PER_SCOSVR3},
21958 + * SCO Unix 3.2.4.2 OpenServer 5 gives 32 bit inodes except
21959 + * programs compiled with ods30 compatibilty. In fact OS5
21960 + * always gives 32 bits but the library drops the top 16 in
21961 + * odt30 mode. We know what should happen and do it however.
21963 + {0, 32, "@(#) crt1.s.source 20.1 94/12/04", 0, PER_SCOSVR3},
21964 + {1, 13, "ods_30_compat", ~0, PERF_SHORT_INODE},
21967 + * Interactive (ISC) 4.0.
21969 + {1, -1, "INTERACTIVE", 0, PER_ISCR4},
21978 + * Parse a comments section looking for clues as to the system this
21979 + * was compiled on so we can get the system call interface right.
21982 +coff_parse_comments(struct file *fp, COFF_SCNHDR *sect, long *personality)
21984 + u_long offset, nbytes;
21985 + int hits = 0, err;
21988 + if (!(buffer = (char *)__get_free_page(GFP_KERNEL)))
21992 + * Fetch the size of the section. There must be something in there
21993 + * or the section wouldn't exist at all. We only bother with the
21994 + * first 8192 characters though. There isn't any point getting too
21997 + if ((nbytes = COFF_LONG(sect->s_size)) > 8192)
22000 + offset = COFF_LONG(sect->s_scnptr);
22001 + while (nbytes > 0) {
22002 + u_long count, start = 0;
22005 + err = kernel_read(fp, offset, buffer,
22006 + nbytes > PAGE_SIZE ? PAGE_SIZE : nbytes);
22009 + free_page((u_long) buffer);
22014 + for (count = 0; count < err; count++) {
22018 + c = *(buffer + PAGE_SIZE - 1);
22019 + *(buffer + PAGE_SIZE - 1) = '\0';
22021 + for (clue = coff_clues; clue->len; clue++) {
22022 + if ((clue->len < 0 && strstr(p, clue->text)) ||
22023 + (clue->len > 0 && !strncmp(p, clue->text, clue->len))) {
22024 + *personality &= clue->mask_and;
22025 + *personality |= clue->mask_or;
22026 + if (clue->terminal) {
22027 + free_page((u_long)buffer);
22033 + *(buffer + PAGE_SIZE - 1) = c;
22035 + while (*p && count < err)
22037 + if (count < err) {
22045 + * If we didn't find an end ofstring at all this page
22046 + * probably isn't useful string data.
22055 + free_page((u_long)buffer);
22060 + * Small procedure to test for the proper file alignment.
22061 + * Return the error code if the section is not properly aligned.
22063 +static __inline__ int
22064 +coff_isaligned(COFF_SCNHDR *sectp)
22066 + long scnptr = COFF_LONG(sectp->s_scnptr);
22067 + long vaddr = COFF_LONG(sectp->s_vaddr);
22069 + if ((vaddr - scnptr) & ~PAGE_MASK)
22075 + * Clear the bytes in the last page of data.
22078 +coff_clear_memory(u_long addr, u_long size)
22082 + if ((size = (PAGE_SIZE - (addr & ~PAGE_MASK)) & ~PAGE_MASK) == 0)
22084 + if (!access_ok(VERIFY_WRITE, (void *)addr, size))
22090 + while (size-- != 0) {
22091 + __put_user(0, (char *)addr);
22099 +static inline unsigned long
22100 +map_coff(struct file *file, coff_section *sect, unsigned long prot,
22101 + unsigned long flag, unsigned long offset)
22103 + unsigned long map_addr;
22105 + down_write(¤t->mm->mmap_sem);
22106 + map_addr = do_mmap(file,
22107 + sect->vaddr & PAGE_MASK,
22108 + sect->size + (sect->vaddr & ~PAGE_MASK),
22109 + prot, flag, offset);
22110 + up_write(¤t->mm->mmap_sem);
22112 + return (map_addr);
22117 +coff_mktables(char *p, int argc, int envc)
22119 + u_long *argv, *envp;
22122 + sp = (u_long *) ((-(u_long)sizeof(char *)) & (u_long)p);
22129 + put_user(argc, --sp);
22130 + current->mm->arg_start = (u_long)p;
22132 + while (argc-- > 0) {
22133 + __put_user(p, argv++);
22134 + p += strlen_user(p);
22137 + __put_user(NULL, argv);
22138 + current->mm->arg_end = current->mm->env_start = (u_long)p;
22140 + while (envc-- > 0) {
22141 + __put_user(p, envp++);
22142 + p += strlen_user(p);
22145 + __put_user(NULL, envp);
22146 + current->mm->env_end = (u_long) p;
22152 + * Helper function to process the load operation.
22155 +coff_load_object(struct linux_binprm *bprm, struct pt_regs *regs, int binary)
22157 + COFF_FILHDR *coff_hdr = NULL;
22158 + COFF_SCNHDR *text_sect = NULL, *data_sect = NULL,
22159 + *bss_sect = NULL, *sect_bufr = NULL,
22160 + *sect_ptr = NULL;
22161 + int text_count = 0, data_count = 0,
22162 + bss_count = 0, lib_count = 0;
22163 + coff_section text, data, bss;
22164 + u_long start_addr = 0, p = bprm->p;
22165 + short flags, aout_size = 0;
22166 + int pageable = 1, sections = 0, status = 0, i;
22167 + int coff_exec_fileno;
22168 + mm_segment_t old_fs;
22171 + coff_hdr = (COFF_FILHDR *)bprm->buf;
22174 + * Validate the magic value for the object file.
22176 + if (COFF_I386BADMAG(*coff_hdr))
22179 + flags = COFF_SHORT(coff_hdr->f_flags);
22182 + * The object file should have 32 BIT little endian format. Do not allow
22183 + * it to have the 16 bit object file flag set as Linux is not able to run
22184 + * on the 80286/80186/8086.
22186 + if ((flags & (COFF_F_AR32WR | COFF_F_AR16WR)) != COFF_F_AR32WR)
22190 + * If the file is not executable then reject the execution. This means
22191 + * that there must not be external references.
22193 + if ((flags & COFF_F_EXEC) == 0)
22197 + * Extract the header information which we need.
22199 + sections = COFF_SHORT(coff_hdr->f_nscns); /* Number of sections */
22200 + aout_size = COFF_SHORT(coff_hdr->f_opthdr); /* Size of opt. headr */
22203 + * There must be at least one section.
22208 + if (!bprm->file->f_op->mmap)
22211 + if (!(sect_bufr = kmalloc(sections * COFF_SCNHSZ, GFP_KERNEL))) {
22212 + printk(KERN_WARNING "coff: kmalloc failed\n");
22216 + status = kernel_read(bprm->file, aout_size + COFF_FILHSZ,
22217 + (char *)sect_bufr, sections * COFF_SCNHSZ);
22218 + if (status < 0) {
22219 + printk(KERN_WARNING "coff: unable to read\n");
22220 + goto out_free_buf;
22223 + status = get_unused_fd();
22224 + if (status < 0) {
22225 + printk(KERN_WARNING "coff: unable to get free fs\n");
22226 + goto out_free_buf;
22229 + get_file(bprm->file);
22230 + fd_install(coff_exec_fileno = status, bprm->file);
22233 + * Loop through the sections and find the various types
22235 + sect_ptr = sect_bufr;
22237 + for (i = 0; i < sections; i++) {
22238 + long int sect_flags = COFF_LONG(sect_ptr->s_flags);
22240 + switch (sect_flags) {
22241 + case COFF_STYP_TEXT:
22242 + status |= coff_isaligned(sect_ptr);
22243 + text_sect = sect_ptr;
22247 + case COFF_STYP_DATA:
22248 + status |= coff_isaligned(sect_ptr);
22249 + data_sect = sect_ptr;
22253 + case COFF_STYP_BSS:
22254 + bss_sect = sect_ptr;
22258 + case COFF_STYP_LIB:
22266 + sect_ptr = (COFF_SCNHDR *) & ((char *) sect_ptr)[COFF_SCNHSZ];
22270 + * If any of the sections weren't properly aligned we aren't
22271 + * going to be able to demand page this executable. Note that
22272 + * at this stage the *only* excuse for having status <= 0 is if
22273 + * the alignment test failed.
22279 + * Ensure that there are the required sections. There must be one
22280 + * text sections and one each of the data and bss sections for an
22281 + * executable. A library may or may not have a data / bss section.
22283 + if (text_count != 1) {
22284 + status = -ENOEXEC;
22285 + goto out_free_file;
22287 + if (binary && (data_count != 1 || bss_count != 1)) {
22288 + status = -ENOEXEC;
22289 + goto out_free_file;
22293 + * If there is no additional header then assume the file starts
22294 + * at the first byte of the text section. This may not be the
22295 + * proper place, so the best solution is to include the optional
22296 + * header. A shared library __MUST__ have an optional header to
22297 + * indicate that it is a shared library.
22299 + if (aout_size == 0) {
22301 + status = -ENOEXEC;
22302 + goto out_free_file;
22304 + start_addr = COFF_LONG(text_sect->s_vaddr);
22305 + } else if (aout_size < (short) COFF_AOUTSZ) {
22306 + status = -ENOEXEC;
22307 + goto out_free_file;
22309 + COFF_AOUTHDR *aout_hdr;
22310 + short aout_magic;
22312 + aout_hdr = (COFF_AOUTHDR *) &((char *)coff_hdr)[COFF_FILHSZ];
22313 + aout_magic = COFF_SHORT(aout_hdr->magic);
22316 + * Validate the magic number in the a.out header. If it is valid then
22317 + * update the starting symbol location. Do not accept these file formats
22318 + * when loading a shared library.
22320 + switch (aout_magic) {
22321 + case COFF_OMAGIC:
22322 + case COFF_ZMAGIC:
22323 + case COFF_STMAGIC:
22325 + status = -ENOEXEC;
22326 + goto out_free_file;
22328 + start_addr = (u_int)COFF_LONG(aout_hdr->entry);
22331 + * Magic value for a shared library. This is valid only when
22332 + * loading a shared library.
22334 + * (There is no need for a start_addr. It won't be used.)
22336 + case COFF_SHMAGIC:
22339 + /* FALLTHROUGH */
22341 + status = -ENOEXEC;
22342 + goto out_free_file;
22347 + * Generate the proper values for the text fields
22349 + * THIS IS THE POINT OF NO RETURN. THE NEW PROCESS WILL TRAP OUT SHOULD
22350 + * SOMETHING FAIL IN THE LOAD SEQUENCE FROM THIS POINT ONWARD.
22353 + text.scnptr = COFF_LONG(text_sect->s_scnptr);
22354 + text.size = COFF_LONG(text_sect->s_size);
22355 + text.vaddr = COFF_LONG(text_sect->s_vaddr);
22358 + * Generate the proper values for the data fields
22361 + if (data_sect != NULL) {
22362 + data.scnptr = COFF_LONG(data_sect->s_scnptr);
22363 + data.size = COFF_LONG(data_sect->s_size);
22364 + data.vaddr = COFF_LONG(data_sect->s_vaddr);
22372 + * Generate the proper values for the bss fields
22375 + if (bss_sect != NULL) {
22376 + bss.size = COFF_LONG(bss_sect->s_size);
22377 + bss.vaddr = COFF_LONG(bss_sect->s_vaddr);
22384 + * Flush the executable from memory. At this point the executable is
22385 + * committed to being defined or a segmentation violation will occur.
22389 + COFF_SCNHDR *sect_ptr2 = sect_bufr;
22390 + u_long personality = PER_SVR3;
22393 + if ((status = flush_old_exec(bprm)))
22394 + goto out_free_file;
22397 + * Look for clues as to the system this binary was compiled
22398 + * on in the comments section(s).
22400 + * Only look at the main binary, not the shared libraries
22401 + * (or would it be better to prefer shared libraries over
22402 + * binaries? Or could they be different???)
22404 + for (i = 0; i < sections; i++) {
22405 + long sect_flags = COFF_LONG(sect_ptr2->s_flags);
22407 + if (sect_flags == COFF_STYP_INFO &&
22408 + (status = coff_parse_comments(bprm->file,
22409 + sect_ptr2, &personality)) > 0)
22412 + sect_ptr2 = (COFF_SCNHDR *) &((char *)sect_ptr2)[COFF_SCNHSZ];
22416 + * If no .comments section was found there is no way to
22417 + * figure out the personality. Odds on it is SCO though...
22419 + personality = abi_defhandler_coff;
22422 + set_personality(personality);
22424 + current->mm->start_data = 0;
22425 + current->mm->end_data = 0;
22426 + current->mm->end_code = 0;
22427 + current->mm->mmap = NULL;
22428 + current->flags &= ~PF_FORKNOEXEC;
22429 + atomic_long_set(¤t->mm->_file_rss, 0);
22432 + * Construct the parameter and environment
22433 + * string table entries.
22435 + if ((status = setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT)) < 0)
22438 + p = (u_long)coff_mktables((char *)bprm->p,
22439 + bprm->argc, bprm->envc);
22441 + current->mm->end_code = text.size +
22442 + (current->mm->start_code = text.vaddr);
22443 + current->mm->end_data = data.size +
22444 + (current->mm->start_data = data.vaddr);
22445 + current->mm->brk = bss.size +
22446 + (current->mm->start_brk = bss.vaddr);
22448 + current->mm->start_stack = p;
22449 + compute_creds(bprm);
22450 + start_thread(regs, start_addr, p);
22453 + old_fs = get_fs();
22454 + set_fs(get_ds());
22458 + * Read the file from disk...
22462 + loff_t pos = data.scnptr;
22463 + status = do_brk(text.vaddr, text.size);
22464 + bprm->file->f_op->read(bprm->file,
22465 + (char *)data.vaddr, data.scnptr, &pos);
22466 + status = do_brk(data.vaddr, data.size);
22467 + bprm->file->f_op->read(bprm->file,
22468 + (char *)text.vaddr, text.scnptr, &pos);
22471 + /* map the text pages...*/
22472 + status = map_coff(bprm->file, &text, PROT_READ | PROT_EXEC,
22473 + MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
22474 + text.scnptr & PAGE_MASK);
22476 + if (status != (text.vaddr & PAGE_MASK)) {
22477 + status = -ENOEXEC;
22478 + goto out_free_file;
22481 + /* map the data pages */
22482 + if (data.size != 0) {
22483 + status = map_coff(bprm->file, &data,
22484 + PROT_READ | PROT_WRITE | PROT_EXEC,
22485 + MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
22486 + data.scnptr & PAGE_MASK);
22488 + if (status != (data.vaddr & PAGE_MASK)) {
22489 + status = -ENOEXEC;
22490 + goto out_free_file;
22498 + * Construct the bss data for the process. The bss ranges from the
22499 + * end of the data (which may not be on a page boundary) to the end
22500 + * of the bss section. Allocate any necessary pages for the data.
22502 + if (bss.size != 0) {
22503 + down_write(¤t->mm->mmap_sem);
22504 + do_mmap(NULL, PAGE_ALIGN(bss.vaddr),
22505 + bss.size + bss.vaddr -
22506 + PAGE_ALIGN(bss.vaddr),
22507 + PROT_READ | PROT_WRITE | PROT_EXEC,
22508 + MAP_FIXED | MAP_PRIVATE, 0);
22509 + up_write(¤t->mm->mmap_sem);
22511 + if ((status = coff_clear_memory(bss.vaddr, bss.size)) < 0)
22512 + goto out_free_file;
22518 + goto out_free_file;
22521 + * Load any shared library for the executable.
22524 + status = coff_preload_shlibs(bprm, sect_bufr, sections);
22526 + set_binfmt(&coff_format);
22529 + * Generate any needed trap for this process. If an error occured then
22530 + * generate a segmentation violation. If the process is being debugged
22531 + * then generate the load trap. (Note: If this is a library load then
22532 + * do not generate the trap here. Pass the error to the caller who
22533 + * will do it for the process in the outer lay of this procedure call.)
22535 + if (status < 0) {
22537 + printk(KERN_WARNING "coff: trapping process with SEGV\n");
22538 + send_sig(SIGSEGV, current, 0); /* Generate the error trap */
22539 + } else if (current->ptrace & PT_PTRACED)
22540 + send_sig(SIGTRAP, current, 0);
22542 + /* We are committed. It can't fail */
22546 + sys_close(coff_exec_fileno);
22549 + kfree(sect_bufr);
22554 + * This procedure is called to load a library section. The various
22555 + * libraries are loaded from the list given in the section data.
22558 +coff_preload_shlib(struct linux_binprm *exe_bprm, COFF_SCNHDR *sect)
22560 + COFF_SLIBHD *phdr;
22566 + * Fetch the size of the section. There must be
22567 + * enough room for at least one entry.
22569 + nbytes = (long)COFF_LONG(sect->s_size);
22570 + if (nbytes < (long)COFF_SLIBSZ)
22573 + if (!(buffer = kmalloc(nbytes, GFP_KERNEL))) {
22574 + printk(KERN_WARNING "coff: unable to allocate shlib buffer\n");
22578 + err = kernel_read(exe_bprm->file,
22579 + COFF_LONG(sect->s_scnptr), buffer, nbytes);
22583 + if (err != nbytes)
22587 + * Go through the list of libraries in the data area.
22589 + phdr = (COFF_SLIBHD *)buffer;
22590 + while (nbytes > (long)COFF_SLIBSZ) {
22591 + int entry_size, header_size;
22592 + mm_segment_t old_fs = get_fs();
22594 + entry_size = COFF_LONG(phdr->sl_entsz) * sizeof(long);
22595 + header_size = COFF_LONG(phdr->sl_pathndx) * sizeof(long);
22598 + * Validate the sizes of the various items.
22599 + * I don't trust the linker!!
22601 + if ((u_int)header_size >= (u_int)nbytes)
22603 + if ((u_int)entry_size <= (u_int)header_size)
22605 + if (entry_size <= 0)
22608 + set_fs(get_ds());
22609 + err = sys_uselib(&((char *)phdr)[header_size]);
22616 + * Point to the next library in the section data.
22618 + nbytes -= entry_size;
22619 + phdr = (COFF_SLIBHD *) & ((char *) phdr)[entry_size];
22631 + * Find all library sections and preload the shared libraries.
22633 + * This will eventually recurse to our code and load the shared
22634 + * library with our own procedures.
22637 +coff_preload_shlibs(struct linux_binprm *bpp, COFF_SCNHDR *sp, int sections)
22642 + for (i = 0; i < sections; i++) {
22643 + flags = COFF_LONG(sp->s_flags);
22644 + if (flags == COFF_STYP_LIB) {
22645 + if ((err = coff_preload_shlib(bpp, sp)))
22648 + sp = (COFF_SCNHDR *)&((char *)sp)[COFF_SCNHSZ];
22655 + * Load the image for an (coff) binary.
22657 + * => this procedure is called by the main load sequence,
22658 + * it will load the executable and prepare it for execution
22661 +coff_load_binary(struct linux_binprm *bpp, struct pt_regs *rp)
22663 + return (coff_load_object(bpp, rp, 1));
22667 + * Load the image for a (coff) shared library.
22669 + * => this is called when we need to load a library based upon a file name.
22670 + * => also called through coff_preload_shlib
22673 +coff_load_shlib(struct file *fp)
22675 + struct linux_binprm *bpp;
22676 + struct pt_regs regs;
22677 + int err = -ENOMEM;
22679 + if (!(bpp = kmalloc(sizeof(struct linux_binprm), GFP_KERNEL))) {
22680 + printk(KERN_WARNING "coff: kmalloc failed\n");
22684 + memset(bpp, 0, sizeof(struct linux_binprm));
22687 + if ((err = kernel_read(fp, 0L, bpp->buf, sizeof(bpp->buf))) < 0)
22688 + printk(KERN_WARNING "coff: unable to read library header\n");
22690 + err = coff_load_object(bpp, ®s, 0);
22698 +coff_module_init(void)
22700 + return (register_binfmt(&coff_format));
22703 +static void __exit
22704 +coff_module_exit(void)
22706 + unregister_binfmt(&coff_format);
22709 +module_init(coff_module_init);
22710 +module_exit(coff_module_exit);
22711 diff -Nur kernel-source-2.6.16.orig/fs/binfmt_xout.c kernel-source-2.6.16/fs/binfmt_xout.c
22712 --- kernel-source-2.6.16.orig/fs/binfmt_xout.c 1970-01-01 10:00:00.000000000 +1000
22713 +++ kernel-source-2.6.16/fs/binfmt_xout.c 2006-04-27 18:50:24.000000000 +1000
22716 + * Copyright (c) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
22717 + * Copyright (c) 2001 Christoph Hellwig (hch@caldera.de)
22723 + * This file is based upon code written by Al Longyear for the COFF file
22724 + * format which is in turn based upon code written by Eric Youngdale for
22725 + * the ELF object file format. Any errors are most likely my own however.
22727 +#define __KERNEL_SYSCALLS__
22728 +#include <linux/config.h>
22729 +#include <linux/module.h>
22730 +#include <linux/init.h>
22731 +#include <linux/fs.h>
22732 +#include <linux/sched.h>
22733 +#include <linux/mm.h>
22734 +#include <linux/mman.h>
22735 +#include <linux/a.out.h>
22736 +#include <linux/errno.h>
22737 +#include <linux/signal.h>
22738 +#include <linux/binfmts.h>
22739 +#include <linux/string.h>
22740 +#include <linux/fcntl.h>
22741 +#include <linux/ptrace.h>
22742 +#include <linux/personality.h>
22743 +#include <linux/file.h>
22744 +#include <linux/slab.h>
22745 +#include <linux/unistd.h>
22746 +#include <linux/syscalls.h>
22747 +#include <linux/xout.h>
22749 +#include <asm/uaccess.h>
22750 +#include <asm/desc.h>
22753 +MODULE_DESCRIPTION("Support for the Microsoft a.out (x.out) binary format");
22754 +MODULE_AUTHOR("Mike Jagdis, Christoph Hellwig");
22755 +MODULE_LICENSE("GPL");
22759 + * This is the name of the overlay library used for handling
22760 + * Xenix/286 binaries. Usually there is no need to change this.
22762 +#define _PATH_X286EMUL "/usr/lib/x286emul"
22765 + * If you compile with XOUT_DEBUG defined you will get additional
22766 + * debugging messages from the x.out module.
22771 + * If you compile with XOUT_SEGMENTS defined the loader will take care
22772 + * to set up the LDT as would "real" Xenix. This shouldn't be necessary
22773 + * for most programs but it is just possible that something out there
22774 + * makes assumptions about its environment and uses segment overrides.
22776 + * The default is not to bother setting up the LDT unless we need support
22777 + * for Xenix 286 binaries.
22779 +#undef XOUT_SEGMENTS
22782 + * Xenix 286 requires segment handling.
22784 +#if defined(CONFIG_BINFMT_XOUT_X286)
22785 +#define XOUT_SEGMENTS
22789 + * Be verbose if XOUT_DEBUG is defined.
22791 +#if defined(XOUT_DEBUG)
22792 +#define dprintk(x...) printk(x)
22794 +#define dprintk(x...)
22798 +static int xout_load_binary(struct linux_binprm *, struct pt_regs *);
22799 +static int xout_load_library(struct file *);
22801 +static struct linux_binfmt xout_format = {
22802 + NULL, THIS_MODULE, xout_load_binary, xout_load_library, NULL, PAGE_SIZE
22805 +#if defined(XOUT_DEBUG) && defined(XOUT_SEGMENTS)
22807 +static u_long __gdt[2];
22810 + * This is borrowed (with minor variations since we are in kernel mode)
22811 + * from the DPMI code for DOSEMU. I don't claim to understand LDTs :-).
22814 +print_desc(int which)
22816 + u_long base_addr, limit;
22818 + int count, type, dpl, i;
22821 + lp = (u_long *)((struct desc_struct*)
22822 + (current->mm->context.segments));
22823 + count = LDT_ENTRIES;
22824 + printk(KERN_DEBUG "xout: LDT\n");
22826 + /* joerg from david bruce */
22827 + asm volatile ("sgdt __gdt+2");
22828 + lp = (u_long *)__gdt[1];
22830 + printk(KERN_DEBUG "xout: GDT\n");
22836 + printk(KERN_DEBUG "XOUT: SLOT BASE/SEL LIM/OFF TYPE DPL ACCESSBITS\n");
22837 + for (i=0; i < count; i++, lp++) {
22838 + /* First 32 bits of descriptor */
22839 + base_addr = (*lp >> 16) & 0x0000FFFF;
22840 + limit = *lp & 0x0000FFFF;
22843 + /* First 32 bits of descriptor */
22844 + base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
22845 + limit |= (*lp & 0x000F0000);
22846 + type = (*lp >> 10) & 7;
22847 + dpl = (*lp >> 13) & 3;
22848 + if ((base_addr > 0) || (limit > 0 )) {
22849 + printk(KERN_DEBUG "XOUT: %03d 0x%08lx 0x%08lx 0x%02x %03d %s%s%s%s%s%s%s\n",
22851 + base_addr, limit, type, dpl,
22852 + (*lp & 0x100) ? " ACCS'D" : "",
22853 + (*lp & 0x200) ? " R&W" : " R&X",
22854 + (*lp & 0x8000) ? " PRESENT" : "",
22855 + (*lp & 0x100000) ? " USER" : "",
22856 + (*lp & 0x200000) ? " X" : "",
22857 + (*lp & 0x400000) ? " 32" : "",
22858 + (*lp & 0x800000) ? " PAGES" : "");
22866 +xout_create_tables(char *p, struct linux_binprm *bprm, int ibcs)
22868 + int argc = bprm->argc, envc = bprm->envc;
22869 + u_long *argv,*envp;
22872 + sp = (u_long *) ((-(u_long)sizeof(char *)) & (u_long) p);
22879 + put_user(envp, sp);
22881 + put_user(argv, sp);
22884 + put_user(argc, sp);
22885 + current->mm->arg_start = (u_long) p;
22886 + while (argc-->0) {
22887 + put_user(p, argv); argv++;
22888 + p += strlen_user(p);
22890 + put_user(NULL,argv);
22891 + current->mm->arg_end = current->mm->env_start = (u_long) p;
22892 + while (envc-->0) {
22893 + put_user(p, envp); envp++;
22894 + p += strlen_user(p);
22896 + put_user(NULL,envp);
22897 + current->mm->env_end = (u_long) p;
22901 +static __inline int
22902 +isnotaligned(struct xseg *seg)
22904 + dprintk(KERN_DEBUG
22905 + "xout: %04x %04x %04x %02x %08lx %08lx %08lx %08lx\n",
22906 + seg->xs_type, seg->xs_attr, seg->xs_seg, seg->xs_align,
22907 + seg->xs_filpos, seg->xs_psize, seg->xs_vsize, seg->xs_rbase);
22909 +#if defined(XOUT_DEBUG)
22910 + if ((seg->xs_filpos - seg->xs_rbase) & ~PAGE_MASK) {
22911 + printk(KERN_DEBUG
22912 + "xout: bad alignment - demand paging disabled\n");
22915 + return ((seg->xs_filpos & ~PAGE_MASK) | (seg->xs_rbase & ~PAGE_MASK));
22918 +static __inline__ void
22919 +clear_memory(u_long addr, u_long size)
22921 + while (size-- != 0)
22922 + put_user(0, (char *)addr++);
22925 +#if defined(XOUT_SEGMENTS)
22926 +#if defined(CONFIG_X86)
22927 +/* from linux-2.4.25/include/asm-i386/ldt.h */
22928 +struct modify_ldt_ldt_s {
22929 + unsigned int entry_number;
22930 + unsigned long base_addr;
22931 + unsigned int limit;
22932 + unsigned int seg_32bit:1;
22933 + unsigned int contents:2;
22934 + unsigned int read_exec_only:1;
22935 + unsigned int limit_in_pages:1;
22936 + unsigned int seg_not_present:1;
22937 + unsigned int useable:1;
22943 +xout_amen(struct file *fp, struct xseg *sp, int pageable, u_long *addrp,
22944 + struct xexec *xexec, struct pt_regs *regs, int impure)
22946 +#if defined(XOUT_SEGMENTS)
22947 + struct xext *xext = (struct xext *)(xexec + 1);
22948 + struct desc_struct def_ldt;
22949 + struct modify_ldt_ldt_s ldt_info;
22950 + mm_segment_t old_fs;
22951 + u_long mirror_addr = 0;
22954 + u_long bss_size, bss_base;
22957 +#if defined(XOUT_SEGMENTS)
22958 + old_fs = get_fs();
22964 + * Xenix 386 segments simply map the whole address
22965 + * space either read-exec only or read-write.
22967 + ldt_info.entry_number = sp->xs_seg >> 3;
22968 + ldt_info.read_exec_only = 0 /* ((s->xs_attr & XS_APURE) ? 1 : 0) */;
22969 + ldt_info.contents = ((sp->xs_type == XS_TTEXT) ? 2 : 0);
22970 + ldt_info.seg_not_present = 0;
22971 + ldt_info.seg_32bit = ((sp->xs_attr & XS_A32BIT) ? 1 : 0);
22972 + if (!ldt_info.seg_32bit) {
22973 + ldt_info.base_addr = *addrp;
22974 + *addrp = PAGE_ALIGN(*addrp + sp->xs_vsize);
22975 + sp->xs_rbase = ldt_info.base_addr;
22977 + ldt_info.base_addr = 0;
22980 + bss_size = sp->xs_vsize - sp->xs_psize;
22981 + bss_base = sp->xs_rbase + sp->xs_psize;
22984 + * If it is a text segment update the code boundary
22985 + * markers. If it is a data segment update the data
22986 + * boundary markers.
22988 + if (sp->xs_type == XS_TTEXT) {
22989 + if ((sp->xs_rbase + sp->xs_psize) > current->mm->end_code)
22990 + current->mm->end_code = (sp->xs_rbase + sp->xs_psize);
22991 + } else if (sp->xs_type == XS_TDATA) {
22992 +#if defined(XOUT_SEGMENTS)
22994 + * If it is the first data segment note that
22995 + * this is the segment we start in. If this
22996 + * isn't a 386 binary add the stack to the
22997 + * top of this segment.
22999 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
23000 + if (regs->ebx == regs->ecx) {
23001 + regs->ecx = sp->xs_seg;
23002 + regs->edx = sp->xs_vsize;
23003 + sp->xs_vsize = 0x10000;
23004 + *addrp = PAGE_ALIGN(ldt_info.base_addr + sp->xs_vsize);
23007 + if (regs->xds == regs->xcs)
23008 + regs->xds = regs->xes = regs->xss = sp->xs_seg;
23011 + if ((sp->xs_rbase + sp->xs_psize) > current->mm->end_data)
23012 + current->mm->end_data = (sp->xs_rbase + sp->xs_psize);
23015 + if ((sp->xs_rbase + sp->xs_vsize) > current->mm->brk) {
23016 + current->mm->start_brk =
23017 + current->mm->brk = PAGE_ALIGN(sp->xs_rbase + sp->xs_vsize);
23020 +#if defined(XOUT_SEGMENTS)
23021 + if (ldt_info.seg_32bit) {
23022 + ldt_info.limit = (TASK_SIZE-1) >> 12;
23023 + ldt_info.limit_in_pages = 1;
23025 + ldt_info.limit = sp->xs_vsize-1;
23026 + ldt_info.limit_in_pages = 0;
23029 + dprintk(KERN_DEBUG "xout: ldt %02x, type=%d, base=0x%08lx, "
23030 + "limit=0x%08x, pages=%d, 32bit=%d\n",
23031 + ldt_info.entry_number, ldt_info.contents,
23032 + ldt_info.base_addr, ldt_info.limit,
23033 + ldt_info.limit_in_pages, ldt_info.seg_32bit);
23036 + * Use the modify_ldt syscall since this allocates
23037 + * the initial space for the LDT table, tweaks the
23038 + * GDT etc. We need to read the current LDT first
23039 + * since we need to copy the lcall7 call gate.
23041 + set_fs(get_ds());
23042 + if (!current->mm->context.size) {
23043 + sys_modify_ldt(2, &def_ldt, sizeof(def_ldt));
23045 + dprintk(KERN_DEBUG
23046 + "x.out: def_ldt.a 0x%08lx, def_ldt.b 0x%08lx\n",
23047 + def_ldt.a, def_ldt.b);
23052 + err = sys_modify_ldt(1, &ldt_info, sizeof(ldt_info));
23054 + if (status >= 0 && !ntext && s->xs_seg == 0x47) {
23055 + /* Uh oh, impure binary... */
23056 + ldt_info.entry_number = 0x3f >> 3;
23058 + ldt_info.read_exec_only = 1;
23060 + ldt_info.read_exec_only = 0;
23062 + ldt_info.contents = 2;
23063 + status = sys_modify_ldt)(1, &ldt_info, sizeof(ldt_info));
23068 + struct desc_struct *ldt;
23070 + ldt = (struct desc_struct *)current->mm->context.ldt;
23071 + ldt->a = def_ldt.a;
23072 + ldt->b = def_ldt.b;
23077 + printk(KERN_INFO "xout: modify_ldt returned %d\n", err);
23084 + dprintk(KERN_DEBUG "xout: Null map 0x%08lx, length 0x%08lx\n",
23085 + sp->xs_rbase, sp->xs_vsize);
23086 + down_write(¤t->mm->mmap_sem);
23087 + err = do_mmap(NULL, sp->xs_rbase, sp->xs_vsize,
23088 + PROT_READ|PROT_WRITE|PROT_EXEC,
23089 + MAP_FIXED|MAP_PRIVATE, 0);
23090 + up_write(¤t->mm->mmap_sem);
23094 + dprintk(KERN_DEBUG "xout: mmap to 0x%08lx from 0x%08lx, length 0x%08lx\n",
23095 + sp->xs_rbase, sp->xs_filpos, sp->xs_psize);
23096 + if (sp->xs_attr & XS_APURE) {
23097 + down_write(¤t->mm->mmap_sem);
23098 + err = do_mmap(fp, sp->xs_rbase, sp->xs_psize,
23099 + PROT_READ|PROT_EXEC, MAP_FIXED|MAP_SHARED,
23101 + up_write(¤t->mm->mmap_sem);
23103 + down_write(¤t->mm->mmap_sem);
23104 + err = do_mmap(fp, sp->xs_rbase, sp->xs_psize,
23105 + PROT_READ|PROT_WRITE|PROT_EXEC,
23106 + MAP_FIXED|MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
23108 + up_write(¤t->mm->mmap_sem);
23111 + if (err > TASK_SIZE || err < 0)
23115 + * Map uninitialised data.
23118 + if (bss_base & PAGE_MASK) {
23119 + clear_memory(bss_base, PAGE_ALIGN(bss_base)-bss_base);
23120 + bss_size -= (PAGE_ALIGN(bss_base) - bss_base);
23121 + bss_base = PAGE_ALIGN(bss_base);
23124 + dprintk(KERN_DEBUG "xout: Null map 0x%08lx, length 0x%08lx\n",
23125 + bss_base, bss_size);
23127 + down_write(¤t->mm->mmap_sem);
23128 + err = do_mmap(NULL, bss_base, bss_size,
23129 + PROT_READ | PROT_WRITE | PROT_EXEC,
23130 + MAP_FIXED | MAP_PRIVATE, 0);
23131 + up_write(¤t->mm->mmap_sem);
23135 + if (err > TASK_SIZE)
23137 +#if defined(XOUT_SEGMENTS)
23138 + if (err >= 0 && impure && sp->xs_seg >= 0x47) {
23140 + * Uh oh, impure binary.
23141 + * Mirror this data segment to the text segment
23143 + *addrp = mirror_addr = sp->xs_rbase;
23144 + sp->xs_seg = xext->xe_eseg;
23145 + sp->xs_type = XS_TTEXT;
23153 + * Helper function to process the load operation.
23156 +xout_load_object(struct linux_binprm * bpp, struct pt_regs *rp, int executable)
23158 + struct xexec *xexec = (struct xexec *)bpp->buf;
23159 + struct xext *xext = (struct xext *)(xexec + 1);
23160 + struct xseg *seglist;
23161 + struct file *fp = NULL;
23163 + int nsegs, ntext, ndata;
23164 + int pageable = 1, err = 0;
23167 + dprintk(KERN_DEBUG "xout: binfmt_xout entry: %s\n",
23168 + bpp->file->f_dentry->d_name.name);
23170 + if (xexec->x_magic != X_MAGIC) {
23171 + dprintk(KERN_DEBUG "xout: bad magic %04x\n", xexec->x_magic);
23175 + switch (xexec->x_cpu & XC_CPU) {
23178 +#if defined(CONFIG_BINFMT_XOUT_X286)
23186 + dprintk(KERN_DEBUG "xout: unsupported CPU type (%02x)\n",
23192 + * We can't handle byte or word swapped headers. Well, we
23193 + * *could* but they should never happen surely?
23195 + if ((xexec->x_cpu & (XC_BSWAP | XC_WSWAP)) != XC_WSWAP) {
23196 + dprintk(KERN_DEBUG "xout: wrong byte or word sex (%02x)\n",
23201 + /* Check it's an executable. */
23202 + if (!(xexec->x_renv & XE_EXEC)) {
23203 + dprintk(KERN_DEBUG "xout: not executable\n");
23208 + * There should be an extended header and there should be
23209 + * some segments. At this stage we don't handle non-segmented
23210 + * binaries. I'm not sure you can get them under Xenix anyway.
23212 + if (xexec->x_ext != sizeof(struct xext)) {
23213 + dprintk(KERN_DEBUG "xout: bad extended header\n");
23217 + if (!(xexec->x_renv & XE_SEG) || !xext->xe_segsize) {
23218 + dprintk(KERN_DEBUG "xout: not segmented\n");
23222 + if (!(seglist = kmalloc(xext->xe_segsize, GFP_KERNEL))) {
23223 + printk(KERN_WARNING "xout: allocating segment list failed\n");
23227 + err = kernel_read(bpp->file, xext->xe_segpos,
23228 + (char *)seglist, xext->xe_segsize);
23230 + dprintk(KERN_DEBUG "xout: problem reading segment table\n");
23234 + if (!bpp->file->f_op->mmap)
23237 + nsegs = xext->xe_segsize / sizeof(struct xseg);
23239 + ntext = ndata = 0;
23240 + for (i = 0; i < nsegs; i++) {
23241 + switch (seglist[i].xs_type) {
23243 + if (isnotaligned(seglist+i))
23248 + if (isnotaligned(seglist+i))
23259 + * Generate the proper values for the text fields
23261 + * THIS IS THE POINT OF NO RETURN. THE NEW PROCESS WILL TRAP OUT SHOULD
23262 + * SOMETHING FAIL IN THE LOAD SEQUENCE FROM THIS POINT ONWARD.
23266 + * Flush the executable from memory. At this point the executable is
23267 + * committed to being defined or a segmentation violation will occur.
23269 + if (executable) {
23270 + dprintk(KERN_DEBUG "xout: flushing executable\n");
23272 + flush_old_exec(bpp);
23274 + current->mm->mmap = NULL;
23275 + atomic_long_set(¤t->mm->_file_rss, 0);
23277 + if ((err = setup_arg_pages(bpp, STACK_TOP, EXSTACK_DEFAULT)) < 0) {
23278 + send_sig(SIGSEGV, current, 1);
23282 + bpp->p = (u_long)xout_create_tables((char *)bpp->p, bpp,
23283 + (xexec->x_cpu & XC_CPU) == XC_386 ? 1 : 0);
23285 +#if defined(XOUT_SEGMENTS)
23287 + * These will be set up later once we've seen the
23288 + * segments that make the program up.
23290 + current->mm->start_code = 0;
23291 + current->mm->start_data = 0;
23292 + current->mm->end_code = 0;
23293 + current->mm->end_data = 0;
23294 + current->mm->start_brk = 0;
23295 + current->mm->brk = 0;
23297 + compute_creds(bpp);
23298 + current->flags &= ~PF_FORKNOEXEC;
23301 + * The code selector is advertised in the header.
23303 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
23304 + rp->ebx = rp->ecx = xext->xe_eseg;
23305 + rp->eax = xexec->x_entry;
23307 + rp->xcs = rp->xds = rp->xes = rp->xss = xext->xe_eseg;
23308 + rp->eip = xexec->x_entry;
23310 +#else /* XOUT_SEGMENTS */
23311 + current->mm->start_code = 0;
23312 + current->mm->end_code = xexec->x_text;
23313 + current->mm->end_data = xexec->x_text + xexec->x_data;
23314 + current->mm->start_brk =
23315 + current->mm->brk = xexec->x_text + xexec->x_data + xexec->x_bss;
23317 + compute_creds(bpp);
23318 + current->flags &= ~PF_FORKNOEXEC;
23320 + rp->xcs = __USER_CS;
23321 + rp->xds = rp->xes = rp->xss = __USER_DS;
23322 + rp->eip = xexec->x_entry;
23323 +#endif /* XOUT_SEGMENTS */
23325 + dprintk(KERN_DEBUG "xout: entry point = 0x%x:0x%08lx\n",
23326 + xext->xe_eseg, xexec->x_entry);
23328 + rp->esp = current->mm->start_stack = bpp->p;
23330 + set_personality(PER_XENIX);
23334 + * Base address for mapping 16bit segments. This should lie above
23335 + * the emulator overlay.
23337 + addr = X286_MAP_ADDR;
23339 +#if defined(CONFIG_BINFMT_XOUT_X286)
23341 + * If this isn't a 386 executable we need to load the overlay
23342 + * library to emulate a [2]86 environment and save the binary
23343 + * headers for later reference by the emulator.
23345 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
23346 + mm_segment_t fs = get_fs();
23348 + set_fs(get_ds());
23349 + err = sys_uselib(_PATH_X286EMUL);
23353 + "xout: loading of %s failed with error %d\n",
23354 + _PATH_X286EMUL, err);
23358 + down_write(¤t->mm->mmap_sem);
23359 + err = do_mmap(NULL,
23360 + addr, sizeof(struct xexec)+sizeof(struct xext),
23361 + PROT_READ|PROT_WRITE|PROT_EXEC,
23362 + MAP_FIXED|MAP_PRIVATE,
23364 + up_write(¤t->mm->mmap_sem);
23366 + if (err > TASK_SIZE)
23369 + if (copy_to_user((char *)addr, xexec, sizeof(struct xexec)))
23373 + if (copy_to_user((char *)addr+sizeof(struct xexec), xext, sizeof(struct xext)))
23377 + addr = PAGE_ALIGN(addr+sizeof(struct xexec)+sizeof(struct xext));
23383 + * Scan the segments and map them into the process space. If this
23384 + * executable is pageable (unlikely since Xenix aligns to 1k
23385 + * boundaries and we want it aligned to 4k boundaries) this is
23386 + * all we need to do. If it isn't pageable we go round again
23387 + * afterwards and load the data. We have to do this in two steps
23388 + * because if segments overlap within a 4K page we'll lose the
23389 + * first instance when we remap the page. Hope that's clear...
23391 + for (i = 0; err >= 0 && i < nsegs; i++) {
23392 + struct xseg *sp = seglist+i;
23394 + if (sp->xs_attr & XS_AMEM) {
23395 + err = xout_amen(fp, sp, pageable, &addr,
23396 + xexec, rp, (!ntext && ndata == 1));
23402 + * We better fix start_data because sys_brk looks there to
23403 + * calculate data size.
23404 + * Kernel 2.2 did look at end_code so this is reasonable.
23406 + if (current->mm->start_data == current->mm->start_code)
23407 + current->mm->start_data = current->mm->end_code;
23409 + dprintk(KERN_DEBUG "xout: start code 0x%08lx, end code 0x%08lx,"
23410 + " start data 0x%08lx, end data 0x%08lx, brk 0x%08lx\n",
23411 + current->mm->start_code, current->mm->end_code,
23412 + current->mm->start_data, current->mm->end_data,
23413 + current->mm->brk);
23415 +#if defined(XOUT_DEBUG) && defined(XOUT_SEGMENTS)
23425 + for (i = 0; (err >= 0) && (i < nsegs); i++) {
23426 + struct xseg *sp = seglist + i;
23429 + if (sp->xs_type == XS_TTEXT || sp->xs_type == XS_TDATA) {
23430 + dprintk(KERN_DEBUG "xout: read to 0x%08lx from 0x%08lx,"
23431 + " length 0x%08lx\n", sp->xs_rbase,
23432 + sp->xs_filpos, sp->xs_psize);
23434 + if (sp->xs_psize < 0)
23438 + * Do we still get the size ? Yes! [joerg]
23440 + psize = kernel_read(bpp->file, sp->xs_filpos,
23441 + (char *)sp->xs_rbase, sp->xs_psize);
23443 + if (psize != sp->xs_psize) {
23444 + dprintk(KERN_DEBUG "xout: short read\n");
23452 + * Generate any needed trap for this process. If an error occured then
23453 + * generate a segmentation violation. If the process is being debugged
23454 + * then generate the load trap. (Note: If this is a library load then
23455 + * do not generate the trap here. Pass the error to the caller who
23456 + * will do it for the process in the outer lay of this procedure call.)
23459 + if (executable) {
23461 + dprintk(KERN_DEBUG "xout: loader forces seg fault "
23462 + "(err = %d)\n", err);
23463 + send_sig(SIGSEGV, current, 0);
23464 + } else if (current->ptrace & PT_PTRACED)
23465 + send_sig(SIGTRAP, current, 0);
23472 + dprintk(KERN_DEBUG "xout: binfmt_xout: result = %d\n", err);
23475 + * If we are using the [2]86 emulation overlay we enter this
23476 + * rather than the real program and give it the information
23477 + * it needs to start the ball rolling.
23479 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
23481 + regs->eax = regs->eip;
23482 + regs->ebx = regs->xcs;
23483 + regs->ecx = regs->xds;
23484 + regs->xcs = __USER_CS;
23485 + regs->xds = regs->xes = regs->xss = __USER_DS;
23487 + rp->eip = 0x1020;
23488 + dprintk(KERN_DEBUG "xout: x286emul 0x%02lx:0x%04lx,"
23489 + " ds=0x%02lx, stack 0x%02lx:0x%04lx\n",
23490 + rp->ebx, rp->eax, rp->ecx, rp->ecx,
23493 + while (!signal_pending(current))
23496 + return (err < 0 ? err : rp->eax);
23500 + while (!signal_pending(current))
23504 + * Xenix 386 programs expect the initial brk value to be in eax
23505 + * on start up. Hence if we succeeded we need to pass back
23506 + * the brk value rather than the status. Ultimately the
23507 + * ret_from_sys_call assembly will place this in eax before
23508 + * resuming (starting) the process.
23510 + return (err < 0 ? err : current->mm->brk);
23512 +#if defined(CONFIG_BINFMT_XOUT_X286)
23521 + * This procedure is called by the main load sequence. It will load
23522 + * the executable and prepare it for execution. It provides the additional
23523 + * parameters used by the recursive xout loader and tells the loader that
23524 + * this is the main executable. How simple it is . . . .
23527 +xout_load_binary(struct linux_binprm *bpp, struct pt_regs *rp)
23529 + return (xout_load_object(bpp, rp, 1));
23533 + * Load the image for any shared library. This is called when
23534 + * we need to load a library based upon a file name.
23536 + * XXX: I have never seen a Xenix shared library... --hch
23539 +xout_load_library(struct file *fp)
23541 + struct linux_binprm *bpp;
23542 + struct pt_regs regs;
23543 + int err = -ENOMEM;
23545 + if (!(bpp = kmalloc(sizeof(struct linux_binprm), GFP_KERNEL))) {
23546 + printk(KERN_WARNING "xout: kmalloc failed\n");
23550 + memset(bpp, 0, sizeof(struct linux_binprm));
23553 + if ((err = kernel_read(fp, 0L, bpp->buf, sizeof(bpp->buf))) < 0)
23554 + printk(KERN_WARNING "xout: unable to read library header\n");
23556 + err = xout_load_object(bpp, ®s, 0);
23564 +binfmt_xout_init(void)
23566 + return register_binfmt(&xout_format);
23569 +static void __exit
23570 +binfmt_xout_exit(void)
23572 + unregister_binfmt(&xout_format);
23575 +module_init(binfmt_xout_init);
23576 +module_exit(binfmt_xout_exit);
23577 diff -Nur kernel-source-2.6.16.orig/fs/exec.c kernel-source-2.6.16/fs/exec.c
23578 --- kernel-source-2.6.16.orig/fs/exec.c 2006-04-27 18:30:01.000000000 +1000
23579 +++ kernel-source-2.6.16/fs/exec.c 2006-04-27 18:50:24.000000000 +1000
23580 @@ -1240,6 +1240,8 @@
23584 +EXPORT_SYMBOL(do_execve);
23586 int set_binfmt(struct linux_binfmt *new)
23588 struct linux_binfmt *old = current->binfmt;
23589 diff -Nur kernel-source-2.6.16.orig/fs/Kconfig.binfmt kernel-source-2.6.16/fs/Kconfig.binfmt
23590 --- kernel-source-2.6.16.orig/fs/Kconfig.binfmt 2006-03-20 15:53:29.000000000 +1000
23591 +++ kernel-source-2.6.16/fs/Kconfig.binfmt 2006-04-27 18:50:24.000000000 +1000
23592 @@ -132,3 +132,5 @@
23593 You may say M here for module support and later load the module when
23594 you have use for it; the module is called binfmt_misc. If you
23595 don't know what to answer at this point, say Y.
23597 +source "abi/Kconfig"
23598 diff -Nur kernel-source-2.6.16.orig/fs/Makefile kernel-source-2.6.16/fs/Makefile
23599 --- kernel-source-2.6.16.orig/fs/Makefile 2006-04-27 18:16:04.000000000 +1000
23600 +++ kernel-source-2.6.16/fs/Makefile 2006-04-27 18:50:24.000000000 +1000
23602 obj-y += $(nfsd-y) $(nfsd-m)
23604 obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o
23605 +obj-$(CONFIG_BINFMT_XOUT) += binfmt_xout.o
23606 +obj-$(CONFIG_BINFMT_COFF) += binfmt_coff.o
23607 obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o
23608 obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
23610 diff -Nur kernel-source-2.6.16.orig/fs/pipe.c kernel-source-2.6.16/fs/pipe.c
23611 --- kernel-source-2.6.16.orig/fs/pipe.c 2006-03-20 15:53:29.000000000 +1000
23612 +++ kernel-source-2.6.16/fs/pipe.c 2006-04-27 18:50:24.000000000 +1000
23613 @@ -838,3 +838,9 @@
23615 fs_initcall(init_pipe_fs);
23616 module_exit(exit_pipe_fs);
23618 +/* symbol exports for LinuxABI Sytem V R4 support */
23619 +/* for ease of use we are exporting those needed symbols permanently */
23620 +/* #if CONFIG_ABI_SVR4 == m */
23621 +EXPORT_SYMBOL(do_pipe);
23623 diff -Nur kernel-source-2.6.16.orig/fs/readdir.c kernel-source-2.6.16/fs/readdir.c
23624 --- kernel-source-2.6.16.orig/fs/readdir.c 2006-03-20 15:53:29.000000000 +1000
23625 +++ kernel-source-2.6.16/fs/readdir.c 2006-04-27 18:50:24.000000000 +1000
23628 #ifdef __ARCH_WANT_OLD_READDIR
23630 -struct old_linux_dirent {
23631 - unsigned long d_ino;
23632 - unsigned long d_offset;
23633 - unsigned short d_namlen;
23637 struct readdir_callback {
23638 struct old_linux_dirent __user * dirent;
23640 diff -Nur kernel-source-2.6.16.orig/include/abi/cxenix/signal.h kernel-source-2.6.16/include/abi/cxenix/signal.h
23641 --- kernel-source-2.6.16.orig/include/abi/cxenix/signal.h 1970-01-01 10:00:00.000000000 +1000
23642 +++ kernel-source-2.6.16/include/abi/cxenix/signal.h 2006-04-27 18:50:24.000000000 +1000
23644 +#ifndef _ABI_CXENIX_SIGNAL_H
23645 +#define _ABI_CXENIX_SIGNAL_H
23648 + SCO_SA_NOCLDSTOP = 0x001,
23649 + SCO_SA_COMPAT = 0x080, /* 3.2.2 compatibilty. */
23650 + SCO_SA_SIGNAL = 0x100,
23653 +struct sco_sigaction {
23654 + void (*sa_handler)(int);
23655 + unsigned long sa_mask;
23659 +#endif /* _ABI_CXENIX_SIGNAL_H */
23660 diff -Nur kernel-source-2.6.16.orig/include/abi/cxenix/sysent.h kernel-source-2.6.16/include/abi/cxenix/sysent.h
23661 --- kernel-source-2.6.16.orig/include/abi/cxenix/sysent.h 1970-01-01 10:00:00.000000000 +1000
23662 +++ kernel-source-2.6.16/include/abi/cxenix/sysent.h 2006-04-27 18:50:24.000000000 +1000
23665 + * include/abi/xnx.h -- xenix ibcs interface
23667 + * Copyright (C) 1993 Drew Sullivan
23668 + * Released for general use as long as this copyright remains.
23673 +struct sco_sigaction;
23676 +typedef unsigned short excode_t;
23678 +extern int xnx_locking(int fd, int mode, unsigned long size);
23679 +extern int xnx_creatsem(char *sem_name, int mode);
23680 +extern int xnx_opensem(char *sem_name);
23681 +extern int xnx_sigsem(int sem_num);
23682 +extern int xnx_waitsem(int sem_num);
23683 +extern int xnx_nbwaitsem(int sem_num);
23684 +extern int xnx_rdchk(int fd);
23685 +extern int xnx_ftime(struct timeb * tp);
23686 +extern int xnx_nap(long period);
23687 +extern int xnx_sdget(char *path, int flags, long size, int mode);
23688 +extern int xnx_sdfree(char* addr);
23689 +extern int xnx_sdenter(char *addr, int flags);
23690 +extern int xnx_sdleave(char *addr);
23691 +extern int xnx_sdgetv(char *addr);
23692 +extern int xnx_sdwaitv(char *addr, int vnum);
23693 +extern int xnx_proctl(int pid, int command, char *arg);
23694 +extern int xnx_execseg(excode_t oldaddr, unsigned size);
23695 +extern int xnx_unexecseg(excode_t addr);
23696 +extern int xnx_eaccess(char *path, int mode);
23697 +extern int xnx_paccess(int pid, int cmd, int offset, int count, char *ptr);
23698 +extern int xnx_sigpending(unsigned long *set);
23699 +extern int xnx_pathconf(char *path, int name);
23700 +extern int xnx_fpathconf(int fildes, int name);
23703 +extern int xnx_sigaction(int, const struct sco_sigaction *,
23704 + struct sco_sigaction *);
23707 +extern int xnx_utsname(u_long addr);
23710 +extern void cxenix(struct pt_regs *);
23711 diff -Nur kernel-source-2.6.16.orig/include/abi/ioctl.h kernel-source-2.6.16/include/abi/ioctl.h
23712 --- kernel-source-2.6.16.orig/include/abi/ioctl.h 1970-01-01 10:00:00.000000000 +1000
23713 +++ kernel-source-2.6.16/include/abi/ioctl.h 2006-04-27 18:50:24.000000000 +1000
23716 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
23717 + * Copyright (C) 2001 Caldera Deutschland GmbH
23719 +#ifndef _ABI_IOCTL_H
23720 +#define _ABI_IOCTL_H
23725 + * Ioctl's have the command encoded in the lower word, and the size of
23726 + * any in or out parameters in the upper word. The high 3 bits of the
23727 + * upper word are used to encode the in/out status of the parameter.
23729 + * Note that Linux does the same but has the IOC_IN and IOC_OUT values
23730 + * round the other way and uses 0 for IOC_VOID.
23733 + /* parameter length, at most 13 bits */
23734 + BSD_IOCPARM_MASK = 0x1fff,
23735 + /* no parameters */
23736 + BSD_IOC_VOID = 0x20000000,
23737 + /* copy out parameters */
23738 + BSD_IOC_OUT = 0x40000000,
23739 + /* copy in parameters */
23740 + BSD_IOC_IN = 0x80000000,
23741 + /* possibly copy in and out parameters */
23742 + BSD_IOC_INOUT = BSD_IOC_IN|BSD_IOC_OUT,
23746 +#define BSD__IOC(inout,group,num,len) \
23747 + (inout | ((len & BSD_IOCPARM_MASK) << 16) | ((group) << 8) | (num))
23749 +#define BSD__IO(g,n) BSD__IOC(BSD_IOC_VOID, (g), (n), 0)
23750 +#define BSD__IOR(g,n,t) BSD__IOC(BSD_IOC_OUT, (g), (n), sizeof(t))
23751 +#define BSD__IOW(g,n,t) BSD__IOC(BSD_IOC_IN, (g), (n), sizeof(t))
23752 +#define BSD__IOWR(g,n,t) BSD__IOC(BSD_IOC_INOUT, (g), (n), sizeof(t))
23754 +/* Some SYSV systems exhibit "compatible" BSD ioctls without the bumf. */
23755 +#define BSD__IOV(c,d) (((c) << 8) | (d))
23757 +#endif /* _ABI_IOCTL_H */
23758 diff -Nur kernel-source-2.6.16.orig/include/abi/sco/ioctl.h kernel-source-2.6.16/include/abi/sco/ioctl.h
23759 --- kernel-source-2.6.16.orig/include/abi/sco/ioctl.h 1970-01-01 10:00:00.000000000 +1000
23760 +++ kernel-source-2.6.16/include/abi/sco/ioctl.h 2006-04-27 18:50:24.000000000 +1000
23762 +#ifndef _ABI_SCO_IOCTL_H
23763 +#define _ABI_SCO_IOCTL_H
23766 +extern int sco_tape_ioctl(int, u_int, caddr_t);
23769 +extern int sco_term_ioctl(int, u_int, caddr_t);
23772 +extern int sco_vtkbd_ioctl(int, u_int, caddr_t);
23774 +#endif /* _ABI_SCO_IOCTL_H */
23775 diff -Nur kernel-source-2.6.16.orig/include/abi/sco/mman.h kernel-source-2.6.16/include/abi/sco/mman.h
23776 --- kernel-source-2.6.16.orig/include/abi/sco/mman.h 1970-01-01 10:00:00.000000000 +1000
23777 +++ kernel-source-2.6.16/include/abi/sco/mman.h 2006-04-27 18:50:24.000000000 +1000
23780 + * Copyright (c) 2001 Caldera Deutschland GmbH.
23781 + * All rights reserved.
23783 + * This program is free software; you can redistribute it and/or modify
23784 + * it under the terms of the GNU General Public License as published by
23785 + * the Free Software Foundation; either version 2 of the License, or
23786 + * (at your option) any later version.
23788 + * This program is distributed in the hope that it will be useful,
23789 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23790 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23791 + * GNU General Public License for more details.
23793 + * You should have received a copy of the GNU General Public License
23794 + * along with this program; if not, write to the Free Software
23795 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23797 +#ifndef _ABI_SCO_MMAN_H
23798 +#define _ABI_SCO_MMAN_H
23803 + * SCO OpenServer memory mapped files declarations
23806 +#define SCO_MAP_FAILED ((void *)-1)
23808 +/* protections flags for mmap() and mprotect() */
23809 +#define SCO_PROT_NONE 0x0000
23810 +#define SCO_PROT_READ 0x0001
23811 +#define SCO_PROT_WRITE 0x0002
23812 +#define SCO_PROT_EXEC 0x0004
23814 +/* sharing types for mmap() */
23815 +#define SCO_MAP_SHARED 0x0001
23816 +#define SCO_MAP_PRIVATE 0x0002
23817 +#define SCO_MAP_FIXED 0x0010
23818 +#define SCO_MAP_PHMEM 0x1000
23819 +#define SCO_MAP_KVMEM 0x2000
23820 +#define SCO_MAP_ANCESTRAL 0x4000
23821 +#define SCO_MAP_NOEOF 0x8000
23823 +#define SCO_MAP_UNIMPL \
23824 + (SCO_MAP_PHMEM|SCO_MAP_KVMEM|SCO_MAP_ANCESTRAL|SCO_MAP_NOEOF)
23826 +/* memcntl() subfunctions */
23827 +#define SCO_MC_SYNC 0x0001
23828 +#define SCO_MC_LOCK 0x0002
23829 +#define SCO_MC_UNLOCK 0x0003
23830 +#define SCO_MC_LOCKAS 0x0005
23831 +#define SCO_MC_UNLOCKAS 0x0006
23832 +#define SCO_MC_MAPCPU 0x8000
23833 +#define SCO_MC_MAPUBLK 0x8001
23835 +/* msync() flags */
23836 +#define SCO_MS_SYNC 0x0000
23837 +#define SCO_MS_ASYNC 0x0001
23838 +#define SCO_MS_INVALIDATE 0x0002
23840 +/* mlockall() flags */
23841 +#define SCO_MCL_CURRENT 0x0001
23842 +#define SCO_MCL_FUTURE 0x0002
23844 +#endif /* _ABI_SCO_MMAN_H */
23845 diff -Nur kernel-source-2.6.16.orig/include/abi/sco/signal.h kernel-source-2.6.16/include/abi/sco/signal.h
23846 --- kernel-source-2.6.16.orig/include/abi/sco/signal.h 1970-01-01 10:00:00.000000000 +1000
23847 +++ kernel-source-2.6.16/include/abi/sco/signal.h 2006-04-27 18:50:24.000000000 +1000
23849 +#ifndef _ABI_SCO_SIGNAL_H
23850 +#define _ABI_SCO_SIGNAL_H
23853 + * Signal numbers for the SCO emulator.
23858 +#define SCO_SIGHUP 1 /* hangup */
23859 +#define SCO_SIGINT 2 /* interrupt (rubout) */
23860 +#define SCO_SIGQUIT 3 /* quit (ASCII FS) */
23861 +#define SCO_SIGILL 4 /* illegal instruction (not reset when caught) */
23862 +#define SCO_SIGTRAP 5 /* trace trap (not reset when caught) */
23863 +#define SCO_SIGIOT 6 /* IOT instruction */
23864 +#define SCO_SIGABRT 6 /* used by abort, replace SIGIOT in the future */
23865 +#define SCO_SIGEMT 7 /* EMT instruction */
23866 +#define SCO_SIGFPE 8 /* floating point exception */
23867 +#define SCO_SIGKILL 9 /* kill (cannot be caught or ignored) */
23868 +#define SCO_SIGBUS 10 /* bus error */
23869 +#define SCO_SIGSEGV 11 /* segmentation violation */
23870 +#define SCO_SIGSYS 12 /* bad argument to system call */
23871 +#define SCO_SIGPIPE 13 /* write on a pipe with no one to read it */
23872 +#define SCO_SIGALRM 14 /* alarm clock */
23873 +#define SCO_SIGTERM 15 /* software termination signal from kill */
23874 +#define SCO_SIGUSR1 16 /* user defined signal 1 */
23875 +#define SCO_SIGUSR2 17 /* user defined signal 2 */
23876 +#define SCO_SIGCLD 18 /* death of a child */
23877 +#define SCO_SIGPWR 19 /* power-fail restart */
23878 +#define SCO_SIGWINCH 20 /* window change */
23879 +#define SCO_SIGURG 21 /* urgent socket condition */
23880 +#define SCO_SIGPOLL 22 /* pollable event occurred */
23881 +#define SCO_SIGSTOP 23 /* sendable stop signal not from tty */
23882 +#define SCO_SIGTSTP 24 /* stop signal from tty */
23883 +#define SCO_SIGCONT 25 /* continue a stopped process */
23884 +#define SCO_SIGTTIN 26 /* to readers pgrp upon background tty read */
23885 +#define SCO_SIGTTOU 27 /* like TTIN for output if tp->t_local&TOSTOP */
23886 +#define SCO_SIGVTALRM 28 /* virtual timer alarm */
23887 +#define SCO_SIGPROF 29 /* profile alarm */
23888 +#define SCO_SIGXCPU 30 /* CPU time limit exceeded */
23889 +#define SCO_SIGXFSZ 31 /* File size limit exceeded */
23891 +#endif /* _ABI_SCO_SIGNAL_H */
23892 diff -Nur kernel-source-2.6.16.orig/include/abi/sco/stat.h kernel-source-2.6.16/include/abi/sco/stat.h
23893 --- kernel-source-2.6.16.orig/include/abi/sco/stat.h 1970-01-01 10:00:00.000000000 +1000
23894 +++ kernel-source-2.6.16/include/abi/sco/stat.h 2006-04-27 18:50:24.000000000 +1000
23896 +#ifndef _ABI_SCO_STAT_H
23897 +#define _ABI_SCO_STAT_H
23901 +#include <abi/sco/types.h>
23904 +struct sco_xstat {
23905 + sco_dev_t st_dev;
23906 + u_int32_t __pad1[3];
23907 + sco_ino_t st_ino;
23908 + sco_mode_t st_mode;
23909 + sco_nlink_t st_nlink;
23910 + sco_uid_t st_uid;
23911 + sco_gid_t st_gid;
23912 + sco_dev_t st_rdev;
23913 + u_int32_t __pad2[2];
23914 + sco_off_t st_size;
23915 + u_int32_t __pad3;
23916 + sco_time_t st_atime;
23917 + sco_time_t st_mtime;
23918 + sco_time_t st_ctime;
23919 + int32_t st_blksize;
23920 + int32_t st_blocks;
23921 + char st_fstype[16];
23922 + u_int32_t __pad4[7];
23923 + int32_t st_sco_flags;
23926 +#endif /* _ABI_SCO_STAT_H */
23927 diff -Nur kernel-source-2.6.16.orig/include/abi/sco/sysent.h kernel-source-2.6.16/include/abi/sco/sysent.h
23928 --- kernel-source-2.6.16.orig/include/abi/sco/sysent.h 1970-01-01 10:00:00.000000000 +1000
23929 +++ kernel-source-2.6.16/include/abi/sco/sysent.h 2006-04-27 18:50:24.000000000 +1000
23932 + * Copyright (c) 2001 Christoph Hellwig.
23933 + * All rights reserved.
23935 + * This program is free software; you can redistribute it and/or modify
23936 + * it under the terms of the GNU General Public License as published by
23937 + * the Free Software Foundation; either version 2 of the License, or
23938 + * (at your option) any later version.
23940 + * This program is distributed in the hope that it will be useful,
23941 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23942 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23943 + * GNU General Public License for more details.
23945 + * You should have received a copy of the GNU General Public License
23946 + * along with this program; if not, write to the Free Software
23947 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23949 +#ifndef _ABI_SCO_SYSENT_H
23950 +#define _ABI_SCO_SYSENT_H
23955 + * External function declarations for the SCO OpenServer syscall table.
23958 +#include <abi/sco/types.h>
23960 +struct sco_statvfs;
23964 +extern int sco_ioctl(struct pt_regs *);
23967 +extern int sco_lseek(int, u_long, int);
23968 +extern int sco_fcntl(int, u_int, u_long);
23969 +extern int sco_sysi86(int, void *, int);
23972 +extern int sco_mmap(u_long, size_t, int, int, int, sco_off_t);
23975 +extern int sco_ptrace(int, int, u_long, u_long);
23977 +/* secureware.c */
23978 +extern int sw_security(int, void *, void *, void *, void *, void *);
23981 +extern int sco_xstat(int, char *, void *);
23982 +extern int sco_lxstat(int, char *, void *);
23983 +extern int sco_fxstat(int, int, void *);
23986 +extern int sco_statvfs(char *, struct sco_statvfs *);
23987 +extern int sco_fstatvfs(int, struct sco_statvfs *);
23989 +#endif /* _ABI_SCO_SYSENT_H */
23990 diff -Nur kernel-source-2.6.16.orig/include/abi/sco/types.h kernel-source-2.6.16/include/abi/sco/types.h
23991 --- kernel-source-2.6.16.orig/include/abi/sco/types.h 1970-01-01 10:00:00.000000000 +1000
23992 +++ kernel-source-2.6.16/include/abi/sco/types.h 2006-04-27 18:50:24.000000000 +1000
23995 + * Copyright (c) 2001 Caldera Deutschland GmbH.
23996 + * Copyright (c) 2001 Christoph Hellwig.
23997 + * All rights reserved.
23999 + * This program is free software; you can redistribute it and/or modify
24000 + * it under the terms of the GNU General Public License as published by
24001 + * the Free Software Foundation; either version 2 of the License, or
24002 + * (at your option) any later version.
24004 + * This program is distributed in the hope that it will be useful,
24005 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24006 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24007 + * GNU General Public License for more details.
24009 + * You should have received a copy of the GNU General Public License
24010 + * along with this program; if not, write to the Free Software
24011 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24013 +#ifndef _ABI_SCO_TYPES_H
24014 +#define _ABI_SCO_TYPES_H
24019 + * SCO OpenServer type declarations.
24021 +#include <linux/highuid.h>
24022 +#include <linux/personality.h>
24023 +#include <linux/sched.h>
24024 +#include <linux/types.h>
24027 +typedef int16_t sco_dev_t;
24028 +typedef u_int32_t sco_ino_t;
24029 +typedef u_int16_t sco_mode_t;
24030 +typedef int16_t sco_nlink_t;
24031 +typedef u_int16_t sco_uid_t;
24032 +typedef u_int16_t sco_gid_t;
24033 +typedef int32_t sco_off_t;
24034 +typedef int32_t sco_time_t;
24037 +struct sco_statvfs {
24038 + u_int32_t f_bsize;
24039 + u_int32_t f_frsize;
24040 + u_int32_t f_blocks;
24041 + u_int32_t f_bfree;
24042 + u_int32_t f_bavail;
24043 + u_int32_t f_files;
24044 + u_int32_t f_free;
24045 + u_int32_t f_favail;
24047 + char f_basetype[16];
24048 + u_int32_t f_flag;
24049 + u_int32_t f_namemax;
24051 + u_int32_t f_filler[16];
24056 + * Stub for now, as we still have a 16 bit dev_t.
24058 +static __inline sco_dev_t
24059 +linux_to_sco_dev_t(dev_t dev)
24065 + * If we thought we were in a short inode environment we are
24066 + * probably already too late - getdents() will have likely
24067 + * already assumed short inodes and "fixed" anything with
24068 + * a zero low word (because it must match stat() which must
24069 + * match read() on a directory).
24071 + * We will just have to go along with it.
24073 +static __inline sco_ino_t
24074 +linux_to_sco_ino_t(ino_t ino)
24076 + if (!is_cur_personality_flag(PERF_SHORT_INODE))
24078 + if ((u_long)ino & 0xffff)
24080 + return 0xfffffffe;
24084 + * SCO user/group IDs are the same as the old linux ones.
24086 +static __inline sco_uid_t
24087 +linux_to_sco_uid_t(uid_t uid)
24089 + return high2lowuid(uid);
24092 +static __inline sco_gid_t
24093 +linux_to_sco_gid_t(gid_t gid)
24095 + return high2lowgid(gid);
24098 +#endif /* _ABI_SCO_TYPES_H */
24099 diff -Nur kernel-source-2.6.16.orig/include/abi/signal.h kernel-source-2.6.16/include/abi/signal.h
24100 --- kernel-source-2.6.16.orig/include/abi/signal.h 1970-01-01 10:00:00.000000000 +1000
24101 +++ kernel-source-2.6.16/include/abi/signal.h 2006-04-27 18:50:24.000000000 +1000
24103 +#define NSIGNALS 32
24106 +/* These are the signal numbers for the SVr4 signal handling */
24107 +#define IBCS_SIGHUP 1
24108 +#define IBCS_SIGINT 2
24109 +#define IBCS_SIGQUIT 3
24110 +#define IBCS_SIGILL 4
24111 +#define IBCS_SIGTRAP 5
24112 +#define IBCS_SIGIOT 6
24113 +#define IBCS_SIGABRT 6
24114 +#define IBCS_SIGEMT 7
24115 +#define IBCS_SIGFPE 8
24116 +#define IBCS_SIGKILL 9
24117 +#define IBCS_SIGBUS 10
24118 +#define IBCS_SIGSEGV 11
24119 +#define IBCS_SIGSYS 12
24120 +#define IBCS_SIGPIPE 13
24121 +#define IBCS_SIGALRM 14
24122 +#define IBCS_SIGTERM 15
24123 +#define IBCS_SIGUSR1 16
24124 +#define IBCS_SIGUSR2 17
24125 +#define IBCS_SIGCLD 18
24126 +#define IBCS_SIGCHLD 18
24127 +#define IBCS_SIGPWR 19
24128 +#define IBCS_SIGWINCH 20
24129 +#define IBCS_SIGURG 21 /* not SCO, SCO uses SIGUSR2 for SIGURG */
24130 +#define IBCS_SIGPOLL 22
24131 +#define IBCS_SIGIO 22
24132 +#define IBCS_SIGSTOP 23
24133 +#define IBCS_SIGTSTP 24
24134 +#define IBCS_SIGCONT 25
24135 +#define IBCS_SIGTTIN 26
24136 +#define IBCS_SIGTTOU 27
24137 +#define IBCS_SIGVTALRM 28
24138 +#define IBCS_SIGPROF 29
24139 +#define IBCS_SIGGXCPU 30
24140 +#define IBCS_SIGGXFSZ 31
24142 +#define ISC_SIGSTOP 24
24143 +#define ISC_SIGTSTP 25
24144 +#define ISC_SIGCONT 23
24146 +/* These are the signal numbers used by BSD. */
24147 +#define BSD_SIGHUP 1
24148 +#define BSD_SIGINT 2
24149 +#define BSD_SIGQUIT 3
24150 +#define BSD_SIGILL 4
24151 +#define BSD_SIGTRAP 5
24152 +#define BSD_SIGABRT 6
24153 +#define BSD_SIGEMT 7
24154 +#define BSD_SIGFPE 8
24155 +#define BSD_SIGKILL 9
24156 +#define BSD_SIGBUS 10
24157 +#define BSD_SIGSEGV 11
24158 +#define BSD_SIGSYS 12
24159 +#define BSD_SIGPIPE 13
24160 +#define BSD_SIGALRM 14
24161 +#define BSD_SIGTERM 15
24162 +#define BSD_SIGURG 16
24163 +#define BSD_SIGSTOP 17
24164 +#define BSD_SIGTSTP 18
24165 +#define BSD_SIGCONT 19
24166 +#define BSD_SIGCHLD 20
24167 +#define BSD_SIGTTIN 21
24168 +#define BSD_SIGTTOU 22
24169 +#define BSD_SIGIO 23
24170 +#define BSD_SIGXCPU 24
24171 +#define BSD_SIGXFSZ 25
24172 +#define BSD_SIGVTALRM 26
24173 +#define BSD_SIGPROF 27
24174 +#define BSD_SIGWINCH 28
24175 +#define BSD_SIGINFO 29
24176 +#define BSD_SIGUSR1 30
24177 +#define BSD_SIGUSR2 31
24179 diff -Nur kernel-source-2.6.16.orig/include/abi/socksys.h kernel-source-2.6.16/include/abi/socksys.h
24180 --- kernel-source-2.6.16.orig/include/abi/socksys.h 1970-01-01 10:00:00.000000000 +1000
24181 +++ kernel-source-2.6.16/include/abi/socksys.h 2006-04-27 18:50:24.000000000 +1000
24184 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
24189 +#include <linux/netdevice.h>
24190 +/* Get struct rtentry from linux/route.h - this should be compatible. */
24191 +#include <linux/route.h>
24192 +/* Get struct arpreq from linux/if_arp.h - this should be compatible. */
24193 +#include <linux/if_arp.h>
24194 +/* Get struct ifreq and struct ifconf from linux/if.h - these should
24195 + * be compatible. */
24196 +#include <linux/if.h>
24199 +struct socksysreq {
24204 +struct socknewproto {
24205 + int family; /* address family (AF_INET, etc.) */
24206 + int type; /* protocol type (SOCK_STREAM, etc.) */
24207 + int proto; /* per family proto number */
24208 + dev_t dev; /* major/minor to use (must be a clone) */
24209 + int flags; /* protosw flags */
24213 +/* These are nothing to do with what we know as SO_*. I think they
24214 + * are the command requests which appear in socksysreq structures?
24216 +#define SSYS_SO_ACCEPT 1
24217 +#define SSYS_SO_BIND 2
24218 +#define SSYS_SO_CONNECT 3
24219 +#define SSYS_SO_GETPEERNAME 4
24220 +#define SSYS_SO_GETSOCKNAME 5
24221 +#define SSYS_SO_GETSOCKOPT 6
24222 +#define SSYS_SO_LISTEN 7
24223 +#define SSYS_SO_RECV 8
24224 +#define SSYS_SO_RECVFROM 9
24225 +#define SSYS_SO_SEND 10
24226 +#define SSYS_SO_SENDTO 11
24227 +#define SSYS_SO_SETSOCKOPT 12
24228 +#define SSYS_SO_SHUTDOWN 13
24229 +#define SSYS_SO_SOCKET 14
24230 +#define SSYS_SO_SELECT 15
24231 +#define SSYS_SO_GETIPDOMAIN 16
24232 +#define SSYS_SO_SETIPDOMAIN 17
24233 +#define SSYS_SO_ADJTIME 18
24234 +#define SSYS_SO_SETREUID 19
24235 +#define SSYS_SO_SETREGID 20
24236 +#define SSYS_SO_GETTIME 21
24237 +#define SSYS_SO_SETTIME 22
24238 +#define SSYS_SO_GETITIMER 23
24239 +#define SSYS_SO_SETITIMER 24
24240 +#define SSYS_SO_RECVMSG 25 /* Here down is SCO 3.2v5 and up */
24241 +#define SSYS_SO_SENDMSG 26
24242 +#define SSYS_SO_SOCKPAIR 27
24245 +/* We encode the ioctl numbers using the argument size as part of
24246 + * the number. This will warn us if we haven't got compatible
24247 + * structures :-).
24248 + * Naturally the SVR3/Lachman ioctl numbers are different from the
24249 + * BSD/SVR4-XTI ioctl numbers. What more would you expect?
24252 +#define SSYS_IOCPARM_MASK 0xff /* parameters must be < 256 bytes */
24253 +#define SSYS_IOC_VOID 0x20000000 /* no parameters */
24254 +#define SSYS_IOC_OUT 0x40000000 /* copy out parameters */
24255 +#define SSYS_IOC_IN 0x80000000 /* copy in parameters */
24256 +#define SSYS_IOC_INOUT (SSYS_IOC_IN|SSYS_IOC_OUT)
24258 +#define SSYS_IOS(x,y) (SSYS_IOC_VOID|(x<<8)|y)
24259 +#define SSYS_IOSR(x,y,t) (SSYS_IOC_OUT|((sizeof(t)&SSYS_IOCPARM_MASK)<<16)|(x<<8)|y)
24260 +#define SSYS_IOSW(x,y,t) (SSYS_IOC_IN|((sizeof(t)&SSYS_IOCPARM_MASK)<<16)|(x<<8)|y)
24261 +#define SSYS_IOSWR(x,y,t) (SSYS_IOC_INOUT|((sizeof(t)&SSYS_IOCPARM_MASK)<<16)|(x<<8)|y)
24263 +#define SSYS_SIOCSHIWAT SSYS_IOSW('S', 1, int) /* set high watermark */
24264 +#define SSYS_SIOCGHIWAT SSYS_IOSR('S', 2, int) /* get high watermark */
24265 +#define SSYS_SIOCSLOWAT SSYS_IOSW('S', 3, int) /* set low watermark */
24266 +#define SSYS_SIOCGLOWAT SSYS_IOSR('S', 4, int) /* get low watermark */
24267 +#define SSYS_SIOCATMARK SSYS_IOSR('S', 5, int) /* at oob mark? */
24268 +#define SSYS_SIOCSPGRP SSYS_IOSW('S', 6, int) /* set process group */
24269 +#define SSYS_SIOCGPGRP SSYS_IOSR('S', 7, int) /* get process group */
24272 +#define SSYS_FIONREAD SSYS_IOSR('S', 8, int) /* BSD compatibilty */
24273 +#define SSYS_FIONBIO SSYS_IOSW('S', 9, int) /* BSD compatibilty */
24274 +#define SSYS_FIOASYNC SSYS_IOSW('S', 10, int) /* BSD compatibilty */
24275 +#define SSYS_SIOCPROTO SSYS_IOSW('S', 11, struct socknewproto) /* link proto */
24276 +#define SSYS_SIOCGETNAME SSYS_IOSR('S', 12, struct sockaddr) /* getsockname */
24277 +#define SSYS_SIOCGETPEER SSYS_IOSR('S', 13, struct sockaddr) /* getpeername */
24278 +#define SSYS_IF_UNITSEL SSYS_IOSW('S', 14, int) /* set unit number */
24279 +#define SSYS_SIOCXPROTO SSYS_IOS('S', 15) /* empty proto table */
24281 +#define SSYS_SIOCADDRT SSYS_IOSW('R', 9, struct rtentry) /* add route */
24282 +#define SSYS_SIOCDELRT SSYS_IOSW('R', 10, struct rtentry) /* delete route */
24284 +#define SSYS_SIOCSIFADDR SSYS_IOSW('I', 11, struct ifreq) /* set ifnet address */
24285 +#define SSYS_SIOCGIFADDR SSYS_IOSWR('I', 12, struct ifreq) /* get ifnet address */
24286 +#define SSYS_SIOCSIFDSTADDR SSYS_IOSW('I', 13, struct ifreq) /* set p-p address */
24287 +#define SSYS_SIOCGIFDSTADDR SSYS_IOSWR('I', 14, struct ifreq) /* get p-p address */
24288 +#define SSYS_SIOCSIFFLAGS SSYS_IOSW('I', 15, struct ifreq) /* set ifnet flags */
24289 +#define SSYS_SIOCGIFFLAGS SSYS_IOSWR('I', 16, struct ifreq) /* get ifnet flags */
24290 +#define SSYS_SIOCGIFCONF SSYS_IOSWR('I', 17, struct ifconf) /* get ifnet list */
24292 +#define SSYS_SIOCSIFMTU SSYS_IOSW('I', 21, struct ifreq) /* get if_mtu */
24293 +#define SSYS_SIOCGIFMTU SSYS_IOSWR('I', 22, struct ifreq) /* set if_mtu */
24295 +#define SSYS_SIOCIFDETACH SSYS_IOSW('I', 26, struct ifreq) /* detach interface */
24296 +#define SSYS_SIOCGENPSTATS SSYS_IOSWR('I', 27, struct ifreq) /* get ENP stats */
24298 +#define SSYS_SIOCX25XMT SSYS_IOSWR('I', 29, struct ifreq) /* start a slp proc in
24300 +#define SSYS_SIOCX25RCV SSYS_IOSWR('I', 30, struct ifreq) /* start a slp proc in
24302 +#define SSYS_SIOCX25TBL SSYS_IOSWR('I', 31, struct ifreq) /* xfer lun table to
24305 +#define SSYS_SIOCGIFBRDADDR SSYS_IOSWR('I', 32, struct ifreq) /* get broadcast addr */
24306 +#define SSYS_SIOCSIFBRDADDR SSYS_IOSW('I', 33, struct ifreq) /* set broadcast addr */
24307 +#define SSYS_SIOCGIFNETMASK SSYS_IOSWR('I', 34, struct ifreq) /* get net addr mask */
24308 +#define SSYS_SIOCSIFNETMASK SSYS_IOSW('I', 35, struct ifreq) /* set net addr mask */
24309 +#define SSYS_SIOCGIFMETRIC SSYS_IOSWR('I', 36, struct ifreq) /* get IF metric */
24310 +#define SSYS_SIOCSIFMETRIC SSYS_IOSW('I', 37, struct ifreq) /* set IF metric */
24312 +#define SSYS_SIOCSARP SSYS_IOSW('I', 38, struct arpreq) /* set arp entry */
24313 +#define SSYS_SIOCGARP SSYS_IOSWR('I', 39, struct arpreq) /* get arp entry */
24314 +#define SSYS_SIOCDARP SSYS_IOSW('I', 40, struct arpreq) /* delete arp entry */
24316 +#define SSYS_SIOCSIFNAME SSYS_IOSW('I', 41, struct ifreq) /* set interface name */
24317 +#define SSYS_SIOCGIFONEP SSYS_IOSWR('I', 42, struct ifreq) /* get one-packet params */
24318 +#define SSYS_SIOCSIFONEP SSYS_IOSW('I', 43, struct ifreq) /* set one-packet params */
24320 +#define SSYS_SIOCGENADDR SSYS_IOSWR('I', 65, struct ifreq) /* Get ethernet addr */
24322 +#define SSYS_SIOCSOCKSYS SSYS_IOSW('I', 66, struct socksysreq) /* Pseudo socket syscall */
24325 +#define SVR4_SIOCSHIWAT SSYS_IOSW('s', 0, int) /* set high watermark */
24326 +#define SVR4_SIOCGHIWAT SSYS_IOSR('s', 1, int) /* get high watermark */
24327 +#define SVR4_SIOCSLOWAT SSYS_IOSW('s', 2, int) /* set low watermark */
24328 +#define SVR4_SIOCGLOWAT SSYS_IOSR('s', 3, int) /* get low watermark */
24329 +#define SVR4_SIOCATMARK SSYS_IOSR('s', 7, int) /* at oob mark? */
24330 +#define SVR4_SIOCSPGRP SSYS_IOSW('s', 8, int) /* set process group */
24331 +#define SVR4_SIOCGPGRP SSYS_IOSR('s', 9, int) /* get process group */
24333 +#define SVR4_SIOCADDRT SSYS_IOSW('r', 10, struct rtentry) /* add route */
24334 +#define SVR4_SIOCDELRT SSYS_IOSW('r', 11, struct rtentry) /* delete route */
24336 +#define SVR4_SIOCSIFADDR SSYS_IOSW('i', 12, struct ifreq) /* set ifnet address */
24337 +#define SVR4_SIOCGIFADDR SSYS_IOSWR('i',13, struct ifreq) /* get ifnet address */
24338 +#define SVR4_SIOCSIFDSTADDR SSYS_IOSW('i', 14, struct ifreq) /* set p-p address */
24339 +#define SVR4_SIOCGIFDSTADDR SSYS_IOSWR('i',15, struct ifreq) /* get p-p address */
24340 +#define SVR4_SIOCSIFFLAGS SSYS_IOSW('i', 16, struct ifreq) /* set ifnet flags */
24341 +#define SVR4_SIOCGIFFLAGS SSYS_IOSWR('i',17, struct ifreq) /* get ifnet flags */
24342 +#define SVR4_SIOCSIFMEM SSYS_IOSW('i', 18, struct ifreq) /* set interface mem */
24343 +#define SVR4_SIOCGIFMEM SSYS_IOSWR('i',19, struct ifreq) /* get interface mem */
24344 +#define SVR4_SIOCGIFCONF SSYS_IOSWR('i',20, struct ifconf) /* get ifnet list */
24345 +#define SVR4_SIOCSIFMTU SSYS_IOSW('i', 21, struct ifreq) /* set if_mtu */
24346 +#define SVR4_SIOCGIFMTU SSYS_IOSWR('i',22, struct ifreq) /* get if_mtu */
24348 + /* from 4.3BSD */
24349 +#define SVR4_SIOCGIFBRDADDR SSYS_IOSWR('i',23, struct ifreq) /* get broadcast addr */
24350 +#define SVR4_SIOCSIFBRDADDR SSYS_IOSW('i',24, struct ifreq) /* set broadcast addr */
24351 +#define SVR4_SIOCGIFNETMASK SSYS_IOSWR('i',25, struct ifreq) /* get net addr mask */
24352 +#define SVR4_SIOCSIFNETMASK SSYS_IOSW('i',26, struct ifreq) /* set net addr mask */
24353 +#define SVR4_SIOCGIFMETRIC SSYS_IOSWR('i',27, struct ifreq) /* get IF metric */
24354 +#define SVR4_SIOCSIFMETRIC SSYS_IOSW('i',28, struct ifreq) /* set IF metric */
24356 +#define SVR4_SIOCSARP SSYS_IOSW('i', 30, struct arpreq) /* set arp entry */
24357 +#define SVR4_SIOCGARP SSYS_IOSWR('i',31, struct arpreq) /* get arp entry */
24358 +#define SVR4_SIOCDARP SSYS_IOSW('i', 32, struct arpreq) /* delete arp entry */
24359 +#define SVR4_SIOCUPPER SSYS_IOSW('i', 40, struct ifreq) /* attach upper layer */
24360 +#define SVR4_SIOCLOWER SSYS_IOSW('i', 41, struct ifreq) /* attach lower layer */
24361 +#define SVR4_SIOCSETSYNC SSYS_IOSW('i', 44, struct ifreq) /* set syncmode */
24362 +#define SVR4_SIOCGETSYNC SSYS_IOSWR('i', 45, struct ifreq) /* get syncmode */
24363 +#define SVR4_SIOCSSDSTATS SSYS_IOSWR('i', 46, struct ifreq) /* sync data stats */
24364 +#define SVR4_SIOCSSESTATS SSYS_IOSWR('i', 47, struct ifreq) /* sync error stats */
24366 +#define SVR4_SIOCSPROMISC SSYS_IOSW('i', 48, int) /* request promisc mode
24368 +#define SVR4_SIOCADDMULTI SSYS_IOSW('i', 49, struct ifreq) /* set m/c address */
24369 +#define SVR4_SIOCDELMULTI SSYS_IOSW('i', 50, struct ifreq) /* clr m/c address */
24371 +/* protocol i/o controls */
24372 +#define SVR4_SIOCSNIT SSYS_IOSW('p', 0, struct nit_ioc) /* set nit modes */
24373 +#define SVR4_SIOCGNIT SSYS_IOSWR('p', 1, struct nit_ioc) /* get nit modes */
24375 +/* STREAMS based socket emulation */
24377 +#define SVR4_SIOCPROTO SSYS_IOSW('s', 51, struct socknewproto) /* link proto */
24378 +#define SVR4_SIOCGETNAME SSYS_IOSR('s', 52, struct sockaddr) /* getsockname */
24379 +#define SVR4_SIOCGETPEER SSYS_IOSR('s', 53, struct sockaddr) /* getpeername */
24380 +#define SVR4_IF_UNITSEL SSYS_IOSW('s', 54, int) /* set unit number */
24381 +#define SVR4_SIOCXPROTO SSYS_IOS('s', 55) /* empty proto table */
24383 +#define SVR4_SIOCIFDETACH SSYS_IOSW('i', 56, struct ifreq) /* detach interface */
24384 +#define SVR4_SIOCGENPSTATS SSYS_IOSWR('i', 57, struct ifreq) /* get ENP stats */
24385 +#define SVR4_SIOCX25XMT SSYS_IOSWR('i', 59, struct ifreq) /* start a slp proc in
24387 +#define SVR4_SIOCX25RCV SSYS_IOSWR('i', 60, struct ifreq) /* start a slp proc in
24389 +#define SVR4_SIOCX25TBL SSYS_IOSWR('i', 61, struct ifreq) /* xfer lun table to
24391 +#define SVR4_SIOCSLGETREQ SSYS_IOSWR('i', 71, struct ifreq) /* wait for switched
24392 + * SLIP request */
24393 +#define SVR4_SIOCSLSTAT SSYS_IOSW('i', 72, struct ifreq) /* pass SLIP info to
24395 +#define SVR4_SIOCSIFNAME SSYS_IOSW('i', 73, struct ifreq) /* set interface name */
24396 +#define SVR4_SIOCGENADDR SSYS_IOSWR('i', 85, struct ifreq) /* Get ethernet addr */
24397 +#define SVR4_SIOCSOCKSYS SSYS_IOSW('i', 86, struct socksysreq) /* Pseudo socket syscall */
24401 +/* Strange, there also seem to be two byte SVR4 ioctls used which are
24402 + * not simply the BSD style ioctl with the high word masked out. i.e the
24403 + * class character doesn't match what I expect.
24405 +#define SVRX_SIOCGIFCONF 0x8912
24406 +#define SVRX_SIOCGIFFLAGS 0x8913
24410 +/* With NFS/NIS there is also a pseudo device /dev/nfsd which understands
24411 + * some ioctls. Since these don't conflict with the socksys ioctls we
24412 + * just link nfsd to socksys and let socksys handle both sets.
24414 +#define NIOCNFSD 1
24415 +#define NIOCOLDGETFH 2
24416 +#define NIOCASYNCD 3
24417 +#define NIOCSETDOMNAM 4
24418 +#define NIOCGETDOMNAM 5
24419 +#define NIOCCLNTHAND 6
24420 +#define NIOCEXPORTFS 7
24421 +#define NIOCGETFH 8
24422 +#define NIOCLSTAT 9
24424 +/* These ioctls take argument structures... */
24425 +struct domnam_args {
24430 +struct lstat_args {
24435 +#define NFS_FHSIZE 32
24438 + unsigned short fsid; /* filesystem id (device) */
24439 + unsigned long fno; /* file number (inode) */
24440 + unsigned long fgen; /* file generation */
24441 + unsigned short ex_fsid; /* exported fs id (device) */
24442 + unsigned long ex_fno; /* exported file no (inode) */
24443 + unsigned long ex_fgen; /* exported file gen */
24445 + char pad[NFS_FHSIZE];
24448 +struct getfh_args {
24453 +extern void inherit_socksys_funcs(unsigned int fd, int state);
24454 +extern int socksys_fdinit(int fd, int rw, const char *buf, int *count);
24455 diff -Nur kernel-source-2.6.16.orig/include/abi/solaris/stat.h kernel-source-2.6.16/include/abi/solaris/stat.h
24456 --- kernel-source-2.6.16.orig/include/abi/solaris/stat.h 1970-01-01 10:00:00.000000000 +1000
24457 +++ kernel-source-2.6.16/include/abi/solaris/stat.h 2006-04-27 18:50:24.000000000 +1000
24459 +#ifndef _ABI_SOLARIS_STAT_H
24460 +#define _ABI_SOLARIS_STAT_H
24464 +#include <abi/solaris/types.h>
24467 +struct sol_stat64 {
24468 + sol_dev_t st_dev;
24469 + u_int32_t st_pad1[3];
24470 + sol_ino_t st_ino;
24471 + sol_mode_t st_mode;
24472 + sol_nlink_t st_nlink;
24473 + sol_uid_t st_uid;
24474 + sol_gid_t st_gid;
24475 + sol_dev_t st_rdev;
24476 + u_int32_t st_pad2[2];
24477 + sol_off_t st_size;
24478 + sol_time_t st_atime;
24479 + sol_time_t st_mtime;
24480 + sol_time_t st_ctime;
24481 + int32_t st_blksize;
24482 + int64_t st_blocks;
24483 + char st_fstype[16];
24484 + u_int32_t st_pad4[4];
24487 +#endif /* _ABI_SOLARIS_STAT_H */
24488 diff -Nur kernel-source-2.6.16.orig/include/abi/solaris/sysent.h kernel-source-2.6.16/include/abi/solaris/sysent.h
24489 --- kernel-source-2.6.16.orig/include/abi/solaris/sysent.h 1970-01-01 10:00:00.000000000 +1000
24490 +++ kernel-source-2.6.16/include/abi/solaris/sysent.h 2006-04-27 18:50:24.000000000 +1000
24492 +#ifndef _ABI_SOLARIS_SYSENT_H
24493 +#define _ABI_SOLARIS_SYSENT_H
24497 +struct sol_stat64;
24498 +struct sol_nmsghdr;
24503 +extern int sol_open64(const char *, int, int);
24504 +extern int sol_getdents64(int fd, char *, int);
24505 +extern int sol_mmap64(u_int, u_int, int, int, int, u_int, u_int);
24508 +extern int solaris_socket(int family, int type, int protocol);
24509 +extern int solaris_socketpair(int *usockvec);
24510 +extern int solaris_bind(int fd, struct sockaddr *addr, int addrlen);
24511 +extern int solaris_setsockopt(int fd, int level, int optname,
24512 + u32 optval, int optlen);
24513 +extern int solaris_getsockopt(int fd, int level, int optname,
24514 + u32 optval, u32 optlen);
24515 +extern int solaris_connect(int fd, struct sockaddr *addr, int addrlen);
24516 +extern int solaris_accept(int fd, struct sockaddr *addr, int *addrlen);
24517 +extern int solaris_listen(int fd, int backlog);
24518 +extern int solaris_shutdown(int fd, int how);
24519 +extern int solaris_recvfrom(int s, char *buf, int len, int flags,
24520 + u32 from, u32 fromlen);
24521 +extern int solaris_recv(int s, char *buf, int len, int flags);
24522 +extern int solaris_sendto(int s, char *buf, int len, int flags,
24523 + u32 to, u32 tolen);
24524 +extern int solaris_send(int s, char *buf, int len, int flags);
24525 +extern int solaris_getpeername(int fd, struct sockaddr *addr,
24527 +extern int solaris_getsockname(int fd, struct sockaddr *addr,
24529 +extern int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg,
24530 + unsigned user_flags);
24531 +extern int solaris_recvmsg(int fd, struct sol_nmsghdr *user_msg,
24532 + unsigned user_flags);
24534 +/* solarisx86.c */
24535 +extern int sol_llseek(struct pt_regs *regs);
24536 +extern int sol_memcntl(unsigned addr, unsigned len, int cmd,
24537 + unsigned arg, int attr, int mask);
24538 +extern int sol_acl(char *pathp, int cmd, int nentries, void *aclbufp);
24541 +extern int sol_stat64(char *, struct sol_stat64 *);
24542 +extern int sol_lstat64(char *, struct sol_stat64 *);
24543 +extern int sol_fstat64(u_int fd, struct sol_stat64 *);
24545 +#endif /* _ABI_SOLARIS_SYSENT_H */
24546 diff -Nur kernel-source-2.6.16.orig/include/abi/solaris/types.h kernel-source-2.6.16/include/abi/solaris/types.h
24547 --- kernel-source-2.6.16.orig/include/abi/solaris/types.h 1970-01-01 10:00:00.000000000 +1000
24548 +++ kernel-source-2.6.16/include/abi/solaris/types.h 2006-04-27 18:50:24.000000000 +1000
24551 + * Copyright (c) 2001 Christoph Hellwig.
24552 + * All rights reserved.
24554 + * This program is free software; you can redistribute it and/or modify
24555 + * it under the terms of the GNU General Public License as published by
24556 + * the Free Software Foundation; either version 2 of the License, or
24557 + * (at your option) any later version.
24559 + * This program is distributed in the hope that it will be useful,
24560 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24561 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24562 + * GNU General Public License for more details.
24564 + * You should have received a copy of the GNU General Public License
24565 + * along with this program; if not, write to the Free Software
24566 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24568 +#ifndef _ABI_SOLARIS_TYPES_H
24569 +#define _ABI_SOLARIS_TYPES_H
24574 + * Solaris 2 type declarations.
24576 +#include <abi/svr4/types.h> /* Solaris 2 is based on SVR4 */
24578 +typedef svr4_dev_t sol_dev_t;
24579 +typedef u_int64_t sol_ino_t;
24580 +typedef svr4_mode_t sol_mode_t;
24581 +typedef svr4_nlink_t sol_nlink_t;
24582 +typedef svr4_uid_t sol_uid_t;
24583 +typedef svr4_gid_t sol_gid_t;
24584 +typedef int64_t sol_off_t;
24585 +typedef svr4_time_t sol_time_t;
24587 +typedef u_int64_t sol_fsblkcnt64_t;
24588 +typedef u_int64_t sol_fsfilcnt64_t;
24591 +#define linux_to_sol_dev_t(dev) \
24592 + linux_to_svr4_dev_t(dev)
24594 +#define linux_to_sol_ino_t(ino) \
24595 + linux_to_svr4_ino_t(ino)
24597 +#define linux_to_sol_uid_t(uid) \
24598 + linux_to_svr4_uid_t(uid)
24600 +#define linux_to_sol_gid_t(gid) \
24601 + linux_to_svr4_gid_t(gid)
24603 +#endif /* _ABI_SOLARIS_TYPES_H */
24604 diff -Nur kernel-source-2.6.16.orig/include/abi/stream.h kernel-source-2.6.16/include/abi/stream.h
24605 --- kernel-source-2.6.16.orig/include/abi/stream.h 1970-01-01 10:00:00.000000000 +1000
24606 +++ kernel-source-2.6.16/include/abi/stream.h 2006-04-27 18:50:24.000000000 +1000
24609 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
24611 +#ifndef _IBCS_STREAM_H_
24612 +#define _IBCS_STREAM_H_
24616 +#define MSG_HIPRI 1
24617 +#define RS_HIPRI MSG_HIPRI
24619 +#define MSG_BAND 4
24622 +#define MOREDATA 2
24625 + int maxlen; /* size of buffer */
24626 + int len; /* number of bytes in buffer */
24627 + char *buf; /* pointer to buffer */
24630 +/* Used for the I_PEEK STREAMS ioctl. */
24632 + struct strbuf ctl;
24633 + struct strbuf dat;
24637 +/* Used for the I_FDINSERT STREAMS ioctl. */
24638 +struct strfdinsert {
24639 + struct strbuf ctlbuf;
24640 + struct strbuf datbuf;
24642 + unsigned int fildes;
24646 +extern int stream_fdinsert(struct pt_regs *regs, int fd,
24647 + struct strfdinsert *arg);
24650 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/ioctl.h kernel-source-2.6.16/include/abi/svr4/ioctl.h
24651 --- kernel-source-2.6.16.orig/include/abi/svr4/ioctl.h 1970-01-01 10:00:00.000000000 +1000
24652 +++ kernel-source-2.6.16/include/abi/svr4/ioctl.h 2006-04-27 18:50:24.000000000 +1000
24654 +#ifndef _ABI_SVR4_IOCTL_H
24655 +#define _ABI_SVR4_IOCTL_H
24658 + * Function prototypes used for SVR4 ioctl emulation.
24663 +extern int __svr4_ioctl(struct pt_regs *, int, unsigned long, void *);
24666 +extern int svr4_console_ioctl(int, u_int, caddr_t);
24667 +extern int svr4_video_ioctl(int, u_int, caddr_t);
24670 +extern int svr4_fil_ioctl(int, u_int, caddr_t);
24673 +extern int svr4_stream_ioctl(struct pt_regs *regs, int, u_int, caddr_t);
24676 +extern int abi_ioctl_socksys(int, u_int, caddr_t);
24679 +extern int svr4_tape_ioctl(int, u_int, caddr_t);
24682 +extern int bsd_ioctl_termios(int, u_int, void *);
24683 +extern int svr4_term_ioctl(int, u_int, caddr_t);
24684 +extern int svr4_termiox_ioctl(int, u_int, caddr_t);
24687 +extern int svr4_sockmod_ioctl(int, u_int, caddr_t);
24688 +extern int do_getmsg(int, struct pt_regs *, char *, int,
24689 + int *, char *, int, int *, int *);
24690 +extern int do_putmsg(int, struct pt_regs *, char *, int,
24691 + char *, int, int);
24693 +#endif /* _ABI_SVR4_IOCTL_H */
24694 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/ipc.h kernel-source-2.6.16/include/abi/svr4/ipc.h
24695 --- kernel-source-2.6.16.orig/include/abi/svr4/ipc.h 1970-01-01 10:00:00.000000000 +1000
24696 +++ kernel-source-2.6.16/include/abi/svr4/ipc.h 2006-04-27 18:50:24.000000000 +1000
24699 + * Copyright (c) 1994 Mike Jagdis.
24700 + * Copyright (c) 2001 Christoph Hellwig.
24701 + * All rights reserved.
24703 + * This program is free software; you can redistribute it and/or modify
24704 + * it under the terms of the GNU General Public License as published by
24705 + * the Free Software Foundation; either version 2 of the License, or
24706 + * (at your option) any later version.
24708 + * This program is distributed in the hope that it will be useful,
24709 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24710 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24711 + * GNU General Public License for more details.
24713 + * You should have received a copy of the GNU General Public License
24714 + * along with this program; if not, write to the Free Software
24715 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24717 +#ifndef _ABI_SVR4_IPC_H
24718 +#define _ABI_SVR4_IPC_H
24726 + SVR4_IPC_RMID = 0,
24727 + SVR4_IPC_SET = 1,
24728 + SVR4_IPC_STAT = 2,
24729 + SVR4_IPC_RMID_L = 10,
24730 + SVR4_IPC_SET_L = 11,
24731 + SVR4_IPC_STAT_L = 12,
24734 +struct ibcs2_ipc_perm {
24735 + u_int16_t uid; /* owner's user id */
24736 + u_int16_t gid; /* owner's group id */
24737 + u_int16_t cuid; /* creator's user id */
24738 + u_int16_t cgid; /* creator's group id */
24739 + u_int16_t mode; /* access modes */
24740 + u_int16_t seq; /* slot usage sequence number */
24741 + int32_t key; /* key */
24744 +struct abi4_ipc_perm {
24745 + u_int32_t uid; /* owner's user id */
24746 + u_int32_t gid; /* owner's group id */
24747 + u_int32_t cuid; /* creator's user id */
24748 + u_int32_t cgid; /* creator's group id */
24749 + u_int32_t mode; /* access modes */
24750 + u_int32_t seq; /* slot usage sequence number */
24751 + int32_t key; /* key */
24752 + int32_t pad[4]; /* reserved */
24765 +struct ibcs2_msqid_ds {
24766 + struct ibcs2_ipc_perm msg_perm;
24767 + struct msg *msg_first;
24768 + struct msg *msg_last;
24769 + u_int16_t msg_cbytes;
24770 + u_int16_t msg_qnum;
24771 + u_int16_t msg_qbytes;
24772 + u_int16_t msg_lspid;
24773 + u_int16_t msg_lrpid;
24774 + time_t msg_stime;
24775 + time_t msg_rtime;
24776 + time_t msg_ctime;
24780 + struct abi4_msg *msg_next;
24781 + int32_t msg_type;
24782 + u_int16_t msg_ts;
24783 + int16_t msg_spot;
24786 +struct abi4_msqid_ds {
24787 + struct abi4_ipc_perm msg_perm;
24788 + struct msg *msg_first;
24789 + struct msg *msg_last;
24790 + u_int32_t msg_cbytes;
24791 + u_int32_t msg_qnum;
24792 + u_int32_t msg_qbytes;
24793 + u_int32_t msg_lspid;
24794 + u_int32_t msg_lrpid;
24795 + u_int32_t msg_stime;
24796 + u_int32_t msg_pad1;
24797 + u_int32_t msg_rtime;
24798 + u_int32_t msg_pad2;
24799 + u_int32_t msg_ctime;
24800 + u_int32_t msg_pad3;
24801 + u_int32_t msg_pad4[4];
24814 +/* shmctl() operations */
24816 + SVR4_SHM_LOCK = 3,
24817 + SVR4_SHM_UNLOCK = 4,
24820 +struct ibcs2_shmid_ds {
24821 + struct ibcs2_ipc_perm shm_perm; /* operation permissions */
24822 + int32_t shm_segsz; /* size of segment in bytes */
24823 + struct region *__pad1; /* ptr to region structure */
24824 + char __pad2[4]; /* for swap compatibility */
24825 + u_int16_t shm_lpid; /* pid of last shmop */
24826 + u_int16_t shm_cpid; /* pid of creator */
24827 + u_int16_t shm_nattch; /* used only for shminfo */
24828 + u_int16_t __pad3;
24829 + time_t shm_atime; /* last shmat time */
24830 + time_t shm_dtime; /* last shmdt time */
24831 + time_t shm_ctime; /* last change time */
24834 +struct abi4_shmid_ds {
24835 + struct abi4_ipc_perm shm_perm; /* operation permissions */
24836 + int32_t shm_segsz; /* size of segment in bytes */
24837 + struct region *__pad1; /* ptr to region structure */
24838 + u_int16_t shm_lckcnt; /* number of locks */
24839 + char __pad2[2]; /* for swap compatibility */
24840 + u_int32_t shm_lpid; /* pid of last shmop */
24841 + u_int32_t shm_cpid; /* pid of creator */
24842 + u_int32_t shm_nattch;/* used only for shminfo */
24843 + u_int32_t shm_cnattch;
24844 + u_int32_t shm_atime; /* last shmat time */
24845 + u_int32_t shm_pad1;
24846 + u_int32_t shm_dtime; /* last shmdt time */
24847 + u_int32_t shm_pad2;
24848 + u_int32_t shm_ctime; /* last change time */
24849 + u_int32_t shm_pad3;
24850 + u_int32_t shm_pad4[4];
24862 +/* semctl() operations */
24864 + SVR4_SEM_GETNCNT = 3,
24865 + SVR4_SEM_GETPID = 4,
24866 + SVR4_SEM_GETVAL = 5,
24867 + SVR4_SEM_GETALL = 6,
24868 + SVR4_SEM_GETZCNT = 7,
24869 + SVR4_SEM_SETVAL = 8,
24870 + SVR4_SEM_SETALL = 9,
24873 +/* mapping of svr4 semaphore operations to Linux (if available) */
24874 +static int svr4sem2linux[] = {
24875 + [SVR4_IPC_RMID] = IPC_RMID,
24876 + [SVR4_IPC_SET] = IPC_SET,
24877 + [SVR4_IPC_STAT] = IPC_STAT,
24878 + [SVR4_SEM_GETNCNT] = GETNCNT,
24879 + [SVR4_SEM_GETPID] = GETPID,
24880 + [SVR4_SEM_GETVAL] = GETVAL,
24881 + [SVR4_SEM_GETALL] = GETALL,
24882 + [SVR4_SEM_GETZCNT] = GETZCNT,
24883 + [SVR4_SEM_SETVAL] = SETVAL,
24884 + [SVR4_SEM_SETALL] = SETALL,
24885 + [SVR4_IPC_RMID_L] = IPC_RMID,
24886 + [SVR4_IPC_SET_L] = IPC_SET,
24887 + [SVR4_IPC_STAT_L] = IPC_STAT,
24890 +struct ibcs2_semid_ds {
24891 + struct ibcs2_ipc_perm sem_perm;
24892 + struct sem *sem_base;
24893 + u_int16_t sem_nsems;
24895 + u_int32_t sem_otime;
24896 + u_int32_t sem_ctime;
24899 +struct abi4_semid_ds {
24900 + struct abi4_ipc_perm sem_perm;
24901 + struct sem *sem_base;
24902 + u_int16_t sem_nsems;
24903 + char __pad[2]; /* this pad is not in the abi doc! */
24904 + u_int32_t sem_otime;
24905 + u_int32_t sem_pad1;
24906 + u_int32_t sem_ctime;
24907 + u_int32_t sem_pad2;
24908 + u_int32_t sem_pad3[4];
24911 +#endif /* _ABI_SVR4_IPC_H */
24912 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/mman.h kernel-source-2.6.16/include/abi/svr4/mman.h
24913 --- kernel-source-2.6.16.orig/include/abi/svr4/mman.h 1970-01-01 10:00:00.000000000 +1000
24914 +++ kernel-source-2.6.16/include/abi/svr4/mman.h 2006-04-27 18:50:24.000000000 +1000
24917 + * Copyright (c) 2001 Christoph Hellwig.
24918 + * All rights reserved.
24920 + * This program is free software; you can redistribute it and/or modify
24921 + * it under the terms of the GNU General Public License as published by
24922 + * the Free Software Foundation; either version 2 of the License, or
24923 + * (at your option) any later version.
24925 + * This program is distributed in the hope that it will be useful,
24926 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24927 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24928 + * GNU General Public License for more details.
24930 + * You should have received a copy of the GNU General Public License
24931 + * along with this program; if not, write to the Free Software
24932 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24934 +#ifndef _ABI_SVR4_MMAN_H
24935 +#define _ABI_SVR4_MMAN_H
24940 + * SVR4 memory mapped files declarations
24943 +#define SVR4_MAP_FAILED ((void *)-1)
24945 +/* protections flags for mmap() and mprotect() */
24946 +#define SVR4_PROT_NONE 0x0000
24947 +#define SVR4_PROT_READ 0x0001
24948 +#define SVR4_PROT_WRITE 0x0002
24949 +#define SVR4_PROT_EXEC 0x0004
24951 +/* sharing types for mmap() */
24952 +#define SVR4_MAP_SHARED 0x0001
24953 +#define SVR4_MAP_PRIVATE 0x0002
24954 +#define SVR4_MAP_FIXED 0x0010
24955 +#define SVR4_MAP_RENAME 0x0020
24956 +#define SVR4_MAP_NORESERVE 0x0040
24957 +#define SVR4_MAP_ANONYMOUS 0x0100
24958 +#define SVR4__MAP_NEW 0x80000000
24960 +#define SVR4_MAP_UNIMPL (SVR4_MAP_RENAME|SVR4__MAP_NEW)
24962 +/* memcntl() subfunctions */
24963 +#define SVR4_MC_SYNC 0x0001
24964 +#define SVR4_MC_LOCK 0x0002
24965 +#define SVR4_MC_UNLOCK 0x0003
24966 +#define SVR4_MC_ADVISE 0x0004
24967 +#define SVR4_MC_LOCKAS 0x0005
24968 +#define SVR4_MC_UNLOCKAS 0x0006
24970 +/* msync() flags */
24971 +#define SVR4_MS_SYNC 0x0000
24972 +#define SVR4_MS_ASYNC 0x0001
24973 +#define SVR4_MS_INVALIDATE 0x0002
24975 +/* mlockall() flags */
24976 +#define SVR4_MCL_CURRENT 0x0001
24977 +#define SVR4_MCL_FUTURE 0x0002
24979 +/* madvice() advices */
24980 +#define SVR4_MADV_NORMAL 0x0000
24981 +#define SVR4_MADV_RANDOM 0x0001
24982 +#define SVR4_MADV_SEQUENTIAL 0x0002
24983 +#define SVR4_MADV_WILLNEED 0x0003
24984 +#define SVR4_MADV_DONTNEED 0x0004
24986 +#endif /* _ABI_SVR4_MMAN_H */
24987 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/sigaction.h kernel-source-2.6.16/include/abi/svr4/sigaction.h
24988 --- kernel-source-2.6.16.orig/include/abi/svr4/sigaction.h 1970-01-01 10:00:00.000000000 +1000
24989 +++ kernel-source-2.6.16/include/abi/svr4/sigaction.h 2006-04-27 18:50:24.000000000 +1000
24991 +#ifndef _ABI_SVR4_SIGACTION_H
24992 +#define _ABI_SVR4_SIGACTION_H
24997 +struct task_struct;
24998 +extern void deactivate_signal(struct task_struct *, int);
25000 +struct abi_sigaction {
25002 + __sighandler_t sa_handler;
25003 + unsigned long sa_mask;
25004 + int sa_resv[2]; /* Reserved for something or another */
25006 +#define ABI_SA_ONSTACK 1
25007 +#define ABI_SA_RESETHAND 2
25008 +#define ABI_SA_RESTART 4
25009 +#define ABI_SA_SIGINFO 8
25010 +#define ABI_SA_NODEFER 16
25011 +#define ABI_SA_NOCLDWAIT 0x10000
25012 +#define ABI_SA_NOCLDSTOP 0x20000
25014 +#endif /* _ABI_SVR4_SIGACTION_H */
25015 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/siginfo.h kernel-source-2.6.16/include/abi/svr4/siginfo.h
25016 --- kernel-source-2.6.16.orig/include/abi/svr4/siginfo.h 1970-01-01 10:00:00.000000000 +1000
25017 +++ kernel-source-2.6.16/include/abi/svr4/siginfo.h 2006-04-27 18:50:24.000000000 +1000
25019 +#ifndef _ABI_SVR4_SIGINFO_H
25020 +#define _ABI_SVR4_SIGINFO_H
25022 +struct svr4_siginfo {
25027 + struct { /* kill(), SIGCLD */
25040 + struct { /* SIGSEGV, SIGBUS, SIGILL, SIGFPE */
25043 + struct { /* SIGPOLL, SIGXFSZ */
25050 +#endif /* _ABI_SVR4_SIGINFO_H */
25051 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/sigset.h kernel-source-2.6.16/include/abi/svr4/sigset.h
25052 --- kernel-source-2.6.16.orig/include/abi/svr4/sigset.h 1970-01-01 10:00:00.000000000 +1000
25053 +++ kernel-source-2.6.16/include/abi/svr4/sigset.h 2006-04-27 18:50:24.000000000 +1000
25055 +#ifndef _ABI_SVR4_SIGSET_H
25056 +#define _ABI_SVR4_SIGSET_H
25058 +typedef void (*svr4_sig_t)(int, void *, void *);
25059 +typedef struct svr4_sigset {
25060 + u_int setbits[4];
25063 +#endif /* _ABI_SVR4_SIGSET_H */
25064 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/sockio.h kernel-source-2.6.16/include/abi/svr4/sockio.h
25065 --- kernel-source-2.6.16.orig/include/abi/svr4/sockio.h 1970-01-01 10:00:00.000000000 +1000
25066 +++ kernel-source-2.6.16/include/abi/svr4/sockio.h 2006-04-27 18:50:24.000000000 +1000
25069 + * Copyright (c) 2001 Caldera Deutschland GmbH.
25070 + * Copyright (c) 2001 Christoph Hellwig.
25071 + * All rights reserved.
25073 + * This program is free software; you can redistribute it and/or modify
25074 + * it under the terms of the GNU General Public License as published by
25075 + * the Free Software Foundation; either version 2 of the License, or
25076 + * (at your option) any later version.
25078 + * This program is distributed in the hope that it will be useful,
25079 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25080 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25081 + * GNU General Public License for more details.
25083 + * You should have received a copy of the GNU General Public License
25084 + * along with this program; if not, write to the Free Software
25085 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25087 +#ifndef _ABI_SVR4_SOCKIO_H
25088 +#define _ABI_SVR4_SOCKIO_H
25092 +#include <linux/socket.h> /* for "struct sockaddr" et al */
25093 +#include <abi/svr4/types.h> /* for "svr4_caddr_t" et al */
25096 +#define SVR4_IFF_UP 0x0001
25097 +#define SVR4_IFF_BROADCAST 0x0002
25098 +#define SVR4_IFF_DEBUG 0x0004
25099 +#define SVR4_IFF_LOOPBACK 0x0008
25100 +#define SVR4_IFF_POINTOPOINT 0x0010
25101 +#define SVR4_IFF_NOTRAILERS 0x0020
25102 +#define SVR4_IFF_RUNNING 0x0040
25103 +#define SVR4_IFF_NOARP 0x0080
25104 +#define SVR4_IFF_PROMISC 0x0100
25105 +#define SVR4_IFF_ALLMULTI 0x0200
25106 +#define SVR4_IFF_INTELLIGENT 0x0400
25107 +#define SVR4_IFF_MULTICAST 0x0800
25108 +#define SVR4_IFF_MULTI_BCAST 0x1000
25109 +#define SVR4_IFF_UNNUMBERED 0x2000
25110 +#define SVR4_IFF_PRIVATE 0x8000
25114 + * Struct used for one-packet mode params in if ioctls
25116 +struct svr4_onepacket {
25117 + u_int spsize; /* short packet size */
25118 + u_int spthresh; /* short packet threshold */
25122 + * Interface specific tuning information that TCP can use to its
25125 +struct svr4_ifperf {
25126 + u_int ip_recvspace; /* Receive window to use */
25127 + u_int ip_sendspace; /* Send window to use */
25128 + u_int ip_fullsize; /* use full-size frames */
25133 + * Interface request structure used for socket ioctl's. All interface
25134 + * ioctl's must have parameter definitions which begin with ifr_name. The
25135 + * remainder may be interface specific.
25137 +struct svr4_ifreq {
25138 +#define SVR4_IFNAMSIZ 16
25140 + char ifrn_name[SVR4_IFNAMSIZ];
25143 + struct sockaddr ifru_addr;
25144 + struct sockaddr ifru_dstaddr;
25145 + struct sockaddr ifru_broadaddr;
25147 + svr4_caddr_t ifru_data;
25148 + char ifru_enaddr[6];
25149 + struct svr4_onepacket ifru_onepacket;
25150 + struct svr4_ifperf ifru_perf;
25152 +#define svr4_ifr_name ifr_ifrn.ifrn_name /* if name, e.g. "en0" */
25153 +#define svr4_ifr_addr ifr_ifru.ifru_addr /* address */
25154 +#define svr4_ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of ptp link */
25155 +#define svr4_ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
25156 +#define svr4_ifr_flags ifr_ifru.ifru_int[0] /* flags */
25157 +#define svr4_ifr_metric ifr_ifru.ifru_int[1] /* metric */
25158 +#define svr4_ifr_mtu ifr_ifru.ifru_int[1] /* mtu */
25159 +#define svr4_ifr_ifindex ifr_ifru.ifru_int[1] /* ifindex */
25160 +#define svr4_ifr_nif ifr_ifru.ifru_int[1] /* # of interfaces */
25161 +#define svr4_ifr_naddr ifr_ifru.ifru_int[1] /* # of addresses */
25162 +#define svr4_ifr_type ifr_ifru.ifru_int[1] /* type of interface */
25163 +#define svr4_ifr_debug ifr_ifru.ifru_int[1] /* debug level */
25164 +#define svr4_ifr_muxid ifr_ifru.ifru_int[1] /* multiplexor id */
25165 +#define svr4_ifr_data ifr_ifru.ifru_data /* for use by interface */
25166 +#define svr4_ifr_enaddr ifr_ifru.ifru_enaddr /* ethernet address */
25167 +#define svr4_ifr_onepacket ifr_ifru.ifru_onepacket /* one-packet mode params */
25168 +#define svr4_ifr_perf ifr_ifru.ifru_perf /* tuning parameters */
25173 +extern int abi_do_setsockopt(unsigned long *sp);
25174 +extern int abi_do_getsockopt(unsigned long *sp);
25178 + * The original Linux socket file operations.
25179 + * We use it for two thing:
25180 + * o initializing the socksys socket file operations
25181 + * o to make calls to the original poll and release routines
25182 + * from our implementations.
25184 +extern struct file_operations socket_file_ops;
25186 +#endif /* _ABI_SVR4_SOCKIO_H */
25187 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/statfs.h kernel-source-2.6.16/include/abi/svr4/statfs.h
25188 --- kernel-source-2.6.16.orig/include/abi/svr4/statfs.h 1970-01-01 10:00:00.000000000 +1000
25189 +++ kernel-source-2.6.16/include/abi/svr4/statfs.h 2006-04-27 18:50:24.000000000 +1000
25191 +#ifndef _ABI_SVR4_STATFS_H
25192 +#define _ABI_SVR4_STATFS_H
25196 +#include <linux/types.h>
25199 +struct svr4_statfs {
25202 + int32_t f_frsize;
25203 + int32_t f_blocks;
25211 +#endif /* _ABI_SVR4_STATFS_H */
25212 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/stat.h kernel-source-2.6.16/include/abi/svr4/stat.h
25213 --- kernel-source-2.6.16.orig/include/abi/svr4/stat.h 1970-01-01 10:00:00.000000000 +1000
25214 +++ kernel-source-2.6.16/include/abi/svr4/stat.h 2006-04-27 18:50:24.000000000 +1000
25216 +#ifndef _ABI_SVR4_STAT_H
25217 +#define _ABI_SVR4_STAT_H
25221 +#include <abi/svr4/types.h>
25224 + * XXX this will need additions if we support emulation of
25225 + * XXX 64bit SVR4 on 64bit Linux
25228 +struct svr4_stat {
25229 + svr4_o_dev_t st_dev;
25230 + svr4_o_ino_t st_ino;
25231 + svr4_o_mode_t st_mode;
25232 + svr4_o_nlink_t st_nlink;
25233 + svr4_o_uid_t st_uid;
25234 + svr4_o_gid_t st_gid;
25235 + svr4_o_dev_t st_rdev;
25236 + svr4_off_t st_size;
25237 + svr4_time_t st_atime;
25238 + svr4_time_t st_mtime;
25239 + svr4_time_t st_ctime;
25242 +struct svr4_xstat {
25243 + svr4_dev_t st_dev;
25244 + u_int32_t st_pad1[3];
25245 + svr4_ino_t st_ino;
25246 + svr4_mode_t st_mode;
25247 + svr4_nlink_t st_nlink;
25248 + svr4_uid_t st_uid;
25249 + svr4_uid_t st_gid;
25250 + svr4_dev_t st_rdev;
25251 + u_int32_t st_pad2[2];
25252 + svr4_off_t st_size;
25253 + u_int32_t st_pad3;
25254 + svr4_timestruc_t st_atim;
25255 + svr4_timestruc_t st_mtim;
25256 + svr4_timestruc_t st_ctim;
25257 + u_int32_t st_blksize;
25258 + u_int32_t st_blocks;
25259 + char st_fstype[16];
25260 + u_int32_t st_pad4[8];
25264 + * Helpers that are used for other xstat implementations as well.
25268 +extern int report_svr4_stat(struct kstat *, struct svr4_stat *);
25269 +extern int report_svr4_xstat(struct kstat *, struct svr4_xstat *);
25271 +#endif /* _ABI_SVR4_STAT_H */
25272 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/sysconf.h kernel-source-2.6.16/include/abi/svr4/sysconf.h
25273 --- kernel-source-2.6.16.orig/include/abi/svr4/sysconf.h 1970-01-01 10:00:00.000000000 +1000
25274 +++ kernel-source-2.6.16/include/abi/svr4/sysconf.h 2006-04-27 18:50:24.000000000 +1000
25276 +#ifndef _ABI_SVR4_SYSCONF_H
25277 +#define _ABI_SVR4_SYSCONF_H
25282 + * Possible SVR4 sysconf parameters.
25285 +#define _CONFIG_NGROUPS 2 /* # configured supplemental groups */
25286 +#define _CONFIG_CHILD_MAX 3 /* max # of processes per uid session */
25287 +#define _CONFIG_OPEN_FILES 4 /* max # of open files per process */
25288 +#define _CONFIG_POSIX_VER 5 /* POSIX version */
25289 +#define _CONFIG_PAGESIZE 6 /* system page size */
25290 +#define _CONFIG_CLK_TCK 7 /* ticks per second */
25291 +#define _CONFIG_XOPEN_VER 8 /* XOPEN version */
25292 +#define _CONFIG_NACLS_MAX 9 /* for Enhanced Security */
25293 +#define _CONFIG_ARG_MAX 10 /* max length of exec args */
25294 +#define _CONFIG_NPROC 11 /* # processes system is config for */
25295 +#define _CONFIG_NENGINE 12 /* # configured processors (CPUs) */
25296 +#define _CONFIG_NENGINE_ONLN 13 /* # online processors (CPUs) */
25297 +#define _CONFIG_TOTAL_MEMORY 14 /* total memory */
25298 +#define _CONFIG_USEABLE_MEMORY 15 /* user + system memory */
25299 +#define _CONFIG_GENERAL_MEMORY 16 /* user only memory */
25300 +#define _CONFIG_DEDICATED_MEMORY 17 /* dedicated memory */
25301 +#define _CONFIG_NCGS_CONF 18 /* # CGs in system */
25302 +#define _CONFIG_NCGS_ONLN 19 /* # CGs online now */
25303 +#define _CONFIG_MAX_ENG_PER_CG 20 /* max engines per CG */
25304 +#define _CONFIG_CACHE_LINE 21 /* memory cache line size */
25305 +#define _CONFIG_SYSTEM_ID 22 /* system id assigned at ISL */
25306 +#define _CONFIG_KERNEL_VM 23 /* size of kernel virtual memory */
25308 +#endif /* _ABI_SVR4_SYSCONF_H */
25309 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/sysent.h kernel-source-2.6.16/include/abi/svr4/sysent.h
25310 --- kernel-source-2.6.16.orig/include/abi/svr4/sysent.h 1970-01-01 10:00:00.000000000 +1000
25311 +++ kernel-source-2.6.16/include/abi/svr4/sysent.h 2006-04-27 18:50:24.000000000 +1000
25313 +#ifndef _ABI_SVR4_SYSENT_H
25314 +#define _ABI_SVR4_SYSENT_H
25319 + * Function prototypes used for the SVR4 emulator.
25322 +#include <abi/svr4/types.h>
25323 +#include <abi/svr4/statfs.h>
25325 +struct abi_sigaction;
25326 +struct ibcs_statfs;
25328 +struct svr4_siginfo;
25329 +struct svr4_sigset;
25330 +struct svr4_statvfs;
25335 +/* MD (lcall7.c for i386) */
25336 +extern int lcall7_syscall(struct pt_regs *);
25337 +#define abi_syscall lcall7_syscall
25340 +extern unsigned short fl_svr4_to_linux[];
25341 +extern int svr4_fcntl(int, unsigned int, unsigned long);
25344 +extern int svr4_hrtsys(struct pt_regs *);
25347 +extern int svr4_ioctl(struct pt_regs *);
25350 +extern int svr4_semsys(struct pt_regs *);
25351 +extern int svr4_shmsys(struct pt_regs *);
25352 +extern int svr4_msgsys(struct pt_regs *);
25355 +extern int abi_brk(u_long);
25356 +extern int abi_exec(struct pt_regs *);
25357 +extern int abi_fork(struct pt_regs *);
25358 +extern int abi_getpid(struct pt_regs *);
25359 +extern int abi_getuid(struct pt_regs *);
25360 +extern int abi_getgid(struct pt_regs *);
25361 +extern int abi_mkdir(const char *, int);
25362 +extern int svr4_mknod(char *, svr4_o_mode_t, svr4_o_dev_t);
25363 +extern int svr4_xmknod(int, char *, svr4_mode_t, svr4_dev_t);
25364 +extern int abi_kill(int, int);
25365 +extern int abi_pipe(struct pt_regs *);
25366 +extern int abi_procids(struct pt_regs *);
25367 +extern int abi_read(int, char *, int);
25368 +extern int abi_select(int, void *, void *, void *, struct timeval *);
25369 +extern int abi_time(void);
25370 +extern int abi_wait(struct pt_regs *);
25373 +extern u_long svr4_mmap(u_long, size_t, int, int, int, svr4_off_t);
25376 +extern int svr4_open(const char *, int, int);
25377 +extern int svr4_statfs(const char *, struct svr4_statfs *, int, int);
25378 +extern int svr4_fstatfs(unsigned int, struct svr4_statfs *, int, int);
25379 +extern int svr4_getdents(int, char *, int);
25382 +extern int abi_sigsuspend(struct pt_regs *);
25383 +extern int abi_sigfunc(struct pt_regs *);
25384 +extern int abi_sigaction(int, const struct abi_sigaction *,
25385 + struct abi_sigaction *);
25386 +extern int abi_sigprocmask(int, u_long *, u_long *);
25387 +extern int abi_sigsuspend(struct pt_regs *);
25390 +extern int socksys_syscall(u_long *);
25393 +extern int svr4_getmsg(struct pt_regs *);
25394 +extern int svr4_putmsg(struct pt_regs *);
25395 +extern int svr4_getpmsg(struct pt_regs *);
25396 +extern int svr4_putpmsg(struct pt_regs *);
25399 +extern int svr4_access(char *, int);
25400 +extern int svr4_waitid(int, int, struct svr4_siginfo *, int);
25401 +extern int svr4_waitsys(struct pt_regs *);
25402 +extern int svr4_seteuid(int);
25403 +extern int svr4_setegid(int);
25404 +extern int svr4_fpathconf(int, int);
25405 +extern int svr4_pathconf(char *, int);
25406 +extern int svr4_sigpending(int, struct svr4_sigset *);
25407 +extern int svr4_context(struct pt_regs *);
25410 +extern int ibcs_sysconf(int);
25413 +extern int svr4_sysfs(int, int, int);
25416 +extern int svr4_sysinfo(int, char *, long);
25419 +extern int svr4_ulimit(int, int);
25420 +extern int svr4_getrlimit(int, void *);
25421 +extern int svr4_setrlimit(int, void *);
25424 +extern int svr4_stat(char *, struct svr4_stat *);
25425 +extern int svr4_lstat(char *, struct svr4_stat *);
25426 +extern int svr4_fstat(u_int, struct svr4_stat *);
25427 +extern int svr4_xstat(int, char *, void *);
25428 +extern int svr4_fxstat(int, int, void *);
25429 +extern int svr4_lxstat(int, char *, void *);
25432 +extern int svr4_sysconfig(int);
25435 +extern int svr4_sysi86(int, void *, int);
25438 +extern int abi_utsname(u_long);
25439 +extern int v7_utsname(u_long);
25442 +extern int svr4_statvfs(char *, struct svr4_statvfs *);
25443 +extern int svr4_fstatvfs(int, struct svr4_statvfs *);
25446 +#endif /* _ABI_SVR4_SYSENT_H */
25447 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/termios.h kernel-source-2.6.16/include/abi/svr4/termios.h
25448 --- kernel-source-2.6.16.orig/include/abi/svr4/termios.h 1970-01-01 10:00:00.000000000 +1000
25449 +++ kernel-source-2.6.16/include/abi/svr4/termios.h 2006-04-27 18:50:24.000000000 +1000
25451 +#ifndef _ABI_SVR4_TERMIOS_H
25452 +#define _ABI_SVR4_TERMIOS_H
25457 + * SVR4 termios declarations.
25461 +struct svr_termio {
25462 + u_int16_t c_iflag;
25463 + u_int16_t c_oflag;
25464 + u_int16_t c_cflag;
25465 + u_int16_t c_lflag;
25467 + u_char c_cc[SVR_NCC];
25470 +#define SVR4_NCCS (19)
25471 +struct svr4_termios {
25476 + u_char c_cc[SVR4_NCCS];
25479 +#endif /* _ABI_SVR4_TERMIOS_H */
25480 diff -Nur kernel-source-2.6.16.orig/include/abi/svr4/types.h kernel-source-2.6.16/include/abi/svr4/types.h
25481 --- kernel-source-2.6.16.orig/include/abi/svr4/types.h 1970-01-01 10:00:00.000000000 +1000
25482 +++ kernel-source-2.6.16/include/abi/svr4/types.h 2006-04-27 18:50:24.000000000 +1000
25485 + * Copyright (c) 2001 Caldera Deutschland GmbH.
25486 + * Copyright (c) 2001 Christoph Hellwig.
25487 + * All rights reserved.
25489 + * This program is free software; you can redistribute it and/or modify
25490 + * it under the terms of the GNU General Public License as published by
25491 + * the Free Software Foundation; either version 2 of the License, or
25492 + * (at your option) any later version.
25494 + * This program is distributed in the hope that it will be useful,
25495 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25496 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25497 + * GNU General Public License for more details.
25499 + * You should have received a copy of the GNU General Public License
25500 + * along with this program; if not, write to the Free Software
25501 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25503 +#ifndef _ABI_SVR4_TYPES_H
25504 +#define _ABI_SVR4_TYPES_H
25509 + * SVR4 type declarations.
25511 +#include <linux/highuid.h>
25512 +#include <linux/kdev_t.h>
25513 +#include <linux/personality.h>
25514 +#include <linux/sched.h>
25515 +#include <linux/types.h>
25518 + * XXX this will need additions if we support emulation of
25519 + * XXX 64bit SVR4 on 64bit Linux
25522 +/* SVR4 (32bit) data types */
25523 +#define SVR4_MINORBITS 18
25524 +#define SVR4_MINORMASK ((1U << SVR4_MINORBITS) - 1)
25525 +#define SVR4_MAJOR(dev) ((unsigned int) ((dev) >> SVR4_MINORBITS))
25526 +#define SVR4_MINOR(dev) ((unsigned int) ((dev) & SVR4_MINORBITS))
25527 +#define SVR4_MKDEV(ma,mi) (((ma) << SVR4_MINORBITS) | (mi))
25528 +typedef u_int32_t svr4_dev_t; /* Major:Minor = 14:18 */
25529 +typedef u_int32_t svr4_ino_t;
25530 +typedef u_int32_t svr4_mode_t;
25531 +typedef u_int32_t svr4_nlink_t;
25532 +typedef int32_t svr4_uid_t;
25533 +typedef int32_t svr4_gid_t;
25534 +typedef int32_t svr4_off_t;
25535 +typedef int32_t svr4_time_t;
25536 +typedef struct timeval svr4_timestruc_t;
25538 +/* SVR4 old == SVR3 data types */
25539 +#define SVR4_O_MINORBITS 8
25540 +#define SVR4_O_MINORMASK ((1U << SVR4_O_MINORBITS) - 1)
25541 +#define SVR4_O_MAJOR(dev) ((unsigned int) ((dev) >> SVR4_O_MINORBITS))
25542 +#define SVR4_O_MINOR(dev) ((unsigned int) ((dev) & SVR4_O_MINORBITS))
25543 +#define SVR4_O_MKDEV(ma,mi) (((ma) << SVR4_O_MINORBITS) | (mi))
25544 +typedef int16_t svr4_o_dev_t; /* Major:Minor = 8:8 */
25545 +typedef int16_t svr4_o_pid_t;
25546 +typedef u_int16_t svr4_o_ino_t;
25547 +typedef u_int16_t svr4_o_mode_t;
25548 +typedef int16_t svr4_o_nlink_t;
25549 +typedef u_int16_t svr4_o_uid_t;
25550 +typedef u_int16_t svr4_o_gid_t;
25553 + * Convert a linux dev number into the SVR4 equivalent.
25555 +static __inline svr4_dev_t
25556 +linux_to_svr4_dev_t(dev_t dev)
25558 + return SVR4_MKDEV (MAJOR (dev), MINOR (dev));
25562 + * SVR4 old (=SVR3) dev_t
25563 + * This is the same as linux 2.4.xx but different from linux 2.6.xx.
25565 +static __inline svr4_o_dev_t
25566 +linux_to_svr4_o_dev_t(dev_t dev)
25568 + return SVR4_O_MKDEV (MAJOR (dev), MINOR (dev));
25572 + * If we thought we were in a short inode environment we are
25573 + * probably already too late - getdents() will have likely
25574 + * already assumed short inodes and "fixed" anything with
25575 + * a zero low word (because it must match stat() which must
25576 + * match read() on a directory).
25578 + * We will just have to go along with it.
25580 +static __inline svr4_ino_t
25581 +linux_to_svr4_ino_t(ino_t ino)
25583 + if (!is_cur_personality_flag(PERF_SHORT_INODE))
25585 + if ((u_long)ino & 0xffff)
25587 + return 0xfffffffe;
25591 + * Old SVR4 ino_t _must_ be in a short inode enviroment.
25593 +static __inline svr4_o_ino_t
25594 +linux_to_svr4_o_ino_t(ino_t ino)
25596 + if ((u_long)ino & 0xffff)
25597 + return (svr4_o_ino_t)ino;
25602 + * SVR4 UIDs/GIDs are the same as current Linux ones,
25603 + * old (SVR3) ones are the same as old Linux ones.
25605 +static __inline svr4_uid_t
25606 +linux_to_svr4_uid_t(uid_t uid)
25611 +static __inline svr4_o_uid_t
25612 +linux_to_svr4_o_uid_t(uid_t uid)
25614 + return high2lowuid(uid);
25617 +static __inline svr4_gid_t
25618 +linux_to_svr4_gid_t(gid_t gid)
25623 +static __inline svr4_o_gid_t
25624 +linux_to_svr4_o_gid_t(gid_t gid)
25626 + return high2lowgid(gid);
25629 +#endif /* _ABI_SVR4_TYPES_H */
25630 diff -Nur kernel-source-2.6.16.orig/include/abi/tli.h kernel-source-2.6.16/include/abi/tli.h
25631 --- kernel-source-2.6.16.orig/include/abi/tli.h 1970-01-01 10:00:00.000000000 +1000
25632 +++ kernel-source-2.6.16/include/abi/tli.h 2006-04-27 18:50:24.000000000 +1000
25649 +/* Error codes used by TLI transport providers. */
25650 +#define TBADADDR 1
25655 +#define TOUTSTATE 6
25659 +#define TBADDATA 10
25660 +#define TBUFOVFLW 11
25662 +#define TNODATA 13
25664 +#define TNOUDERR 15
25665 +#define TBADFLAG 16
25667 +#define TNOTSUPPORT 18
25668 +#define TSTATECHNG 19
25671 +/* User level states (maintained internally by libnsl_s). */
25672 +#define T_UNINIT 0
25675 +#define T_OUTCON 3
25677 +#define T_DATAXFER 5
25678 +#define T_OUTREL 6
25683 +/* Kernel level states of a transport end point. */
25684 +#define TS_UNBND 0 /* unbound */
25685 +#define TS_WACK_BREQ 1 /* waiting for T_BIND_REQ ack */
25686 +#define TS_WACK_UREQ 2 /* waiting for T_UNBIND_REQ ack */
25687 +#define TS_IDLE 3 /* idle */
25688 +#define TS_WACK_OPTREQ 4 /* waiting for T_OPTMGMT_REQ ack */
25689 +#define TS_WACK_CREQ 5 /* waiting for T_CONN_REQ ack */
25690 +#define TS_WCON_CREQ 6 /* waiting for T_CONN_REQ confirmation */
25691 +#define TS_WRES_CIND 7 /* waiting for T_CONN_IND */
25692 +#define TS_WACK_CRES 8 /* waiting for T_CONN_RES ack */
25693 +#define TS_DATA_XFER 9 /* data transfer */
25694 +#define TS_WIND_ORDREL 10 /* releasing read but not write */
25695 +#define TS_WREQ_ORDREL 11 /* wait to release write but not read */
25696 +#define TS_WACK_DREQ6 12 /* waiting for T_DISCON_REQ ack */
25697 +#define TS_WACK_DREQ7 13 /* waiting for T_DISCON_REQ ack */
25698 +#define TS_WACK_DREQ9 14 /* waiting for T_DISCON_REQ ack */
25699 +#define TS_WACK_DREQ10 15 /* waiting for T_DISCON_REQ ack */
25700 +#define TS_WACK_DREQ11 16 /* waiting for T_DISCON_REQ ack */
25701 +#define TS_NOSTATES 17
25704 +/* Messages used by "timod". */
25705 +#define T_CONN_REQ 0
25706 +#define T_CONN_RES 1
25707 +#define T_DISCON_REQ 2
25708 +#define T_DATA_REQ 3
25709 +#define T_EXDATA_REQ 4
25710 +#define T_INFO_REQ 5
25711 +#define T_BIND_REQ 6
25712 +#define T_UNBIND_REQ 7
25713 +#define T_UNITDATA_REQ 8
25714 +#define T_OPTMGMT_REQ 9
25715 +#define T_ORDREL_REQ 10
25717 +#define T_CONN_IND 11
25718 +#define T_CONN_CON 12
25719 +#define T_DISCON_IND 13
25720 +#define T_DATA_IND 14
25721 +#define T_EXDATA_IND 15
25722 +#define T_INFO_ACK 16
25723 +#define T_BIND_ACK 17
25724 +#define T_ERROR_ACK 18
25725 +#define T_OK_ACK 19
25726 +#define T_UNITDATA_IND 20
25727 +#define T_UDERROR_IND 21
25728 +#define T_OPTMGMT_ACK 22
25729 +#define T_ORDREL_IND 23
25731 +/* Flags used from user level library routines. */
25732 +#define T_MORE 0x0001
25733 +#define T_EXPEDITED 0x0002
25734 +#define T_NEGOTIATE 0x0004
25735 +#define T_CHECK 0x0008
25736 +#define T_DEFAULT 0x0010
25737 +#define T_SUCCESS 0x0020
25738 +#define T_FAILURE 0x0040
25739 +#define T_CURRENT 0x0080
25740 +#define T_PARTSUCCESS 0x0100
25741 +#define T_READONLY 0x0200
25742 +#define T_NOTSUPPORT 0x0400
25745 +struct T_conn_req {
25746 + long PRIM_type; /* T_CONN_REQ */
25747 + long DEST_length;
25748 + long DEST_offset;
25753 +struct T_conn_res {
25754 + long PRIM_type; /* T_CONN_RES */
25761 +struct T_discon_req {
25762 + long PRIM_type; /* T_DISCON_REQ */
25766 +struct T_data_req {
25767 + long PRIM_type; /* T_DATA_REQ */
25771 +struct T_exdata_req {
25772 + long PRIM_type; /* T_EXDATA_REQ */
25776 +struct T_info_req {
25777 + long PRIM_type; /* T_INFO_REQ */
25780 +struct T_bind_req {
25781 + long PRIM_type; /* T_BIND_REQ */
25782 + long ADDR_length;
25783 + long ADDR_offset;
25784 + unsigned long CONIND_number;
25787 +struct T_unbind_req {
25788 + long PRIM_type; /* T_UNBIND_REQ */
25791 +struct T_unitdata_req {
25792 + long PRIM_type; /* T_UNITDATA_REQ */
25793 + long DEST_length;
25794 + long DEST_offset;
25799 +struct T_optmgmt_req {
25800 + long PRIM_type; /* T_OPTMGMT_REQ */
25806 +struct T_ordrel_req {
25807 + long PRIM_type; /* T_ORDREL_REQ */
25811 +struct T_conn_ind {
25812 + long PRIM_type; /* T_CONN_IND */
25820 +struct T_conn_con {
25821 + long PRIM_type; /* T_CONN_CON */
25828 +struct T_discon_ind {
25829 + long PRIM_type; /* T_DISCON_IND */
25830 + long DISCON_reason;
25834 +struct T_data_ind {
25835 + long PRIM_type; /* T_DATA_IND */
25839 +struct T_exdata_ind {
25840 + long PRIM_type; /* T_EXDATA_IND */
25844 +/* information acknowledgment */
25846 +struct T_info_ack {
25847 + long PRIM_type; /* T_INFO_ACK */
25856 + long CURRENT_state;
25857 + long PROVIDER_flag;
25860 +struct T_bind_ack {
25861 + long PRIM_type; /* T_BIND_ACK */
25862 + long ADDR_length;
25863 + long ADDR_offset;
25864 + unsigned long CONIND_number;
25867 +struct T_error_ack {
25868 + long PRIM_type; /* T_ERROR_ACK */
25875 + long PRIM_type; /* T_OK_ACK */
25876 + long CORRECT_prim;
25879 +struct T_unitdata_ind {
25880 + long PRIM_type; /* T_UNITDATA_IND */
25887 +struct T_uderror_ind {
25888 + long PRIM_type; /* T_UDERROR_IND */
25889 + long DEST_length;
25890 + long DEST_offset;
25896 +struct T_optmgmt_ack {
25897 + long PRIM_type; /* T_OPTMGMT_ACK */
25903 +struct T_ordrel_ind {
25904 + long PRIM_type; /* T_ORDREL_IND */
25908 +union T_primitives {
25910 + struct T_conn_req conn_req;
25911 + struct T_conn_res conn_res;
25912 + struct T_discon_req discon_req;
25913 + struct T_data_req data_req;
25914 + struct T_exdata_req exdata_req;
25915 + struct T_info_req info_req;
25916 + struct T_bind_req bind_req;
25917 + struct T_unbind_req unbind_req;
25918 + struct T_unitdata_req unitdata_req;
25919 + struct T_optmgmt_req optmgmt_req;
25920 + struct T_ordrel_req ordrel_req;
25921 + struct T_conn_ind conn_ind;
25922 + struct T_conn_con conn_con;
25923 + struct T_discon_ind discon_ind;
25924 + struct T_data_ind data_ind;
25925 + struct T_exdata_ind exdata_ind;
25926 + struct T_info_ack info_ack;
25927 + struct T_bind_ack bind_ack;
25928 + struct T_error_ack error_ack;
25929 + struct T_ok_ack ok_ack;
25930 + struct T_unitdata_ind unitdata_ind;
25931 + struct T_uderror_ind uderror_ind;
25932 + struct T_optmgmt_ack optmgmt_ack;
25933 + struct T_ordrel_ind ordrel_ind;
25937 +/* The t_opthdr structure defines the layout of options in a T_OPTMGMT_*
25938 + * data buffer. This is specified in the X/Open specs but does not
25939 + * appear to exist in SCO 3.2.x, SCO OS5, Interactive SVR4 or UnixWare 1.x.
25940 + * There are programs that make options request however.
25941 + * The older TLI uses struct opthdr which is different and incompatible
25945 + unsigned long len; /* *Total* length including header */
25946 + unsigned long level;
25947 + unsigned long name;
25948 + unsigned long status;
25949 + char value[0]; /* and onwards... */
25955 + long len; /* Length of option value */
25956 + char value[0]; /* and onwards... */
25961 + struct T_primsg *next;
25962 + unsigned char pri;
25963 + unsigned char band;
25968 +#define XTI_MAGIC 638654838
25970 +struct T_private {
25974 + struct T_primsg *pfirst, *plast;
25977 +#define Priv(file) ((struct T_private *)(file->private_data))
25979 +extern int timod_ioctl(struct pt_regs *, int, unsigned int, void *, int, int *);
25980 +extern int timod_putmsg(int, struct inode *, int, struct pt_regs *);
25981 +extern int timod_getmsg(int, struct inode *, int, struct pt_regs *);
25982 +extern int timod_update_socket(int, struct file *, struct pt_regs *);
25984 +#ifndef SOCKSYS_MAJOR
25985 +#define SOCKSYS_MAJOR 30
25988 +#endif /* __TLI_H */
25989 diff -Nur kernel-source-2.6.16.orig/include/abi/unused-termios.h kernel-source-2.6.16/include/abi/unused-termios.h
25990 --- kernel-source-2.6.16.orig/include/abi/unused-termios.h 1970-01-01 10:00:00.000000000 +1000
25991 +++ kernel-source-2.6.16/include/abi/unused-termios.h 2006-04-27 18:50:24.000000000 +1000
25994 + * This file was entered from the book
25995 + * Intel386 Family Binary Compatability Specification 2
25996 + * McGraw-Hill Book company
25997 + * ISBN 0-07-031219-2
26005 +typedef unsigned short tcflag_t;
26006 +typesef unsigned char cc_t;
26007 +typedef unsigned long speed_t;
26010 + unsigned short c_iflag;
26011 + unsigned short c_oflag;
26012 + unsigned short c_cflag;
26013 + unsigned short c_lflag;
26015 + unsigned char c_cc[NC];
26019 + tcflag_t c_iflag;
26020 + tcflag_t c_oflag;
26021 + tcflag_t c_cflag;
26022 + tcflag_t c_lflag;
26046 +#define CINTR 0177
26048 +#define CERASE '#'
26050 +#define CSTART 021
26052 +#define CSWTCH 032
26056 +#define IGNBRK 0000001
26057 +#define BRKINT 0000002
26058 +#define IGNPAR 0000004
26059 +#define PARMRK 0000010
26060 +#define INPCK 0000020
26061 +#define ISTRIP 0000040
26062 +#define INLCR 0000100
26063 +#define IGNCR 0000200
26064 +#define ICRNL 0000400
26065 +#define IUCLC 0001000
26066 +#define IXON 0002000
26067 +#define IXANY 0004000
26068 +#define IXOFF 0010000
26069 +#define IMAXBEL 0020000 /* RESERVED */
26070 +#define DOSMODE 0100000
26072 +#define OPOST 00000001
26073 +#define OLCUC 00000002
26074 +#define ONLCR 00000004
26075 +#define OCRNL 00000010
26076 +#define ONOCR 00000020
26077 +#define ONLRET 00000040
26078 +#define OFILL 00000100
26079 +#define OFDEL 00000200
26080 +#define NLDLY 00000400
26082 +#define NL1 00000400
26083 +#define CRDLY 00003000
26085 +#define CR1 00001000
26086 +#define CR2 00002000
26087 +#define CR3 00003000
26088 +#define TABDLY 00014000
26090 +#define TAB1 00004000
26091 +#define TAB2 00010000
26092 +#define TAB3 00014000
26093 +#define BSDLY 00200000
26095 +#define BS1 00200000
26096 +#define VTDLY 00400000
26098 +#define VT1 00400000
26099 +#define FFDLY 01000000
26101 +#define FF1 01000000
26103 +#define CBAUD 0000017
26104 +#define CSIZE 0000060
26106 +#define CS6 0000020
26107 +#define CS7 0000040
26108 +#define CS8 0000060
26109 +#define CSTOPB 0000100
26110 +#define CREAD 0000200
26111 +#define PARENB 0000400
26112 +#define PARODD 0001000
26113 +#define HUPCL 0002000
26114 +#define CLOCAL 0004000
26115 +#define RCV1EN 0010000
26116 +#define XMT1EN 0020000
26117 +#define LOBLK 0040000
26118 +#define XCLUDE 0100000
26120 +#define ISIG 0000001
26121 +#define ICANON 0000002
26122 +#define XCASE 0000004
26123 +#define ECHO 0000010
26124 +#define ECHOE 0000020
26125 +#define ECHOK 0000040
26126 +#define ECHONL 0000100
26127 +#define NOFLSH 0000200
26128 +#define IEXTEN 0000400
26129 +#defien TOSTOP 0001000
26131 +/* Bits 10-15 (0176000) in the c_lflag field are RESERVED */
26134 +#define XIOC ('x'<<8) Level 2
26136 +#define XIOC (('i'<<8)|('X'<<16))
26137 +#define XCGETA (XIOC|1)
26138 +#define XCSETA (XIOC|2)
26139 +#define XCSETAW (XIOC|3)
26140 +#define XCSETAF (XIOC|4)
26142 +#define TIOC ('T'<<8)
26144 +#define TCGETA (TIOC|1)
26145 +#define TCSETA (TIOC|2)
26146 +#define TCSETAW (TIOC|3)
26147 +#define TCSETAF (TIOC|4)
26148 +#define TCSBRK (TIOC|5)
26149 +#define TCXONC (TIOC|6)
26150 +#define TCFLSH (TIOC|7)
26152 +#define TIOCGWINSZ (TIOC|104)
26153 +#define TIOCSWINSZ (TIOC|103)
26155 +#define TCSANOW XCSETA
26156 +#define TCSADRAIN XCSETAW
26157 +#define TCSAFLUSH XCSETAF
26158 +#define TCSADFLUSH XCSETAF
26160 +#define TCIFLUSH 0
26161 +#define TCOFLUSH 1
26162 +#define TCIOFLUSH 2
26187 + unsigned short ws_row;
26188 + unsigned short ws_col;
26189 + unsigned short ws_xpixel;
26190 + unsigned short ws_ypixel;
26192 diff -Nur kernel-source-2.6.16.orig/include/abi/util/errno.h kernel-source-2.6.16/include/abi/util/errno.h
26193 --- kernel-source-2.6.16.orig/include/abi/util/errno.h 1970-01-01 10:00:00.000000000 +1000
26194 +++ kernel-source-2.6.16/include/abi/util/errno.h 2006-04-27 18:50:24.000000000 +1000
26196 +#ifndef _ABI_UTIL_ERRNO_H
26197 +#define _ABI_UTIL_ERRNO_H
26201 +#include <asm/abi_machdep.h>
26202 +#include <abi/util/map.h>
26205 + * Translate the errno numbers from linux to current personality.
26206 + * This should be removed and all other sources changed to call the
26207 + * map function above directly.
26209 +#define iABI_errors(errno) \
26210 + (map_value(current_thread_info()->exec_domain->err_map, errno, 1))
26212 +#endif /* _ABI_UTIL_ERRNO_H */
26213 diff -Nur kernel-source-2.6.16.orig/include/abi/util/map.h kernel-source-2.6.16/include/abi/util/map.h
26214 --- kernel-source-2.6.16.orig/include/abi/util/map.h 1970-01-01 10:00:00.000000000 +1000
26215 +++ kernel-source-2.6.16/include/abi/util/map.h 2006-04-27 18:50:24.000000000 +1000
26217 +#ifndef _ABI_MAP_H
26218 +#define _ABI_MAP_H
26223 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
26227 +struct map_segment {
26233 +static __inline u_short
26234 +map_flags(u_short f, u_short map[])
26236 + u_short m, r = 0;
26239 + for (i = 0, m = 1; i < 16; i++) {
26248 +static __inline long
26249 +map_bitvec(u_long vec, long map[])
26251 + u_long newvec = 0, m = 1;
26254 + for (i = 1; i <= 32; i++) {
26255 + if ((vec & m) && map[i] != -1 && map[i] != 0)
26256 + newvec |= (1 << (map[i] - 1));
26263 +static __inline u_long
26264 +map_sigvec_from_kernel(sigset_t vec, u_long map[])
26266 + u_long newvec = 0;
26269 + for (i = 1; i <= 32; i++) {
26270 + if (sigismember(&vec, i) && map[i] != -1 && map[i] != 0)
26271 + newvec |= (1 << (map[i] - 1));
26277 +static __inline sigset_t
26278 +map_sigvec_to_kernel(u_long vec, u_long map[])
26284 + sigemptyset(&newvec);
26285 + for (i = 1; i <= 32; i++) {
26286 + if ((vec & m) && map[i] != -1)
26287 + sigaddset(&newvec, map[i]);
26294 +static __inline int
26295 +map_value(struct map_segment *m, int val, int def)
26297 + struct map_segment *seg;
26300 + * If no mapping exists in this personality just return the
26301 + * number we were given.
26307 + * Search the map looking for a mapping for the given number.
26309 + for (seg = m; seg->start != -1; seg++) {
26310 + if (seg->start <= val && val <= seg->end) {
26312 + * If the start and end are the same then this
26313 + * segment has one entry and the map is the value
26314 + * it maps to. Otherwise if we have a vector we
26315 + * pick out the relevant value, if we don't have
26316 + * a vector we give identity mapping.
26318 + if (seg->start == seg->end)
26319 + return (int)seg->map;
26321 + return (seg->map ? seg->map[val-seg->start] : val);
26325 + /* Number isn't mapped. Returned the requested default. */
26329 +#endif /* ABI_MAP_H */
26330 diff -Nur kernel-source-2.6.16.orig/include/abi/util/revalidate.h kernel-source-2.6.16/include/abi/util/revalidate.h
26331 --- kernel-source-2.6.16.orig/include/abi/util/revalidate.h 1970-01-01 10:00:00.000000000 +1000
26332 +++ kernel-source-2.6.16/include/abi/util/revalidate.h 2006-04-27 18:50:24.000000000 +1000
26335 + * This is straight from linux/fs/stat.c.
26337 +#ifndef _ABI_UTIL_REVALIDATE_H
26338 +#define _ABI_UTIL_REVALIDATE_H
26342 +#include <linux/fs.h>
26344 +/* LINUXABI_TODO */
26346 + * This is required for proper NFS attribute caching (so it says there).
26347 + * Maybe the kernel should export it - but it is basically simple...
26349 +static __inline int
26350 +do_revalidate(struct dentry *dentry)
26352 + struct inode *inode = dentry->d_inode;
26353 + struct iattr attr;
26356 + attr.ia_valid = 0; /* setup an empty flag for the inode attribute change */
26358 + mutex_lock(&inode->i_mutex);
26359 + error = notify_change(dentry, &attr);
26360 + mutex_unlock(&inode->i_mutex);
26364 +#endif /* _ABI_UTIL_REVALIDATE_H */
26365 diff -Nur kernel-source-2.6.16.orig/include/abi/util/socket.h kernel-source-2.6.16/include/abi/util/socket.h
26366 --- kernel-source-2.6.16.orig/include/abi/util/socket.h 1970-01-01 10:00:00.000000000 +1000
26367 +++ kernel-source-2.6.16/include/abi/util/socket.h 2006-04-27 18:50:24.000000000 +1000
26369 +#ifndef _ABI_UTIL_SOCKET_H
26370 +#define _ABI_UTIL_SOCKET_H
26373 + * These aren't (currently) defined by Linux. Watch out for warnings
26374 + * about redefinitions...
26376 +#define SO_USELOOPBACK 0xff02
26377 +#define SO_ORDREL 0xff03
26378 +#define SO_IMASOCKET 0xff04
26379 +#define SO_PROTOTYPE 0xff09
26381 +#endif /* _ABI_UTIL_SOCKET_H */
26382 diff -Nur kernel-source-2.6.16.orig/include/abi/util/stat.h kernel-source-2.6.16/include/abi/util/stat.h
26383 --- kernel-source-2.6.16.orig/include/abi/util/stat.h 1970-01-01 10:00:00.000000000 +1000
26384 +++ kernel-source-2.6.16/include/abi/util/stat.h 2006-04-27 18:50:24.000000000 +1000
26387 + * Mostly ripped from Al Viro's stat-a-AC9-10 patch, 2001 Christoph Hellwig.
26389 +#ifndef _ABI_UTIL_STAT_H
26390 +#define _ABI_UTIL_STAT_H
26395 +/* gone to ./include/linux/stat.h */
26409 + unsigned long blksize;
26410 + unsigned long blocks;
26415 +/* gone to ./include/linux/fs.h */
26416 +extern int vfs_stat(char *, struct kstat *);
26417 +extern int vfs_lstat(char *, struct kstat *);
26418 +extern int vfs_fstat(int, struct kstat *);
26421 +#endif /* _ABI_UTIL_STAT_H */
26422 diff -Nur kernel-source-2.6.16.orig/include/abi/util/sysent.h kernel-source-2.6.16/include/abi/util/sysent.h
26423 --- kernel-source-2.6.16.orig/include/abi/util/sysent.h 1970-01-01 10:00:00.000000000 +1000
26424 +++ kernel-source-2.6.16/include/abi/util/sysent.h 2006-04-27 18:50:24.000000000 +1000
26426 +#ifndef _ABI_SYSENT_H
26427 +#define _ABI_SYSENT_H
26432 +#include <asm/abi_machdep.h>
26438 + * This is needed for subdispatchers like cxenix().
26440 +extern void lcall7_dispatch(struct pt_regs *, struct sysent *, int);
26444 + * - If an entry is 'Ukn' we don't know how to handle it yet.
26445 + * - Spl means that we need to do special processing for this syscall.
26446 + * - Fast means that even the error return handling is done by the function.
26447 + * - Unimpl means the syscall is not implemented at all.
26450 + Spl = 0x65, /* pass the regs structure down */
26451 + Fast = 0x66, /* same as above + regs already setup at return */
26452 + Unimpl = 0x67, /* syscall is not implemented yet */
26453 + Ukn = Unimpl, /* source compat (XXX: kill me!) */
26457 + * Every entry in the systen tables is described by this structure.
26460 + void *se_syscall; /* function to call */
26461 + short se_nargs; /* number of aguments */
26464 + * Theses are only used for syscall tracing.
26466 + char *se_name; /* name of function */
26467 + char *se_args; /* how to print the argument list */
26471 + * Types for syscall pointers.
26473 +typedef int (*syscall_t)(struct pt_regs *);
26474 +typedef int (*syscallv_t)(void);
26475 +typedef int (*syscall1_t)(int);
26476 +typedef int (*syscall2_t)(int, int);
26477 +typedef int (*syscall3_t)(int, int, int);
26478 +typedef int (*syscall4_t)(int, int, int, int);
26479 +typedef int (*syscall5_t)(int, int, int, int, int);
26480 +typedef int (*syscall6_t)(int, int, int, int, int, int);
26481 +typedef int (*syscall7_t)(int, int, int, int, int, int, int);
26484 + * Marcos to call syscall pointers.
26486 +#define SYSCALL_VOID(sys) \
26487 + ((syscallv_t)(sys))();
26488 +#define SYSCALL_PREGS(sys, regs) \
26489 + ((syscall_t)(sys))((regs))
26490 +#define SYSCALL_1ARG(sys, args) \
26491 + ((syscall1_t)(sys))((args)[0])
26492 +#define SYSCALL_2ARG(sys, args) \
26493 + ((syscall2_t)(sys))((args)[0], (args)[1])
26494 +#define SYSCALL_3ARG(sys, args) \
26495 + ((syscall3_t)(sys))((args)[0], (args)[1], (args)[2])
26496 +#define SYSCALL_4ARG(sys, args) \
26497 + ((syscall4_t)(sys))((args)[0], (args)[1], (args)[2], (args)[3])
26498 +#define SYSCALL_5ARG(sys, args) \
26499 + ((syscall5_t)(sys))((args)[0], (args)[1], (args)[2], \
26500 + (args)[3], (args)[4])
26501 +#define SYSCALL_6ARG(sys, args) \
26502 + ((syscall6_t)(sys))((args)[0], (args)[1], (args)[2], \
26503 + (args)[3], (args)[4], (args)[5])
26504 +#define SYSCALL_7ARG(sys, args) \
26505 + ((syscall7_t)(sys))((args)[0], (args)[1], (args)[2], \
26506 + (args)[3], (args)[4], (args)[5], (args)[6])
26508 +#endif /* _ABI_SYSENT_H */
26509 diff -Nur kernel-source-2.6.16.orig/include/abi/util/trace.h kernel-source-2.6.16/include/abi/util/trace.h
26510 --- kernel-source-2.6.16.orig/include/abi/util/trace.h 1970-01-01 10:00:00.000000000 +1000
26511 +++ kernel-source-2.6.16/include/abi/util/trace.h 2006-04-27 18:50:24.000000000 +1000
26514 + * Copyright (c) 2001 Christoph Hellwig.
26515 + * All rights resered.
26517 + * This program is free software; you can redistribute it and/or modify
26518 + * it under the terms of the GNU General Public License as published by
26519 + * the Free Software Foundation; either version 2 of the License, or
26520 + * (at your option) any later version.
26522 + * This program is distributed in the hope that it will be useful,
26523 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26524 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26525 + * GNU General Public License for more details.
26527 + * You should have received a copy of the GNU General Public License
26528 + * along with this program; if not, write to the Free Software
26529 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26531 +#ifndef _ABI_TRACE_H_
26532 +#define _ABI_TRACE_H_
26537 + * Linux-ABI tracing helpers.
26539 +#include <linux/types.h>
26546 + ABI_TRACE_API = 0x00000001, /* all call/return values */
26547 + ABI_TRACE_IOCTL = 0x00000002, /* all ioctl calls */
26548 + ABI_TRACE_IOCTL_F = 0x00000004, /* ioctl calls that fail */
26549 + ABI_TRACE_SIGNAL = 0x00000008, /* all signal calls */
26550 + ABI_TRACE_SIGNAL_F = 0x00000010, /* signal calls that fail */
26551 + ABI_TRACE_SOCKSYS = 0x00000020, /* socksys and spx devices */
26552 + ABI_TRACE_STREAMS = 0x00000040, /* STREAMS faking */
26553 + ABI_TRACE_UNIMPL = 0x00000100, /* unimplemened functions */
26555 +extern u_int abi_traceflg;
26559 + * Check if a syscall needs tracing.
26561 +#define abi_traced(res) (abi_traceflg & (res))
26564 + * Unconditinal trace.
26566 +#define __abi_trace(fmt...) \
26568 + printk(KERN_DEBUG "[%s:%d]: ", current->comm, current->pid); \
26573 + * Trace depending on reason.
26575 +#define abi_trace(res, fmt...) \
26577 + if (abi_traced(res)) \
26578 + __abi_trace(fmt); \
26581 +/* prototype for ./abi/util/plist.h */
26582 +extern void plist(char *, char *, int *);
26584 +#endif /* _ABI_TRACE_H_ */
26585 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/acl.h kernel-source-2.6.16/include/abi/uw7/acl.h
26586 --- kernel-source-2.6.16.orig/include/abi/uw7/acl.h 1970-01-01 10:00:00.000000000 +1000
26587 +++ kernel-source-2.6.16/include/abi/uw7/acl.h 2006-04-27 18:50:24.000000000 +1000
26589 +#ifndef _ABI_UW7_ACL_H
26590 +#define _ABI_UW7_ACL_H
26595 + * UnixWare 7 ACL bits (unused so far).
26607 + u_int16_t a_perm;
26611 +/* int uw7_acl(char * path, int cmd, int nentries, struct acl * aclp); */
26613 +#endif /* _ABI_UW7_ACL_H */
26614 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/context.h kernel-source-2.6.16/include/abi/uw7/context.h
26615 --- kernel-source-2.6.16.orig/include/abi/uw7/context.h 1970-01-01 10:00:00.000000000 +1000
26616 +++ kernel-source-2.6.16/include/abi/uw7/context.h 2006-04-27 18:50:24.000000000 +1000
26618 +#ifndef _ABI_UW7_CONTEXT_H
26619 +#define _ABI_UW7_CONTEXT_H
26624 + * UnixWare context bits.
26627 +/* ss_size <-> ss_flags which is why we can't use native Linux stack_t :( */
26628 +typedef struct uw7_stack {
26634 +/* XXX more registers, please */
26635 +typedef struct uw7_mcontext {
26636 + unsigned short gs, __gsh;
26637 + unsigned short fs, __fsh;
26638 + unsigned short es, __esh;
26639 + unsigned short ds, __dsh;
26642 +typedef struct uw7_sigset {
26643 + unsigned int sigbits[4];
26646 +typedef struct uw7_context {
26647 + unsigned long uc_flags;
26648 + struct uw7_context *uc_link;
26649 + uw7_sigset_t uc_sigmask;
26650 + uw7_stack_t uc_stack;
26651 + uw7_mcontext_t uc_mcontext;
26653 + char uc_unused[16];
26656 +#define UW7_GETCONTEXT 0
26657 +#define UW7_SETCONTEXT 1
26658 +#define UW7_GETXCONTEXT 2
26660 +#endif /* _ABI_UW7_CONTEXT_H */
26661 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/resource.h kernel-source-2.6.16/include/abi/uw7/resource.h
26662 --- kernel-source-2.6.16.orig/include/abi/uw7/resource.h 1970-01-01 10:00:00.000000000 +1000
26663 +++ kernel-source-2.6.16/include/abi/uw7/resource.h 2006-04-27 18:50:24.000000000 +1000
26665 +#ifndef _ABI_UW7_RESOURCE_H
26666 +#define _ABI_UW7_RESOURCE_H
26671 + * UnixWare 7 resource limit handling.
26674 +typedef u_int64_t uw7_rlim64_t;
26676 +struct uw7_rlim64 {
26677 + uw7_rlim64_t rlim_cur; /* current limit */
26678 + uw7_rlim64_t rlim_max; /* maximum value for rlim_cur */
26682 + UW7_RLIMIT_CPU = 0, /* cpu time in milliseconds */
26683 + UW7_RLIMIT_FSIZE = 1, /* maximum file size */
26684 + UW7_RLIMIT_DATA = 2, /* data size */
26685 + UW7_RLIMIT_STACK = 3, /* stack size */
26686 + UW7_RLIMIT_CORE = 4, /* core file size */
26687 + UW7_RLIMIT_NOFILE = 5, /* file descriptors */
26688 + UW7_RLIMIT_VMEM = 6, /* maximum mapped memory */
26691 +static int uw7_to_linux_rlimit[] = {
26700 +#endif /* _ABI_UW7_RESOURCE_H */
26701 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/stat.h kernel-source-2.6.16/include/abi/uw7/stat.h
26702 --- kernel-source-2.6.16.orig/include/abi/uw7/stat.h 1970-01-01 10:00:00.000000000 +1000
26703 +++ kernel-source-2.6.16/include/abi/uw7/stat.h 2006-04-27 18:50:24.000000000 +1000
26705 +#ifndef _ABI_UW7_STAT_H
26706 +#define _ABI_UW7_STAT_H
26711 +#include <abi/uw7/types.h>
26713 +struct uw7_stat64 {
26714 + uw7_dev_t st_dev;
26715 + u_int32_t st_pad1[3];
26716 + uw7_ino_t st_ino;
26717 + uw7_mode_t st_mode;
26718 + uw7_nlink_t st_nlink;
26719 + uw7_uid_t st_uid;
26720 + uw7_gid_t st_gid;
26721 + uw7_dev_t st_rdev;
26722 + u_int32_t st_pad2[2];
26723 + uw7_off_t st_size;
26724 + struct timeval st_atime;
26725 + struct timeval st_mtime;
26726 + struct timeval st_ctime;
26727 + int32_t st_blksize;
26728 + int64_t st_blocks;
26729 + char st_fstype[16];
26730 + int32_t st_aclcnt;
26731 + u_int32_t st_level;
26732 + u_int32_t st_flags;
26733 + u_int32_t st_cmwlevel;
26734 + u_int32_t st_pad4[4];
26737 +#endif /* _ABI_UW7_STAT_H */
26738 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/statvfs.h kernel-source-2.6.16/include/abi/uw7/statvfs.h
26739 --- kernel-source-2.6.16.orig/include/abi/uw7/statvfs.h 1970-01-01 10:00:00.000000000 +1000
26740 +++ kernel-source-2.6.16/include/abi/uw7/statvfs.h 2006-04-27 18:50:24.000000000 +1000
26742 +#ifndef _ABI_UW7_STATVFS_H
26743 +#define _ABI_UW7_STATVFS_H
26747 +#include <abi/uw7/types.h>
26750 +struct uw7_statvfs64 {
26751 + u_int32_t f_bsize; /* file system block size */
26752 + u_int32_t f_frsize; /* file system fragment size */
26753 + uw7_fsblkcnt64_t f_blocks; /* total # of fragments */
26754 + uw7_fsblkcnt64_t f_bfree; /* total # of free fragments */
26755 + uw7_fsblkcnt64_t f_bavail; /* # of free fragments avail */
26756 + uw7_fsfilcnt64_t f_files; /* total # of inodes */
26757 + uw7_fsfilcnt64_t f_ffree; /* total # of free inodes */
26758 + uw7_fsfilcnt64_t f_favail; /* # of free inodes avail */
26759 + u_int32_t f_fsid; /* file system id */
26760 + char f_basetype[16]; /* target fs type name */
26761 + u_int32_t f_flag; /* bit-mask of flags */
26762 + u_int32_t f_namemax; /* maximum file name length */
26763 + char f_fstr[32]; /* filesystem string */
26764 + u_int32_t f_filler[16]; /* reserved */
26767 +#endif /* _ABI_UW7_STATVFS_H */
26768 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/sysent.h kernel-source-2.6.16/include/abi/uw7/sysent.h
26769 --- kernel-source-2.6.16.orig/include/abi/uw7/sysent.h 1970-01-01 10:00:00.000000000 +1000
26770 +++ kernel-source-2.6.16/include/abi/uw7/sysent.h 2006-04-27 18:50:24.000000000 +1000
26772 +#ifndef _ABI_UW7_SYSENT_H
26773 +#define _ABI_UW7_SYSENT_H
26778 + * External function declarations for the SCO UnixWare 7 syscall table.
26782 +struct uw7_rlimit64;
26784 +struct uw7_statvfs64;
26788 +extern int uw7_access(char *, int);
26791 +extern int uw7_context(struct pt_regs *);
26792 +extern int uw7_sigaltstack(const struct uw7_stack *, struct uw7_stack *);
26795 +extern int uw7_sleep(int);
26796 +extern int uw7_seteuid(int);
26797 +extern int uw7_setegid(int);
26798 +extern int uw7_pread(u_int, char *, int, long);
26799 +extern int uw7_pwrite(u_int, char *, int, long);
26800 +extern int uw7_stty(int, int);
26801 +extern int uw7_gtty(int, int);
26804 +extern int uw7_ioctl(struct pt_regs *);
26807 +extern int uw7_truncate64(const char *, u_long, u_long);
26808 +extern int uw7_ftruncate64(int, u_long, u_long);
26809 +extern int uw7_statvfs64(char *, struct uw7_statvfs64 *);
26810 +extern int uw7_fstatvfs64(int, struct uw7_statvfs64 *);
26811 +extern int uw7_getrlimit64(int, struct uw7_rlimit64 *);
26812 +extern int uw7_setrlimit64(int, const struct uw7_rlimit64 *);
26813 +extern int uw7_lseek64(int, u_int, u_int, int);
26814 +extern ssize_t uw7_pread64(int, char *, int, u_int, u_int);
26815 +extern ssize_t uw7_pwrite64(int, char *, int, u_int, u_int);
26816 +extern int uw7_creat64(const char *, int);
26819 +extern int uw7_mldmode(int);
26822 +extern int uw7_mmap64(u_long, size_t, int, int, int, u_long, u_long);
26825 +extern int uw7_xstat(int, char *, void *);
26826 +extern int uw7_lxstat(int, char *, void *);
26827 +extern int uw7_fxstat(int, int, void *);
26829 +#endif /* _ABI_UW7_SYSENT_H */
26830 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/termbits.h kernel-source-2.6.16/include/abi/uw7/termbits.h
26831 --- kernel-source-2.6.16.orig/include/abi/uw7/termbits.h 1970-01-01 10:00:00.000000000 +1000
26832 +++ kernel-source-2.6.16/include/abi/uw7/termbits.h 2006-04-27 18:50:24.000000000 +1000
26834 +#ifndef _ABI_UW7_TERMBITS_H
26835 +#define _ABI_UW7_TERMBITS_H
26837 +#define UW7_TIOC ('T'<<8)
26838 +#define UW7_TCGETA (UW7_TIOC|1)
26839 +#define UW7_TCSETA (UW7_TIOC|2)
26840 +#define UW7_TCSETAW (UW7_TIOC|3)
26841 +#define UW7_TCSETAF (UW7_TIOC|4)
26842 +#define UW7_TCSBRK (UW7_TIOC|5)
26843 +#define UW7_TCXONC (UW7_TIOC|6)
26844 +#define UW7_TCFLSH (UW7_TIOC|7)
26845 +#define UW7_TCDSET (UW7_TIOC|32)
26846 +#define UW7_RTS_TOG (UW7_TIOC|33)
26847 +#define UW7_TIOCGWINSZ (UW7_TIOC|104)
26848 +#define UW7_TIOCSWINSZ (UW7_TIOC|103)
26849 +#define UW7_TCGETS (UW7_TIOC|13)
26850 +#define UW7_TCSETS (UW7_TIOC|14)
26851 +#define UW7_TCSANOW UW7_TCSETS
26852 +#define UW7_TCSETSW (UW7_TIOC|15)
26853 +#define UW7_TCSADRAIN UW7_TCSETSW
26854 +#define UW7_TCSETSF (UW7_TIOC|16)
26855 +#define UW7_TCSAFLUSH UW7_TCSETSF
26858 + * VEOF/VEOL and VMIN/VTIME are overloaded.
26859 + * VEOF/VEOL are used in canonical mode (ICANON),
26860 + * otherwise VMIN/VTIME are used.
26862 +#define UW7_VINTR 0
26863 +#define UW7_VQUIT 1
26864 +#define UW7_VERASE 2
26865 +#define UW7_VKILL 3
26866 +#define UW7_VEOF 4
26867 +#define UW7_VEOL 5
26868 +#define UW7_VEOL2 6
26869 +#define UW7_VMIN 4
26870 +#define UW7_VTIME 5
26871 +#define UW7_VSWTCH 7
26872 +#define UW7_VSTART 8
26873 +#define UW7_VSTOP 9
26874 +#define UW7_VSUSP 10
26875 +#define UW7_VDSUSP 11
26876 +#define UW7_VREPRINT 12
26877 +#define UW7_VDISCARD 13
26878 +#define UW7_VWERASE 14
26879 +#define UW7_VLNEXT 15
26882 + * Input modes (c_iflag), same as Linux bits, except DOSMODE (obsolete).
26884 +#define UW7_IFLAG_MSK 0017777
26885 +#define UW7_IGNBRK 0000001
26886 +#define UW7_BRKINT 0000002
26887 +#define UW7_IGNPAR 0000004
26888 +#define UW7_PARMRK 0000010
26889 +#define UW7_INPCK 0000020
26890 +#define UW7_ISTRIP 0000040
26891 +#define UW7_INLCR 0000100
26892 +#define UW7_IGNCR 0000200
26893 +#define UW7_ICRNL 0000400
26894 +#define UW7_IUCLC 0001000
26895 +#define UW7_IXON 0002000
26896 +#define UW7_IXANY 0004000
26897 +#define UW7_IXOFF 0010000
26898 +#define UW7_IMAXBEL 0020000
26899 +#define UW7_DOSMODE 0100000
26902 + * Output modes (c_oflag), exactly the same as Linux bits.
26904 +#define UW7_OFLAG_MSK 0177777
26905 +#define UW7_OPOST 0000001
26906 +#define UW7_OLCUC 0000002
26907 +#define UW7_ONLCR 0000004
26908 +#define UW7_OCRNL 0000010
26909 +#define UW7_ONOCR 0000020
26910 +#define UW7_ONLRET 0000040
26911 +#define UW7_OFILL 0000100
26912 +#define UW7_OFDEL 0000200
26913 +#define UW7_NLDLY 0000400
26914 +#define UW7_NL0 0000000
26915 +#define UW7_NL1 0000400
26916 +#define UW7_CRDLY 0003000
26917 +#define UW7_CR0 0000000
26918 +#define UW7_CR1 0001000
26919 +#define UW7_CR2 0002000
26920 +#define UW7_CR3 0003000
26921 +#define UW7_TABDLY 0014000
26922 +#define UW7_TAB0 0000000
26923 +#define UW7_TAB1 0004000
26924 +#define UW7_TAB2 0010000
26925 +#define UW7_TAB3 0014000
26926 +#define UW7_XTABS UW7_TAB3
26927 +#define UW7_BSDLY 0020000
26928 +#define UW7_BS0 0000000
26929 +#define UW7_BS1 0020000
26930 +#define UW7_VTDLY 0040000
26931 +#define UW7_VT0 0000000
26932 +#define UW7_VT1 0040000
26933 +#define UW7_FFDLY 0100000
26934 +#define UW7_FF0 0000000
26935 +#define UW7_FF1 0100000
26938 + * Control modes (c_cflag).
26940 +#define UW7_CFLAG_MSK 0177777
26941 +#define UW7_CBAUD 0000017
26942 +#define UW7_CSIZE 0000060
26943 +#define UW7_CS5 0000000
26944 +#define UW7_CS6 0000020
26945 +#define UW7_CS7 0000040
26946 +#define UW7_CS8 0000060
26947 +#define UW7_CSTOPB 0000100
26948 +#define UW7_CREAD 0000200
26949 +#define UW7_PARENB 0000400
26950 +#define UW7_PARODD 0001000
26951 +#define UW7_HUPCL 0002000
26952 +#define UW7_CLOCAL 0004000
26953 +#define UW7_XCLUDE 0100000
26954 +#define UW7_CIBAUD 000003600000
26955 +#define UW7_IBSHIFT 16
26956 +#define UW7_PAREXT 000004000000
26959 + * Local modes (c_lflag), same as Linux except
26960 + * UW7_FLUSHO is different and UW7_DEFECHO is obsolete (set to 0).
26962 +#define UW7_LFLAG_MSK 0001777
26963 +#define UW7_ISIG 0000001
26964 +#define UW7_ICANON 0000002
26965 +#define UW7_XCASE 0000004
26966 +#define UW7_ECHO 0000010
26967 +#define UW7_ECHOE 0000020
26968 +#define UW7_ECHOK 0000040
26969 +#define UW7_ECHONL 0000100
26970 +#define UW7_NOFLSH 0000200
26971 +#define UW7_TOSTOP 0000400
26972 +#define UW7_ECHOCTL 0001000
26973 +#define UW7_ECHOPRT 0002000
26974 +#define UW7_ECHOKE 0004000
26975 +#define UW7_DEFECHO 0010000
26976 +#define UW7_FLUSHO 0020000
26977 +#define UW7_PENDIN 0040000
26978 +#define UW7_IEXTEN 0100000
26980 +#endif /* _ABI_UW7_TERMBITS_H */
26981 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/termios.h kernel-source-2.6.16/include/abi/uw7/termios.h
26982 --- kernel-source-2.6.16.orig/include/abi/uw7/termios.h 1970-01-01 10:00:00.000000000 +1000
26983 +++ kernel-source-2.6.16/include/abi/uw7/termios.h 2006-04-27 18:50:24.000000000 +1000
26985 +#ifndef _ABI_UW7_TERMIOS_H
26986 +#define _ABI_UW7_TERMIOS_H
26988 +#define UW7_NCCS (19)
26989 +struct uw7_termios {
26990 + unsigned long c_iflag;
26991 + unsigned long c_oflag;
26992 + unsigned long c_cflag;
26993 + unsigned long c_lflag;
26994 + unsigned char c_cc[UW7_NCCS];
26997 +#endif /* _ABI_UW7_TERMIOS_H */
26998 diff -Nur kernel-source-2.6.16.orig/include/abi/uw7/types.h kernel-source-2.6.16/include/abi/uw7/types.h
26999 --- kernel-source-2.6.16.orig/include/abi/uw7/types.h 1970-01-01 10:00:00.000000000 +1000
27000 +++ kernel-source-2.6.16/include/abi/uw7/types.h 2006-04-27 18:50:24.000000000 +1000
27003 + * Copyright (c) 2001 Christoph Hellwig.
27004 + * All rights reserved.
27006 + * This program is free software; you can redistribute it and/or modify
27007 + * it under the terms of the GNU General Public License as published by
27008 + * the Free Software Foundation; either version 2 of the License, or
27009 + * (at your option) any later version.
27011 + * This program is distributed in the hope that it will be useful,
27012 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27013 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27014 + * GNU General Public License for more details.
27016 + * You should have received a copy of the GNU General Public License
27017 + * along with this program; if not, write to the Free Software
27018 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27020 +#ifndef _ABI_UW7_TYPES_H
27021 +#define _ABI_UW7_TYPES_H
27026 + * UnixWare 7 type declarations.
27028 +#include <abi/svr4/types.h> /* UnixWare is based on SVR4 */
27030 +typedef svr4_dev_t uw7_dev_t;
27031 +typedef u_int64_t uw7_ino_t;
27032 +typedef svr4_mode_t uw7_mode_t;
27033 +typedef svr4_nlink_t uw7_nlink_t;
27034 +typedef svr4_uid_t uw7_uid_t;
27035 +typedef svr4_gid_t uw7_gid_t;
27036 +typedef int64_t uw7_off_t;
27037 +typedef struct timeval uw7_timestruc_t;
27039 +typedef u_int64_t uw7_fsblkcnt64_t;
27040 +typedef u_int64_t uw7_fsfilcnt64_t;
27043 +#define linux_to_uw7_dev_t(dev) \
27044 + linux_to_svr4_dev_t(dev)
27046 +#define linux_to_uw7_ino_t(ino) \
27047 + linux_to_svr4_ino_t(ino)
27049 +#define linux_to_uw7_uid_t(uid) \
27050 + linux_to_svr4_uid_t(uid)
27052 +#define linux_to_uw7_gid_t(gid) \
27053 + linux_to_svr4_gid_t(gid)
27055 +#endif /* _ABI_UW7_TYPES_H */
27056 diff -Nur kernel-source-2.6.16.orig/include/abi/wyse/net.h kernel-source-2.6.16/include/abi/wyse/net.h
27057 --- kernel-source-2.6.16.orig/include/abi/wyse/net.h 1970-01-01 10:00:00.000000000 +1000
27058 +++ kernel-source-2.6.16/include/abi/wyse/net.h 2006-04-27 18:50:24.000000000 +1000
27061 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
27067 + * Wyse extensions for 4.3 BSD TCP/IP in V/386 3.2.1A
27069 +#include <linux/ioctl.h>
27071 +/* Get struct rtentry from linux/route.h - this should be compatible. */
27072 +#include <linux/route.h>
27073 +/* Get struct arpreq from linux/if_arp.h - this should be compatible. */
27074 +#include <linux/if_arp.h>
27075 +/* Get struct ifreq and struct ifconf from linux/if.h - these should
27076 + * be compatible. */
27077 +#include <linux/if.h>
27080 +/* Wyse use BSD style ioctls. This will warn us if we haven't got compatible
27081 + * structures :-).
27084 +/* socket i/o controls */
27085 +#define WVR3_SIOCSHIWAT BSD__IOW('s', 0, int) /* set high watermark */
27086 +#define WVR3_SIOCGHIWAT BSD__IOR('s', 1, int) /* get high watermark */
27087 +#define WVR3_SIOCSLOWAT BSD__IOW('s', 2, int) /* set low watermark */
27088 +#define WVR3_SIOCGLOWAT BSD__IOR('s', 3, int) /* get low watermark */
27089 +#define WVR3_SIOCATMARK BSD__IOR('s', 7, int) /* at oob mark? */
27090 +#define WVR3_SIOCSPGRP BSD__IOW('s', 8, int) /* set process group */
27091 +#define WVR3_SIOCGPGRP BSD__IOR('s', 9, int) /* get process group */
27093 +#define WVR3_SIOCADDRT BSD__IOW('r', 10, struct rtentry) /* add route */
27094 +#define WVR3_SIOCDELRT BSD__IOW('r', 11, struct rtentry) /* delete route */
27096 +#define WVR3_SIOCSIFADDR BSD__IOW('i', 12, struct ifreq) /* set ifnet address */
27097 +#define WVR3_SIOCGIFADDR BSD__IOWR('i',13, struct ifreq) /* get ifnet address */
27098 +#define WVR3_SIOCSIFDSTADDR BSD__IOW('i', 14, struct ifreq) /* set p-p address */
27099 +#define WVR3_SIOCGIFDSTADDR BSD__IOWR('i',15, struct ifreq) /* get p-p address */
27100 +#define WVR3_SIOCSIFFLAGS BSD__IOW('i', 16, struct ifreq) /* set ifnet flags */
27101 +#define WVR3_SIOCGIFFLAGS BSD__IOWR('i',17, struct ifreq) /* get ifnet flags */
27102 +#define WVR3_SIOCGIFBRDADDR BSD__IOWR('i',18, struct ifreq) /* get broadcast addr */
27103 +#define WVR3_SIOCSIFBRDADDR BSD__IOW('i',19, struct ifreq) /* set broadcast addr */
27104 +#define WVR3_SIOCGIFCONF BSD__IOWR('i',20, struct ifconf) /* get ifnet list */
27105 +#define WVR3_SIOCGIFNETMASK BSD__IOWR('i',21, struct ifreq) /* get net addr mask */
27106 +#define WVR3_SIOCSIFNETMASK BSD__IOW('i',22, struct ifreq) /* set net addr mask */
27107 +#define WVR3_SIOCGIFMETRIC BSD__IOWR('i',23, struct ifreq) /* get IF metric */
27108 +#define WVR3_SIOCSIFMETRIC BSD__IOW('i',24, struct ifreq) /* set IF metric */
27109 +#define WVR3_SIOCSIFHADDR BSD__IOW('i', 25, struct ifreq) /* set hardware addr */
27110 +#define WVR3_SIOCGIFHADDR BSD__IOWR('i',26, struct ifreq) /* get hardware addr */
27111 +#define WVR3_SIOCRIFHADDR BSD__IOW('i', 27, struct ifreq) /* reset hardware addr */
27113 +#define WVR3_SIOCSARP BSD__IOW('i', 30, struct arpreq) /* set arp entry */
27114 +#define WVR3_SIOCGARP BSD__IOWR('i',31, struct arpreq) /* get arp entry */
27115 +#define WVR3_SIOCDARP BSD__IOW('i', 32, struct arpreq) /* delete arp entry */
27117 +#define WVR3_SIOCADDMULTI BSD__IOW('i', 33, struct ifreq) /* set multicast addr */
27118 +#define WVR3_SIOCDELMULTI BSD__IOW('i', 34, struct ifreq) /* set multicast addr */
27119 diff -Nur kernel-source-2.6.16.orig/include/abi/wyse/sysent.h kernel-source-2.6.16/include/abi/wyse/sysent.h
27120 --- kernel-source-2.6.16.orig/include/abi/wyse/sysent.h 1970-01-01 10:00:00.000000000 +1000
27121 +++ kernel-source-2.6.16/include/abi/wyse/sysent.h 2006-04-27 18:50:24.000000000 +1000
27124 + * Copyright (c) 2001 Christoph Hellwig.
27125 + * All rights reserved.
27127 + * This program is free software; you can redistribute it and/or modify
27128 + * it under the terms of the GNU General Public License as published by
27129 + * the Free Software Foundation; either version 2 of the License, or
27130 + * (at your option) any later version.
27132 + * This program is distributed in the hope that it will be useful,
27133 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27134 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27135 + * GNU General Public License for more details.
27137 + * You should have received a copy of the GNU General Public License
27138 + * along with this program; if not, write to the Free Software
27139 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27141 +#ifndef _ABI_WYSE_SYSENT_H
27142 +#define _ABI_WYSE_SYSENT_H
27147 + * External function declarations for the Wyse V/386 syscall table.
27154 +extern int wyse_ptrace(int, int, u_long, u_long);
27157 +extern int wyse_gethostname(char *, int);
27158 +extern int wyse_getdomainname(char *, int);
27159 +extern int wyse_wait3(int *);
27160 +extern int wyse_socket(int, int, int);
27161 +extern int wyse_setsockopt(int, int, int, char *, int);
27162 +extern int wyse_getsockopt(int, int, int, char *, int *);
27163 +extern int wyse_recvfrom(int, void *, size_t, unsigned,
27164 + struct sockaddr *, int *);
27165 +extern int wyse_recv(int, void *, size_t, unsigned);
27166 +extern int wyse_sendto(int, void *, size_t, unsigned,
27167 + struct sockaddr *, int);
27168 +extern int wyse_send(int, void *, size_t, unsigned);
27171 +extern int wyse_syslocal(struct pt_regs *);
27173 +#endif /* _ABI_WYSE_SYSENT_H */
27174 diff -Nur kernel-source-2.6.16.orig/include/asm-i386/abi_machdep.h kernel-source-2.6.16/include/asm-i386/abi_machdep.h
27175 --- kernel-source-2.6.16.orig/include/asm-i386/abi_machdep.h 1970-01-01 10:00:00.000000000 +1000
27176 +++ kernel-source-2.6.16/include/asm-i386/abi_machdep.h 2006-04-27 18:50:24.000000000 +1000
27179 + * Copyright (c) 2001 Caldera Deutschland GmbH.
27180 + * Copyright (c) 2001 Christoph Hellwig.
27181 + * All rights reserved.
27183 + * This program is free software; you can redistribute it and/or modify
27184 + * it under the terms of the GNU General Public License as published by
27185 + * the Free Software Foundation; either version 2 of the License, or
27186 + * (at your option) any later version.
27188 + * This program is distributed in the hope that it will be useful,
27189 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27190 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27191 + * GNU General Public License for more details.
27193 + * You should have received a copy of the GNU General Public License
27194 + * along with this program; if not, write to the Free Software
27195 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27197 +#ifndef _ASM_ABI_MACHDEP_H
27198 +#define _ASM_ABI_MACHDEP_H
27200 +#include <linux/ptrace.h>
27203 + * get_syscall_parameter - get syscall parameter
27204 + * @regs: saved register contents
27205 + * @n: nth syscall to get
27207 + * This function gets the nth syscall parameter if
27208 + * the syscall got a &struct pt_regs * passed instead
27209 + * of the traditional C calling convention.
27211 +static __inline unsigned long
27212 +get_syscall_parameter(struct pt_regs *regs, int n)
27216 + __get_user(r, ((unsigned long *)regs->esp)+(n+1));
27221 + * set_error - set error number
27222 + * @regs: saved register contents
27223 + * @errno: error number
27225 + * This function sets the syscall error return for lcall7
27226 + * calling conventions to @errno.
27228 +static __inline void
27229 +set_error(struct pt_regs *regs, int errno)
27231 + regs->eax = errno;
27232 + regs->eflags |= 1;
27236 + * clear_error - clear error return flag
27237 + * @regs: saved register contents
27239 + * This funtion clears the flag that indicates an error
27240 + * return for lcall7-based syscalls.
27242 +static __inline void
27243 +clear_error(struct pt_regs *regs)
27245 + regs->eflags &= ~1;
27249 + * set_result - set syscall return value
27250 + * @regs: saved register contents
27252 + * This funtion sets the return value for syscalls
27253 + * that have the saved register set calling convention.
27255 +static __inline void
27256 +set_result(struct pt_regs *regs, int r)
27262 + * get_result - get syscall return value
27263 + * @regs: saved register contents
27265 + * This funtion gets the return value for syscalls
27266 + * that have the saved register set calling convention.
27268 +static __inline int
27269 +get_result(struct pt_regs *regs)
27271 + return regs->eax;
27274 +#endif /* _ASM_ABI_MACHDEP_H */
27275 diff -Nur kernel-source-2.6.16.orig/include/asm-i386/elf.h kernel-source-2.6.16/include/asm-i386/elf.h
27276 --- kernel-source-2.6.16.orig/include/asm-i386/elf.h 2006-04-27 18:30:02.000000000 +1000
27277 +++ kernel-source-2.6.16/include/asm-i386/elf.h 2006-04-27 18:50:24.000000000 +1000
27278 @@ -111,7 +111,20 @@
27279 #define ELF_PLATFORM (system_utsname.machine)
27282 -#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
27284 +#include <asm/elfmark.h>
27286 +#define SET_PERSONALITY(ex, ibcs2) \
27288 + unsigned long personality = abi_defhandler_elf; \
27289 + if ((ex).e_flags == EF_386_UW7) \
27290 + personality = PER_UW7; \
27291 + else if ((ex).e_flags == EF_386_OSR5) \
27292 + personality = PER_OSR5; \
27293 + else if (ibcs2) \
27294 + personality = abi_defhandler_libcso; \
27295 + set_personality(personality); \
27299 * An executable for which elf_read_implies_exec() returns TRUE will
27300 diff -Nur kernel-source-2.6.16.orig/include/asm-i386/elfmark.h kernel-source-2.6.16/include/asm-i386/elfmark.h
27301 --- kernel-source-2.6.16.orig/include/asm-i386/elfmark.h 1970-01-01 10:00:00.000000000 +1000
27302 +++ kernel-source-2.6.16/include/asm-i386/elfmark.h 2006-04-27 18:50:24.000000000 +1000
27305 + * elfmark - set ELF header e_flags value to an abi-specific value.
27307 + * This utility is used for marking ELF binaries (including shared libraries)
27308 + * for use by the UW Linux kernel module that provides exec domain for PER_UW7
27309 + * personality. Run only on IA32 architectures.
27311 + * Authors - Tigran Aivazian <tigran@veritas.com>,
27312 + * Christoph Hellwig <hch@caldera.de>
27314 + * This software is under GPL
27316 +#ifndef _ELFMARK_H
27317 +#define _ELFMARK_H
27320 + * The e_flags value for SCO UnixWare 7/UDK binaries
27322 +#ifndef EF_386_UW7
27323 +#define EF_386_UW7 0x314B4455
27327 + * The e_flags value for SCO OpenServer 5 binaries.
27329 +#ifndef EF_386_OSR5
27330 +#define EF_386_OSR5 0x3552534f
27334 + * e_flags value with no special meaning.
27336 +#ifndef EF_386_NONE
27337 +#define EF_386_NONE 0
27340 +#endif /* _ELFMARK_H */
27341 diff -Nur kernel-source-2.6.16.orig/include/asm-i386/namei.h kernel-source-2.6.16/include/asm-i386/namei.h
27342 --- kernel-source-2.6.16.orig/include/asm-i386/namei.h 2006-03-20 15:53:29.000000000 +1000
27343 +++ kernel-source-2.6.16/include/asm-i386/namei.h 2006-04-27 18:50:24.000000000 +1000
27347 * linux/include/asm-i386/namei.h
27349 * Included from linux/fs/namei.c
27351 #ifndef __I386_NAMEI_H
27352 #define __I386_NAMEI_H
27354 -/* This dummy routine maybe changed to something useful
27355 - * for /usr/gnemul/ emulation stuff.
27356 - * Look at asm-sparc/namei.h for details.
27357 +#include <linux/config.h>
27360 + * The base directory for our emulations.
27361 + * - sparc uses usr/gmemul here.
27363 +#define I386_EMUL_BASE "emul/"
27366 + * We emulate quite a lot operting systems...
27368 +#define I386_SVR4_EMUL I386_EMUL_BASE "/svr4/"
27369 +#define I386_SVR3_EMUL I386_EMUL_BASE "/svr3/"
27370 +#define I386_SCOSVR3_EMUL I386_EMUL_BASE "/sco/"
27371 +#define I386_OSR5_EMUL I386_EMUL_BASE "/osr5/"
27372 +#define I386_WYSEV386_EMUL I386_EMUL_BASE "/wyse/"
27373 +#define I386_ISCR4_EMUL I386_EMUL_BASE "/isc/"
27374 +#define I386_BSD_EMUL I386_EMUL_BASE "/bsd/"
27375 +#define I386_XENIX_EMUL I386_EMUL_BASE "/xenix/"
27376 +#define I386_SOLARIS_EMUL I386_EMUL_BASE "/solaris/"
27377 +#define I386_UW7_EMUL I386_EMUL_BASE "/uw7/"
27379 -#define __emul_prefix() NULL
27380 +static inline char *__emul_prefix(void)
27382 +#if defined(CONFIG_ABI) || defined (CONFIG_ABI_MODULE)
27383 + switch (get_cur_personality()) {
27385 + return I386_SVR4_EMUL;
27387 + return I386_SVR3_EMUL;
27388 + case PER_SCOSVR3:
27389 + return I386_SCOSVR3_EMUL;
27391 + return I386_OSR5_EMUL;
27392 + case PER_WYSEV386:
27393 + return I386_WYSEV386_EMUL;
27395 + return I386_ISCR4_EMUL;
27397 + return I386_BSD_EMUL;
27399 + return I386_XENIX_EMUL;
27400 + case PER_SOLARIS:
27401 + return I386_SOLARIS_EMUL;
27403 + return I386_UW7_EMUL;
27405 +#endif /* CONFIG_ABI || CONFIG_ABI_MODULE */
27409 #endif /* __I386_NAMEI_H */
27410 diff -Nur kernel-source-2.6.16.orig/include/asm-i386/signal.h kernel-source-2.6.16/include/asm-i386/signal.h
27411 --- kernel-source-2.6.16.orig/include/asm-i386/signal.h 2006-03-20 15:53:29.000000000 +1000
27412 +++ kernel-source-2.6.16/include/asm-i386/signal.h 2006-04-27 18:50:24.000000000 +1000
27413 @@ -218,6 +218,7 @@
27417 +extern asmlinkage int signal_suspend(struct pt_regs * regs, old_sigset_t mask);
27419 #define ptrace_signal_deliver(regs, cookie) \
27421 diff -Nur kernel-source-2.6.16.orig/include/asm-i386/unistd.h kernel-source-2.6.16/include/asm-i386/unistd.h
27422 --- kernel-source-2.6.16.orig/include/asm-i386/unistd.h 2006-03-20 15:53:29.000000000 +1000
27423 +++ kernel-source-2.6.16/include/asm-i386/unistd.h 2006-04-27 18:50:24.000000000 +1000
27424 @@ -442,6 +442,7 @@
27425 #include <linux/types.h>
27426 #include <linux/linkage.h>
27427 #include <asm/ptrace.h>
27428 +#include <asm/signal.h> /* for old_sigset_t */
27431 * we need this inline - forking from kernel space will result
27432 @@ -472,7 +473,11 @@
27433 const struct sigaction __user *act,
27434 struct sigaction __user *oact,
27435 size_t sigsetsize);
27437 +extern asmlinkage int sys_ipc(uint call, int first, int second,
27438 + int third, void *ptr, long fifth);
27439 +extern asmlinkage long sys_sigaltstack(const stack_t *uss, stack_t *uoss);
27440 +extern asmlinkage int sys_sigsuspend(int history0, int history1,
27441 + old_sigset_t mask);
27445 diff -Nur kernel-source-2.6.16.orig/include/asm-parisc/processor.h kernel-source-2.6.16/include/asm-parisc/processor.h
27446 --- kernel-source-2.6.16.orig/include/asm-parisc/processor.h 2006-03-20 15:53:29.000000000 +1000
27447 +++ kernel-source-2.6.16/include/asm-parisc/processor.h 2006-04-27 18:50:24.000000000 +1000
27448 @@ -279,7 +279,7 @@
27452 -#define USER_WIDE_MODE (personality(current->personality) == PER_LINUX)
27453 +#define USER_WIDE_MODE (is_cur_personality_id(PERID_LINUX))
27455 #define USER_WIDE_MODE 0
27457 diff -Nur kernel-source-2.6.16.orig/include/linux/fs.h kernel-source-2.6.16/include/linux/fs.h
27458 --- kernel-source-2.6.16.orig/include/linux/fs.h 2006-04-27 18:30:02.000000000 +1000
27459 +++ kernel-source-2.6.16/include/linux/fs.h 2006-04-27 18:50:24.000000000 +1000
27460 @@ -1702,6 +1702,18 @@
27462 extern int vfs_readdir(struct file *, filldir_t, void *);
27465 +struct old_linux_dirent {
27466 + unsigned long d_ino;
27467 + unsigned long d_offset;
27468 + unsigned short d_namlen;
27472 +extern asmlinkage long old_readdir(unsigned int fd,
27473 + struct old_linux_dirent __user * dirent, unsigned int count);
27476 extern int vfs_stat(char __user *, struct kstat *);
27477 extern int vfs_lstat(char __user *, struct kstat *);
27478 extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
27479 diff -Nur kernel-source-2.6.16.orig/include/linux/major.h kernel-source-2.6.16/include/linux/major.h
27480 --- kernel-source-2.6.16.orig/include/linux/major.h 2006-04-27 18:30:02.000000000 +1000
27481 +++ kernel-source-2.6.16/include/linux/major.h 2006-04-27 18:50:24.000000000 +1000
27483 #define ACSI_MAJOR 28
27484 #define AZTECH_CDROM_MAJOR 29
27485 #define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */
27486 +#define SOCKSYS_MAJOR 30 /* iBCS needs this for STREAMS-based TCP/IP */
27487 #define CM206_CDROM_MAJOR 32
27488 #define IDE2_MAJOR 33
27489 #define IDE3_MAJOR 34
27490 diff -Nur kernel-source-2.6.16.orig/include/linux/personality.h kernel-source-2.6.16/include/linux/personality.h
27491 --- kernel-source-2.6.16.orig/include/linux/personality.h 2006-03-20 15:53:29.000000000 +1000
27492 +++ kernel-source-2.6.16/include/linux/personality.h 2006-04-27 18:50:24.000000000 +1000
27494 struct exec_domain;
27497 +typedef unsigned long personality_t; /* type for full personality value */
27498 +typedef unsigned char per_id_t;/* type for base per id */
27500 extern int register_exec_domain(struct exec_domain *);
27501 extern int unregister_exec_domain(struct exec_domain *);
27502 extern int __set_personality(unsigned long);
27505 - * Flags for bug emulation.
27506 + * Sysctl variables related to binary emulation.
27508 +extern unsigned long abi_defhandler_coff;
27509 +extern unsigned long abi_defhandler_elf;
27510 +extern unsigned long abi_defhandler_lcall7;
27511 +extern unsigned long abi_defhandler_libcso;
27512 +extern int abi_fake_utsname;
27515 + * Basic personality ids (per_id).
27517 + * The per_id is occupying byte 0.
27518 + * (It has to fit into an unsigned char! -> per_id_t)
27521 + PERID_LINUX = 0x00, /* native execution mode of os platform */
27522 + PERID_SVR4 = 0x01,
27523 + PERID_SVR3 = 0x02,
27524 + PERID_SCOSVR3 = 0x03, /* and SCO-OS-R5 */
27525 + PERID_WYSEV386 = 0x04,
27526 + PERID_ISCR4 = 0x05,
27527 + PERID_BSD = 0x06, /* and SUN OS */
27528 + PERID_XENIX = 0x07,
27529 + PERID_LINUX32 = 0x08, /* 32 bit mode on non-32 bit platforms */
27530 + PERID_IRIX32 = 0x09, /* IRIX5 32-bit */
27531 + PERID_IRIXN32 = 0x0a, /* IRIX6 new 32-bit */
27532 + PERID_IRIX64 = 0x0b, /* IRIX6 64-bit */
27533 + PERID_RISCOS = 0x0c,
27534 + PERID_SOLARIS = 0x0d,
27535 + PERID_UW7 = 0x0e,
27536 + PERID_OSF4 = 0x0f, /* OSF/1 v4 */
27537 + PERID_HPUX = 0x10,
27538 + PERID_MASK = 0xff,
27542 + * Flags for customizing the behaviour of a base personality id.
27544 - * These occupy the top three bytes.
27545 + * The flags occupy bytes 1 trough 3. Byte 0 is for the base personality id.
27546 + * (Avoid defining the top bit, it will conflict with error returns.)
27549 +#if 1 /* only for compatibilty with old code */
27550 ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */
27551 FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors
27552 * (signal handling)
27554 ADDR_LIMIT_32BIT = 0x0800000,
27555 SHORT_INODE = 0x1000000,
27556 WHOLE_SECONDS = 0x2000000,
27557 - STICKY_TIMEOUTS = 0x4000000,
27558 + STICKY_TIMEOUTS = 0x4000000,
27559 ADDR_LIMIT_3GB = 0x8000000,
27562 + PERF_MMAP_PAGE_ZERO = 0x00100000,
27563 + PERF_ADDR_COMPAT_LAYOUT = 0x00200000,
27564 + PERF_READ_IMPLIES_EXEC = 0x00400000,
27565 + PERF_ADDR_LIMIT_32BIT = 0x00800000,
27566 + PERF_SHORT_INODE = 0x01000000,
27567 + PERF_WHOLE_SECONDS = 0x02000000,
27568 + PERF_STICKY_TIMEOUTS = 0x04000000,
27569 + PERF_ADDR_LIMIT_3GB = 0x08000000,
27570 + PERF_MASK = 0xFFFFFF00,
27574 @@ -39,36 +91,34 @@
27575 #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE)
27578 - * Personality types.
27580 - * These go in the low byte. Avoid using the top bit, it will
27581 - * conflict with error returns.
27582 + * Predefined personality profiles.
27585 - PER_LINUX = 0x0000,
27586 - PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
27587 + PER_LINUX = PERID_LINUX,
27588 + PER_LINUX_32BIT = PERID_LINUX | PERF_ADDR_LIMIT_32BIT,
27589 + PER_SVR4 = PERID_SVR4 | PERF_STICKY_TIMEOUTS | PERF_MMAP_PAGE_ZERO,
27590 + PER_SVR3 = PERID_SVR3 | PERF_STICKY_TIMEOUTS | PERF_SHORT_INODE,
27591 + PER_SCOSVR3 = PERID_SCOSVR3 | PERF_STICKY_TIMEOUTS |
27592 + PERF_WHOLE_SECONDS | PERF_SHORT_INODE,
27593 PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
27594 - PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
27595 - PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
27596 - PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS |
27597 - WHOLE_SECONDS | SHORT_INODE,
27598 - PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
27599 - PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
27600 - PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
27601 - PER_BSD = 0x0006,
27602 - PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
27603 - PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
27604 - PER_LINUX32 = 0x0008,
27605 - PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
27606 - PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
27607 - PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
27608 - PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
27609 - PER_RISCOS = 0x000c,
27610 - PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
27611 - PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
27612 - PER_OSF4 = 0x000f, /* OSF/1 v4 */
27613 - PER_HPUX = 0x0010,
27614 - PER_MASK = 0x00ff,
27615 + PER_OSR5 = PERID_SCOSVR3 | PERF_STICKY_TIMEOUTS | PERF_WHOLE_SECONDS,
27616 + PER_WYSEV386 = PERID_WYSEV386 | PERF_STICKY_TIMEOUTS | PERF_SHORT_INODE,
27617 + PER_ISCR4 = PERID_ISCR4 | PERF_STICKY_TIMEOUTS,
27618 + PER_BSD = PERID_BSD,
27619 + PER_SUNOS = PERID_BSD | PERF_STICKY_TIMEOUTS,
27620 + PER_XENIX = PERID_XENIX | PERF_STICKY_TIMEOUTS | PERF_SHORT_INODE,
27621 + PER_LINUX32 = PERID_LINUX32,
27622 + PER_LINUX32_3GB = PERID_LINUX32 | PERF_ADDR_LIMIT_3GB,
27623 + PER_IRIX32 = PERID_IRIX32 | PERF_STICKY_TIMEOUTS,/* IRIX5 32-bit */
27624 + PER_IRIXN32 = PERID_IRIXN32 | PERF_STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
27625 + PER_IRIX64 = PERID_IRIX64 | PERF_STICKY_TIMEOUTS,/* IRIX6 64-bit */
27626 + PER_RISCOS = PERID_RISCOS,
27627 + PER_SOLARIS = PERID_SOLARIS | PERF_STICKY_TIMEOUTS,
27628 + PER_UW7 = PERID_UW7 | PERF_STICKY_TIMEOUTS | PERF_MMAP_PAGE_ZERO,
27629 + PER_OSF4 = PERID_OSF4,/* OSF/1 v4 */
27630 + PER_HPUX = PERID_HPUX,
27631 + PER_MASK = PERID_MASK | PERF_MASK,
27632 + PER_QUERY = 0xffffffff, /* indicates query when passed to sys_personality */
27637 struct exec_domain {
27638 const char *name; /* name of the execdomain */
27639 handler_t handler; /* handler for syscalls */
27640 - unsigned char pers_low; /* lowest personality */
27641 - unsigned char pers_high; /* highest personality */
27642 + per_id_t pers_low; /* lowest personality id for this execdomain */
27643 + per_id_t pers_high; /* highest personality id for this execdomain */
27644 unsigned long *signal_map; /* signal mapping */
27645 unsigned long *signal_invmap; /* reverse signal mapping */
27646 struct map_segment *err_map; /* error mapping */
27647 @@ -96,19 +146,72 @@
27651 - * Return the base personality without flags.
27652 + * Return the base personality id of the given personality.
27654 +#define get_personality_id(personality) ((personality) & PERID_MASK)
27655 +/* compatibility with old naming */
27656 +#define personality(personality) get_personality_id(personality)
27659 + * Return the flags of the given personality.
27661 -#define personality(pers) (pers & PER_MASK)
27662 +#define get_personality_flags(personality) ((personality) & PERF_MASK)
27665 * Personality of the currently running process.
27667 -#define get_personality (current->personality)
27668 +#define get_cur_personality() (current->personality)
27671 + * Return the base personality id of current process.
27673 +#define get_cur_personality_id() get_personality_id(get_cur_personality())
27676 + * Return the flags of the personality of current process.
27678 +#define get_cur_personality_flags() get_personality_flags(get_cur_personality())
27681 + * Check if the personality of the current process matches with the given value.
27683 +#define is_cur_personality(personality) \
27684 + (get_cur_personality() == (personality))
27687 + * Check if the pers id of the current userland process matches the given.
27688 + * No masking does apply to the given id!
27690 +#define is_cur_personality_id(per_id) \
27691 + (get_cur_personality_id() == (per_id))
27694 + * Check if the personality id of the current userland process
27695 + * matches the personality id of the given personality code value.
27697 +#define is_cur_same_personality_id_as(personality) \
27698 + (get_cur_personality_id() == get_personality_id(personality))
27701 + * Check if the current userland process has set one or more of the given flags.
27702 + * This macro works only with single flags!
27704 +#define is_cur_personality_flag(per_flag) \
27705 + (get_cur_personality_flags() & (per_flag))
27708 + * Check if the current userland process has all of the given flags set.
27709 + * This macro works only with single flags!
27711 +#define is_cur_personality_all_flags(per_flags) \
27712 + (get_cur_personality_flags() & (per_flags) == (per_flags))
27715 - * Change personality of the currently running process.
27716 + * Set a new personality for the current userland process (if not already set).
27718 -#define set_personality(pers) \
27719 - ((current->personality == pers) ? 0 : __set_personality(pers))
27720 +#define set_cur_personality(personality) \
27721 + (is_cur_personality(personality) ? 0 : __set_personality(personality))
27722 +/* compatibility with old naming */
27723 +#define set_personality(personality) set_cur_personality(personality)
27725 #endif /* _LINUX_PERSONALITY_H */
27726 diff -Nur kernel-source-2.6.16.orig/include/linux/xout.h kernel-source-2.6.16/include/linux/xout.h
27727 --- kernel-source-2.6.16.orig/include/linux/xout.h 1970-01-01 10:00:00.000000000 +1000
27728 +++ kernel-source-2.6.16/include/linux/xout.h 2006-04-27 18:50:24.000000000 +1000
27731 + * Copyright (c) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
27733 +#ifndef _ABI_XOUT_H_
27734 +#define _ABI_XOUT_H_
27739 + * This file is based on available documentation for the Xenix x.out
27740 + * format. Much is missing here. There is just enough to allow us to
27741 + * support 386 small model and not a lot more.
27748 + u_short x_magic; /* magic number */
27749 + u_short x_ext; /* size of header extension */
27752 + * For segmented binaries the following sizes are the sums
27753 + * of the segment sizes.
27755 + long x_text; /* size of text segments */
27756 + long x_data; /* size of initialized data */
27757 + long x_bss; /* size of uninitialized data */
27758 + long x_syms; /* size of symbol table */
27759 + long x_reloc; /* relocation table length */
27761 + long x_entry; /* entry point */
27762 + char x_cpu; /* cpu type and byte/word order */
27763 + char x_relsym; /* undefined */
27764 + u_short x_renv; /* run-time environment */
27768 + * X.out header extension
27772 + * These are unused.
27774 + long xe_trsize; /* ??? */
27775 + long xe_drsize; /* ??? */
27776 + long xe_tbase; /* ??? */
27777 + long xe_dbase; /* ??? */
27779 + long xe_stksize; /* stack size (if XE_FS set) */
27782 + * The following are present if XE_SEG is set.
27784 + long xe_segpos; /* offset to segment table */
27785 + long xe_segsize; /* segment table size */
27786 + long xe_mdtpos; /* offset to machdep table */
27787 + long xe_mdtsize; /* machine dependent table size */
27788 + char xe_mdttype; /* machine dependent table type */
27789 + char xe_pagesize; /* file pagesize, in 512 units */
27790 + char xe_ostype; /* operating system type */
27791 + char xe_osvers; /* operating system version */
27792 + u_short xe_eseg; /* entry segment, machdep */
27793 + u_short xe_sres; /* reserved */
27797 + * X.out segment description.
27800 + u_short xs_type; /* segment type */
27801 + u_short xs_attr; /* segment attributes */
27802 + u_short xs_seg; /* segment number */
27803 + char xs_align; /* log base 2 of alignment */
27804 + char xs_cres; /* unused */
27805 + u_long xs_filpos; /* file position */
27806 + u_long xs_psize; /* physical size (in file) */
27807 + u_long xs_vsize; /* virtual size (in core) */
27808 + u_long xs_rbase; /* relocation base addr/offset */
27809 + u_short xs_noff; /* segment name table offset */
27810 + u_short xs_sres; /* unused */
27811 + long xs_lres; /* unused */
27816 + * Magic number for an x.out header.
27818 +#define X_MAGIC 0x0206 /* indicates x.out header */
27821 + * Codes for x_cpu.
27823 +#define XC_BSWAP 0x80 /* bytes swapped */
27824 +#define XC_WSWAP 0x40 /* words swapped */
27825 +#define XC_8086 0x04 /* I8086 */
27826 +#define XC_286 0x09 /* iAPX 80286 */
27827 +#define XC_286V 0x29 /* iAPX 80286, use xe_osver for version */
27828 +#define XC_386 0x0a /* iAPX 80386 */
27829 +#define XC_186 0x0b /* iAPX 80186 */
27830 +#define XC_CPU 0x3f /* cpu mask */
27833 + * Flags for the run-time environment.
27835 +#define XE_V2 0x4000 /* version 2.x */
27836 +#define XE_V3 0x8000 /* version 3.x */
27837 +#define XE_OSV 0xc000 /* if XE_SEG use xe_osvers ... */
27838 +#define XE_V5 XE_OSV /* else assume v5.x */
27839 +#define XE_VERS 0xc000 /* version mask */
27841 +#define XE_5_3 0x2000 /* binary needs 5.3 functionality */
27842 +#define XE_LOCK 0x1000 /* Use Advisory locking */
27843 +#define XE_SEG 0x0800 /* segment table present */
27844 +#define XE_ABS 0x0400 /* absolute memory image (standalone) */
27845 +#define XE_ITER 0x0200 /* iterated text/data present */
27846 +#define XE_HDATA 0x0100 /* huge model data (never used) */
27847 +#define XE_VMOD XE_HDATA /* virtual module */
27848 +#define XE_FPH 0x0080 /* floating point hardware required */
27849 +#define XE_LTEXT 0x0040 /* large model text */
27850 +#define XE_LDATA 0x0020 /* large model data */
27851 +#define XE_OVER 0x0010 /* text overlay */
27852 +#define XE_FS 0x0008 /* fixed stack */
27853 +#define XE_PURE 0x0004 /* pure text */
27854 +#define XE_SEP 0x0002 /* separate I & D */
27855 +#define XE_EXEC 0x0001 /* executable */
27861 +#define XS_TNULL 0 /* unused segment */
27862 +#define XS_TTEXT 1 /* text segment */
27863 +#define XS_TDATA 2 /* data segment */
27864 +#define XS_TSYMS 3 /* symbol table segment */
27865 +#define XS_TREL 4 /* relocation segment */
27866 +#define XS_TSESTR 5 /* segment table's string table segment */
27867 +#define XS_TGRPS 6 /* group definitions segment */
27869 +#define XS_TIDATA 64 /* iterated data */
27870 +#define XS_TTSS 65 /* tss */
27871 +#define XS_TLFIX 66 /* lodfix */
27872 +#define XS_TDNAME 67 /* descriptor names */
27873 +#define XS_TDTEXT 68 /* debug text segment */
27874 +#define XS_TIDBG XS_TDTEXT
27875 +#define XS_TDFIX 69 /* debug relocation */
27876 +#define XS_TOVTAB 70 /* overlay table */
27878 +#define XS_TSYSTR 72 /* symbol string table */
27881 + * Segment attributes.
27883 +#define XS_AMEM 0x8000 /* is a memory image */
27886 + * For text and data segment types
27888 +#define XS_AITER 0x0001 /* contains iteration records */
27889 +#define XS_AHUGE 0x0002 /* contains huge element */
27890 +#define XS_ABSS 0x0004 /* contains implicit BSS */
27891 +#define XS_APURE 0x0008 /* read only, shareable */
27892 +#define XS_AEDOWN 0x0010 /* expands downward (stack) */
27893 +#define XS_APRIV 0x0020 /* may not be combined */
27894 +#define XS_A32BIT 0x0040 /* is 32 bit */
27897 + * File position macros, valid only if !XE_SEG.
27899 +#define XEXTPOS(xp) ((long) sizeof(struct xexec))
27900 +#define XTEXTPOS(xp) (XEXTPOS(xp) + (long) (xp)->x_ext)
27901 +#define XDATAPOS(xp) (XTEXTPOS(xp) + (xp)->x_text)
27902 +#define XBSSPOS(xp) (XDATAPOS(xp) + (xp)->x_data)
27903 +#define XSYMPOS(xp) (XDATAPOS(xp) + (xp)->x_data)
27904 +#define XRELPOS(xp) (XSYMPOS(xp) + (xp)->x_syms)
27905 +#define XENDPOS(xp) (XRELPOS(xp) + (xp)->x_reloc)
27907 +#define XRTEXTPOS(xp, ep) (XRELPOS(xp))
27908 +#define XRDATAPOS(xp, ep) (XRELPOS(xp) + (ep)->xe_trsize)
27912 + * Specials for the Linux Xenix 286 emulator.
27914 + * The base address that 286 segments are loaded above. This should be
27915 + * above memory used by the emulator overlay. Actual segment data
27916 + * starts slightly higher than this since we map the xexec and xext
27917 + * structures of the executable to this address.
27919 +#define X286_MAP_ADDR 0x4000000
27921 +#endif /* _ABI_XOUT_H_ */
27922 diff -Nur kernel-source-2.6.16.orig/include/net/sock.h kernel-source-2.6.16/include/net/sock.h
27923 --- kernel-source-2.6.16.orig/include/net/sock.h 2006-04-27 18:30:02.000000000 +1000
27924 +++ kernel-source-2.6.16/include/net/sock.h 2006-04-27 18:50:24.000000000 +1000
27925 @@ -393,6 +393,7 @@
27926 SOCK_NO_LARGESEND, /* whether to sent large segments or not */
27927 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
27928 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
27932 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
27933 diff -Nur kernel-source-2.6.16.orig/init/main.c kernel-source-2.6.16/init/main.c
27934 --- kernel-source-2.6.16.orig/init/main.c 2006-04-27 18:29:59.000000000 +1000
27935 +++ kernel-source-2.6.16/init/main.c 2006-04-27 18:50:24.000000000 +1000
27937 #include <linux/rmap.h>
27938 #include <linux/mempolicy.h>
27939 #include <linux/key.h>
27940 +#include <linux/hrtimer.h>
27942 #include <asm/io.h>
27943 #include <asm/bugs.h>
27944 diff -Nur kernel-source-2.6.16.orig/kernel/exec_domain.c kernel-source-2.6.16/kernel/exec_domain.c
27945 --- kernel-source-2.6.16.orig/kernel/exec_domain.c 2006-04-27 18:16:04.000000000 +1000
27946 +++ kernel-source-2.6.16/kernel/exec_domain.c 2006-04-27 18:52:46.000000000 +1000
27947 @@ -19,10 +19,14 @@
27948 #include <linux/types.h>
27951 -static void default_handler(int, struct pt_regs *);
27952 +#if !defined(CONFIG_ABI_LATE_PROBING)
27953 +static void lcall_default_handler(int, struct pt_regs *);
27955 +static void lcall_autodetect_handler(int, struct pt_regs *);
27958 -static struct exec_domain *exec_domains = &default_exec_domain;
27959 -static DEFINE_RWLOCK(exec_domains_lock);
27960 +static struct exec_domain *exec_domains = &default_exec_domain; /* linked list of registered exed domains */
27961 +static DEFINE_RWLOCK(exec_domains_lock); /* access lock for linked list */
27964 static u_long ident_map[32] = {
27965 @@ -32,55 +36,127 @@
27966 24, 25, 26, 27, 28, 29, 30, 31
27969 +#define PERID_DEFAULT PERID_LINUX /* Linux personality id. */
27971 struct exec_domain default_exec_domain = {
27972 .name = "Linux", /* name */
27973 - .handler = default_handler, /* lcall7 causes a seg fault. */
27974 - .pers_low = 0, /* PER_LINUX personality. */
27975 - .pers_high = 0, /* PER_LINUX personality. */
27976 +#if !defined(CONFIG_ABI_LATE_PROBING)
27977 + .handler = lcall_default_handler,/* any unknown lcall raises a segmentation fault */
27979 + .handler = lcall_autodetect_handler,/* lcall 0x07 & 0x27 causes autoconfig or a seg fault. */
27981 + .pers_low = PERID_DEFAULT, /* low personality id */
27982 + .pers_high = PERID_DEFAULT, /* high personality id */
27983 .signal_map = ident_map, /* Identity map signals. */
27984 .signal_invmap = ident_map, /* - both ways. */
27988 +#if !defined(CONFIG_ABI_LATE_PROBING)
27990 +lcall_default_handler(int segment, struct pt_regs *regp)
27992 + /* raise a segfault for the current process */
27993 + send_sig(SIGSEGV, current, 1);
27997 -default_handler(int segment, struct pt_regs *regp)
27998 +lcall_autodetect_handler(int segment, struct pt_regs *regp)
28000 - set_personality(0);
28001 + personality_t personality = PER_LINUX;
28003 - if (current_thread_info()->exec_domain->handler != default_handler)
28004 - current_thread_info()->exec_domain->handler(segment, regp);
28007 + * This may have been a static linked SVr4 binary, so we would
28008 + * have the personality set incorrectly. Or it might have been
28009 + * a Solaris/x86 binary. We can tell which because the former
28010 + * uses lcall7, while the latter used lcall 0x27.
28011 + * Try to find or load the appropriate personality, and fall back
28012 + * to just forcing a SEGV.
28013 + * Try to find or load the appropriate personality on first invocation.
28014 + * If loading failed and handler is still default then raise a SEGV.
28016 + * XXX: this is IA32-specific and should be moved to the MD-tree.
28018 + switch (segment) {
28021 + personality = abi_defhandler_lcall7;
28024 + personality = PER_SOLARIS;
28028 + set_personality(personality);
28030 + if (current_thread_info()->exec_domain->handler == lcall_autodetect_handler)
28032 + /* we are still at the same handler - recursing impossible! */
28033 + /* raise a segfault for the current process */
28034 send_sig(SIGSEGV, current, 1);
28038 + /* identifying the needed handler at exec time succeeded. */
28039 + /* recursively call these installed handler (one level deep) */
28040 + current_thread_info()->exec_domain->handler(segment, regp);
28045 static struct exec_domain *
28046 lookup_exec_domain(u_long personality)
28048 struct exec_domain * ep;
28049 - u_long pers = personality(personality);
28051 + per_id_t per_id = get_personality_id(personality);
28053 + /* browse for id in list of exec domains */
28054 read_lock(&exec_domains_lock);
28055 for (ep = exec_domains; ep; ep = ep->next) {
28056 - if (pers >= ep->pers_low && pers <= ep->pers_high)
28057 + if (per_id >= ep->pers_low && per_id <= ep->pers_high)
28058 if (try_module_get(ep->module))
28060 + read_unlock(&exec_domains_lock);
28064 + read_unlock(&exec_domains_lock);
28067 - read_unlock(&exec_domains_lock);
28068 - request_module("personality-%ld", pers);
28069 - read_lock(&exec_domains_lock);
28070 + /* request loading of all data bound to personality id */
28071 + request_module("personality-%i", per_id);
28073 + /* browse for id in list of exec domains - once again */
28074 + read_lock(&exec_domains_lock);
28075 for (ep = exec_domains; ep; ep = ep->next) {
28076 - if (pers >= ep->pers_low && pers <= ep->pers_high)
28077 + if (per_id >= ep->pers_low && per_id <= ep->pers_high)
28078 if (try_module_get(ep->module))
28080 + read_unlock(&exec_domains_lock);
28084 + read_unlock(&exec_domains_lock);
28087 + /* matching exec domain is still not availabel. */
28088 +#if !defined(CONFIG_ABI_LATE_PROBING)
28089 + ep = NULL; /* error */
28092 + printk(KERN_WARNING \
28093 + "%s: personality-%i not found, using %i instead.\n",
28094 + __FILE__, per_id, PER_DEFAULT);
28097 + /* we will start with default exec domain. */
28098 + /* this will allow simple programs (mov/ret) to fully execute. */
28099 + /* complex programs will run until the very first syscall. */
28100 + /* then the syscall handler will attempt switch the identity again. */
28101 ep = &default_exec_domain;
28105 - read_unlock(&exec_domains_lock);
28109 @@ -138,26 +214,37 @@
28110 struct exec_domain *ep, *oep;
28112 ep = lookup_exec_domain(personality);
28116 + /* if the needed exec domain is already set for this process
28117 + then we save the works for registering with the new fs
28118 + and releasing the old fs and exec_domain,
28119 + we just have to update the personality to this process */
28120 if (ep == current_thread_info()->exec_domain) {
28121 current->personality = personality;
28122 module_put(ep->module);
28126 + /* when the new fs is already bound to the current process */
28127 if (atomic_read(¤t->fs->count) != 1) {
28128 struct fs_struct *fsp, *ofsp;
28130 + /* register as client for the new fs by copying it */
28131 fsp = copy_fs_struct(current->fs);
28133 module_put(ep->module);
28137 + /* replace the old with the new fs */
28138 task_lock(current);
28139 ofsp = current->fs;
28141 task_unlock(current);
28143 + /* quit as a client to the old fs */
28144 put_fs_struct(ofsp);
28147 @@ -166,17 +253,20 @@
28151 + /* replace the old with the new exec_domain */
28152 current->personality = personality;
28153 oep = current_thread_info()->exec_domain;
28154 current_thread_info()->exec_domain = ep;
28157 + /* quit as client for the old exec_domain */
28158 module_put(oep->module);
28164 -get_exec_domain_list(char *page)
28165 +get_exec_domain_list(char *page) /* handler for /proc/execdomains */
28167 struct exec_domain *ep;
28169 @@ -195,11 +285,12 @@
28171 u_long old = current->personality;
28173 - if (personality != 0xffffffff) {
28174 - set_personality(personality);
28175 - if (current->personality != personality)
28178 + if (personality == PER_QUERY)
28179 + return (long)old;
28181 + set_personality(personality);
28182 + if (get_cur_personality() != personality)
28187 @@ -208,3 +299,100 @@
28188 EXPORT_SYMBOL(register_exec_domain);
28189 EXPORT_SYMBOL(unregister_exec_domain);
28190 EXPORT_SYMBOL(__set_personality);
28193 + * We have to have all sysctl handling for the Linux-ABI
28194 + * in one place as the dynamic registration of sysctls is
28195 + * horribly crufty in Linux <= 2.4.
28197 + * I hope the new sysctl schemes discussed for future versions
28198 + * will obsolete this.
28203 +u_long abi_defhandler_coff = PER_SCOSVR3;
28204 +u_long abi_defhandler_elf = PER_LINUX;
28205 +u_long abi_defhandler_lcall7 = PER_SVR4;
28206 +u_long abi_defhandler_libcso = PER_SVR4;
28207 +u_int abi_traceflg;
28208 +int abi_fake_utsname;
28210 +static struct ctl_table abi_table[] = {
28212 + .ctl_name = ABI_DEFHANDLER_COFF,
28213 + .procname = "defhandler_coff",
28214 + .data = &abi_defhandler_coff,
28215 + .maxlen = sizeof(int),
28217 + .proc_handler = &proc_doulongvec_minmax,
28220 + .ctl_name = ABI_DEFHANDLER_ELF,
28221 + .procname = "defhandler_elf",
28222 + .data = &abi_defhandler_elf,
28223 + .maxlen = sizeof(int),
28225 + .proc_handler = &proc_doulongvec_minmax,
28228 + .ctl_name = ABI_DEFHANDLER_LCALL7,
28229 + .procname = "defhandler_lcall7",
28230 + .data = &abi_defhandler_lcall7,
28231 + .maxlen = sizeof(int),
28233 + .proc_handler = &proc_doulongvec_minmax,
28236 + .ctl_name = ABI_DEFHANDLER_LIBCSO,
28237 + .procname = "defhandler_libcso",
28238 + .data = &abi_defhandler_libcso,
28239 + .maxlen = sizeof(int),
28241 + .proc_handler = &proc_doulongvec_minmax,
28244 + .ctl_name = ABI_TRACE,
28245 + .procname = "trace",
28246 + .data = &abi_traceflg,
28247 + .maxlen = sizeof(u_int),
28249 + .proc_handler = &proc_dointvec,
28252 + .ctl_name = ABI_FAKE_UTSNAME,
28253 + .procname = "fake_utsname",
28254 + .data = &abi_fake_utsname,
28255 + .maxlen = sizeof(int),
28257 + .proc_handler = &proc_dointvec,
28259 + { .ctl_name = 0 }
28262 +static struct ctl_table abi_root_table[] = {
28264 + .ctl_name = CTL_ABI,
28265 + .procname = "abi",
28267 + .child = abi_table,
28269 + { .ctl_name = 0 }
28273 +abi_register_sysctl(void)
28275 + register_sysctl_table(abi_root_table, 1);
28279 +__initcall(abi_register_sysctl);
28282 +EXPORT_SYMBOL(abi_defhandler_coff);
28283 +EXPORT_SYMBOL(abi_defhandler_elf);
28284 +EXPORT_SYMBOL(abi_defhandler_lcall7);
28285 +EXPORT_SYMBOL(abi_defhandler_libcso);
28286 +EXPORT_SYMBOL(abi_traceflg);
28287 +EXPORT_SYMBOL(abi_fake_utsname);
28288 diff -Nur kernel-source-2.6.16.orig/kernel/fork.c kernel-source-2.6.16/kernel/fork.c
28289 --- kernel-source-2.6.16.orig/kernel/fork.c 2006-04-27 18:30:02.000000000 +1000
28290 +++ kernel-source-2.6.16/kernel/fork.c 2006-04-27 18:50:25.000000000 +1000
28291 @@ -1670,3 +1670,9 @@
28296 +/* symbol exports for LinuxABI Sytem V R4 support */
28297 +/* for ease of use we are exporting those needed symbols permanently */
28298 +/* #if CONFIG_ABI_SVR4 == m */
28299 +EXPORT_SYMBOL(do_fork);
28301 diff -Nur kernel-source-2.6.16.orig/kernel/Makefile kernel-source-2.6.16/kernel/Makefile
28302 --- kernel-source-2.6.16.orig/kernel/Makefile 2006-04-27 18:30:02.000000000 +1000
28303 +++ kernel-source-2.6.16/kernel/Makefile 2006-04-27 18:50:25.000000000 +1000
28305 signal.o sys.o kmod.o workqueue.o pid.o \
28306 rcupdate.o extable.o params.o posix-timers.o \
28307 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
28309 + hrtimer.o syscall_ksyms.o
28313 diff -Nur kernel-source-2.6.16.orig/kernel/syscall_ksyms.c kernel-source-2.6.16/kernel/syscall_ksyms.c
28314 --- kernel-source-2.6.16.orig/kernel/syscall_ksyms.c 1970-01-01 10:00:00.000000000 +1000
28315 +++ kernel-source-2.6.16/kernel/syscall_ksyms.c 2006-04-27 18:50:25.000000000 +1000
28318 + * Exports all Linux syscalls.
28319 + * Christoph Hellwig (hch@caldera.de), 2001
28322 +#define __KERNEL_SYSCALLS__
28323 +#include <linux/unistd.h>
28324 +#include <linux/syscalls.h>
28326 +#include <linux/config.h>
28327 +#include <linux/module.h>
28328 +#include <linux/personality.h>
28329 +#include <linux/msg.h>
28330 +#include <linux/sem.h>
28331 +#include <linux/shm.h>
28332 +#include <linux/fs.h>
28334 +EXPORT_SYMBOL(sys_uselib);
28335 +EXPORT_SYMBOL(sys_sync);
28336 +EXPORT_SYMBOL(sys_fsync);
28337 +EXPORT_SYMBOL(sys_fdatasync);
28338 +EXPORT_SYMBOL(sys_dup);
28339 +EXPORT_SYMBOL(sys_dup2);
28340 +EXPORT_SYMBOL(sys_fcntl);
28341 +#if (BITS_PER_LONG == 32)
28342 +EXPORT_SYMBOL(sys_fcntl64);
28344 +EXPORT_SYMBOL(sys_ioctl);
28345 +EXPORT_SYMBOL(sys_link);
28346 +EXPORT_SYMBOL(sys_mkdir);
28347 +EXPORT_SYMBOL(sys_mknod);
28348 +EXPORT_SYMBOL(sys_rename);
28349 +EXPORT_SYMBOL(sys_rmdir);
28350 +EXPORT_SYMBOL(sys_symlink);
28351 +EXPORT_SYMBOL(sys_unlink);
28352 +EXPORT_SYMBOL(sys_umount);
28353 +EXPORT_SYMBOL(sys_oldumount);
28354 +EXPORT_SYMBOL(sys_mount);
28355 +EXPORT_SYMBOL(sys_pivot_root);
28356 +EXPORT_SYMBOL(sys_access);
28357 +EXPORT_SYMBOL(sys_chdir);
28358 +EXPORT_SYMBOL(sys_fchdir);
28359 +EXPORT_SYMBOL(sys_chroot);
28360 +EXPORT_SYMBOL(sys_chmod);
28361 +EXPORT_SYMBOL(sys_fchmod);
28362 +EXPORT_SYMBOL(sys_chown);
28363 +EXPORT_SYMBOL(sys_lchown);
28364 +EXPORT_SYMBOL(sys_fchown);
28365 +EXPORT_SYMBOL(sys_close);
28366 +#if !defined(__alpha__)
28367 +EXPORT_SYMBOL(sys_creat);
28369 +EXPORT_SYMBOL(sys_open);
28370 +EXPORT_SYMBOL(sys_statfs);
28371 +EXPORT_SYMBOL(sys_fstatfs);
28372 +EXPORT_SYMBOL(sys_ftruncate);
28373 +EXPORT_SYMBOL(sys_ftruncate64);
28374 +EXPORT_SYMBOL(sys_truncate);
28375 +EXPORT_SYMBOL(sys_truncate64);
28376 +#if !defined(__alpha__) && !defined(__ia64__)
28377 +EXPORT_SYMBOL(sys_utime);
28379 +EXPORT_SYMBOL(sys_utimes);
28380 +EXPORT_SYMBOL(sys_vhangup);
28381 +#if !defined(__alpha__)
28382 +EXPORT_SYMBOL(sys_lseek);
28384 +EXPORT_SYMBOL(sys_llseek);
28385 +EXPORT_SYMBOL(sys_read);
28386 +EXPORT_SYMBOL(sys_readv);
28387 +EXPORT_SYMBOL(sys_pread64);
28388 +EXPORT_SYMBOL(sys_pwrite64);
28389 +EXPORT_SYMBOL(sys_write);
28390 +EXPORT_SYMBOL(sys_writev);
28391 +EXPORT_SYMBOL(old_readdir);
28392 +EXPORT_SYMBOL(sys_poll);
28393 +EXPORT_SYMBOL(sys_select);
28394 +EXPORT_SYMBOL(sys_readlink);
28395 +EXPORT_SYMBOL(sys_sysfs);
28396 +EXPORT_SYMBOL(sys_acct);
28397 +EXPORT_SYMBOL(sys_exit);
28398 +EXPORT_SYMBOL(sys_getitimer);
28399 +EXPORT_SYMBOL(sys_setitimer);
28400 +EXPORT_SYMBOL(sys_gettimeofday);
28401 +EXPORT_SYMBOL(sys_settimeofday);
28402 +EXPORT_SYMBOL(sys_stime);
28403 +EXPORT_SYMBOL(sys_time);
28404 +#if !defined(__alpha__)
28405 +EXPORT_SYMBOL(sys_nice);
28407 +EXPORT_SYMBOL(sys_sched_setscheduler);
28408 +EXPORT_SYMBOL(sys_sched_setparam);
28409 +EXPORT_SYMBOL(sys_sched_getscheduler);
28410 +EXPORT_SYMBOL(sys_sched_getparam);
28411 +EXPORT_SYMBOL(sys_sched_get_priority_max);
28412 +EXPORT_SYMBOL(sys_sched_get_priority_min);
28413 +EXPORT_SYMBOL(sys_sched_rr_get_interval);
28414 +EXPORT_SYMBOL(sys_kill);
28415 +EXPORT_SYMBOL(sys_rt_sigaction);
28416 +EXPORT_SYMBOL(sys_rt_sigpending);
28417 +EXPORT_SYMBOL(sys_rt_sigprocmask);
28418 +EXPORT_SYMBOL(sys_rt_sigtimedwait);
28419 +EXPORT_SYMBOL(sys_sigaltstack);
28420 +EXPORT_SYMBOL(sys_sigpending);
28421 +EXPORT_SYMBOL(sys_sigprocmask);
28422 +EXPORT_SYMBOL(sys_sigsuspend);
28423 +EXPORT_SYMBOL(sys_gethostname);
28424 +EXPORT_SYMBOL(sys_sethostname);
28425 +EXPORT_SYMBOL(sys_setdomainname);
28426 +EXPORT_SYMBOL(sys_getrlimit);
28427 +EXPORT_SYMBOL(sys_setsid);
28428 +EXPORT_SYMBOL(sys_getsid);
28429 +EXPORT_SYMBOL(sys_getpgid);
28430 +EXPORT_SYMBOL(sys_setpgid);
28431 +EXPORT_SYMBOL(sys_getgroups);
28432 +EXPORT_SYMBOL(sys_setgroups);
28433 +EXPORT_SYMBOL(sys_setpriority);
28434 +EXPORT_SYMBOL(sys_getpriority);
28435 +EXPORT_SYMBOL(sys_reboot);
28436 +EXPORT_SYMBOL(sys_setgid);
28437 +EXPORT_SYMBOL(sys_setuid);
28438 +EXPORT_SYMBOL(sys_times);
28439 +EXPORT_SYMBOL(sys_umask);
28440 +EXPORT_SYMBOL(sys_prctl);
28441 +EXPORT_SYMBOL(sys_setreuid);
28442 +EXPORT_SYMBOL(sys_setregid);
28443 +#if !defined(__alpha__) && !defined(__ia64__)
28444 +EXPORT_SYMBOL(sys_alarm);
28446 +#if !defined(__alpha__)
28447 +EXPORT_SYMBOL(sys_getpid);
28448 +EXPORT_SYMBOL(sys_getppid);
28449 +EXPORT_SYMBOL(sys_getuid);
28450 +EXPORT_SYMBOL(sys_geteuid);
28451 +EXPORT_SYMBOL(sys_getgid);
28452 +EXPORT_SYMBOL(sys_getegid);
28454 +EXPORT_SYMBOL(sys_gettid);
28455 +EXPORT_SYMBOL(sys_nanosleep);
28456 +#if defined(CONFIG_UID16)
28457 +EXPORT_SYMBOL(sys_setreuid16);
28458 +EXPORT_SYMBOL(sys_setregid16);
28459 +EXPORT_SYMBOL(sys_getgroups16);
28460 +EXPORT_SYMBOL(sys_setgroups16);
28462 +EXPORT_SYMBOL(sys_wait4);
28463 +EXPORT_SYMBOL(sys_waitpid);
28464 +EXPORT_SYMBOL(sys_sendfile);
28465 +EXPORT_SYMBOL(sys_brk);
28466 +EXPORT_SYMBOL(sys_msync);
28467 +EXPORT_SYMBOL(sys_madvise);
28468 +EXPORT_SYMBOL(sys_mincore);
28469 +EXPORT_SYMBOL(sys_munmap);
28470 +EXPORT_SYMBOL(sys_mprotect);
28471 +EXPORT_SYMBOL(sys_socket);
28472 +EXPORT_SYMBOL(sys_socketpair);
28473 +EXPORT_SYMBOL(sys_bind);
28474 +EXPORT_SYMBOL(sys_listen);
28475 +EXPORT_SYMBOL(sys_accept);
28476 +EXPORT_SYMBOL(sys_connect);
28477 +EXPORT_SYMBOL(sys_getsockname);
28478 +EXPORT_SYMBOL(sys_getpeername);
28479 +EXPORT_SYMBOL(sys_sendto);
28480 +EXPORT_SYMBOL(sys_send);
28481 +EXPORT_SYMBOL(sys_recvfrom);
28482 +EXPORT_SYMBOL(sys_setsockopt);
28483 +EXPORT_SYMBOL(sys_getsockopt);
28484 +EXPORT_SYMBOL(sys_shutdown);
28485 +EXPORT_SYMBOL(sys_sendmsg);
28486 +EXPORT_SYMBOL(sys_recvmsg);
28487 +EXPORT_SYMBOL(sys_socketcall);
28489 +EXPORT_SYMBOL(sys_msgget);
28490 +EXPORT_SYMBOL(sys_msgsnd);
28491 +EXPORT_SYMBOL(sys_msgrcv);
28492 +EXPORT_SYMBOL(sys_msgctl);
28493 +EXPORT_SYMBOL(sys_semget);
28494 +EXPORT_SYMBOL(sys_semop);
28495 +EXPORT_SYMBOL(sys_semctl);
28496 +EXPORT_SYMBOL(sys_shmget);
28497 +EXPORT_SYMBOL(do_shmat);
28498 +EXPORT_SYMBOL(sys_shmdt);
28499 +EXPORT_SYMBOL(sys_shmctl);
28500 diff -Nur kernel-source-2.6.16.orig/Makefile kernel-source-2.6.16/Makefile
28501 --- kernel-source-2.6.16.orig/Makefile 2006-04-27 18:16:04.000000000 +1000
28502 +++ kernel-source-2.6.16/Makefile 2006-04-27 18:50:25.000000000 +1000
28503 @@ -464,6 +464,7 @@
28508 endif # KBUILD_EXTMOD
28510 ifeq ($(dot-config),1)
28511 @@ -560,12 +561,14 @@
28513 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
28514 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
28515 - $(net-y) $(net-m) $(libs-y) $(libs-m)))
28516 + $(net-y) $(net-m) $(libs-y) $(libs-m) \
28517 + $(abi-y) $(abi-m)))
28519 vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
28520 $(init-n) $(init-) \
28521 $(core-n) $(core-) $(drivers-n) $(drivers-) \
28522 - $(net-n) $(net-) $(libs-n) $(libs-))))
28523 + $(net-n) $(net-) $(libs-n) $(libs-) \
28524 + $(abi-n) $(abi-))))
28526 init-y := $(patsubst %/, %/built-in.o, $(init-y))
28527 core-y := $(patsubst %/, %/built-in.o, $(core-y))
28528 @@ -574,6 +577,7 @@
28529 libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
28530 libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
28531 libs-y := $(libs-y1) $(libs-y2)
28532 +abi-y := $(patsubst %/, %/built-in.o, $(abi-y))
28535 # ---------------------------------------------------------------------------
28536 @@ -603,7 +607,7 @@
28537 # System.map is generated to document addresses of all kernel symbols
28539 vmlinux-init := $(head-y) $(init-y)
28540 -vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
28541 +vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(abi-y)
28542 vmlinux-all := $(vmlinux-init) $(vmlinux-main)
28543 vmlinux-lds := arch/$(ARCH)/kernel/vmlinux.lds
28545 diff -Nur kernel-source-2.6.16.orig/net/socket.c kernel-source-2.6.16/net/socket.c
28546 --- kernel-source-2.6.16.orig/net/socket.c 2006-04-27 18:30:02.000000000 +1000
28547 +++ kernel-source-2.6.16/net/socket.c 2006-04-27 18:50:25.000000000 +1000
28548 @@ -124,7 +124,7 @@
28549 * in the operation structures but are done directly via the socketcall() multiplexor.
28552 -static struct file_operations socket_file_ops = {
28553 +struct file_operations socket_file_ops = {
28554 .owner = THIS_MODULE,
28555 .llseek = no_llseek,
28556 .aio_read = sock_aio_read,
28557 @@ -2121,7 +2121,7 @@
28559 #endif /* CONFIG_PROC_FS */
28561 -/* ABI emulation layers need these two */
28562 +/* LinuxABI emulation layer modules do need these exports */
28563 EXPORT_SYMBOL(move_addr_to_kernel);
28564 EXPORT_SYMBOL(move_addr_to_user);
28565 EXPORT_SYMBOL(sock_create);
28566 @@ -2137,3 +2137,9 @@
28567 EXPORT_SYMBOL(sockfd_lookup);
28568 EXPORT_SYMBOL(kernel_sendmsg);
28569 EXPORT_SYMBOL(kernel_recvmsg);
28571 +/* symbol exports for LinuxABI Sytem V R4 support */
28572 +/* for ease of use we are exporting those needed symbols permanently */
28573 +/* #if CONFIG_ABI_SVR4 == m */
28574 +EXPORT_SYMBOL(socket_file_ops);