Sponsored Content
Top Forums Shell Programming and Scripting UNIX fifo concurrent read from a named pipe Post 303013484 by Scrutinizer on Thursday 22nd of February 2018 04:11:56 AM
Old 02-22-2018
  • You need a wait statement after the second readpipe.sh
  • echo var >> log.txt . The $ sign is left out of the variable expansion and you need to quote the variable.
  • Why are you appending instead of writing to the pipe
  • The first readpipe will read all there is in the pipe. The second one gets nothing

Last edited by Scrutinizer; 02-22-2018 at 05:18 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

Pipe & fifo....

Could someone Help me with this code please? #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <fcntl.h> #define SIZE_B 256 /*buffer's size */ #define NUM_ARG 20 /* max number of args for any command */ int... (4 Replies)
Discussion started by: M3xican
4 Replies

2. UNIX for Advanced & Expert Users

PIPE and FIFO buffer size

Hello! How I can increase (or decrease) the predefined pipe buffer size? Thanks! (1 Reply)
Discussion started by: Jus
1 Replies

3. Shell Programming and Scripting

FIFO named pipes

Hi...Can anyone please guide me on FIFO Pipes in UNIX.I have lerant things like creating fifo pipes,using them for reads and writes etc.I want to know what is the maximum amount of memory that such a pipe may have? Also can anyone guide me on where to get info on this topic from? (1 Reply)
Discussion started by: tej.buch
1 Replies

4. UNIX for Dummies Questions & Answers

Named PIPE

Gurus, I've a File Transaction Server, which communicates with other servers and performs some processing.It uses many Named PIPE's. By mistake i copied a named PIPE into a text file. I heard that PIPE files shouldn't be copied.Isn't it? Since it's a production box, i'm afraid on... (2 Replies)
Discussion started by: Tamil
2 Replies

5. Shell Programming and Scripting

Reading from blocking fifo pipe in shell script

Hi!! I have a problem reading from a fifo pipe in shell script. The idea is simple, I have a C program with two pipe files: An input pipe I use to send commands in shell script to the C program (echo "command" > input.pipe) An output pipe that I read the result of the command also in... (4 Replies)
Discussion started by: victorin
4 Replies

6. UNIX for Dummies Questions & Answers

fifo or named pipe working?

Can someone explain to me the working of fifo() system call using simple C programs so that I can implement them in the UNIX environement? (1 Reply)
Discussion started by: lvkchaitanya
1 Replies

7. UNIX for Advanced & Expert Users

Why not SIGPIPE for readers of pipe/FIFO?

Hi This is a exercise question from Unix network programming vol2. Why the SIGPIPE signal is generated only for writers when readers disappear. why not it is generated for readers when writer disappears. I guess, if the writer didn't get any response like the reader gets EOF, it will... (4 Replies)
Discussion started by: kumaran_5555
4 Replies

8. Programming

Pipe & fifo size limit

Hi guys. 1. how much is the size of pipe?(i mean the buffer size) 2. is this size different in various UNIX derivations? 3. what happens if we write to a full pipe? does it block until get some free space(the other side receive data) or returns an error? 3. FIFO s are physical files on the... (2 Replies)
Discussion started by: majid.merkava
2 Replies

9. Shell Programming and Scripting

awk reading from named pipe (fifo)

I'm trying to read a fifo using awk and comming across some problems. I'm writing to the fifo from multiple processes invoked by GNU Parallel: mkfifo my_fifo awk '{ a = a + $2 } END { for (i in a) print i, a }' my_fifo | sort -nk1 > sorted_output grep -v '^@' massive_file | parallel... (3 Replies)
Discussion started by: nathanhaigh
3 Replies

10. UNIX for Beginners Questions & Answers

UNIX Pipe -Exit when there are no bytes to read

Hi All, I'm creating a program which reads millions of bytes from the PIPE and do some processing. As the data is more, the idea is to read the pipe parallely. Sun Solaris 8 See the code below: #!/bin/sh MAXTHREAD=30 awk '{print $1}' metadata.csv > nvpipe & while do ... (3 Replies)
Discussion started by: mr_manii
3 Replies
tingea.log(7)							  MISCELLANEOUS 						     tingea.log(7)

  NAME
      tingea.log - How to set the Tingea log parameters

  DESCRIPTION
      The  Tingea  logging framework is part of the Tingea library.  In this context logging means that a pgrogram issues statements about what it
      is doing. It can do so for different purposes and at different levels of verbosity. By default logging statements are written on STDERR.

      Tingea logging provides a quick and easy way for programmers to associate verbosity levels with logging statements.  Only logging statements
      for which the verbosity level does not exceed the user-imposed threshold will be executed.  Users can easily regulate the verbosity level by
      setting the environment variable TINGEA_LOG_TAG.	Alternatively, programs may accept a command line argument.  The format accepted  by  both
      environment  variable  and command line argument is identical.  For the command line the programmer is free in choosing the option name.	It
      is customarily named -q.	The availability of such an option may vary from program to program.  However, any program that makes use  of  the
      Tingea logging facilities can be regulated with the TINGEA_LOG_TAG environment variable.	If a -q type option is present and the environment
      variable is set, then the environment variable is interpreted first followed by the -q argument.

      Tingea logging allows a programmer to assign categories to logging statements. The categories FUNCTION and DATA have a  subdivision  ranging
      from fine-grained to coarse-grained. The categorie MONITORING has a subdivision ranging from low priority to high priority.  The other cate-
      gories are unimodal. These are IO, THREAD, PROCESS, and GAUGE. Three unspecified unimodal categories are SLOT1, SLOT2, and SLOT3.  They  can
      be used to encode program-specific semantics.

      The  programmer  may  assign multiple categories to a single logging statement.  It is unusual for more than two categories to be specified.
      For example, IO and DATA at the LIST level may be combined to indicate a logging statement that provides data summaries  for  a  certain	IO
      related information. In order of granularity the DATA levels are CELL, LIST, and AGGREGRATE. If the user accepts IO logging and accepts DATA
      logging at level CELL or LIST the statement will be executed. If no IO logging is accepted or DATA logging is only accepted  at  the  AGGRE-
      GRATE level, the statement will be skipped.

      By  default,  all  categories  that are specified by the programmer need to pass the threshold specified by the user for that category.  The
      user may relax this requirement so that only one category needs to pass the user threshold. In the above example, the statement  categorized
      as both IO and DATA at LIST level will be accepted if the user specifies IO and DATA at AGGR level with OR semantics.

  SYNTAX
      The syntax of the TINGEA_LOG_TAG environment variable is described by

	 [[189x]]{<[dfgimpstABC][1-9]>*,[V]}

      which  translates to the following. An optional lead tag is followed by a concatenation of units. A unit is either a pair in [dfgimpstABC] x
      [1-9x] or the single character V.  The leading tag semantics are described further below.  The single character  V,  if  present,  specifies
      that OR semantics should be used rather than the default AND semantics. The semantics for the other units are given below.

	 d     DATA
		  1  CELL
		  2  LIST
		  3  AGGR
		  x  turned off

	 f     FUNCTION
		  1  LINE
		  2  FUNCTION
		  3  MODULE
		  4  APPLICATION
		  x  turned off

	 m     MONITORING
		  1  DEBUG
		  2  INFO
		  3  WARNING
		  4  ERROR
		  5  PANIC
		  x  turned off

	 g     GAUGE	|
	 i     IO	|
	 n     NETWORK	|
	 p     PROCESS	|  (Inter Process really)
	 t     THREAD	|______  1 on
			|	 x off
	 A     SLOT1	|
	 B     SLOT2	|
	 C     SLOT3	|

      The  leading  tag  can be used to set levels for all categories at once.	Subsequent units may then alter this intial setting.  The lead tag
      settings and their meaning are these:

	 1     d1f1m1g1i1p1s1t1A1B1C1	  # very yappy
	 9     d3f4m5gxixpxsxtxAxBxCx	  # very terse, only d f m
	 8     d3f4m5g1i1p1s1t1A1B1C1	  # less terse
	 x     dxfxmxgxixpxsxtxAxBxCx	  # silent

      All categories accept values between 1 and 9 in addition to the value x. As seen above, only a few categories contain more  than	one  level
      and no category contains more than five levels.  The rule is that if a level exceeds the maximul level available for a category it is simply
      interpreted as the maximum level.

      The GAUGE category, if set, indicates that a program may write line based progress bars or other output in which a single  line  is  accumu-
      lated  over  multiple  statements.  This	implies that a single GAUGE logging statement may not result in newline-terminated output. This is
      undesirable in case the logging stream is directed to a file that is written to by other applications as well. In that case, turn off GAUGE.
      All other categories are garantueed to result in line-terminated output, by virtue of the programmer contract.

  AUTHOR
      Stijn van Dongen.

  tingea.log 12-068						      8 Mar 2012						       tingea.log(7)
All times are GMT -4. The time now is 08:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy