Solved

How to use "exportfs" programatically

Posted on 2004-03-24
8
345 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
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
USB management software on a network of computers 4 47
Vmotion configuration 4 55
Can’t disable NAT protocol in Windows Server 2012 3 82
Wireshark question 1 19
#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

749 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