1Z0-460 · Question #44
As a root user, you executed the following command on your Oracle Linux 6 server: [root@host] # strace - o/tmp/diag.out sh diag.sh Which statement describes the purpose of this command?
The correct answer is D. It records the system calls, which are called by the processes when the diag.sh script runs. strace - trace system calls and signals In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments…
Question
As a root user, you executed the following command on your Oracle Linux 6 server:
[root@host] # strace - o/tmp/diag.out sh diag.sh Which statement describes the purpose of this command?
Options
- AIt collects the memory and swap space metrics when the diag.sh scripts runs.
- BIt collects the operating system metrics when the diag.sh script runs.
- CIt records the memory usage and CPU usage information of the processes when the diah.sh
- DIt records the system calls, which are called by the processes when the diag.sh script runs.
How the community answered
(36 responses)- A3% (1)
- B11% (4)
- C3% (1)
- D83% (30)
Explanation
*strace - trace system calls and signals In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process 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. *strace is a useful diagnostic, instructional, and debugging tool. System administrators, diagnosticians and trouble-shooters will find it invaluable for solving problems with programs for which the source is not readily available since they do not need to be recompiled in order to trace them. Students, hackers and the overly-curious will find that a great deal can be learned about a system and its system calls by tracing even ordinary programs. And programmers will find that since system calls and signals are events that happen at the user/kernel interface, a close examination of this boundary is very useful for bug isolation, sanity checking and attempting to capture race conditions. Each line in the trace contains the system call name, followed by its arguments in parentheses and its return value. An example from stracing the command ''cat /dev/null'' is: open("/dev/null", O_RDONLY) = 3 Errors (typically a return value of -1) have the errno symbol and error string appended. open("/foo/bar", O_RDONLY) = -1 ENOENT (No such file or directory) Signals are printed as a signal symbol and a signal string. An excerpt from stracing and interrupting the command ''sleep sigsuspend([] <unfinished ...> --- SIGINT (Interrupt) --- +++ killed by SIGINT +++
Topics
Community Discussion
No community discussion yet for this question.