SOURCES: linuxabi-2.6.16-0.patch (NEW) - from http://ace-host.stua...

marcus marcus at pld-linux.org
Tue Feb 26 09:30:27 CET 2008


Author: marcus                       Date: Tue Feb 26 08:30:27 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- from http://ace-host.stuart.id.au/russell/files/debian/sarge/kernel-patch-linuxabi/kernel-patch-linuxabi_20060404.tar.gz
for kernel 2.6.16

---- Files affected:
SOURCES:
   linuxabi-2.6.16-0.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linuxabi-2.6.16-0.patch
diff -u /dev/null SOURCES/linuxabi-2.6.16-0.patch:1.1
--- /dev/null	Tue Feb 26 09:30:27 2008
+++ SOURCES/linuxabi-2.6.16-0.patch	Tue Feb 26 09:30:22 2008
@@ -0,0 +1,28575 @@
+diff -Nur kernel-source-2.6.16.orig/abi/cxenix/Makefile kernel-source-2.6.16/abi/cxenix/Makefile
+--- kernel-source-2.6.16.orig/abi/cxenix/Makefile	1970-01-01 10:00:00.000000000 +1000
++++ kernel-source-2.6.16/abi/cxenix/Makefile	2006-04-27 18:50:24.000000000 +1000
+@@ -0,0 +1,7 @@
++
++abi-cxenix-objs	:= sysent.o misc.o stubs.o signal.o pathconf.o utsname.o
++
++obj-$(CONFIG_ABI_SCO)	+= abi-cxenix.o
++
++abi-cxenix.o: $(abi-cxenix-objs)
++	$(LD) -r -o $@ $(abi-cxenix-objs)
+diff -Nur kernel-source-2.6.16.orig/abi/cxenix/misc.c kernel-source-2.6.16/abi/cxenix/misc.c
+--- kernel-source-2.6.16.orig/abi/cxenix/misc.c	1970-01-01 10:00:00.000000000 +1000
++++ kernel-source-2.6.16/abi/cxenix/misc.c	2006-04-27 18:50:24.000000000 +1000
+@@ -0,0 +1,294 @@
++/*
++ * misc.c - misc cxenix() subcalls
++ *
++ * Copyright (c) 1993,1994 Drew Sullivan
++ * Copyright (c) 1994-1996 Mike Jagdis
++ */
++
++#ident "%W% %G%"
++
++#include <linux/types.h>
++#include <linux/module.h>
++#include <linux/errno.h>
++#include <linux/kernel.h>
++#include <linux/unistd.h>
++#include <linux/ptrace.h>
++#include <linux/fcntl.h>
++#include <linux/time.h>
++#include <linux/signal.h>
++#include <linux/syscalls.h>
++#include <linux/termios.h>
++#include <asm/uaccess.h>
++
++#include <abi/util/trace.h>
++#include <abi/util/sysent.h>
++#include <abi/svr4/sigaction.h>
++
++
++struct timeb {
++	time_t	time;
++	u_short	millitm;
++	short	timezone;
++	short	dstflag;
++};
++
++enum {
++	XF_UNLCK =	0,
++	XF_WRLCK =	1,
++	XF_RDLCK =	3,
++};
++
++struct ibcs_flock {
++	short l_type;
++	short l_whence;
++	off_t l_start;
++	off_t l_len;
++	short l_sysid;
++	short l_pid;
++};
++
++
++/*
++ * locking() requires mandatory locking. Processes that attempt to
++ * read or write a region locked with locking() are required to block.
++ * You need to build a kernel with mandatory locking support and set
++ * the permissions on the required file to setgid, no group execute.
++ */
++int
++xnx_locking(int fd, int mode, unsigned long size)
++{
++	struct flock fl;
++	mm_segment_t old_fs;
++	int error;
++
++	if ((mode < 0 || mode > 7) && mode != 20) {
++#if defined(CONFIG_ABI_TRACE)
++		abi_trace(ABI_TRACE_API,
++				"unsupported locking() mode=0x%x\n", mode);
++#endif
++		return -EINVAL;
++	}
++
++	/*
++	 * Modes 5, 6 & 7 are very like the fcntl mechanism but
++	 * we can't just punt to that because the type values are
++	 * different.
++	 */
++	if (mode > 4 && mode < 8) {
++		struct ibcs_flock *ifl = (struct ibcs_flock *)size;
++		short t;
++
++		if (!access_ok(VERIFY_READ, ifl, sizeof(*ifl)))
++			return -EFAULT;
++
++		get_user(t, &ifl->l_type);
++		switch (t) {
++			case XF_UNLCK:	t = F_UNLCK; break;
++			case XF_WRLCK:	t = F_WRLCK; break;
++			case XF_RDLCK:	t = F_RDLCK; break;
++			default:	return -EINVAL;
++		}
++		put_user(t, &ifl->l_type);
++
++		error = sys_fcntl(fd, mode, (u_long)ifl);
++
++		get_user(t, &ifl->l_type);
++		switch (t) {
++			case F_UNLCK:	t = XF_UNLCK; break;
++			case F_WRLCK:	t = XF_WRLCK; break;
++			case F_RDLCK:	t = XF_RDLCK; break;
++		}
++		put_user(t, &ifl->l_type);
++
++		get_user(t, &ifl->l_sysid);
++		put_user(t, &ifl->l_pid);
++		put_user(0, &ifl->l_sysid);
++		return error;
++	}
++
++	fl.l_type = (mode == 0 ? F_UNLCK
++			: ((mode <= 2 || mode == 20) ? F_WRLCK
++			: F_RDLCK));
++	fl.l_whence = 1;
++	fl.l_start = 0;
++	fl.l_len = size;
++
++	old_fs = get_fs();
++	set_fs (get_ds());
++	error = sys_fcntl(fd, (mode == 5) ? F_GETLK
++			: (!(mode % 2) ? F_SETLK : F_SETLKW), (u_long)&fl);
++	set_fs(old_fs);
++	return error;
++}
++
++
++/* Check if input is available */
++int
++xnx_rdchk(int fd)
++{
++	int error, nbytes;
++	mm_segment_t old_fs;
++
++	old_fs = get_fs();
++	set_fs (get_ds());
++	error = sys_ioctl(fd, FIONREAD, (long)&nbytes);
++	set_fs(old_fs);
++
++	if (error < 0) return error;
++	return nbytes ? 1 : 0;
++}
++
++/*
++ * Linux has a stub sys_ftime. Perhaps this should be there? On the other
++ * hand it's an old call that probably shouldn't be used by most modern
++ * applications so perhaps it's better here where it needn't bloat the
++ * base kernel.
++ */
++int
++xnx_ftime(struct timeb *tp)
++{
++	struct timeval tv;
++	struct timezone tz;
++	int error;
++	mm_segment_t old_fs;
++
++	if (!access_ok(VERIFY_WRITE, tp, sizeof(struct timeb)))
++		return -EFAULT;
++
++	old_fs = get_fs();
++	set_fs (get_ds());
++	error = sys_gettimeofday(&tv, &tz);
++	set_fs(old_fs);
++	if (error)
++		return error;
++
++	put_user(tv.tv_sec, &tp->time);
++	put_user((unsigned short)(tv.tv_usec/1000), &tp->millitm);
++	put_user((short)tz.tz_minuteswest, &tp->timezone);
++	put_user((short)tz.tz_dsttime, &tp->dstflag);
++
++	return 0;
++}
++
++#define USE_NEW_NAP_CODE
++
++#ifndef USE_NEW_NAP_CODE
++static __inline __sighandler_t
++sigaction(int sig, __sighandler_t handler)
++{
++	struct k_sigaction *k = &current->sighand->action[sig-1];
++	__sighandler_t old_handler;
++
++	spin_lock(&current->sighand->siglock);
++	old_handler = k->sa.sa_handler;
++	k->sa.sa_handler = handler;
++	spin_unlock(&current->sighand->siglock);
++
++	return old_handler;
++}
++#endif
++
++/* go to sleep for period milliseconds */
++/* - returns either an EINTR error or returns the elapsed time */
++/* Note:
++   for SCO OpenServer 5.0.6 the original nap was fixed so that it
++   no longer waits a minimum of 2 tick (20ms)
++   but fewer time with a 10 ms granularity */
++long
++xnx_nap(long period)
++{
++#ifdef USE_NEW_NAP_CODE
++	// Hz means the number of jiffies per second.
++	// the below code needs HZ to be 1 <= HZ <= 1000
++	// in order to work correctly in any case.
++#if HZ > 1000
++#error this code only works with HZ <= 1000
++#endif
++	struct timeval tv1, tv2;
++	struct timezone tz;
++	mm_segment_t oldfs;
++	long period_s; // seconds part
++	long period_ms_hz; // milli seconds part, scaled to a base of HZ
++	long period_j; // jiffies
++
++	if (!period)
++		return 0; // zereo request, zero reply
++
++	oldfs = get_fs();
++	set_fs(get_ds());
++	sys_gettimeofday(&tv1, &tz);
++
++	period_s = period / 1000;
++	period_ms_hz = (period - period_s * 1000) * HZ;
++	period_j = period_s * HZ + period_ms_hz / 1000;
++	// take care of rounding errors, round up
++	if (period > period_j * (1000 / HZ)) period_j++;
++
++	set_current_state(TASK_INTERRUPTIBLE);
++	schedule_timeout (period_j);
++
++	sys_gettimeofday(&tv2, &tz);
++	set_fs(oldfs);
++
++	if (signal_pending(current))
++		return -EINTR; // interrupted
++	return (tv2.tv_sec - tv1.tv_sec) * 1000
++		+ (tv2.tv_usec - tv1.tv_usec + 500) / 1000;
++#else
++	__sighandler_t old_handler;
++	struct itimerval it;
++	struct timeval tv1, tv2;
++	struct timezone tz;
++	mm_segment_t oldfs;
++
++	if (!period)
++		return 0;
++
++	it.it_interval.tv_sec = 0;
++	it.it_interval.tv_usec = 0;
++	it.it_value.tv_sec = 0;
++	it.it_value.tv_usec = period * 1000;
++
++	oldfs = get_fs();
++	set_fs(get_ds());
++
++	sys_gettimeofday(&tv1, &tz);
++	old_handler = sigaction(SIGALRM, SIG_DFL); // SIG_DFL -> terminate
++	sys_setitimer(ITIMER_REAL, &it, NULL);
++	sys_pause();
++	sigaction(SIGALRM, old_handler);
++	sys_gettimeofday(&tv2, &tz);
++	set_fs(oldfs);
++
++	deactivate_signal(current, SIGALRM);
++
++	if (signal_pending(current))
++		return -EINTR;
++	return ((tv2.tv_sec - tv1.tv_sec) * 1000000
++			+ (tv2.tv_usec - tv1.tv_usec)) / 1000;
++#endif
++}
++
++/*
++ * eaccess() checks access to the given path using the effective
++ * uid/gid rather than the real uid/gid.
++ */
++int
++xnx_eaccess(char *path, int mode)
++{
++	uid_t		ouid;
++	gid_t		ogid;
++	int		err;
++
++	ouid = current->uid;
++	ogid = current->gid;
++	current->uid = current->euid;
++	current->gid = current->egid;
++
++	err = sys_access(path, mode);
++
++	current->uid = ouid;
++	current->gid = ogid;
++
++	return err;
++}
+diff -Nur kernel-source-2.6.16.orig/abi/cxenix/pathconf.c kernel-source-2.6.16/abi/cxenix/pathconf.c
+--- kernel-source-2.6.16.orig/abi/cxenix/pathconf.c	1970-01-01 10:00:00.000000000 +1000
++++ kernel-source-2.6.16/abi/cxenix/pathconf.c	2006-04-27 18:50:24.000000000 +1000
+@@ -0,0 +1,140 @@
++/*
++ * pathconf.c - support for xenix pathconf
++ *
++ * Copyright (c) 1993,1994 Drew Sullivan
++ * Copyright (c) 1994-1996 Mike Jagdis
++ */
++
++#ident "%W% %G%"
++
++#include <linux/errno.h>
++#include <linux/fs.h>
++#include <linux/slab.h>
++#include <linux/sched.h>
++#include <linux/unistd.h>
++#include <linux/syscalls.h>
++#include <linux/statfs.h>
++#include <asm/uaccess.h>
++
++
++enum {
++	_PC_LINK_MAX =		0,
++	_PC_MAX_CANON =		1,
++	_PC_MAX_INPUT =		2,
++	_PC_NAME_MAX =		3,
++	_PC_PATH_MAX =		4,
++	_PC_PIPE_BUF =		5,
++	_PC_CHOWN_RESTRICTED =	6,
++	_PC_NO_TRUNC =		7,
++	_PC_VDISABLE =		8,
++};
++
++static int
++xnx_name_max(char *path)
++{
++	struct statfs		stf;
++	mm_segment_t		fs;
++	char			*p;
++	int			error;
++
++	p = getname(path);
++	if (IS_ERR(p))
++		return PTR_ERR(p);
++
++	fs = get_fs();
++	set_fs(get_ds());
++	error = sys_statfs(p, &stf);
++	set_fs(fs);
++
++	putname(p);
++	if (error)
++		return (error);
++	return (stf.f_namelen);
++}
++
++int
++xnx_pathconf(char *path, int name)
++{
++	switch (name) {
++	case _PC_LINK_MAX:
++		/*
++		 * Although Linux headers define values on a per
++		 * filesystem basis there is no way to access
++		 * these without hard coding fs information here
++		 * so for now we use a bogus value.
++		 */
++		return LINK_MAX;
++	case _PC_MAX_CANON:
++		return MAX_CANON;
++	case _PC_MAX_INPUT:
++		return MAX_INPUT;
++	case _PC_PATH_MAX:
++		return PATH_MAX;
++	case _PC_PIPE_BUF:
++		return PIPE_BUF;
++	case _PC_CHOWN_RESTRICTED:
++		/*
++		 * We should really think about this and tell
++		 * the truth.
++		 */
++		return 0;
++	case _PC_NO_TRUNC:
++		/* Not sure... It could be fs dependent? */
++		return 1;
++	case _PC_VDISABLE:
++		return 1;
++	case _PC_NAME_MAX:
++		return xnx_name_max(path);
++	}
++	return -EINVAL;
++}
++
++int
++xnx_fpathconf(int fildes, int name)
++{
++	switch (name) {
++	case _PC_LINK_MAX:
++		/*
++		 * Although Linux headers define values on a per
++		 * filesystem basis there is no way to access
++		 * these without hard coding fs information here
++		 * so for now we use a bogus value.
++		 */
++		return LINK_MAX;
++	case _PC_MAX_CANON:
++		return MAX_CANON;
++	case _PC_MAX_INPUT:
++		return MAX_INPUT;
++	case _PC_PATH_MAX:
++		return PATH_MAX;
++	case _PC_PIPE_BUF:
++		return PIPE_BUF;
++	case _PC_CHOWN_RESTRICTED:
++		/*
++		 * We should really think about this and tell
++		 * the truth.
++		 */
++		return 0;
++	case _PC_NO_TRUNC:
++		/* Not sure... It could be fs dependent? */
++		return 1;
++	case _PC_VDISABLE:
++		return 1;
++	case _PC_NAME_MAX:
++		{
++			struct statfs buf;
++			int error;
++			mm_segment_t old_fs;
++
++			old_fs = get_fs();
++			set_fs (get_ds());
++			error = sys_fstatfs(fildes, &buf);
++			set_fs(old_fs);
++			if (!error)
++				return buf.f_namelen;
++			return error;
++		}
++	}
++
++	return -EINVAL;
++}
+diff -Nur kernel-source-2.6.16.orig/abi/cxenix/signal.c kernel-source-2.6.16/abi/cxenix/signal.c
+--- kernel-source-2.6.16.orig/abi/cxenix/signal.c	1970-01-01 10:00:00.000000000 +1000
++++ kernel-source-2.6.16/abi/cxenix/signal.c	2006-04-27 18:50:24.000000000 +1000
+@@ -0,0 +1,88 @@
++#ident "%W% %G%"
++
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/personality.h>
++#include <linux/sched.h>
++#define __KERNEL_SYSCALLS__
++#include <linux/unistd.h>
++#include <asm/uaccess.h>
++
++#include <abi/cxenix/signal.h>
++#include <abi/signal.h>
++
++#include <abi/util/map.h>
++#include <abi/util/sysent.h>
++
++
++int
++xnx_sigaction(int sco_signum, const struct sco_sigaction *action,
++		struct sco_sigaction *oldaction)
++{
++	struct sco_sigaction	new_sa, old_sa;
++	struct sigaction	nsa, osa;
++	mm_segment_t		fs;
++	int			error, signo;
++
++	if (sco_signum >= NSIGNALS)
++		return -EINVAL;
++	signo = current_thread_info()->exec_domain->signal_map[sco_signum];
++
++	if (oldaction) {
++		if (!access_ok(VERIFY_WRITE, oldaction,
++				sizeof(struct sco_sigaction)))
++			return -EFAULT;
++	}
++
++	if (action) {
++		error = copy_from_user(&new_sa, action,
++				sizeof(struct sco_sigaction));
++		if (error)
++			return -EFAULT;
++		nsa.sa_restorer = NULL;
++		nsa.sa_handler = new_sa.sa_handler;
++		nsa.sa_mask = map_sigvec_to_kernel(new_sa.sa_mask,
++			current_thread_info()->exec_domain->signal_map);
++		nsa.sa_flags = SA_NOMASK;
++		if (new_sa.sa_flags & SCO_SA_NOCLDSTOP)
++			nsa.sa_flags |= SA_NOCLDSTOP;
++	}
++
++	fs = get_fs();
++	set_fs(get_ds());
++	error = sys_rt_sigaction(signo, action ? &nsa : NULL,
++			oldaction ? &osa : NULL, sizeof(sigset_t));
++	set_fs(fs);
++
++	if (error || !oldaction)
++		return (error);
++
++	old_sa.sa_handler = osa.sa_handler;
++	old_sa.sa_mask = map_sigvec_from_kernel(osa.sa_mask,
++			current_thread_info()->exec_domain->signal_invmap);
++	old_sa.sa_flags = 0;
++	if (osa.sa_flags & SA_NOCLDSTOP)
++		old_sa.sa_flags |= SCO_SA_NOCLDSTOP;
++
++	if (copy_to_user(oldaction, &old_sa, sizeof(struct sco_sigaction)))
++		return -EFAULT;
++	return 0;
++}
++
++int
++xnx_sigpending(u_long *setp)
++{
++	sigset_t		lxpending;
++	u_long			pending;
++
++	spin_lock_irq(&current->sighand->siglock);
++	sigandsets(&lxpending, &current->blocked, &current->pending.signal);
++	spin_unlock_irq(&current->sighand->siglock);
++
++	pending = map_sigvec_from_kernel(lxpending,
++			current_thread_info()->exec_domain->signal_invmap);
++
++	if (copy_to_user(setp, &pending, sizeof(u_long)))
++		return -EFAULT;
++	return 0;
++}
+diff -Nur kernel-source-2.6.16.orig/abi/cxenix/stubs.c kernel-source-2.6.16/abi/cxenix/stubs.c
+--- kernel-source-2.6.16.orig/abi/cxenix/stubs.c	1970-01-01 10:00:00.000000000 +1000
++++ kernel-source-2.6.16/abi/cxenix/stubs.c	2006-04-27 18:50:24.000000000 +1000
+@@ -0,0 +1,123 @@
++/*
++ * stubs.c - stubs for unimplemented cxenix subcalls
++ *
++ * Copyright (c) 1993,1994 Drew Sullivan.
++ * Copyright (c) 1994-1996 Mike Jagdis.
++ */
++
++#ident "%W% %G%"
++
++#include <linux/errno.h>
++#include <linux/types.h>
++#include <linux/ptrace.h>
++
++#include <abi/cxenix/sysent.h>
++
++
++int
++xnx_creatsem(char *sem_name, int mode)
++{
++	return -EPERM;
++}
++
++int
++xnx_opensem(char *sem_name)
++{
++	return -EPERM;
++}
++
++int
++xnx_sigsem(int sem_num)
++{
++	return -EPERM;
++}
++
++int
++xnx_waitsem(int sem_num)
++{
++	return -EPERM;
++}
++
++int
++xnx_nbwaitsem(int sem_num)
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list