Skip to contentSkip to conversation

export of sys_call_tabl

PATCH Petr Vandrovec 2 participants 2 messages Oct 10, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · David Grothe

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 [email protected]

+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;
#1 lore raw

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

Quoted 36 lines · Petr Vandrovec
Quoted 2 lines · David Grothe

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 [email protected]

(quoted diff) +19 -0
+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;