public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Brian F. G. Bidulock" <bidulock@openss7.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Re: export of sys_call_table
Date: Tue, 8 Oct 2002 16:20:17 -0600	[thread overview]
Message-ID: <20021008162017.A11261@openss7.org> (raw)
In-Reply-To: <20021004.153804.94857396.davem@redhat.com>; from davem@redhat.com on Fri, Oct 04, 2002 at 03:38:04PM -0700

Following is a tested patch for i386 architecture for registration
of putpmsg and getpmsg system calls.  This version (courtesy of
Dave Grothe at GCOM) uses up/down semaphore instead of read/write
spinlocks.  The patch is against 2.4.19 but should apply up and
down a ways as well.

--brian

--- arch/i386/kernel/entry.S.orig	2002-09-04 10:54:01.000000000 -0500
+++ arch/i386/kernel/entry.S	2002-10-08 11:39:14.000000000 -0500
@@ -586,8 +586,8 @@
 	.long SYMBOL_NAME(sys_capset)           /* 185 */
 	.long SYMBOL_NAME(sys_sigaltstack)
 	.long SYMBOL_NAME(sys_sendfile)
-	.long SYMBOL_NAME(sys_ni_syscall)		/* streams1 */
-	.long SYMBOL_NAME(sys_ni_syscall)		/* streams2 */
+	.long SYMBOL_NAME(sys_getpmsg)		/* streams1 */
+	.long SYMBOL_NAME(sys_putpmsg)		/* streams2 */
 	.long SYMBOL_NAME(sys_vfork)            /* 190 */
 	.long SYMBOL_NAME(sys_getrlimit)
 	.long SYMBOL_NAME(sys_mmap2)
--- kernel/ksyms.c.orig	2002-09-04 10:54:06.000000000 -0500
+++ kernel/ksyms.c	2002-10-08 11:39:14.000000000 -0500
@@ -541,6 +541,11 @@
 EXPORT_SYMBOL(seq_lseek);
 extern int disable_all_usb;
 EXPORT_SYMBOL(disable_all_usb);
+extern void register_streams_calls(int (*putpmsg) (int,void *,void *,int,int),
+			    int (*getpmsg) (int,void *,void *,int,int));
+extern void unregister_streams_calls(void);
+EXPORT_SYMBOL(register_streams_calls);
+EXPORT_SYMBOL(unregister_streams_calls);
 
 /* Program loader interfaces */
 EXPORT_SYMBOL(setup_arg_pages);
--- kernel/sys.c.orig	2002-09-04 10:54:01.000000000 -0500
+++ kernel/sys.c	2002-10-08 11:39:14.000000000 -0500
@@ -168,6 +168,45 @@
 	return notifier_chain_unregister(&reboot_notifier_list, nb);
 }
 
+static int (*do_putpmsg) (int, void *, void *, int, int) = NULL;
+static int (*do_getpmsg) (int, void *, void *, int, int) = NULL;
+
+static rwlock_t streams_call_lock = RW_LOCK_UNLOCKED;
+
+long asmlinkage sys_putpmsg(int fd, void *ctlptr, void *datptr, int band, int flags)
+{
+	int ret = -ENOSYS;
+	read_lock(&streams_call_lock);
+	if (do_putpmsg)
+		ret = (*do_putpmsg) (fd, ctlptr, datptr, band, flags);
+	read_unlock(&streams_call_lock);
+	return ret;
+}
+
+long asmlinkage sys_getpmsg(int fd, void *ctlptr, void *datptr, int band, int flags)
+{
+	int ret = -ENOSYS;
+	read_lock(&streams_call_lock);
+	if (do_getpmsg)
+		ret = (*do_getpmsg) (fd, ctlptr, datptr, band, flags);
+	read_unlock(&streams_call_lock);
+	return ret;
+}
+
+void register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
+			    int (*getpmsg) (int, void *, void *, int, int))
+{
+	write_lock(&streams_call_lock);
+	do_putpmsg = putpmsg;
+	do_getpmsg = getpmsg;
+	write_unlock(&streams_call_lock);
+}
+
+void unregister_streams_calls(void)
+{
+	register_streams_calls(NULL, NULL);
+}
+
 asmlinkage long sys_ni_syscall(void)
 {
 	return -ENOSYS;


  reply	other threads:[~2002-10-08 22:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20021003153943.E22418@openss7.org.suse.lists.linux.kernel>
     [not found] ` <1033682560.28850.32.camel@irongate.swansea.linux.org.uk.suse.lists.linux.kernel>
     [not found]   ` <20021003170608.A30759@openss7.org.suse.lists.linux.kernel>
     [not found]     ` <1033722612.1853.1.camel@localhost.localdomain.suse.lists.linux.kernel>
     [not found]       ` <20021004051932.A13743@openss7.org.suse.lists.linux.kernel>
2002-10-04 13:01         ` export of sys_call_table Andi Kleen
2002-10-04 13:11           ` Brian F. G. Bidulock
2002-10-04 13:15             ` Andi Kleen
2002-10-04 13:22               ` Brian F. G. Bidulock
2002-10-04 14:11                 ` Andi Kleen
2002-10-04 14:31                   ` Brian F. G. Bidulock
     [not found] ` <20021003221525.GA2221@kroah.com.suse.lists.linux.kernel>
     [not found]   ` <20021003222716.GB14919@suse.de.suse.lists.linux.kernel>
     [not found]     ` <1033684027.1247.43.camel@phantasy.suse.lists.linux.kernel>
     [not found]       ` <20021003233504.GA20570@suse.de.suse.lists.linux.kernel>
     [not found]         ` <20021003235022.GA82187@compsoc.man.ac.uk.suse.lists.linux.kernel>
     [not found]           ` <mailman.1033691043.6446.linux-kernel2news@redhat.com.suse.lists.linux.kernel>
     [not found]             ` <200210040403.g9443Vu03329@devserv.devel.redhat.com.suse.lists.linux.kernel>
     [not found]               ` <20021003233221.C31444@openss7.org.suse.lists.linux.kernel>
     [not found]                 ` <20021004133657.B17216@devserv.devel.redhat.com.suse.lists.linux.kernel>
2002-10-04 18:14                   ` Andi Kleen
2002-10-04 18:46                     ` Alan Cox
2002-10-04 18:45                       ` Alexander Viro
2002-10-04 19:15                       ` Brian F. G. Bidulock
2002-10-04 19:26                         ` Andi Kleen
2002-10-04 19:37                         ` Pete Zaitcev
2002-10-04 20:17                           ` (off-list) Mail headers (was: Re: export of sys_call_table) Sean Neakums
2002-10-04 20:33                             ` Sean Neakums
2002-10-04 19:43                         ` export of sys_call_table Robert Love
2002-10-04 22:21                         ` David S. Miller
2002-10-04 22:41                           ` Brian F. G. Bidulock
2002-10-04 22:38                             ` David S. Miller
2002-10-08 22:20                               ` Brian F. G. Bidulock [this message]
2002-10-08 22:27                                 ` [PATCH] " Brian F. G. Bidulock
2002-10-08 23:39                                   ` David S. Miller
2002-10-08 23:18                                 ` David S. Miller
2002-10-09  0:21                                   ` Brian F. G. Bidulock
2002-10-09  0:00                                 ` Robert Love
     [not found]                               ` <mailman.1034119380.19047.linux-kernel2news@redhat.com>
2002-10-09  0:30                                 ` Pete Zaitcev
2002-10-09  0:40                                   ` Brian F. G. Bidulock
2002-10-09 12:20 Petr Vandrovec
2002-10-09 19:54 ` Brian F. G. Bidulock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021008162017.A11261@openss7.org \
    --to=bidulock@openss7.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox