When I do a vi filename from the command prompt, what fuse functions are called if I am using the fusexmp example ? I could guess mknod, open are called. When I do a write ie when i do :wq write is called. is that right.
Asked
Active
Viewed 212 times
0
-
vi/vim is open source. I suggest you get the source and look through it. What's a fuse function? – octopusgrabbus Apr 13 '12 at 00:00
-
you can see for yourself by using dtrace, systemtap, or even oprofile (with kernel support). start one of those, then use vi, and then get a report of all the calls! – andrew cooke Apr 13 '12 at 00:03
-
fusexmp example that comes with the download has some functions defined. I meant to refer to those functions – user1330431 Apr 13 '12 at 00:09
1 Answers
3
There's no fantastically easy way to see which FUSE functions are called for any given file operation, but running strace(1)
will record the system calls, which is quite close to the FUSE functions:
$ strace -o /tmp/vim.all vim /etc/motd
A lot of those system calls aren't related to the one file specifically, but to the process of loading vim
, its dynamically linked libraries, your local configuration, and all its supporting files.
Here's some selected lines that refer to the /etc/motd
that I opened:
stat("/etc/motd", {st_mode=S_IFREG|0644, st_size=183, ...}) = 0
stat("/etc/motd", {st_mode=S_IFREG|0644, st_size=183, ...}) = 0
stat("/etc/motd", {st_mode=S_IFREG|0644, st_size=183, ...}) = 0
stat("/etc/motd", {st_mode=S_IFREG|0644, st_size=183, ...}) = 0
access("/etc/motd", W_OK) = -1 EACCES (Permission denied)
open("/etc/motd", O_RDONLY) = 7
close(7) = 0
open("/etc/motd", O_RDONLY) = 7
read(7, "Welcome to Ubuntu 11.04 (GNU/Lin"..., 8192) = 183
read(7, "", 65536) = 0
close(7) = 0
stat("/etc/motd", {st_mode=S_IFREG|0644, st_size=183, ...}) = 0
The intervening lines make the repeated stat(2)
calls a little less silly looking.

sarnold
- 102,305
- 22
- 181
- 238