Professional Web Applications Themes

flockfile does not work with stdout (on - FreeBSD

How can I control the output of processes (forked from a single process) all writing to the same file? f{un,}lockfile(file) seems to work unless file=stdout. Are there any other simple methods I can try? - Till PS. I am using 5.4-PRERELEASE i386 SMP-GENERIC...

  1. #1

    Default flockfile does not work with stdout (on


    How can I control the output of processes (forked from a single
    process) all writing to the same file?

    f{un,}lockfile(file) seems to work unless file=stdout.

    Are there any other simple methods I can try?

    - Till

    PS. I am using 5.4-PRERELEASE i386 SMP-GENERIC
    Till Guest

  2. #2

    Default Re: flockfile does not work with stdout (on

    In the last episode (Apr 06), Till Plewe said: 

    If they are still the same process image (i.e. no execs), you could
    mmap some ANONYMOUS|SHARED memory and wait on a flag byte with
    atomic_cmpset(). Actually, writing to stdout should be atomic for most
    writes (I have never seen gcc output garbled when doing parallel makes
    for example).


    --
    Dan Nelson
    com
    Dan Guest

  3. #3

    Default Re: flockfile does not work with stdout (on

    On Tue, Apr 05, 2005 at 10:40:49PM -0500, Dan Nelson wrote: 
    >
    > If they are still the same process image (i.e. no execs), you could
    > mmap some ANONYMOUS|SHARED memory and wait on a flag byte with
    > atomic_cmpset(). Actually, writing to stdout should be atomic for most
    > writes (I have never seen gcc output garbled when doing parallel makes
    > for example).
    >[/ref]

    The life span of each process is quite short (<0.001s) and the system load
    is fairly high (~40)

    Thanks, your suggestion works. In fact flockfile also works if I
    use cons25 instead of {x,ml,...}term. So the culprit may be X.

    - Till

    Till Guest

Similar Threads

  1. stdin ot stdout
    By ehabaziz2001@gmail.com in forum Linux / Unix Administration
    Replies: 2
    Last Post: April 7th, 03:44 PM
  2. /dev/tty vs. /dev/stdout
    By Andre in forum UNIX Programming
    Replies: 10
    Last Post: February 14th, 08:17 PM
  3. tie STDOUT to TextUndo
    By lobach@email.chop.edu in forum PERL Beginners
    Replies: 0
    Last Post: January 21st, 04:57 PM
  4. Redirect stdout, stderr to file and stdout
    By Larry Guest in forum PERL Beginners
    Replies: 8
    Last Post: January 20th, 10:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139