<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; execl</title>
	<atom:link href="https://www.emblogic.com/blog/tag/execl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Replacing a Process Image</title>
		<link>https://www.emblogic.com/blog/01/replacing-a-process-image/</link>
		<comments>https://www.emblogic.com/blog/01/replacing-a-process-image/#comments</comments>
		<pubDate>Fri, 15 Jan 2016 10:40:34 +0000</pubDate>
		<dc:creator><![CDATA[Ankur Garg]]></dc:creator>
				<category><![CDATA[Linux Internals and System Programming]]></category>
		<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[execl]]></category>
		<category><![CDATA[execv]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[process replacement]]></category>
		<category><![CDATA[Replacing a Process Image]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=13167</guid>
		<description><![CDATA[Replacing a Process Image ========================= - The exec function replaces current process with a new process. - The path of new process is specified as argument to exec. - It is defined in header : #include&#60;unistd.h&#62; - Last argument of &#8230; <a href="https://www.emblogic.com/blog/01/replacing-a-process-image/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Replacing a Process Image<br />
=========================<br />
- The exec function replaces current process with a new process.<br />
- The path of new process is specified as argument to exec.<br />
- It is defined in header :<br />
#include&lt;unistd.h&gt;<br />
- Last argument of function should be NULL.<br />
- It has 6 types of functions, whose prototype are :-<br />
(i) Complete path is specified<br />
int execl(const char * path, const char * arg0,const char * arg1,&#8230;,NULL);<br />
(ii) If file is at one of default paths<br />
int execlp(const char * file, const char * arg0,const char * arg1,&#8230;,NULL);<br />
(iii) If arguments are given as an vector(array)<br />
int execv(const char *path,char *const argv[]);<br />
(iv) If arguments are given as an vector(array) and file is at one of default paths<br />
int execvp(const char* file, char *const argv[]);<br />
(v) int execle(const char *path, const char * arg0, const char * arg1,&#8230;,NULL, char *const envp[]);<br />
(vi) int execve(const char *path, char *const argv[],char *const envp[] );</p>
<p>- The suffix p means to search PATH environmental variable.</p>
<p>- If the exec is executed successfully the statements after it will not be executed.<br />
- It is because the current process is replaced.<br />
- The arguments given to exec are used by main() function of new process as command line argument.<br />
- If exec fails, it returns -1<br />
- The open file descriptors remain open after the exec command.<br />
- These file descriptors can be passed to exec as command and can be used by the replaced process to read/write from opened file.<br />
- The argument is passed to exec as character.<br />
- For this sprintf() is used.<br />
- And for getting the file descriptors back , atoi() or integer typecasting can be used on the arguments of main().</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/01/replacing-a-process-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>process replacement followed by inter process comm. using file</title>
		<link>https://www.emblogic.com/blog/09/process-replacement-followed-by-inter-process-comm-using-file/</link>
		<comments>https://www.emblogic.com/blog/09/process-replacement-followed-by-inter-process-comm-using-file/#comments</comments>
		<pubDate>Mon, 22 Sep 2014 13:17:41 +0000</pubDate>
		<dc:creator><![CDATA[Joon Vichitra]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>
		<category><![CDATA[execl]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[ipc]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11516</guid>
		<description><![CDATA[This is the output: [root@localhost ipc]# ./p_comm File Open Successfully This is Parent with id=31340 This is child with id=31341 This is a new program which replaced the child Write By Child:: Success Read by Parent: Success     Child Said:Hello &#8230; <a href="https://www.emblogic.com/blog/09/process-replacement-followed-by-inter-process-comm-using-file/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>This is the output:</strong></p>
<p><strong>[root@localhost ipc]# ./p_comm </strong><br />
<strong>File Open Successfully</strong><br />
<strong>This is Parent with id=31340</strong><br />
<strong>This is child with id=31341</strong><br />
<strong>This is a new program which replaced the child</strong><br />
<strong>Write By Child:: Success</strong><br />
<strong>Read by Parent: Success</strong><br />
<strong>    Child Said:Hello Parent</strong><br />
<strong>Write by Parent: Success</strong><br />
<strong>Read By Child:: Success</strong><br />
<strong>    Parent said:Hi Child How are you?</strong><br />
<strong>Write By Child:: Success</strong><br />
<strong>Read by Parent: Success</strong><br />
<strong>    Child Said:I am Fine. U Tell?</strong><br />
<strong>Write by Parent: Success</strong><br />
<strong>Read By Child:: Success</strong><br />
<strong>    Parent said:We are also fine.Ok Bye</strong><br />
<strong>Child exit successfully and code is 0</strong></p>
<p>Log File</p>
<p>RCS file: RCS/p_comm.c,v<br />
Working file: p_comm.c<br />
head: 1.4<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 4;    selected revisions: 4<br />
description:<br />
program to communicate between two process through a file<br />
done- opening a file in rdwr mode<br />
convert int fd into string to make compatiple with execl argument<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/09/22 12:46:24;  author: root;  state: Exp;  lines: +13 -3<br />
done:both read and write by parent in the same file<br />
Note: Before executing this program make sure that &#8220;child_comm.c&#8221; file must be in the same directory<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/09/22 12:10:56;  author: root;  state: Exp;  lines: +9 -4<br />
1st read by the parent and then reply back to child by writing into the same file<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/22 11:53:56;  author: root;  state: Exp;  lines: +10 -4<br />
read the message written by child in a file<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/22 11:23:57;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: RCS/child_comm.c,v<br />
Working file: child_comm.c<br />
head: 1.4<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 4;    selected revisions: 4<br />
description:<br />
program which will replace the child to do inter process comm through file<br />
get fd through argv[0] and than convert into integer using atoi<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/09/22 12:48:25;  author: root;  state: Exp;  lines: +12 -2<br />
done:child repalace itself with this file using execl and this program then communicate with parent<br />
note:this program is linked with p_comm.c<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/09/22 12:11:48;  author: root;  state: Exp;  lines: +9 -2<br />
1st write the msg for parent and then read the msg from parent using the same file<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/22 11:40:06;  author: root;  state: Exp;  lines: +4 -3<br />
got message which is to be written in file through argv[1]<br />
write the message into file<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/22 11:32:27;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/09/process-replacement-followed-by-inter-process-comm-using-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Process replacement using execl</title>
		<link>https://www.emblogic.com/blog/09/process-replacement-using-execl/</link>
		<comments>https://www.emblogic.com/blog/09/process-replacement-using-execl/#comments</comments>
		<pubDate>Mon, 22 Sep 2014 13:09:46 +0000</pubDate>
		<dc:creator><![CDATA[Joon Vichitra]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>
		<category><![CDATA[execl]]></category>
		<category><![CDATA[ipc]]></category>
		<category><![CDATA[process replacement]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11514</guid>
		<description><![CDATA[RCS file: p_replace.c,v Working file: p_replace.c head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2;    selected revisions: 2 description: program to replace the child process using execl() &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.2 date: 2014/09/22 10:22:30;  author: &#8230; <a href="https://www.emblogic.com/blog/09/process-replacement-using-execl/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: p_replace.c,v<br />
Working file: p_replace.c<br />
head: 1.2<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 2;    selected revisions: 2<br />
description:<br />
program to replace the child process using execl()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/22 10:22:30;  author: root;  state: Exp;  lines: +9 -1<br />
use wait statement so that parent will wait till the child completed its execution<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/22 10:06:47;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: child.c,v<br />
Working file: child.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
sample program which replace the child when call by child through execl()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/22 10:06:07;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/09/process-replacement-using-execl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
