* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
@ 2002-10-10 16:38 Petr Vandrovec
2002-10-10 16:57 ` David Grothe
0 siblings, 1 reply; 18+ messages in thread
From: Petr Vandrovec @ 2002-10-10 16:38 UTC (permalink / raw)
To: David Grothe; +Cc: linux-kernel, LiS, davem, bidulock
On 10 Oct 02 at 11:32, David Grothe wrote:
> Previous patch was "better" but not correct. How about this? (changed
> return 0 to return ret).
Yes, it's ok with me. You can still do
register(NULL, notNULL);
register(notNULL, NULL);
without trigerring any error, but maybe that it can be called feature.
Best regards,
Petr Vandrovec
vandrove@vc.cvut.cz
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 16:38 [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl Petr Vandrovec
@ 2002-10-10 16:57 ` David Grothe
2002-10-10 17:27 ` Christoph Hellwig
0 siblings, 1 reply; 18+ messages in thread
From: David Grothe @ 2002-10-10 16:57 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: linux-kernel, LiS, davem, bidulock
[-- Attachment #1: Type: text/plain, Size: 181 bytes --]
Attached is the "final" patch. I eliminated the unregister function. This
is tested on stock 2.4.19 kernel.
Will someone see that it is added to the kernel source?
Thanks,
Dave
[-- Attachment #2: stock-i386-2.4.19.txt --]
[-- Type: text/plain, Size: 2559 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 11:46:54.000000000 -0500
@@ -497,6 +497,9 @@
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));
+EXPORT_SYMBOL(register_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 11:46:44.000000000 -0500
@@ -167,6 +167,48 @@
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))
+{
+ int ret = 0;
+ down_write(&streams_call_sem) ; /* should return int, but doesn't */
+ if ( (putpmsg != NULL && do_putpmsg != NULL)
+ || (getpmsg != NULL && do_getpmsg != NULL)
+ )
+ ret = -EBUSY;
+ else {
+ do_putpmsg = putpmsg;
+ do_getpmsg = getpmsg;
+ }
+ up_write(&streams_call_sem);
+ return ret ;
+}
+
asmlinkage long sys_ni_syscall(void)
{
return -ENOSYS;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 16:57 ` David Grothe
@ 2002-10-10 17:27 ` Christoph Hellwig
2002-10-10 19:07 ` David Grothe
0 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2002-10-10 17:27 UTC (permalink / raw)
To: David Grothe; +Cc: Petr Vandrovec, linux-kernel, LiS, davem, bidulock
a) please read Documentation/CodingStyle
b) please add a prototype in a header
c) please make it EXPORT_SYMBOL_GPL
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 17:27 ` Christoph Hellwig
@ 2002-10-10 19:07 ` David Grothe
2002-10-10 19:33 ` Arjan van de Ven
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: David Grothe @ 2002-10-10 19:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Petr Vandrovec, linux-kernel, LiS, davem, bidulock
At 06:27 PM 10/10/2002 Thursday, Christoph Hellwig wrote:
>a) please read Documentation/CodingStyle
Is there a specific problem here? We tried to imitate the kernel coding
style with this patch.
>b) please add a prototype in a header
Can you suggest which header file would be appropriate? I would be glad to
add the prototype there.
>c) please make it EXPORT_SYMBOL_GPL
LiS is LGPL. Would it work if the exported symbol was GPL only?
As this is something of a replacement for the old exported sys_call_table,
which was exported generally, we thought that a general export was appropriate.
Thanks,
Dave
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 19:07 ` David Grothe
@ 2002-10-10 19:33 ` Arjan van de Ven
2002-10-10 20:31 ` David Grothe
[not found] ` <20021011180209.A30671@infradead.org>
2 siblings, 0 replies; 18+ messages in thread
From: Arjan van de Ven @ 2002-10-10 19:33 UTC (permalink / raw)
To: David Grothe
Cc: Christoph Hellwig, Petr Vandrovec, linux-kernel, LiS, Dave Miller,
bidulock
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
On Thu, 2002-10-10 at 21:07, David Grothe wrote:
> LiS is LGPL. Would it work if the exported symbol was GPL only?
since LiS becomes GPL when you link it into the kernel with insmod,
that's not a problem ;)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 19:07 ` David Grothe
2002-10-10 19:33 ` Arjan van de Ven
@ 2002-10-10 20:31 ` David Grothe
[not found] ` <20021011180209.A30671@infradead.org>
2 siblings, 0 replies; 18+ messages in thread
From: David Grothe @ 2002-10-10 20:31 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Petr Vandrovec, linux-kernel, LiS, davem, bidulock
Guys, I think we are closing in on it.
I ran the patch through Lindent. I moved the exported symbol to sys.c and
made it GPL only. I tested it on 2.4.19.
If we could agree on a header file location for the prototype, or not to
have a prototype, I could cook up another candidate for "final" in short order.
Thanks for all the suggestions,
Dave
^ permalink raw reply [flat|nested] 18+ messages in thread[parent not found: <20021011180209.A30671@infradead.org>]
* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
@ 2002-10-10 19:41 Petr Vandrovec
2002-10-11 14:22 ` David Grothe
0 siblings, 1 reply; 18+ messages in thread
From: Petr Vandrovec @ 2002-10-10 19:41 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: hch, linux-kernel, LiS, Dave Miller, bidulock, dave
On 10 Oct 02 at 21:33, Arjan van de Ven wrote:
> On Thu, 2002-10-10 at 21:07, David Grothe wrote:
>
> > LiS is LGPL. Would it work if the exported symbol was GPL only?
>
> since LiS becomes GPL when you link it into the kernel with insmod,
> that's not a problem ;)
Only problem is that modutils do not know about LGPL, you must use
"GPL with additional rights" in source (at least Debian's 2.4.19-3),
and "GPL with additional rights" might be too ambiguous for authors.
Petr Vandrovec
vandrove@vc.cvut.cz
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 19:41 Petr Vandrovec
@ 2002-10-11 14:22 ` David Grothe
2002-10-11 14:49 ` Alan Cox
0 siblings, 1 reply; 18+ messages in thread
From: David Grothe @ 2002-10-11 14:22 UTC (permalink / raw)
To: Petr Vandrovec, Arjan van de Ven
Cc: hch, linux-kernel, LiS, Dave Miller, bidulock
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
Here is a proposed "final" patch for the streams hooks. I think that it
takes into account all suggestions. I put the prototype in linux/sys.h.
This is for stock 2.4.19, and has been tested.
-- Dave
[-- Attachment #2: stock-i386-2.4.19.txt --]
[-- Type: text/plain, Size: 2883 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/sys.c.orig 2002-08-02 19:39:46.000000000 -0500
+++ kernel/sys.c 2002-10-10 15:00:45.000000000 -0500
@@ -167,6 +167,49 @@
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))
+{
+ int ret = -EBUSY;
+ down_write(&streams_call_sem); /* should return int, but doesn't */
+ if ( (putpmsg == NULL || do_putpmsg == NULL)
+ && (getpmsg == NULL || do_getpmsg == NULL)) {
+ do_putpmsg = putpmsg;
+ do_getpmsg = getpmsg;
+ ret = 0;
+ }
+ up_write(&streams_call_sem);
+ return ret;
+}
+
asmlinkage long sys_ni_syscall(void)
{
return -ENOSYS;
@@ -1286,3 +1329,4 @@
EXPORT_SYMBOL(unregister_reboot_notifier);
EXPORT_SYMBOL(in_group_p);
EXPORT_SYMBOL(in_egroup_p);
+EXPORT_SYMBOL_GPL(register_streams_calls);
--- include/linux/sys.h.orig 2002-10-11 08:59:10.000000000 -0500
+++ include/linux/sys.h 2002-10-11 09:15:04.000000000 -0500
@@ -27,4 +27,16 @@
* These are system calls that haven't been implemented yet
* but have an entry in the table for future expansion..
*/
+
+/*
+ * These are registration routines for system calls that are
+ * implemented by loadable modules outside of the kernel
+ * source tree.
+ */
+#if !defined(__ASSEMBLY__)
+extern int
+register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
+ int (*getpmsg) (int, void *, void *, int, int)) ;
+
+#endif /* __ASSEMBLY__ */
#endif
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-11 14:22 ` David Grothe
@ 2002-10-11 14:49 ` Alan Cox
0 siblings, 0 replies; 18+ messages in thread
From: Alan Cox @ 2002-10-11 14:49 UTC (permalink / raw)
To: David Grothe
Cc: Petr Vandrovec, Arjan van de Ven, hch, Linux Kernel Mailing List,
LiS, Dave Miller, bidulock
On Fri, 2002-10-11 at 15:22, David Grothe wrote:
> Here is a proposed "final" patch for the streams hooks. I think that it
> takes into account all suggestions. I put the prototype in linux/sys.h.
>
> This is for stock 2.4.19, and has been tested.
>
Looks good to me
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
@ 2002-10-10 16:32 David Grothe
0 siblings, 0 replies; 18+ messages in thread
From: David Grothe @ 2002-10-10 16:32 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: linux-kernel, LiS, davem, bidulock
Previous patch was "better" but not correct. How about this? (changed
return 0 to return ret).
int register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
int (*getpmsg) (int, void *, void *, int, int))
{
int ret = 0;
down_write(&streams_call_sem) ; /* should return int, but doesn't */
if ( (putpmsg != NULL && do_putpmsg != NULL)
|| (getpmsg != NULL && do_getpmsg != NULL)
)
ret = -EBUSY;
else {
do_putpmsg = putpmsg;
do_getpmsg = getpmsg;
}
up_write(&streams_call_sem);
return ret ;
}
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
@ 2002-10-10 16:25 Petr Vandrovec
2002-10-10 16:30 ` David Grothe
0 siblings, 1 reply; 18+ messages in thread
From: Petr Vandrovec @ 2002-10-10 16:25 UTC (permalink / raw)
To: David Grothe; +Cc: linux-kernel, LiS, davem, bidulock
On 10 Oct 02 at 11:01, David Grothe wrote:
>
> Does this patch address your suggestions? This has been tested on 2.4.19.
Well, it can be that way. But if you are allowing
register_streams_calls(NULL, NULL), maybe you can move
unregister_streams_calls() to the headers and make it inline.
And you are returning while holding streams_call_sem semaphore
when failing with -EBUSY. It is not good idea.
Petr Vandrovec
vandrove@vc.cvut.cz
+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] 18+ messages in thread* Re: [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl
2002-10-10 16:25 Petr Vandrovec
@ 2002-10-10 16:30 ` David Grothe
0 siblings, 0 replies; 18+ messages in thread
From: David Grothe @ 2002-10-10 16:30 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: linux-kernel, LiS, davem, bidulock
This looks better:
int register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
int (*getpmsg) (int, void *, void *, int, int))
{
int ret = 0;
down_write(&streams_call_sem) ; /* should return int, but doesn't */
if ( (putpmsg != NULL && do_putpmsg != NULL)
|| (getpmsg != NULL && do_getpmsg != NULL)
)
ret = -EBUSY;
else {
do_putpmsg = putpmsg;
do_getpmsg = getpmsg;
}
up_write(&streams_call_sem);
return 0 ;
}
How about if we just eliminate the unregister_streams routine? LiS can
just call register_streams(NULL,NULL) when it wants to unregister.
-- Dave
At 06:25 PM 10/10/2002 Thursday, Petr Vandrovec wrote:
>On 10 Oct 02 at 11:01, David Grothe wrote:
> >
> > Does this patch address your suggestions? This has been tested on 2.4.19.
>
>Well, it can be that way. But if you are allowing
>register_streams_calls(NULL, NULL), maybe you can move
>unregister_streams_calls() to the headers and make it inline.
>
>And you are returning while holding streams_call_sem semaphore
>when failing with -EBUSY. It is not good idea.
> Petr Vandrovec
> vandrove@vc.cvut.cz
>
>
>+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] 18+ messages in thread
end of thread, other threads:[~2002-10-12 15:24 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-10 16:38 [Linux-streams] Re: [PATCH] Re: export of sys_call_tabl Petr Vandrovec
2002-10-10 16:57 ` David Grothe
2002-10-10 17:27 ` Christoph Hellwig
2002-10-10 19:07 ` David Grothe
2002-10-10 19:33 ` Arjan van de Ven
2002-10-10 20:31 ` David Grothe
[not found] ` <20021011180209.A30671@infradead.org>
[not found] ` <20021011142657.B32421@openss7.org>
2002-10-12 2:29 ` Ole Husgaard
2002-10-12 9:32 ` Arjan van de Ven
2002-10-12 9:54 ` Brian F. G. Bidulock
2002-10-12 9:56 ` Brian F. G. Bidulock
2002-10-12 11:51 ` Alan Cox
2002-10-12 15:29 ` Ole Husgaard
-- strict thread matches above, loose matches on Subject: below --
2002-10-10 19:41 Petr Vandrovec
2002-10-11 14:22 ` David Grothe
2002-10-11 14:49 ` Alan Cox
2002-10-10 16:32 David Grothe
2002-10-10 16:25 Petr Vandrovec
2002-10-10 16:30 ` David Grothe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox