|
Home > Archive > Unix Programming > January 2004 > mount() = mount -f NFS,bg
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
mount() = mount -f NFS,bg
|
|
|
| in my program, I want to use mount to mount NFS. the rigth command is
#mount -f NFS,bg u8:/ /nfs/u8
in my program I write:
mflag=0;
fstyp=0;
cc=mount("u8/","/nfs/u8",mflag, fstyp,NULL,0);
this function does not work. what should be mflag? what should be fstyp?
gdm
| |
| Fletcher Glenn 2004-01-23, 4:55 pm |
|
gdm wrote:quote:
> in my program, I want to use mount to mount NFS. the rigth command is
> #mount -f NFS,bg u8:/ /nfs/u8
>
> in my program I write:
> mflag=0;
> fstyp=0;
> cc=mount("u8/","/nfs/u8",mflag, fstyp,NULL,0);
>
> this function does not work. what should be mflag? what should be fstyp?
> gdm
>
Your mount() function call does not match the prototype on the mount(2)
man page for Solaris. You probably need to specify your O/S if you
want specific help. BTW - on the Solaris function, fstyp is a char *.
--
Fletcher Glenn
| |
| Fletcher Glenn 2004-01-23, 4:55 pm |
|
gdm wrote:quote:
> in my program, I want to use mount to mount NFS. the rigth command is
> #mount -f NFS,bg u8:/ /nfs/u8
>
> in my program I write:
> mflag=0;
> fstyp=0;
> cc=mount("u8/","/nfs/u8",mflag, fstyp,NULL,0);
>
> this function does not work. what should be mflag? what should be fstyp?
> gdm
>
Your mount() function call does not match the prototype on the mount(2)
man page for Solaris. You probably need to specify your O/S if you
want specific help. BTW - on the Solaris function, fstyp is a char *.
--
Fletcher Glenn
| |
|
| Fletcher Glenn wrote:quote:
> gdm wrote:
[QUOTE][color=darkred]
[QUOTE][color=darkred]
[QUOTE][color=darkred]
> Your mount() function call does not match the prototype on the
> mount(2) man page for Solaris. You probably need to specify your O/S
> if you
> want specific help. BTW - on the Solaris function, fstyp is a char *.
I use SCO openserver5.0.5. But I am not sure that the syscall could be so
different according to the O/S. it seems that my problem is to know what
value is mflag and to know what value is fstyp.
gdm
| |
|
| Fletcher Glenn wrote:quote:
> gdm wrote:
[QUOTE][color=darkred]
[QUOTE][color=darkred]
[QUOTE][color=darkred]
> Your mount() function call does not match the prototype on the
> mount(2) man page for Solaris. You probably need to specify your O/S
> if you
> want specific help. BTW - on the Solaris function, fstyp is a char *.
I use SCO openserver5.0.5. But I am not sure that the syscall could be so
different according to the O/S. it seems that my problem is to know what
value is mflag and to know what value is fstyp.
gdm
| |
| David Schwartz 2004-01-23, 4:55 pm |
|
"gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
news:3fb8e671$0$6966$7a628cd7@news.club-internet.fr...
quote:
> in my program, I want to use mount to mount NFS. the rigth command is
> #mount -f NFS,bg u8:/ /nfs/u8
>
> in my program I write:
> mflag=0;
> fstyp=0;
> cc=mount("u8/","/nfs/u8",mflag, fstyp,NULL,0);
>
> this function does not work. what should be mflag? what should be fstyp?
> gdm
Are you trying to write your own 'mount' program? Why not just use the
existing one?
DS
| |
| David Schwartz 2004-01-23, 4:55 pm |
|
"gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
news:3fb8e671$0$6966$7a628cd7@news.club-internet.fr...
quote:
> in my program, I want to use mount to mount NFS. the rigth command is
> #mount -f NFS,bg u8:/ /nfs/u8
>
> in my program I write:
> mflag=0;
> fstyp=0;
> cc=mount("u8/","/nfs/u8",mflag, fstyp,NULL,0);
>
> this function does not work. what should be mflag? what should be fstyp?
> gdm
Are you trying to write your own 'mount' program? Why not just use the
existing one?
DS
| |
| Fletcher Glenn 2004-01-23, 4:55 pm |
|
gdm wrote:quote:
> Fletcher Glenn wrote:
>
>
>
>
>
>
> I use SCO openserver5.0.5. But I am not sure that the syscall could be so
> different according to the O/S. it seems that my problem is to know what
> value is mflag and to know what value is fstyp.
>
> gdm
>
Well, fstyp is "NFS", but the mflags would be in the header file
specified on the man page for the mount(2) command. It would be a
combination of flags indicating read/only(or not), no-suid, overlay,
etc... This should all be specified on the man page.
--
Fletcher Glenn
| |
| Fletcher Glenn 2004-01-23, 4:55 pm |
|
gdm wrote:quote:
> Fletcher Glenn wrote:
>
>
>
>
>
>
> I use SCO openserver5.0.5. But I am not sure that the syscall could be so
> different according to the O/S. it seems that my problem is to know what
> value is mflag and to know what value is fstyp.
>
> gdm
>
Well, fstyp is "NFS", but the mflags would be in the header file
specified on the man page for the mount(2) command. It would be a
combination of flags indicating read/only(or not), no-suid, overlay,
etc... This should all be specified on the man page.
--
Fletcher Glenn
| |
|
| David Schwartz wrote:quote:
> "gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
> news:3fb8e671$0$6966$7a628cd7@news.club-internet.fr...
>
>
> Are you trying to write your own 'mount' program? Why not just
> use the existing one?
no, I do not want to write my own program. No certainly not! I prefer use
mount(......); rather than "system("mount -f NFS .... ");
gdm
| |
|
| David Schwartz wrote:quote:
> "gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
> news:3fb8e671$0$6966$7a628cd7@news.club-internet.fr...
>
>
> Are you trying to write your own 'mount' program? Why not just
> use the existing one?
no, I do not want to write my own program. No certainly not! I prefer use
mount(......); rather than "system("mount -f NFS .... ");
gdm
| |
| David Schwartz 2004-01-23, 4:55 pm |
|
"gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
news:3fb9654c$0
$6968$7a628cd7@news.club-internet.fr...
quote:
> David Schwartz wrote:
quote:
[QUOTE][color=darkred]
[QUOTE][color=darkred]
> no, I do not want to write my own program. No certainly not! I prefer use
> mount(......); rather than "system("mount -f NFS .... ");
You're being inconsitent. If you don't want to write your own mount
program, use the existing one. If you don't use the existing one, you're
writing your own.
I'm not sure about your specific operating system, but on some, the
'mount' program has to do a lot of work to mount an NFS volume. The actual
attaching of the server to the mount point (with the 'mount' system call)
may be only the last step of a very complex set of steps.
DS
| |
| David Schwartz 2004-01-23, 4:55 pm |
|
"gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
news:3fb9654c$0
$6968$7a628cd7@news.club-internet.fr...
quote:
> David Schwartz wrote:
quote:
[QUOTE][color=darkred]
[QUOTE][color=darkred]
> no, I do not want to write my own program. No certainly not! I prefer use
> mount(......); rather than "system("mount -f NFS .... ");
You're being inconsitent. If you don't want to write your own mount
program, use the existing one. If you don't use the existing one, you're
writing your own.
I'm not sure about your specific operating system, but on some, the
'mount' program has to do a lot of work to mount an NFS volume. The actual
attaching of the server to the mount point (with the 'mount' system call)
may be only the last step of a very complex set of steps.
DS
| |
| Barry Margolin 2004-01-23, 4:56 pm |
| In article <bpboq8$dku$1@nntp.webmaster.com>,
David Schwartz <davids@webmaster.com> wrote:quote:
>
>"gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
>news:3fb9654c$0
>$6968$7a628cd7@news.club-internet.fr...
>
>
>
> You're being inconsitent. If you don't want to write your own mount
>program, use the existing one. If you don't use the existing one, you're
>writing your own.
He's writing a program that needs to mount a filesystem as part of its
operation. That's not the same thing as "his own mount program".
System() should not generally be used when the OS provides a usable API for
an operation.
--
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
| |
| Barry Margolin 2004-01-23, 4:56 pm |
| In article <bpboq8$dku$1@nntp.webmaster.com>,
David Schwartz <davids@webmaster.com> wrote:quote:
>
>"gdm" <ggdm123a._sans_le_a@club-internet.fr> wrote in message
>news:3fb9654c$0
>$6968$7a628cd7@news.club-internet.fr...
>
>
>
> You're being inconsitent. If you don't want to write your own mount
>program, use the existing one. If you don't use the existing one, you're
>writing your own.
He's writing a program that needs to mount a filesystem as part of its
operation. That's not the same thing as "his own mount program".
System() should not generally be used when the OS provides a usable API for
an operation.
--
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
| |
| David Schwartz 2004-01-23, 4:56 pm |
|
"Barry Margolin" <barry.margolin@level3.com> wrote in message
news:TSrub.541$lK3.141@news.level3.com...
quote:
[QUOTE][color=darkred]
> He's writing a program that needs to mount a filesystem as part of its
> operation. That's not the same thing as "his own mount program".
Then he should use the system's mount program.
But they're not the same operation. The 'mount' system call is just one
of the many steps the 'mount' program may have to do to create a mount. The
'mount' program may be responsible for DNS, creating a socket, connecting
it, performing authentication, and who knows what else.
quote:
> System() should not generally be used when the OS provides a usable API
forquote:
> an operation.
Yes, if the API was portable. However, in this case, the program is
portable but the API isn't. Attempting to use the platform-specific API
directly would result in him having to re-create the platform's 'mount'
program, and who knows what that does.
DS
| |
| David Schwartz 2004-01-23, 4:56 pm |
|
"Barry Margolin" <barry.margolin@level3.com> wrote in message
news:TSrub.541$lK3.141@news.level3.com...
quote:
[QUOTE][color=darkred]
> He's writing a program that needs to mount a filesystem as part of its
> operation. That's not the same thing as "his own mount program".
Then he should use the system's mount program.
But they're not the same operation. The 'mount' system call is just one
of the many steps the 'mount' program may have to do to create a mount. The
'mount' program may be responsible for DNS, creating a socket, connecting
it, performing authentication, and who knows what else.
quote:
> System() should not generally be used when the OS provides a usable API
forquote:
> an operation.
Yes, if the API was portable. However, in this case, the program is
portable but the API isn't. Attempting to use the platform-specific API
directly would result in him having to re-create the platform's 'mount'
program, and who knows what that does.
DS
|
|
|
|
|