Re: Overriding System Calls
- From: "Lew Pitcher" <lpitcher@xxxxxxxxxxxx>
- Date: 14 Sep 2006 05:52:43 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Content reorganized to correct top-posting
Prafulla T wrote:
David Schwartz wrote:[snip]
Anything that can be done by intercepting a system call can be done
another way. What are you trying to do?
I am trying to develope recycle bin like thing in Linux.
Hmmm.. The only advantage that I can see of the "recycle bin" approach
vs a straight "delete" is that the contents of the "recycle bin" can be
restored. This implies that, within the recycle bin, you somehow track
the original path to the deleted file, and implement some mechanism for
selecting between different files with the same path to restore (i.e. I
edit a text file, and delete the txt~ backup. I edit again and delete
the 2nd txt~ backup, which shares the same name as the first txt~
backup. Now I want to restore the 1st txt~ backup file; how do I choose
it from the recycle bin?)
The recycle bin approach also implies a further "empty bin" function
that irreversably completes the delete process.
Add to this the requirements of properly handling hard and soft links
(hard links will be harder; how do you restore a file that had multiple
hard links? Do you overwrite the file (through the other links) that
/may/ have different contents than the "recycled" file, or do you
restore to a different name? If a different name is selected, how do
you select the name?)
For that matter, the restore will have to accomodate multiple users as
well, and you don't want user A restoring user B's deleted files from
the recycle bin, so you may need multiple recycle bins, and some way to
associate a specific recycle bin to a specific user, both for restore
and for delete.
For that i need to override unlink sys call!.
My gut feel is that
a) this is a job better done outside of the kernel, in userspace
somewhere. It depends too much on userspace variables and interaction
with the user to be part of the kernel, and
b) overriding the unlink syscall is the least of your worries if you
were to implement this in system space. You'll have to come up with
changes to the link() syscall and the symlink() syscall, and you'll
have to build several new syscalls to manage and restore from the
"recycle bin".
Anyways,It is working now!!
Good. Have fun with it. At least it's a learning experience for you
HTH
- --
Lew Pitcher
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12
iD8DBQFFCVCVagVFX4UWr64RAg2OAJ4pr+dK0iauEICPvKx0RbsUSKWzPQCgyjB4
RQeTAkyh2UILqEKa1QlFyYs=
=2rZW
-----END PGP SIGNATURE-----
.
- References:
- Re: Overriding System Calls
- From: Prafulla T
- Re: Overriding System Calls
- Prev by Date: Re: Overriding System Calls
- Next by Date: Re: Threads vs Forks in embedded environment : Some Conclusions
- Previous by thread: Re: Overriding System Calls
- Next by thread: Re: Overriding System Calls
- Index(es):
Relevant Pages
|