I'll let you know if I need it; I reckon it might not be too
difficult to backport it anyway, so I can also do it myself ;).
I stumbled upon ttyrpld a couple weeks ago and thought it was pretty
useful, to keep track of all actions performed on a couple of machines
where only the admins have local accounts. Since I'm running a (heavily
modified) custom 2.4.22 kernel, I took the version Jan offered for
2.4.29 (in ttyrpld-2.03.5) and synced it up with the work he did on
later versions. I think it's identical, functionality wise, to the
patch he offered on ttyrpld 2.10. I also massaged it a bit so it would
build statically into the kernel (my boxes don't have module support)
and to get rid of the extra fluff -- the dependency on moduleparm.h
which doesn't exit in 2.4.22, the BSD defines, the 2.6 defines, etc.
Also, if built as a module, it'll be called 'rpl' instead of 'rpldev'.
Why?
I'm running it now on a couple boxes, with the latest userspace bits
(libHX 1.74 and ttyrpld 2.10), and It Works For Me (tm). So, with that
disclaimer out of the way, here's the patch. It's diffed against my
custom 2.4.22 kernel, but should apply fairly well to any 2.4.
Thanks for sharing your work! Comments on the coding style aside (it's
not exactly winning a beauty contest), one thing I spotted while
skimming over your patch:
> +static int urpl_open(struct inode *inode, struct file *filp) {
> + // This one is called when the device node has been opened.
> + if(inode != NULL) {
> + inode->i_mtime = CURRENT_TIME;
> + inode->i_mode &= ~(S_IWUGO | S_IXUGO);
> + }
> +
> + /* The RPL device should only be opened once, since otherwise,
different
> + packets could go to different readers. */
> + down(&Open_lock);
> + if(Open_count) {
> + up(&Open_lock);
> + return -EBUSY;
> + }
> + ++Open_count;
> + up(&Open_lock);
> +
> + down(&Buffer_lock);
> + Buffer = __vmalloc(Bufsize, GFP_KERNEL | __GFP_HIGHMEM,
PAGE_KERNEL);
> + if(Buffer == NULL) {
> + up(&Buffer_lock);
> + up(&Open_lock);
This does not seem to be correct. This semaphore has been released
already and urpl_open is not called under a lock AFAICS.
I'll see if we can fit something like this into the next kernel round
for our distro. The code needs major cleanup though.
Best regards,
Roberto Nibali, ratz
--
echo
'[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]