Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use "exportfs" programatically

Posted on 2004-03-24
8
Medium Priority
?
360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

670 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