LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-17-2011, 01:22 PM   #1
prafu
LQ Newbie
 
Registered: Aug 2010
Posts: 9

Rep: Reputation: 0
Unhappy Linux internals


hi,

I'm studying linux internals programming. can anyone tell me what is wrong in the following program? it hangs at the open statement.... I'm getting the "1" value which mkfifo returns...

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<fcntl.h>
int main()
{
int a,b=4,fid;
printf("\n\n Hello World \n\n");
a=mkfifo("new",0666);
printf("\n mkfifo returnes : %d\n",a);
fid=open("new",O_WRONLY,0777);
printf("given number is : %d",b);
write(fid,&b,sizeof(b));
close(fid);
return 0;
}
 
Old 09-17-2011, 01:42 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
please use useful and informative thread titles in future.

This thread will shortly be moved to the Programming forum.
 
Old 09-17-2011, 05:58 PM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Welcome to LQ. Hope your time here helps you as much as mine has helped me.

Please put code, command line output, config files, etc. inside [CODE] tags, aka "Code:" blocks.

It will make your posts easier to read, & that will get you more, faster, better answers. -- Help us help you.
BTW, You can edit your post(s) to do this retroactively. Please do so soon.

Thank you, & again, welcome.


Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.


P.S. I tried to fix your "Help me" title.

Last edited by archtoad6; 09-17-2011 at 06:01 PM.
 
Old 09-17-2011, 08:33 PM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by prafu View Post
hi,

I'm studying linux internals programming. can anyone tell me what is wrong in the following program? it hangs at the open statement.... I'm getting the "1" value which mkfifo returns...

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<fcntl.h>
int main()
{
int a,b=4,fid;
printf("\n\n Hello World \n\n");
a=mkfifo("new",0666);
printf("\n mkfifo returnes : %d\n",a);
fid=open("new",O_WRONLY,0777);
printf("given number is : %d",b);
write(fid,&b,sizeof(b));
close(fid);
return 0;
}
open in write mode will block until the same pipe is opened in read mode.
Kevin Barry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux-Internals ardcanand Linux - Newbie 3 03-15-2011 02:48 PM
Linux internals? learning embedded Linux - General 2 01-21-2010 06:45 AM
see linux kernel internals kpachopoulos Linux - General 4 07-05-2005 06:15 PM
Linux Kernel Internals altosys Programming 10 07-24-2004 03:13 PM
Linux kernel internals RussoIsraeli Linux - General 2 11-02-2003 09:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration