 |
|
 |
|
Next: Snit runs away from his "issue"
|
| Author |
Message |
External

Since: Oct 31, 2007 Posts: 5
|
(Msg. 1) Posted: Thu Jun 04, 2009 5:32 am
Post subject: mknod issue Archived from groups: comp>os>linux>development>system (more info?)
|
|
|
Hi Friends,
I'm getting a mknod error while executing this program which
is to create a named fifo.
What is wrong with this usage? It will be really helpful
to correct me.
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#define FILE_NAME "/home/dejose/linux/named-fifo"
int
main()
{
int wr_desc, err_no;
err_no = mknod(FILE_NAME, S_IFIFO | 0666, 0);
if (err_no < 0) {
printf("\nmknod error = %d", err_no);
return;
}
wr_desc = open(FILE_NAME, O_WRONLY);
if (wr_desc < 0) {
printf("\nopen error");
}
write(wr_desc, "My first named fifo", strlen("My first named
fifo"));
}
Thanks,
Deepak |
|
| Back to top |
|
 |  |
External

Since: Apr 25, 2007 Posts: 134
|
(Msg. 2) Posted: Thu Jun 04, 2009 6:40 am
Post subject: Re: mknod issue [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jun 4, 5:32 am, deepak <deepakpj....TakeThisOut@gmail.com> wrote:
> I'm getting a mknod error while executing this program which
> is to create a named fifo.
> What is wrong with this usage? It will be really helpful
> to correct me.
No idea. What error do you get?
> err_no = mknod(FILE_NAME, S_IFIFO | 0666, 0);
> if (err_no < 0) {
> printf("\nmknod error = %d", err_no);
> return;
> }
The 'mknod' call does not return an error number.
"mknod() returns zero on success, or -1 if an error occurred
(in which
case, errno is set appropriately)."
DS |
|
| Back to top |
|
 |  |
External

Since: Jul 17, 2006 Posts: 53
|
(Msg. 3) Posted: Thu Jun 04, 2009 8:42 am
Post subject: Re: mknod issue [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
David Schwartz <davids DeleteThis @webmaster.com> writes:
> On Jun 4, 5:32 am, deepak <deepakpj... DeleteThis @gmail.com> wrote:
>
>> I'm getting a mknod error while executing this program which
>> is to create a named fifo.
>> What is wrong with this usage? It will be really helpful
>> to correct me.
>
> No idea. What error do you get?
>
>> err_no = mknod(FILE_NAME, S_IFIFO | 0666, 0);
>> if (err_no < 0) {
>> printf("\nmknod error = %d", err_no);
>> return;
>> }
>
> The 'mknod' call does not return an error number.
>
> "mknod() returns zero on success, or -1 if an error occurred
> (in which
> case, errno is set appropriately)."
.... and perror() can then be used to print a more-or-less human-readable
description of the error. |
|
| Back to top |
|
 |  |
External

Since: Jun 04, 2009 Posts: 2
|
(Msg. 4) Posted: Thu Jun 04, 2009 9:37 pm
Post subject: Re: mknod issue [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jun 4, 7:42 pm, Joe Pfeiffer <pfeif... DeleteThis @cs.nmsu.edu> wrote:
> David Schwartz <dav... DeleteThis @webmaster.com> writes:
> > On Jun 4, 5:32 am, deepak <deepakpj... DeleteThis @gmail.com> wrote:
>
> >> I'm getting a mknod error while executing this program which
> >> is to create a named fifo.
> >> What is wrong with this usage? It will be really helpful
> >> to correct me.
>
> > No idea. What error do you get?
>
> >> err_no = mknod(FILE_NAME, S_IFIFO | 0666, 0);
> >> if (err_no < 0) {
> >> printf("\nmknod error = %d", err_no);
> >> return;
> >> }
>
> > The 'mknod' call does not return an error number.
>
> > "mknod() returns zero on success, or -1 if an error occurred
> > (in which
> > case, errno is set appropriately)."
>
> ... and perror() can then be used to print a more-or-less human-readable
> description of the error.
Perror helped me to find the reason and it said file was already
present in the location.
Thanks for your help joe and david.
-Deepak |
|
| Back to top |
|
 |  |
| Related Topics: | RFC3971 - Does anyone know if RFC3971 support is being developed for Linux? It does not seem to be implemented in the mainline..
Size 8 bit, 16 bit, 32 bit and 64 bit systems. - I need to find out what is the size of following data structures in 8 bit, 16 bit, 32 bit, and 64 bit systems. struct....
Size 8 bit, 16 bit, 32 bit and 64 bit systems. - I need to find out what is the size of following data structures in 8 bit, 16 bit, 32 bit, and 64 bit systems. struct....
Access shared memory from kernel module - Hi All, I wanted to know if shared memory created in user space can be accessed from a loadable kernel module. Have no...
Controlling UART transmission of bytes - I'm programming an ARM's UART that comes with a library implementing the standard unix termios interface. Regarding..
[gentoo-user] where to put mknod? - Hello everyone, Another post-emerge -u world wrinkle: before I can /usr/sbin/pon must now mknod /dev/ppp c 108 0. .. |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|