[PATCH] Re: export of sys_call_table

From: Brian F. G. Bidulock (bidulock@openss7.org)
Date: Tue Oct 08 2002 - 17:20:17 EST


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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:28 EST