Re: help regarding the strace output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19-12-07 11:45, Santosh Pradhan wrote:

I am new to this group. I am not sure whether this is the right place to ask this kind of question. Here is my doubt.

It's fine here, although it might be the case that you don't actually get an answer from here. At least I seem to not know the answer. Just thought I'd mention though that "strace ./sample >foo" is already enough to have the sleep and write switch places, no shell script necessary.

I also very much expect there's nothing that guarantees one way or the other but not withstanding that, I agree you'd not expect to see it happen.

Leaving in enough context:

I wrote a simple C program.

#include<stdio.h>
#include<unistd.h>

int main()
{
       printf("Hello, World\n");
       sleep(10);
}

if i compile this program using "gcc sample.c -o sample" and run this using 'strace',

case 1) run as fg process using "strace ./sample" in command prompt


write(1, "Hello, World\n", 13Hello, World)          = 13
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({10, 0}, {10, 0})             = 0

... but with "strace ./sample.c >foo", the write and sleep (sequence) switch places.

Rene.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux