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(2)							     Linux Programmer's Manual							    IPC(2)

NAME
ipc - System V IPC system calls SYNOPSIS
int ipc(unsigned int call, int first, int second, int third, void *ptr, long fifth); DESCRIPTION
ipc() is a common kernel entry point for the System V IPC calls for messages, semaphores, and shared memory. call determines which IPC function to invoke; the other arguments are passed through to the appropriate call. User programs should call the appropriate functions by their usual names. Only standard library implementors and kernel hackers need to know about ipc(). CONFORMING TO
ipc() is Linux-specific, and should not be used in programs intended to be portable. NOTES
On a few architectures, for example ia64, there is no ipc() system call; instead msgctl(2), semctl(2), shmctl(2), and so on really are implemented as separate system calls. SEE ALSO
msgctl(2), msgget(2), msgrcv(2), msgsnd(2), semctl(2), semget(2), semop(2), semtimedop(2), shmat(2), shmctl(2), shmdt(2), shmget(2) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2007-06-28 IPC(2)
All times are GMT -4. The time now is 03:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy