public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Re: export of sys_call_table
  2002-10-04 22:38     ` David S. Miller
@ 2002-10-08 22:20       ` Brian F. G. Bidulock
  2002-10-08 22:27         ` Brian F. G. Bidulock
                           ` (2 more replies)
       [not found]       ` <mailman.1034119380.19047.linux-kernel2news@redhat.com>
  1 sibling, 3 replies; 11+ messages in thread
From: Brian F. G. Bidulock @ 2002-10-08 22:20 UTC (permalink / raw)
  To: linux-kernel

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;


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-08 22:20       ` [PATCH] " Brian F. G. Bidulock
@ 2002-10-08 22:27         ` Brian F. G. Bidulock
  2002-10-08 23:39           ` David S. Miller
  2002-10-08 23:18         ` David S. Miller
  2002-10-09  0:00         ` Robert Love
  2 siblings, 1 reply; 11+ messages in thread
From: Brian F. G. Bidulock @ 2002-10-08 22:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: LiS

We are looking for volunteers to test the following patch for architectures
other than i386.  If you are running LiS on PPC or IA64 or any of these other
architectures, please test and sumbit the tested patch  for you architecture
back.  Thx.

--brian

Index: arch/alpha/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/alpha/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/alpha/kernel/entry.S
*** arch/alpha/kernel/entry.S	9 Nov 2001 21:45:35 -0000	1.1.3.1
--- arch/alpha/kernel/entry.S	4 Oct 2002 17:48:33 -0000
***************
*** 1148,1150 ****
--- 1148,1152 ----
  	.quad sys_gettid
  	.quad sys_readahead
  	.quad sys_ni_syscall			/* 380, sys_security */
+ 	.quad sys_getpmsg
+ 	.quad sys_putpmsg
Index: arch/arm/kernel/calls.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/arm/kernel/calls.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/arm/kernel/calls.S
*** arch/arm/kernel/calls.S	8 Oct 2001 17:39:18 -0000	1.1.3.1
--- arch/arm/kernel/calls.S	4 Oct 2002 18:24:18 -0000
***************
*** 202,209 ****
  /* 185 */	.long	SYMBOL_NAME(sys_capset)
  		.long	SYMBOL_NAME(sys_sigaltstack_wrapper)
  		.long	SYMBOL_NAME(sys_sendfile)
! 		.long	SYMBOL_NAME(sys_ni_syscall)
! 		.long	SYMBOL_NAME(sys_ni_syscall)
  /* 190 */	.long	SYMBOL_NAME(sys_vfork_wrapper)
  		.long	SYMBOL_NAME(sys_getrlimit)
  		.long	SYMBOL_NAME(sys_mmap2)
--- 202,209 ----
  /* 185 */	.long	SYMBOL_NAME(sys_capset)
  		.long	SYMBOL_NAME(sys_sigaltstack_wrapper)
  		.long	SYMBOL_NAME(sys_sendfile)
! 		.long	SYMBOL_NAME(sys_getpmsg)
! 		.long	SYMBOL_NAME(sys_putpmsg)
  /* 190 */	.long	SYMBOL_NAME(sys_vfork_wrapper)
  		.long	SYMBOL_NAME(sys_getrlimit)
  		.long	SYMBOL_NAME(sys_mmap2)
Index: arch/cris/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/cris/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/cris/kernel/entry.S
*** arch/cris/kernel/entry.S	25 Feb 2002 19:37:52 -0000	1.1.3.1
--- arch/cris/kernel/entry.S	4 Oct 2002 17:24:40 -0000
***************
*** 975,982 ****
  	.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_vfork)            /* 190 */
  	.long SYMBOL_NAME(sys_getrlimit)
  	.long SYMBOL_NAME(sys_mmap2)
--- 975,982 ----
  	.long SYMBOL_NAME(sys_capset)           /* 185 */
  	.long SYMBOL_NAME(sys_sigaltstack)
  	.long SYMBOL_NAME(sys_sendfile)
! 	.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)
Index: arch/i386/kernel/entry.S
Index: arch/ia64/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/ia64/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/ia64/kernel/entry.S
*** arch/ia64/kernel/entry.S	9 Nov 2001 22:26:17 -0000	1.1.3.1
--- arch/ia64/kernel/entry.S	4 Oct 2002 17:23:55 -0000
***************
*** 1101,1108 ****
  	data8 sys_capget			// 1185
  	data8 sys_capset
  	data8 sys_sendfile
! 	data8 sys_ni_syscall		// sys_getpmsg (STREAMS)
! 	data8 sys_ni_syscall		// sys_putpmsg (STREAMS)
  	data8 sys_socket			// 1190
  	data8 sys_bind
  	data8 sys_connect
--- 1101,1108 ----
  	data8 sys_capget			// 1185
  	data8 sys_capset
  	data8 sys_sendfile
! 	data8 sys_getpmsg		// sys_getpmsg (STREAMS)
! 	data8 sys_putpmsg		// sys_putpmsg (STREAMS)
  	data8 sys_socket			// 1190
  	data8 sys_bind
  	data8 sys_connect
Index: arch/m68k/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/m68k/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/m68k/kernel/entry.S
*** arch/m68k/kernel/entry.S	8 Oct 2001 17:39:18 -0000	1.1.3.1
--- arch/m68k/kernel/entry.S	4 Oct 2002 17:25:17 -0000
***************
*** 613,620 ****
  	.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_vfork)            /* 190 */
  	.long SYMBOL_NAME(sys_getrlimit)
  	.long SYMBOL_NAME(sys_mmap2)
--- 613,620 ----
  	.long SYMBOL_NAME(sys_capset)           /* 185 */
  	.long SYMBOL_NAME(sys_sigaltstack)
  	.long SYMBOL_NAME(sys_sendfile)
! 	.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)
Index: arch/mips/kernel/syscalls.h
===================================================================
RCS file: /home/common/cvsroot/linux/arch/mips/kernel/syscalls.h,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/mips/kernel/syscalls.h
*** arch/mips/kernel/syscalls.h	8 Oct 2001 17:39:18 -0000	1.1.3.1
--- arch/mips/kernel/syscalls.h	4 Oct 2002 17:31:26 -0000
***************
*** 222,229 ****
  SYS(sys_capset, 2)				/* 4205 */
  SYS(sys_sigaltstack, 0)
  SYS(sys_sendfile, 3)
! SYS(sys_ni_syscall, 0)
! SYS(sys_ni_syscall, 0)
  SYS(sys_mmap2, 6)				/* 4210 */
  SYS(sys_truncate64, 2)
  SYS(sys_ftruncate64, 2)
--- 222,229 ----
  SYS(sys_capset, 2)				/* 4205 */
  SYS(sys_sigaltstack, 0)
  SYS(sys_sendfile, 3)
! SYS(sys_getpmsg, 5)
! SYS(sys_putpmsg, 5)
  SYS(sys_mmap2, 6)				/* 4210 */
  SYS(sys_truncate64, 2)
  SYS(sys_ftruncate64, 2)
Index: arch/mips64/kernel/scall_64.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/mips64/kernel/scall_64.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/mips64/kernel/scall_64.S
*** arch/mips64/kernel/scall_64.S	8 Oct 2001 17:39:18 -0000	1.1.3.1
--- arch/mips64/kernel/scall_64.S	4 Oct 2002 18:26:01 -0000
***************
*** 341,348 ****
  	PTR	sys_capset				/* 5205 */
  	PTR	sys_sigaltstack
  	PTR	sys_sendfile
! 	PTR	sys_ni_syscall
! 	PTR	sys_ni_syscall
  	PTR	sys_pivot_root				/* 5210 */
  	PTR	sys_mincore
  	PTR	sys_madvise
--- 341,348 ----
  	PTR	sys_capset				/* 5205 */
  	PTR	sys_sigaltstack
  	PTR	sys_sendfile
! 	PTR	sys_getpmsg
! 	PTR	sys_putpmsg
  	PTR	sys_pivot_root				/* 5210 */
  	PTR	sys_mincore
  	PTR	sys_madvise
Index: arch/parisc/kernel/syscall.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/parisc/kernel/syscall.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/parisc/kernel/syscall.S
*** arch/parisc/kernel/syscall.S	8 Oct 2001 17:39:18 -0000	1.1.3.1
--- arch/parisc/kernel/syscall.S	4 Oct 2002 17:37:11 -0000
***************
*** 550,557 ****
  	/***************/
  	/* struct shmid_ds contains pointers */
  	ENTRY_UHOH(shmctl)		/* 195 */
! 	ENTRY_SAME(ni_syscall)		/* streams1 */
! 	ENTRY_SAME(ni_syscall)		/* streams2 */
  
  .end
  
--- 550,557 ----
  	/***************/
  	/* struct shmid_ds contains pointers */
  	ENTRY_UHOH(shmctl)		/* 195 */
! 	ENTRY_SAME(getpmsg)		/* streams1 */
! 	ENTRY_SAME(putpmsg)		/* streams2 */
  
  .end
  
Index: arch/ppc/kernel/misc.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/ppc/kernel/misc.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/ppc/kernel/misc.S
*** arch/ppc/kernel/misc.S	25 Feb 2002 19:37:55 -0000	1.1.3.1
--- arch/ppc/kernel/misc.S	4 Oct 2002 17:38:36 -0000
***************
*** 1101,1108 ****
  	.long sys_capset
  	.long sys_sigaltstack	/* 185 */
  	.long sys_sendfile
! 	.long sys_ni_syscall		/* streams1 */
! 	.long sys_ni_syscall		/* streams2 */
  	.long sys_vfork
  	.long sys_getrlimit	/* 190 */
  	.long sys_readahead
--- 1101,1108 ----
  	.long sys_capset
  	.long sys_sigaltstack	/* 185 */
  	.long sys_sendfile
! 	.long sys_getpmsg		/* streams1 */
! 	.long sys_putpmsg		/* streams2 */
  	.long sys_vfork
  	.long sys_getrlimit	/* 190 */
  	.long sys_readahead
Index: arch/s390/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/s390/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/s390/kernel/entry.S
*** arch/s390/kernel/entry.S	25 Feb 2002 19:37:56 -0000	1.1.3.1
--- arch/s390/kernel/entry.S	4 Oct 2002 17:39:16 -0000
***************
*** 563,570 ****
          .long  sys_capset                /* 185 */
          .long  sys_sigaltstack_glue
          .long  sys_sendfile
!         .long  sys_ni_syscall            /* streams1 */
!         .long  sys_ni_syscall            /* streams2 */
          .long  sys_vfork_glue            /* 190 */
          .long  sys_getrlimit
  	.long  sys_mmap2
--- 563,570 ----
          .long  sys_capset                /* 185 */
          .long  sys_sigaltstack_glue
          .long  sys_sendfile
!         .long  sys_getpmsg            /* streams1 */
!         .long  sys_putpmsg            /* streams2 */
          .long  sys_vfork_glue            /* 190 */
          .long  sys_getrlimit
  	.long  sys_mmap2
Index: arch/s390x/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/s390x/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/s390x/kernel/entry.S
*** arch/s390x/kernel/entry.S	25 Feb 2002 19:37:56 -0000	1.1.3.1
--- arch/s390x/kernel/entry.S	4 Oct 2002 17:44:03 -0000
***************
*** 596,603 ****
          .long  SYSCALL(sys_capset,sys32_capset_wrapper)         /* 185 */
          .long  SYSCALL(sys_sigaltstack_glue,sys32_sigaltstack_glue)
          .long  SYSCALL(sys_sendfile,sys32_sendfile_wrapper)
!         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* streams1 */
!         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* streams2 */
          .long  SYSCALL(sys_vfork_glue,sys_vfork_glue) /* 190 */
          .long  SYSCALL(sys_getrlimit,sys32_old_getrlimit_wrapper)
  	.long  SYSCALL(sys_mmap2,sys32_mmap2_wrapper)
--- 596,603 ----
          .long  SYSCALL(sys_capset,sys32_capset_wrapper)         /* 185 */
          .long  SYSCALL(sys_sigaltstack_glue,sys32_sigaltstack_glue)
          .long  SYSCALL(sys_sendfile,sys32_sendfile_wrapper)
!         .long  SYSCALL(sys_getpmsg,sys_getpmsg) /* streams1 */
!         .long  SYSCALL(sys_putpmsg,sys_putpmsg) /* streams2 */
          .long  SYSCALL(sys_vfork_glue,sys_vfork_glue) /* 190 */
          .long  SYSCALL(sys_getrlimit,sys32_old_getrlimit_wrapper)
  	.long  SYSCALL(sys_mmap2,sys32_mmap2_wrapper)
Index: arch/sh/kernel/entry.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/sh/kernel/entry.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/sh/kernel/entry.S
*** arch/sh/kernel/entry.S	8 Oct 2001 17:39:18 -0000	1.1.3.1
--- arch/sh/kernel/entry.S	4 Oct 2002 18:27:09 -0000
***************
*** 1264,1271 ****
  	.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_vfork)            /* 190 */
  	.long SYMBOL_NAME(sys_getrlimit)
  	.long SYMBOL_NAME(sys_mmap2)
--- 1264,1271 ----
  	.long SYMBOL_NAME(sys_capset)           /* 185 */
  	.long SYMBOL_NAME(sys_sigaltstack)
  	.long SYMBOL_NAME(sys_sendfile)
! 	.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)
Index: arch/sparc/kernel/systbls.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/sparc/kernel/systbls.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/sparc/kernel/systbls.S
*** arch/sparc/kernel/systbls.S	21 Oct 2001 17:36:54 -0000	1.1.3.1
--- arch/sparc/kernel/systbls.S	4 Oct 2002 18:37:31 -0000
***************
*** 48,54 ****
  /*135*/	.long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
  /*140*/	.long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_gettid, sys_getrlimit
  /*145*/	.long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
! /*150*/	.long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
  /*155*/	.long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
  /*160*/	.long sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
  /*165*/	.long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
--- 48,54 ----
  /*135*/	.long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
  /*140*/	.long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_gettid, sys_getrlimit
  /*145*/	.long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
! /*150*/	.long sys_nis_syscall, sys_getpmsg, sys_putpmsg, sys_poll, sys_getdents64
  /*155*/	.long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
  /*160*/	.long sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
  /*165*/	.long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
***************
*** 129,135 ****
  	.long sunos_gethostid, sunos_nosys, sys_getrlimit
  	.long sys_setrlimit, sunos_killpg, sunos_nosys
  	.long sunos_nosys, sunos_nosys
! /*150*/	.long sys_getsockname, sunos_nosys, sunos_nosys
  	.long sys_poll, sunos_nosys, sunos_nosys
  	.long sunos_getdirentries, sys_statfs, sys_fstatfs
  	.long sys_oldumount, sunos_nosys, sunos_nosys
--- 129,135 ----
  	.long sunos_gethostid, sunos_nosys, sys_getrlimit
  	.long sys_setrlimit, sunos_killpg, sunos_nosys
  	.long sunos_nosys, sunos_nosys
! /*150*/	.long sys_getsockname, sys_getpmsg, sys_putpmsg
  	.long sys_poll, sunos_nosys, sunos_nosys
  	.long sunos_getdirentries, sys_statfs, sys_fstatfs
  	.long sys_oldumount, sunos_nosys, sunos_nosys
Index: arch/sparc64/kernel/systbls.S
===================================================================
RCS file: /home/common/cvsroot/linux/arch/sparc64/kernel/systbls.S,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 arch/sparc64/kernel/systbls.S
*** arch/sparc64/kernel/systbls.S	21 Oct 2001 17:36:54 -0000	1.1.3.1
--- arch/sparc64/kernel/systbls.S	4 Oct 2002 18:34:53 -0000
***************
*** 49,55 ****
  	.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64
  /*140*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_gettid, sys32_getrlimit
  	.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
! /*150*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
  	.word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
  /*160*/	.word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
  	.word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_nis_syscall
--- 49,55 ----
  	.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64
  /*140*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_gettid, sys32_getrlimit
  	.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
! /*150*/	.word sys_nis_syscall, sys_getpmsg, sys_putpmsg, sys_poll, sys_getdents64
  	.word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
  /*160*/	.word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
  	.word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_nis_syscall
***************
*** 108,114 ****
  	.word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_nis_syscall
  /*140*/	.word sys_nis_syscall, sys_getpeername, sys_nis_syscall, sys_gettid, sys_getrlimit
  	.word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
! /*150*/	.word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
  	.word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
  /*160*/	.word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_utrap_install
  	.word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
--- 108,114 ----
  	.word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_nis_syscall
  /*140*/	.word sys_nis_syscall, sys_getpeername, sys_nis_syscall, sys_gettid, sys_getrlimit
  	.word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
! /*150*/	.word sys_getsockname, sys_getpmsg, sys_putpmsg, sys_poll, sys_getdents64
  	.word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
  /*160*/	.word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_utrap_install
  	.word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
***************
*** 189,195 ****
  	.word sunos_gethostid, sunos_nosys, sys32_getrlimit
  	.word sys32_setrlimit, sunos_killpg, sunos_nosys
  	.word sunos_nosys, sunos_nosys
! /*150*/	.word sys_getsockname, sunos_nosys, sunos_nosys
  	.word sys_poll, sunos_nosys, sunos_nosys
  	.word sunos_getdirentries, sys32_statfs, sys32_fstatfs
  	.word sys_oldumount, sunos_nosys, sunos_nosys
--- 189,195 ----
  	.word sunos_gethostid, sunos_nosys, sys32_getrlimit
  	.word sys32_setrlimit, sunos_killpg, sunos_nosys
  	.word sunos_nosys, sunos_nosys
! /*150*/	.word sys_getsockname, sys_getpmsg, sys_putpmsg
  	.word sys_poll, sunos_nosys, sunos_nosys
  	.word sunos_getdirentries, sys32_statfs, sys32_fstatfs
  	.word sys_oldumount, sunos_nosys, sunos_nosys
Index: include/asm-alpha/unistd.h
===================================================================
RCS file: /home/common/cvsroot/linux/include/asm-alpha/unistd.h,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 include/asm-alpha/unistd.h
*** include/asm-alpha/unistd.h	9 Nov 2001 21:45:35 -0000	1.1.3.1
--- include/asm-alpha/unistd.h	4 Oct 2002 17:48:03 -0000
***************
*** 318,323 ****
--- 318,325 ----
  #define __NR_gettid			378
  #define __NR_readahead			379
  #define __NR_security			380 /* syscall for security modules */
+ #define __NR_getpmsg			381
+ #define __NR_putpmsg			382
  
  #if defined(__GNUC__)
  
Index: include/asm-arm/unistd.h
===================================================================
RCS file: /home/common/cvsroot/linux/include/asm-arm/unistd.h,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 include/asm-arm/unistd.h
*** include/asm-arm/unistd.h	12 Aug 2001 18:14:00 -0000	1.1.3.1
--- include/asm-arm/unistd.h	4 Oct 2002 18:24:15 -0000
***************
*** 206,213 ****
  #define __NR_capset			(__NR_SYSCALL_BASE+185)
  #define __NR_sigaltstack		(__NR_SYSCALL_BASE+186)
  #define __NR_sendfile			(__NR_SYSCALL_BASE+187)
! 					/* 188 reserved */
! 					/* 189 reserved */
  #define __NR_vfork			(__NR_SYSCALL_BASE+190)
  #define __NR_ugetrlimit			(__NR_SYSCALL_BASE+191)	/* SuS compliant getrlimit */
  #define __NR_mmap2			(__NR_SYSCALL_BASE+192)
--- 206,213 ----
  #define __NR_capset			(__NR_SYSCALL_BASE+185)
  #define __NR_sigaltstack		(__NR_SYSCALL_BASE+186)
  #define __NR_sendfile			(__NR_SYSCALL_BASE+187)
! #define __NR_getpmsg			(__NR_SYSCALL_BASE+188)
! #define __NR_putpmsg			(__NR_SYSCALL_BASE+189)
  #define __NR_vfork			(__NR_SYSCALL_BASE+190)
  #define __NR_ugetrlimit			(__NR_SYSCALL_BASE+191)	/* SuS compliant getrlimit */
  #define __NR_mmap2			(__NR_SYSCALL_BASE+192)
Index: include/asm-sh/unistd.h
===================================================================
RCS file: /home/common/cvsroot/linux/include/asm-sh/unistd.h,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 include/asm-sh/unistd.h
*** include/asm-sh/unistd.h	2 Oct 2000 18:57:34 -0000	1.1.3.1
--- include/asm-sh/unistd.h	4 Oct 2002 18:27:41 -0000
***************
*** 197,204 ****
  #define __NR_capset		185
  #define __NR_sigaltstack	186
  #define __NR_sendfile		187
! #define __NR_streams1		188	/* some people actually want it */
! #define __NR_streams2		189	/* some people actually want it */
  #define __NR_vfork		190
  #define __NR_ugetrlimit		191	/* SuS compliant getrlimit */
  #define __NR_mmap2		192
--- 197,204 ----
  #define __NR_capset		185
  #define __NR_sigaltstack	186
  #define __NR_sendfile		187
! #define __NR_getpmsg		188	/* some people actually want it */
! #define __NR_putpmsg		189	/* some people actually want it */
  #define __NR_vfork		190
  #define __NR_ugetrlimit		191	/* SuS compliant getrlimit */
  #define __NR_mmap2		192
Index: include/asm-sparc/unistd.h
===================================================================
RCS file: /home/common/cvsroot/linux/include/asm-sparc/unistd.h,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 include/asm-sparc/unistd.h
*** include/asm-sparc/unistd.h	21 Oct 2001 17:36:54 -0000	1.1.3.1
--- include/asm-sparc/unistd.h	4 Oct 2002 18:32:40 -0000
***************
*** 166,173 ****
  #define __NR_pciconfig_read	148 /* ENOSYS under SunOS                          */
  #define __NR_pciconfig_write	149 /* ENOSYS under SunOS                          */
  #define __NR_getsockname        150 /* Common                                      */
! /* #define __NR_getmsg          151    SunOS Specific                              */
! /* #define __NR_putmsg          152    SunOS Specific                              */
  #define __NR_poll               153 /* Common                                      */
  #define __NR_getdents64		154 /* Linux specific				   */
  #define __NR_fcntl64		155 /* Linux sparc32 Specific                      */
--- 166,173 ----
  #define __NR_pciconfig_read	148 /* ENOSYS under SunOS                          */
  #define __NR_pciconfig_write	149 /* ENOSYS under SunOS                          */
  #define __NR_getsockname        150 /* Common                                      */
! #define __NR_getpmsg		151 /* Common					   */
! #define __NR_putpmsg		152 /* Common					   */
  #define __NR_poll               153 /* Common                                      */
  #define __NR_getdents64		154 /* Linux specific				   */
  #define __NR_fcntl64		155 /* Linux sparc32 Specific                      */
Index: include/asm-sparc64/unistd.h
===================================================================
RCS file: /home/common/cvsroot/linux/include/asm-sparc64/unistd.h,v
retrieving revision 1.1.3.1
diff -c -r1.1.3.1 include/asm-sparc64/unistd.h
*** include/asm-sparc64/unistd.h	21 Oct 2001 17:36:54 -0000	1.1.3.1
--- include/asm-sparc64/unistd.h	4 Oct 2002 18:35:53 -0000
***************
*** 166,173 ****
  #define __NR_pciconfig_read	148 /* ENOSYS under SunOS                          */
  #define __NR_pciconfig_write	149 /* ENOSYS under SunOS                          */
  #define __NR_getsockname        150 /* Common                                      */
! /* #define __NR_getmsg          151    SunOS Specific                              */
! /* #define __NR_putmsg          152    SunOS Specific                              */
  #define __NR_poll               153 /* Common                                      */
  #define __NR_getdents64		154 /* Linux specific				   */
  /* #define __NR_fcntl64         155    Linux sparc32 Specific                      */
--- 166,173 ----
  #define __NR_pciconfig_read	148 /* ENOSYS under SunOS                          */
  #define __NR_pciconfig_write	149 /* ENOSYS under SunOS                          */
  #define __NR_getsockname        150 /* Common                                      */
! #define __NR_getpmsg		151 /* Common					   */
! #define __NR_putpmsg		152 /* Common					   */
  #define __NR_poll               153 /* Common                                      */
  #define __NR_getdents64		154 /* Linux specific				   */
  /* #define __NR_fcntl64         155    Linux sparc32 Specific                      */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-08 22:20       ` [PATCH] " Brian F. G. Bidulock
  2002-10-08 22:27         ` Brian F. G. Bidulock
@ 2002-10-08 23:18         ` David S. Miller
  2002-10-09  0:21           ` Brian F. G. Bidulock
  2002-10-09  0:00         ` Robert Love
  2 siblings, 1 reply; 11+ messages in thread
From: David S. Miller @ 2002-10-08 23:18 UTC (permalink / raw)
  To: bidulock; +Cc: linux-kernel

   From: "Brian F. G. Bidulock" <bidulock@openss7.org>
   Date: Tue, 8 Oct 2002 16:20:17 -0600

   This version (courtesy of Dave Grothe at GCOM) uses up/down
   semaphore instead of read/write spinlocks.
   
Oh really?

   +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;
   +}

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-08 22:27         ` Brian F. G. Bidulock
@ 2002-10-08 23:39           ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2002-10-08 23:39 UTC (permalink / raw)
  To: bidulock; +Cc: linux-kernel, linux-streams


1) How can anyone test this, the new syscall entries point
   to nothing so the final kernel image won't even link.

2) Did you even check if the SunOS and Linux streams system
   calls take the same arguments?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-08 22:20       ` [PATCH] " Brian F. G. Bidulock
  2002-10-08 22:27         ` Brian F. G. Bidulock
  2002-10-08 23:18         ` David S. Miller
@ 2002-10-09  0:00         ` Robert Love
  2 siblings, 0 replies; 11+ messages in thread
From: Robert Love @ 2002-10-09  0:00 UTC (permalink / raw)
  To: bidulock; +Cc: linux-kernel

On Tue, 2002-10-08 at 18:20, Brian F. G. Bidulock wrote:

> This version (courtesy of Dave Grothe at GCOM) uses up/down
> semaphore instead of read/write spinlocks.

> +static rwlock_t streams_call_lock = RW_LOCK_UNLOCKED;
> +	read_lock(&streams_call_lock);
> +	read_unlock(&streams_call_lock);
> +	read_lock(&streams_call_lock);
> +	read_unlock(&streams_call_lock);
> +	write_lock(&streams_call_lock);
> +	write_unlock(&streams_call_lock);

Eh?  These are all read-write spinlocks, not semaphores.

	Robert Love


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-08 23:18         ` David S. Miller
@ 2002-10-09  0:21           ` Brian F. G. Bidulock
  0 siblings, 0 replies; 11+ messages in thread
From: Brian F. G. Bidulock @ 2002-10-09  0:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel, LiS

David,

On Tue, 08 Oct 2002, David S. Miller wrote:

> Oh really?

Many apologies.  Of course it is the wrong patch...
(My excuse: Finger trouble late in the day.)

Here is the correct patch:

--- arch/i386/kernel/entry.S.orig	2002-08-02 19:39:42.000000000 -0500
+++ arch/i386/kernel/entry.S	2002-10-08 15:43:08.000000000 -0500
@@ -584,8 +584,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-08-02 19:39:46.000000000 -0500
+++ kernel/ksyms.c	2002-10-08 15:44:37.000000000 -0500
@@ -497,6 +497,11 @@
 EXPORT_SYMBOL(seq_release);
 EXPORT_SYMBOL(seq_read);
 EXPORT_SYMBOL(seq_lseek);
+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-08-02 19:39:46.000000000 -0500
+++ kernel/sys.c	2002-10-08 16:46:55.000000000 -0500
@@ -167,6 +167,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 DECLARE_RWSEM(streams_call_sem) ;
+
+long asmlinkage sys_putpmsg(int fd, void *ctlptr, void *datptr, int band, int flags)
+{
+	int ret = -ENOSYS;
+	down_read(&streams_call_sem);
+	if (do_putpmsg)
+		ret = (*do_putpmsg) (fd, ctlptr, datptr, band, flags);
+	up_read(&streams_call_sem);
+	return ret;
+}
+
+long asmlinkage sys_getpmsg(int fd, void *ctlptr, void *datptr, int band, int flags)
+{
+	int ret = -ENOSYS;
+	down_read(&streams_call_sem);
+	if (do_getpmsg)
+		ret = (*do_getpmsg) (fd, ctlptr, datptr, band, flags);
+	up_read(&streams_call_sem);
+	return ret;
+}
+
+void register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
+			    int (*getpmsg) (int, void *, void *, int, int))
+{
+	down_write(&streams_call_sem);
+	do_putpmsg = putpmsg;
+	do_getpmsg = getpmsg;
+	up_write(&streams_call_sem);
+}
+
+void unregister_streams_calls(void)
+{
+	register_streams_calls(NULL, NULL);
+}
+
 asmlinkage long sys_ni_syscall(void)
 {
 	return -ENOSYS;


-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
bidulock@openss7.org    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
       [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
  0 siblings, 1 reply; 11+ messages in thread
From: Pete Zaitcev @ 2002-10-09  0:30 UTC (permalink / raw)
  To: bidulock; +Cc: linux-kernel

> 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.

> +EXPORT_SYMBOL(register_streams_calls);
> +EXPORT_SYMBOL(unregister_streams_calls);

EXPORT_SYMBOL_GPL perhaps? Otherwise it's just a disguised hook,
just like nVidia's shell driver.
 
> +static rwlock_t streams_call_lock = RW_LOCK_UNLOCKED;

Does not look like a semaphore to me...

-- Pete

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-09  0:30         ` Pete Zaitcev
@ 2002-10-09  0:40           ` Brian F. G. Bidulock
  0 siblings, 0 replies; 11+ messages in thread
From: Brian F. G. Bidulock @ 2002-10-09  0:40 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: linux-kernel

Pete,

Sorry, wrong patch.  See correct patch re-posted on this thread.

BTW no other symbols in ksyms are exported with EXPORT_SYMBOL_GPL
in 2.4.19.

--brian

On Tue, 08 Oct 2002, Pete Zaitcev wrote:

> > 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.
> 
> > +EXPORT_SYMBOL(register_streams_calls);
> > +EXPORT_SYMBOL(unregister_streams_calls);
> 
> EXPORT_SYMBOL_GPL perhaps? Otherwise it's just a disguised hook,
> just like nVidia's shell driver.
>  
> > +static rwlock_t streams_call_lock = RW_LOCK_UNLOCKED;
> 
> Does not look like a semaphore to me...
> 
> -- Pete

-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
bidulock@openss7.org    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
@ 2002-10-09 12:20 Petr Vandrovec
  2002-10-09 19:54 ` Brian F. G. Bidulock
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Vandrovec @ 2002-10-09 12:20 UTC (permalink / raw)
  To: Brian F. G. Bidulock; +Cc: linux-kernel, LiS, davem

On  8 Oct 02 at 18:21, Brian F. G. Bidulock wrote:
> --- kernel/sys.c.orig   2002-08-02 19:39:46.000000000 -0500
> +++ kernel/sys.c    2002-10-08 16:46:55.000000000 -0500
...

I believe that you should check that nobody else has registered its
own streams module. You can also allow for multiple streams modules
in parallel (and fall through when module returns on -ENOIOCTLCMD or -ENOTTY),
but I believe that usually only one module will be registered.

And I believe that export symbols should NOT be _GPL_ONLY: before
(non-GPL) export of syscall_table was available, non-GPL modules were
able to hook syscalls, and when _GPL_ONLY was introduced into kernel
it was promised that we'll never make currently provided functionality
GPL-only (as far as I remember).
                                                    Best regards,
                                                        Petr Vandrovec
                                                        
int register_streams_calls(...)
> +void register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
> +               int (*getpmsg) (int, void *, void *, int, int))
> +{

int err;
if (!putpmsg || !getpmsg) return -EINVAL;

> +   down_write(&streams_call_sem);

err = -EBUSY;
if (!do_putpmsg) {
  err = 0;

> +   do_putpmsg = putpmsg;
> +   do_getpmsg = getpmsg;

}

> +   up_write(&streams_call_sem);

return err;

> +}
> +
> +void unregister_streams_calls(void)
> +{

   down_write(&streams_call_sem);
   do_putpmsg = NULL;
   do_getpmsg = NULL;
   up_write(&streams_call_sem);
}
    

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Re: export of sys_call_table
  2002-10-09 12:20 [PATCH] Re: export of sys_call_table Petr Vandrovec
@ 2002-10-09 19:54 ` Brian F. G. Bidulock
  2002-10-10 16:01   ` [Linux-streams] " David Grothe
  0 siblings, 1 reply; 11+ messages in thread
From: Brian F. G. Bidulock @ 2002-10-09 19:54 UTC (permalink / raw)
  To: Petr Vandrovec; +Cc: linux-kernel, LiS, davem

Petr,

Thanks you for the constructive suggestions.  I'll see if we
can add those in an test it up.

--brian

On Wed, 09 Oct 2002, Petr Vandrovec wrote:

> On  8 Oct 02 at 18:21, Brian F. G. Bidulock wrote:
> > --- kernel/sys.c.orig   2002-08-02 19:39:46.000000000 -0500
> > +++ kernel/sys.c    2002-10-08 16:46:55.000000000 -0500
> ...
> 
> I believe that you should check that nobody else has registered its
> own streams module. You can also allow for multiple streams modules
> in parallel (and fall through when module returns on -ENOIOCTLCMD or -ENOTTY),
> but I believe that usually only one module will be registered.
> 
> And I believe that export symbols should NOT be _GPL_ONLY: before
> (non-GPL) export of syscall_table was available, non-GPL modules were
> able to hook syscalls, and when _GPL_ONLY was introduced into kernel
> it was promised that we'll never make currently provided functionality
> GPL-only (as far as I remember).
>                                                     Best regards,
>                                                         Petr Vandrovec
>                                                         
> int register_streams_calls(...)
> > +void register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
> > +               int (*getpmsg) (int, void *, void *, int, int))
> > +{
> 
> int err;
> if (!putpmsg || !getpmsg) return -EINVAL;
> 
> > +   down_write(&streams_call_sem);
> 
> err = -EBUSY;
> if (!do_putpmsg) {
>   err = 0;
> 
> > +   do_putpmsg = putpmsg;
> > +   do_getpmsg = getpmsg;
> 
> }
> 
> > +   up_write(&streams_call_sem);
> 
> return err;
> 
> > +}
> > +
> > +void unregister_streams_calls(void)
> > +{
> 
>    down_write(&streams_call_sem);
>    do_putpmsg = NULL;
>    do_getpmsg = NULL;
>    up_write(&streams_call_sem);
> }
>     

-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
bidulock@openss7.org    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_table
  2002-10-09 19:54 ` Brian F. G. Bidulock
@ 2002-10-10 16:01   ` David Grothe
  0 siblings, 0 replies; 11+ messages in thread
From: David Grothe @ 2002-10-10 16:01 UTC (permalink / raw)
  To: bidulock, Petr Vandrovec; +Cc: linux-kernel, LiS, davem

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Brian, Petr, et al:

Does this patch address your suggestions?  This has been tested on 2.4.19.

Thanks,
Dave

At 01:54 PM 10/9/2002 Wednesday, Brian F. G. Bidulock wrote:
>Petr,
>
>Thanks you for the constructive suggestions.  I'll see if we
>can add those in an test it up.
>
>--brian

[-- Attachment #2: stock-i386-2.4.19.txt --]
[-- Type: text/plain, Size: 2699 bytes --]

--- arch/i386/kernel/entry.S.orig	2002-08-02 19:39:42.000000000 -0500
+++ arch/i386/kernel/entry.S	2002-10-08 15:43:08.000000000 -0500
@@ -584,8 +584,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-08-02 19:39:46.000000000 -0500
+++ kernel/ksyms.c	2002-10-10 10:46:43.000000000 -0500
@@ -497,6 +497,11 @@
 EXPORT_SYMBOL(seq_release);
 EXPORT_SYMBOL(seq_read);
 EXPORT_SYMBOL(seq_lseek);
+extern int 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-08-02 19:39:46.000000000 -0500
+++ kernel/sys.c	2002-10-10 10:51:27.000000000 -0500
@@ -167,6 +167,50 @@
 	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 DECLARE_RWSEM(streams_call_sem) ;
+
+long asmlinkage sys_putpmsg(int fd, void *ctlptr, void *datptr, int band, int flags)
+{
+	int ret = -ENOSYS;
+	down_read(&streams_call_sem) ;	/* should return int, but doesn't */
+	if (do_putpmsg)
+		ret = (*do_putpmsg) (fd, ctlptr, datptr, band, flags);
+	up_read(&streams_call_sem);
+	return ret;
+}
+
+long asmlinkage sys_getpmsg(int fd, void *ctlptr, void *datptr, int band, int flags)
+{
+	int ret = -ENOSYS;
+	down_read(&streams_call_sem) ;	/* should return int, but doesn't */
+	if (do_getpmsg)
+		ret = (*do_getpmsg) (fd, ctlptr, datptr, band, flags);
+	up_read(&streams_call_sem);
+	return ret;
+}
+
+int register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
+			    int (*getpmsg) (int, void *, void *, int, int))
+{
+	down_write(&streams_call_sem) ;	/* should return int, but doesn't */
+	if (   (putpmsg != NULL && do_putpmsg != NULL)
+	    || (getpmsg != NULL && do_getpmsg != NULL)
+	   )
+		return -EBUSY;
+	do_putpmsg = putpmsg;
+	do_getpmsg = getpmsg;
+	up_write(&streams_call_sem);
+	return 0 ;
+}
+
+void unregister_streams_calls(void)
+{
+	register_streams_calls(NULL, NULL);
+}
+
 asmlinkage long sys_ni_syscall(void)
 {
 	return -ENOSYS;

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-10-10 15:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-09 12:20 [PATCH] Re: export of sys_call_table Petr Vandrovec
2002-10-09 19:54 ` Brian F. G. Bidulock
2002-10-10 16:01   ` [Linux-streams] " David Grothe
  -- strict thread matches above, loose matches on Subject: below --
2002-10-04 19:15 Brian F. G. Bidulock
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       ` [PATCH] " Brian F. G. Bidulock
2002-10-08 22:27         ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox