Solved

How to use "exportfs" programatically

Posted on 2004-03-24
8
336 Views
Last Modified: 2013-12-23
How do I programatically use "exportfs" feature and get the failure if any.
I tried forking new process and using "execpv" function to execute "exportfs" command. But I am not able to get the errors if "exportfs" command fails.

Thanks.
Madhu
0
Comment
Question by:bs_madhu
8 Comments
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 10669869
What do you mean by "get the errors".

Do you mean get the error messages?

If so, you're probably best off to call exportfs from a popen() call.

If you mean get the return code, you'll have to fork(), do the exec() in the child, and wait for  the return status with waitpid().

If you mean both get the return code and the error messages, you'll need to create a pipe(), fork(), dup() stderr to the pipe in the child, then exec() in the child, then read the child's stderr from the pipe in the parent, then wait for the return status with waitpid().

The various man pages should tell you the details you need to implement all this.
0
 

Author Comment

by:bs_madhu
ID: 10674251
My problem is programatically export file system ( so that other hosts can mount it )and inform the user if any error occurs while exporting.
Is their any library function which provides the option to export a file system ?.
I searched linux manpages I found only executable (exportfs) which does this. Since I have to do this programatically I don't know how to get the error codes ( like 'errno' ) and inform the user about the failure.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10675508
these functions depend on your OS
on Solaris for eaxample it's add_share() and del_share() (see /usr/include/sys/share.h)
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:bs_madhu
ID: 10675694
Anything on linux
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10675903
see linux/nfsd/export.h
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13238355
sigh, but agreed ..
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13275623
PAQed with no points refunded (of 125)

modulo
Community Support Moderator
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Valid LIN protocol Protected ID values 1 37
Can't connect to WAMP server 5 48
Clarification on Network "Usage" for ESXi host. 13 65
WLC 5508 controller configuration 4 75
If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now