Results 1 to 3 of 3
Hi,
When I use Linux, I can type those Linux command in shell and the command will be executed,like "ls". I can also use ltrace to know the details of ...
- 03-21-2011 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 5
how the Linux command or library implemented in background
Hi,
When I use Linux, I can type those Linux command in shell and the command will be executed,like "ls". I can also use ltrace to know the details of the specific command.
For example:
desktop:~$ ltrace echo $PATH
__libc_start_main(0x8049060, 2, 0xbfd032f4, 0x804da10, 0x804da00 <unfinished ...>
getenv("POSIXLY_CORRECT") = NULL
strrchr("echo", '/') = NULL
setlocale(6, "") = "en_US.UTF-8"
bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale"
textdomain("coreutils") = "coreutils"
__cxa_atexit(0x8049a80, 0, 0, 2, 0xbfd0324
= 0
fputs_unlocked(0xbfd045cf, 0x4cb4e0, 0xbfd03218, 0x80489b0, 0x931030) = 1
__overflow(0x4cb4e0, 10, 0xbfd03218, 0x80489b0, 0x931030/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/lei/jdk/jdk1.6.0_20/bin:/home/lei/software/apache-ant-1.8.0/bin:.
) = 10
exit(0 <unfinished ...>
__fpending(0x4cb4e0, 0xbfd03194, 0x102d02b9, 0x93f8f8, 0) = 0
fclose(0x4cb4e0) = 0
__fpending(0x4cb580, 0xbfd03194, 0x102d02b9, 0x93f8f8, 0) = 0
fclose(0x4cb580) = 0
+++ exited (status 0) +++
However, these are still some libraries or linux commands. Is there a way I can know the details to system call level or kernel code level for a specific command?
Thanks,
- 03-22-2011 #2Just Joined!
- Join Date
- Jul 2008
- Posts
- 81
strace(1)
strace - trace system calls and signals
SYNOPSIS
strace [ -dffhiqrtttTvxx ] [ -acolumn ] [ -eexpr ] ... [ -ofile ] [
-ppid ] ... [ -sstrsize ] [ -uusername ] [ -Evar=val ] ... [ -Evar ]
... [ command [ arg ... ] ]
strace -c [ -eexpr ] ... [ -Ooverhead ] [ -Ssortby ] [ command [ arg
... ] ]
DESCRIPTION
In the simplest case strace runs the specified command until it exits.
It intercepts and records the system calls which are called by a pro-
cess and the signals which are received by a process. The name of each
system call, its arguments and its return value are printed on standard
error or to the file specified with the -o option.
- 03-22-2011 #3Just Joined!
- Join Date
- Mar 2011
- Posts
- 5
clowenstein:Thank you very much.


Reply With Quote
