Re: export of sys_call_table

Arjan van de Ven
2002-10-04T11:22:51Z

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

On Fri, 2002-10-04 at 13:19, Brian F. G. Bidulock wrote:

> > Why ?
> > Adding "unknown" syscalls is I doubt EVER a good idea.
> > LiS has *known* and *official* syscalls, they can easily live with a
> > stub like nfsd uses.... few lines of code and it's safe.
>
> Well, nfsd does something like this:
>
> struct nfsd_linkage *nfsd_linkage = NULL;
>
> long
> asmlinkage sys_nfsservctl(int cmd, void *argp, void *resp)
> {
> int ret = -ENOSYS;
>
> lock_kernel();
>
> if (nfsd_linkage ||
> (request_module ("nfsd") == 0 && nfsd_linkage))
> ret = nfsd_linkage->do_nfsservctl(cmd, argp, resp);
>
> unlock_kernel();
> return ret;
> }
> EXPORT_SYMBOL(nfsd_linkage);
>
> I take it that this system call is not in nsfd's main data flow
> (probably write() and read are()). Taking the big kernel lock is
> excessive across every putpmsg() and getpmsg() operation and would
> seriously impact LiS performance on multiple processors. In effect,
> only one processor would run for LiS. A reader/write lock would be
> better.

The kernel has such locks too, no big deal
>
> Also, LiS does not require module loading on system call, but
> (questionably) needs unloading protection -- LiS does not really
> need to unload once loaded. This turns into something more like:
>
> static int (*do_putpmsg) (int, void *, void *, int, int) = NULL;
> static int (*do_getpmsg) (int, void *, void *, int, int) = NULL;
> static int (*do_spipe) (int *) = NULL;
> static int (*do_fattach) (int, const char *) = NULL;
> static int (*do_fdetach) (const char *) = NULL;
>
> static rwlock_t streams_call_lock = RW_LOCK_UNLOCKED;
>
> static long asmlinkage sys_putpmsg(int fd, void *ctlptr,
> void *dataptr, int band, int flags)
> {
> int ret = -ENOSYS;
> read_lock(&streams_call_lock);
> if (do_putpmsg)
> ret = do_putpmsg(fd, ctrptr, dataptr, band, flags);
> read_unlock(&streams_call_lock);
> return ret;
> }

not to bad...

>
> static long asmlinkage sys_spipe(int *fd)
> {
> int ret = -ENOSYS;
> read_lock(&streams_call_lock);
> if (do_spipe)
> ret = do_spipe(fd);
> read_unlock(&streams_call_lock);
> return ret;
> }

ehm sys_spipe doesn't exist, neither do all but 2 of the others you
showed.

>
> The module (LiS or iBCS) calls register_streams_calls after it loads and calls
> unregister_streams_calls before it unloads.

iBCS is dead. It's called linux-abi nowadays.....

> But this is repetative and doesn't solve replacement of existing
> system calls for profilers and such.

Profilers don't actually NEED this.... OProfile is fixed for this for
example in the 2.5 branch.

Taking over "random" unimplemented system calls really sounds bad..... I
mean, for the next minor release of the kernel Linus can assign that
number to something official and different......

Greetings,
Arjan van de Ven

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]