kopia lustrzana https://gitlab.com/sane-project/website
109 wiersze
4.5 KiB
HTML
109 wiersze
4.5 KiB
HTML
<!-- received="Mon Jan 25 09:24:29 1999 PST" -->
|
|
<!-- sent="Mon, 25 Jan 1999 18:23:10 +0100 (MET)" -->
|
|
<!-- name="Petter Reinholdtsen" -->
|
|
<!-- email="pere@hungry.com" -->
|
|
<!-- subject="Re: SG_BIG_BUFF woes on Linux" -->
|
|
<!-- id="199901251723.SAA25823@zero.cc.uit.no" -->
|
|
<!-- inreplyto="SG_BIG_BUFF woes on Linux" -->
|
|
<title>sane-devel: Re: SG_BIG_BUFF woes on Linux</title>
|
|
<h1>Re: SG_BIG_BUFF woes on Linux</h1>
|
|
<b>Petter Reinholdtsen</b> (<a href="mailto:pere@hungry.com"><i>pere@hungry.com</i></a>)<br>
|
|
<i>Mon, 25 Jan 1999 18:23:10 +0100 (MET)</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#215">[ date ]</a><a href="index.html#215">[ thread ]</a><a href="subject.html#215">[ subject ]</a><a href="author.html#215">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0216.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Previous message:</b> <a href="0214.html">Lee Riemenschneider: "Re: Microtek E3+ and SANE 0.74 (OS/2)"</a>
|
|
<li> <b>Maybe in reply to:</b> <a href="0177.html">Gerald Turner: "SG_BIG_BUFF woes on Linux"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0216.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Reply:</b> <a href="0216.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
[Gerald Turner]<br>
|
|
<i>> Hmm, I thought I read somewhere in the kernel source that reading</i><br>
|
|
<i>> /proc would be better, maybe having something to do with sysctl</i><br>
|
|
<i>> interface/values changing. However, I went looking for this and</i><br>
|
|
<i>> can't seem to find it.</i><br>
|
|
<p>
|
|
man sysctl(2) informs that this is a non-portable way to extract this<br>
|
|
value.<br>
|
|
<p>
|
|
<i>> Excuse me, the suggestion was by mistake. Use sysctl(). I just had a</i><br>
|
|
<i>> look through <confname.h>, sysconf() doesn't support anything beyond</i><br>
|
|
<i>> the POSIX definitions, no SG_BIG_BUFF.</i><br>
|
|
<p>
|
|
OK. I beleave it should be extractable for sysconf(), but until that<br>
|
|
happends, we will just have to make without it.<br>
|
|
<p>
|
|
<i>> Anyway is this doable? I can't be the only one using a distribution</i><br>
|
|
<i>> and modifying SG_BIG_BUFF (I do it to also improve cdda audio</i><br>
|
|
<i>> ripping performance)...</i><br>
|
|
<p>
|
|
I beleave it is the correct way. If the function returning the value<br>
|
|
is written to try lots of ways to extract this value, the result<br>
|
|
should be quite portable. Example:<br>
|
|
<p>
|
|
/*<br>
|
|
* return max size of file buffers(?), or -1 if not able to find the<br>
|
|
* current value.<br>
|
|
*/<br>
|
|
int<br>
|
|
get_sg_big_buff_value(void)<br>
|
|
{<br>
|
|
int value = -1;<br>
|
|
FILE *procfile = NULL;<br>
|
|
<p>
|
|
procfile = fopen("/proc/sys/kernel/sg-big-buff", "r");<br>
|
|
if (NULL != procfile)<br>
|
|
{<br>
|
|
fscanf(procfile, "%d", &value);<br>
|
|
fclose(procfile);<br>
|
|
return value;<br>
|
|
}<br>
|
|
<p>
|
|
#if defined(HAVE_LINUX_SYSCTL_H) && defined(HAVE_SYSCTL)<br>
|
|
{<br>
|
|
int name[] = { CTL_KERN, KERN_SG_BIG_BUFF };<br>
|
|
int namesize = sizeof(name)/sizeof(name[0]);<br>
|
|
if (0 == sysctl(name, namesize, &value, sizeof(value), 0, 0))<br>
|
|
return value;<br>
|
|
}<br>
|
|
#endif<br>
|
|
<p>
|
|
/* ... More ways to find it ... */<br>
|
|
<p>
|
|
return value;<br>
|
|
}<br>
|
|
<p>
|
|
This code is not tested. I'm not even sure if it compiles. You have<br>
|
|
been warned. :-)<br>
|
|
<p>
|
|
BTW: '/proc/sys/kernel/sg-big-buff' is missing on Linux 2.0.32, but<br>
|
|
present on 2.2.0-pre5.<br>
|
|
<pre>
|
|
--
|
|
##> Petter Reinholdtsen <## | <a href="mailto:pere@td.org.uit.no">pere@td.org.uit.no</a>
|
|
O- |
|
|
<a href="http://www.hungry.com/~pere/">http://www.hungry.com/~pere/</a> | Go Mozilla, go! Go!
|
|
<p>
|
|
<pre>
|
|
--
|
|
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
|
|
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
|
|
</pre>
|
|
<!-- body="end" -->
|
|
<p>
|
|
<ul>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0216.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Previous message:</b> <a href="0214.html">Lee Riemenschneider: "Re: Microtek E3+ and SANE 0.74 (OS/2)"</a>
|
|
<li> <b>Maybe in reply to:</b> <a href="0177.html">Gerald Turner: "SG_BIG_BUFF woes on Linux"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0216.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Reply:</b> <a href="0216.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|