1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>DVB frontend open()</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="frontend_fcalls.html" title="Frontend Function Calls"><link rel="prev" href="frontend_fcalls.html" title="Frontend Function Calls"><link rel="next" href="frontend_f_close.html" title="DVB frontend close()"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">DVB frontend open()</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="frontend_fcalls.html">Prev</a> </td><th width="60%" align="center">Frontend Function Calls</th><td width="20%" align="right"> <a accesskey="n" href="frontend_f_close.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="frontend_f_open"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>fe-open — Open a frontend device</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <fcntl.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">open</b>(</code></td><td>const char *<var class="pdparam">device_name</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.5.5.12.2.4"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>device_name</code></em></span></dt><dd><p>Device to be opened.</p></dd><dt><span class="term"><em class="parameter"><code>flags</code></em></span></dt><dd><p>Open flags. Access can either be 2 <code class="constant">O_RDWR</code> or <code class="constant">O_RDONLY</code>.</p><p>Multiple opens are allowed with <code class="constant">O_RDONLY</code>. In this mode, only query and read ioctls are allowed.</p><p>Only one open is allowed in <code class="constant">O_RDWR</code>. In this mode, all ioctls are allowed.</p><p>When the <code class="constant">O_NONBLOCK</code> flag is given, the system calls may return <span class="errorcode">EAGAIN</span> error code when no data is available or when the device driver is temporarily busy.</p><p>Other flags have no effect.</p></dd></dl></div></div><div class="refsect1"><a name="id-1.5.5.12.2.5"></a><h2>Description</h2><p>This system call opens a named frontend device (<code class="constant">/dev/dvb/adapter?/frontend?</code>) 3 for subsequent use. Usually the first thing to do after a successful open is to 4 find out the frontend type with <a class="link" href="FE_GET_INFO.html" title="ioctl FE_GET_INFO">FE_GET_INFO</a>.</p><p>The device can be opened in read-only mode, which only allows monitoring of 5 device status and statistics, or read/write mode, which allows any kind of use 6 (e.g. performing tuning operations.) 7</p><p>In a system with multiple front-ends, it is usually the case that multiple devices 8 cannot be open in read/write mode simultaneously. As long as a front-end 9 device is opened in read/write mode, other open() calls in read/write mode will 10 either fail or block, depending on whether non-blocking or blocking mode was 11 specified. A front-end device opened in blocking mode can later be put into 12 non-blocking mode (and vice versa) using the F_SETFL command of the fcntl 13 system call. This is a standard system call, documented in the Linux manual 14 page for fcntl. When an open() call has succeeded, the device will be ready 15 for use in the specified mode. This implies that the corresponding hardware is 16 powered up, and that other front-ends may have been powered down to make 17 that possible.</p></div><div class="refsect1"><a name="id-1.5.5.12.2.6"></a><h2>Return Value</h2><p>On success <code class="function">open</code> returns the new file 18descriptor. On error -1 is returned, and the <code class="varname">errno</code> 19variable is set appropriately. Possible error codes are:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">EACCES</span></span></dt><dd><p>The caller has no permission to access the 20device.</p></dd><dt><span class="term"><span class="errorcode">EBUSY</span></span></dt><dd><p>The the device driver is already in use.</p></dd><dt><span class="term"><span class="errorcode">ENXIO</span></span></dt><dd><p>No device corresponding to this device special file 21exists.</p></dd><dt><span class="term"><span class="errorcode">ENOMEM</span></span></dt><dd><p>Not enough kernel memory was available to complete the 22request.</p></dd><dt><span class="term"><span class="errorcode">EMFILE</span></span></dt><dd><p>The process already has the maximum number of 23files open.</p></dd><dt><span class="term"><span class="errorcode">ENFILE</span></span></dt><dd><p>The limit on the total number of files open on the 24system has been reached.</p></dd><dt><span class="term"><span class="errorcode">ENODEV</span></span></dt><dd><p>The device got removed.</p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="frontend_fcalls.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="frontend_fcalls.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="frontend_f_close.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Frontend Function Calls </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> DVB frontend close()</td></tr></table></div></body></html> 25