Sponsored Content
Top Forums Programming Unix/Linux Newbie(ish) Question - IPC/Signals Post 13585 by theultimatechuf on Saturday 19th of January 2002 06:28:30 PM
Old 01-19-2002
Unix/Linux Newbie(ish) Question - IPC/Signals - EDITED, OOPS!

Smilie Hello, i have been given the following code to help me learn how to use signals, it won't compile. The problem maybe because this was written for use in Unix and i am trying to compile in Linux.

The error i get says that SIGPIPE and SIG_IGN are undeclared.

I think that these are defined in signum.h but am not sure and I can't check as nothing seems to be working at the mo (Triple booting with a couple of Win OS' = Grief). Please can somebody offer me some guidance, you all seem fairly knowledgeable. Apologies if this is all a bit Newbie or i'm being dense, it's all a bit strange.

EDIT- I have put normal brackets instead of the proper ones around my #include's so that they will display.

#include (stdio.h)
#include (stdlib.h)
#include (sys/stat.h)
#include (unistd.h)

#define FIFO_FILE "MYFIFO"
#define FIFO_FILE2 "MYFIFO2"
#define MAXNUM 8

int main(void)
{
FILE *fp;
FILE *fp2;

int i = 1; /* counters */
int j = 1;
int count = 0;
int array[10]; /* array to hold converted numbers */

signal(SIGPIPE, SIG_IGN);/* tell kernel to ignore a broken pipe */

/* Create the FIFO's if they do not exist */
mknod(FIFO_FILE, S_IFIFO|0666, 0);
mknod(FIFO_FILE2, S_IFIFO|0666, 0);

while(1)
{
/* Open the FIFO's here */

fp = fopen(FIFO_FILE, "r");
fp2 = fopen(FIFO_FILE2, "w");

/* Read in the array sent from Detector */

fread(array, sizeof(array), 1, fp);

/* here we cheek the values of the array.
If equal 2 write to the out FIFO so that
it can be read by display */
count = 0;
for (j=0; j < 9; j++)
{
if(array[j] > MAXNUM) count++;
else count = 0;
}

if(count == 2)
{
fwrite(array, sizeof(array), 1, fp2);
fwrite(NULL, 0, 1, fp2);
}

fclose(fp);
fclose(fp2);
}

return(0);

}





I don't want to sound rude but help other than 'go find X book' would be preferable as I would rather not wait 2 weeks to get one ordered.

Thank you kindly in advance[

Last edited by theultimatechuf; 01-19-2002 at 09:56 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Newbie question about unix flavours

Hi, I am newbie to unix. I am been immensily impressed by this forum. I have installed sun solaris in my pc and started learning unix. The question is, If i know one unix flavour (say sun solaris) is that i can claim, i know all the unix and linux flavours. Can i be able to work on other vendor... (3 Replies)
Discussion started by: Balaji
3 Replies

2. UNIX for Dummies Questions & Answers

linux newbie question...

I'm running Vector Linux on this computer, and everythign works fine, except for the NIC. I run netconfig, and then when I reboot it says: DC21140 at 0x9400(PCI BUS 0, device 11) h/w address 00:00:C0:2E:13:dC, and reqquires IRQ 9(provided by PCI BIOS) Setting up net subsytems. ... (5 Replies)
Discussion started by: Corey
5 Replies

3. UNIX for Dummies Questions & Answers

Newbie's question about COBOL Installation in Unix

I wanna to install a COBOL on the AIX unix server. Would u like to tell me the disk usage of COBOL installation? Thanks in advance. (2 Replies)
Discussion started by: GCTEII
2 Replies

4. Programming

signals related question

Hi all, Just a little question relative to signals. I know that if an application is in the sleep state, When a signal is catched, it will be processed by the handler. But what happens if it's processing something? Does the processing stops?? The following code should illustrate this case ... (2 Replies)
Discussion started by: ninjanesto
2 Replies

5. HP-UX

Question form unix newbie

hi, just starting to learn about unix in school. got stuck on shell script chapter and need some help i completed task one but the other four is byond me. Task 1) Write a shell script/program called dow that takes no arguments and displays just the current day of the week in lower case (i.e.... (2 Replies)
Discussion started by: wesleywu
2 Replies

6. Shell Programming and Scripting

Question using signals in my own shell..

Wasn't really sure where to put this, since I'm using C in UNIX, but I am making my own shell... so, what's going on is this: For our program, we had to create our own shell, and if the user pressed ctrl-c just at the cmdline, then this signal would be ignored, but if there is a foreground... (1 Reply)
Discussion started by: blind melon
1 Replies

7. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

8. Shell Programming and Scripting

A question about signals in Unix

Whats a signal 0. An exhaustive search on signals landed me nowhere. Is it possible to do something like this trap "echo $var" 0. If so what signal does this trap catch ? (2 Replies)
Discussion started by: kinny
2 Replies

9. Solaris

errors on Netra-440: "IPC Warning: ipc: tcp_protocol: bad magic number"

I was asked to look into a problem with a Sun Netra 440 in another department. On the server in question, the relevant 'uname -a' information is, "SunOS host1 5.9 Generic_118558-16 sun4u sparc SUNW,Netra-440". That information aside, while the other admin is logged into the ALOM, these errors are... (0 Replies)
Discussion started by: Borealis
0 Replies

10. Programming

C++ signals Linux

how can do this programs in c++ Program description: Infinite loop in a program starts working with 2 seconds the screen (console) "I 'm trying" to write, but it automatically after 10 seconds, the screen "Close" will terminate the execution of typing. c++ code (3 Replies)
Discussion started by: ss54
3 Replies
IPC::Run::Debug(3pm)					User Contributed Perl Documentation				      IPC::Run::Debug(3pm)

NAME
IPC::Run::Debug - debugging routines for IPC::Run SYNOPSIS
## ## Environment variable usage ## ## To force debugging off and shave a bit of CPU and memory ## by compile-time optimizing away all debugging code in IPC::Run ## (debug => ...) options to IPC::Run will be ignored. export IPCRUNDEBUG=none ## To force debugging on (levels are from 0..10) export IPCRUNDEBUG=basic ## Leave unset or set to "" to compile in debugging support and ## allow runtime control of it using the debug option. DESCRIPTION
Controls IPC::Run debugging. Debugging levels are now set by using words, but the numbers shown are still supported for backwards compatibility: 0 none disabled (special, see below) 1 basic what's running 2 data what's being sent/recieved 3 details what's going on in more detail 4 gory way too much detail for most uses 10 all use this when submitting bug reports noopts optimizations forbidden due to inherited STDIN The "none" level is special when the environment variable IPCRUNDEBUG is set to this the first time IPC::Run::Debug is loaded: it prevents the debugging code from being compiled in to the remaining IPC::Run modules, saving a bit of cpu. To do this in a script, here's a way that allows it to be overridden: BEGIN { unless ( defined $ENV{IPCRUNDEBUG} ) { eval 'local $ENV{IPCRUNDEBUG} = "none"; require IPC::Run::Debug"' or die $@; } } This should force IPC::Run to not be debuggable unless somebody sets the IPCRUNDEBUG flag; modify this formula to grep @ARGV if need be: BEGIN { unless ( grep /^--debug/, @ARGV ) { eval 'local $ENV{IPCRUNDEBUG} = "none"; require IPC::Run::Debug"' or die $@; } Both of those are untested. AUTHOR
Barrie Slaymaker <barries@slaysys.com>, with numerous suggestions by p5p. perl v5.14.2 2012-01-16 IPC::Run::Debug(3pm)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy