Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 18 Sep 2014, 07:45
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to intercept an access call to a given directory..?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Fri 13 Nov 2009, 20:32    Post subject:  How to intercept an access call to a given directory..?  

i want to be able to point access to a directory to other directories.
Like a link does, but I need it to access multiple target directories.

I`ve thought of a few ways of doing this, a kernel module`s the best.
I`ve done some C programming, but that level is beyond my abilities.

System calls can be used to intercept access to files and directories.
Again this is done with C only I believe, I`ve only seen C examples.

Is there a way of making Linux system calls using only Bash script?

I need to stop the directory access and run a script or C program.
It reads a file listing directories to search for the file being accessed.
If the file is found, it is accessed in place of the original file access.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Sat 14 Nov 2009, 18:09    Post subject:  

You'd need to use inotify, fam or gamin to catch the access attempts and then re-direct the paths from there.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Mon 16 Nov 2009, 00:59    Post subject:  

Thanks amigo; Looking at them, they look to be access notices or loggers.
It doesn`t look like they trap the access and allow you to do something else.
Code sample for inotify:
Code:
         /* File was accessed */
         case IN_ACCESS:
         printf("ACCESS EVENT OCCURRED: File \"%s\" on WD #%i\n",

Notice the comments "was" reference and the printf output is "past event" also.

I need to stop the access and run a script that does a "path" search for the file.

This is one method for making a "Multi-Link", a link that has multiple target directories.

A hard link points to files only.
A sym. link points to both files and directories.
A multi. link points to directories only.

It acts like PATH does, except it`s for directories that are not part of the PATH.
The union file system does the same thing also. except it`s complex over kill.
In reading about Linux kernel system calls, it looks like the way to do it.
But I don`t see how to do it except in C...
I really need a new type of link to be written into the kernel. " ln -m " = ( Multi-Link ).
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0417s ][ Queries: 12 (0.0044s) ][ GZIP on ]