Commit Graph
136 Commits
Author SHA1 Message Date
Jean Delvare 0871a7d568 Drop invalid statement.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6032 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-08 20:36:42 +00:00
Jean Delvare 38158e4fe3 Calling strcat twice in a row is inefficient, it's better to use
sprintf at the end of the string, so that we look for that end only
once.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6027 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-06 07:24:42 +00:00
Jean Delvare 1c20f6a298 Fold get_features() into do_features().
There is no rationale for having separate functions, both are static
and called only once. do_features() is calling helper functions to get
values it doesn't use and passes to get_features() directly. Having a
single function is more efficient and allows for per-action
optimizations.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6026 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-06 07:23:42 +00:00
Jean Delvare 8aa001900f Fix memory leaks in sensord revealed by valgrind.
The leak in daemonize() is harmless, we're about to exit anyway. Fix
it still to make valgrind happy.

The leak in do_features() is real, as the function is called
periodically by the daemon, for all actions. If the intervals at set
low and the system has many sensors, the leak could be significant,
maybe 150 kB/day.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6025 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-06 07:22:06 +00:00
Jean Delvare d61b638245 Fix support of multiple chips. Regression in 3.1.2, faulty commit is
r5792. Fixes ticket #2377.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5835 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-05-07 09:01:58 +00:00
Jean Delvare 6d3f81d5da "alarm" is a glibc function, don't use this identifier for our own
variables to prevent any confusion.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5797 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-05 09:23:46 +00:00
Andre Prendel db0b1e6e11 sensord: Break long lines in doChips()
This patch breaks long lines in function doChips().


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5796 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:12:34 +00:00
Andre Prendel a079f9c35d sensord: Evaluate return value of idChip()
Evaluate return value of idChip().

Some of the functions called from idChip() can fail which means
idChip() can return an error. Callers of idChip() should be aware of
this.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5795 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:11:41 +00:00
Andre Prendel 57e7762901 sensord: Refactoring of file prog/sensord/sense.c
This patch does some refactoring of function doKnownChip().

* doKnownChip() is a huge function with deep indentation
levels. Splitting this funcion up into smaller ones makes code much
more readable.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5794 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:08:32 +00:00
Andre Prendel bb6495d47d sensord: Change signature of (*FeatureFN)
This patch changes the signature of function pointer (*FeatureFN) and
the related functions:

  rrdGetSensors_DS()
  rrdCGI_DEF()
  rrdCGI_LINE()

Return type is now void because none of the functions return an error
code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5793 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:07:38 +00:00
Andre Prendel ae56c60bff sensord: Refactoring of applyToFeature()
This patch cleans up function applyToFeature().

Function applyToFeature() is nearly unreadable. There are some deep
levels of indentation and cascades of loops makes code flow difficult to
read.

I split up this function into three smaller one. This reduces
indentation levels and makes code flow clearer.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5792 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:06:54 +00:00
Andre Prendel 051d8693e4 sensord: Remove needless casts
This patch removes some needless casts. We don't have to cast
explicitly from void * (in C).


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5791 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:05:19 +00:00
Andre Prendel eea3628561 sensord: Convert CGI script to lower case
This patch converts HTML code in the generated CGI script to lower
case. This makes us a bit more XHTML compatible.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5790 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:04:30 +00:00
Andre Prendel 13b3c7aa36 sensord: Fix coding style
This patch fixes some coding style issues.

* Remove whitespaces between variable and increment operator.
* Break long lines.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5789 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-11-04 19:02:58 +00:00
Jean Delvare 78f496ca62 libsensors: New method to free the memory allocated for the internal
representation of chip names.
sensord, sensors: Fix a memory leak when one or more chip names are
provided on the command line.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5740 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-20 10:04:52 +00:00
Jean Delvare ef2f2c04ce Use the "daemon" logging facility instead of "local4" by default.
Local facilities are meant for local uses, no daemon should use it by
default.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5737 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-11 17:39:48 +00:00
Jean Delvare 8eeb9081a8 Optimize CGI generation code a bit.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5736 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-09 12:44:44 +00:00
Jean Delvare a5bb03f300 Disable unit scaling for fan speeds. We want fan speed to be reported as
3000 RPM, not 3.0 kRPM.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5735 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-09 12:22:11 +00:00
Jean Delvare 098ae6d2e5 Don't use the system log when generating a CGI script. This is is
normally done by a human on a console, rather than in the background,
so the system log isn't where people would look for error messages.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5734 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-09 12:19:53 +00:00
Andre Prendel cae8b2a1e7 sensord: Fix build error.
This is caused by a missing file (prog/sensord/args.h) in commit:

r5719 sensord: Introduce struct sensord_args.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5732 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-09 08:02:49 +00:00
Andre Prendel 73911c4c93 sensord: Refactoring of the rrdInit() function.
* Fix deep indentation levels
* Return with unique error code (-1)
* Rename buffer for struct stat from tmp to sb.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5724 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:13:41 +00:00
Andre Prendel 13dc7c0232 Replace the deprecated signal() function by sigaction().
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5723 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:11:57 +00:00
Andre Prendel f5aaeec448 sensord: This patch does some refactoring of the loadConfig()
function.

* Simplifying the conditions makes code flow clearer and eliminates
long lines (> 80 chars).
* Removed useless stat() call.
* Return -1 in error case, instead of several positive values (never defined).


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5722 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:09:06 +00:00
Andre Prendel b5375e4344 sensord: Did some refactoring in parseChips(). This fixes some deep indentation
levels.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5721 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:07:50 +00:00
Andre Prendel d71ed51702 sensord: Removed useless breaks after some exit() calls.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5720 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:06:17 +00:00
Andre Prendel 49344ef205 sensord: Introduce struct sensord_args.
This structure encapsulate all the variables holding the commandline
arguments. So we get rid of plenty of extern variables. This reduces
namespace collisions and unifies access.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5719 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:04:51 +00:00
Andre Prendel b42461426d sensord: Remove the hidden commandline interface.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5718 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-05-13 16:03:23 +00:00
Andre Prendel 3a002f7487 sensord: Remove leading whitespaces in empty lines.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5679 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-03-10 10:37:41 +00:00
Andre Prendel e065e827e9 Convert coding style in prog/sensord/ from gnu to kernel style.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5678 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-03-09 15:32:03 +00:00
Jean Delvare 93aa7f3222 Don't bail out on transient errors (#2330).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5580 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-01-08 11:01:41 +00:00
Jean Delvare 05db7e0c10 Accept negative temperatures in RRD database.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5473 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-11-30 13:18:35 +00:00
Jean Delvare aa47fb99e2 Fix support of multiple chip names on the command line. It got broken
accidentally during the conversion to the new libsensors API in version
3.0.0. This closes ticket #2321.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5252 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-05-12 11:51:18 +00:00
Jean Delvare f2e518511d Patch from Aurelien Jarno:
I have just noticed that the FSF address is the old one in all files
except COPYING. Please find a patch below to fix that.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5163 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-03-26 13:37:12 +00:00
Jean Delvare b029b8f861 sensord: Drop workaround needed by old versions of rrdtool. The bug
(missing getopt variables initialization) was fixed in rrdtool version
1.2.1, 2.5 years ago.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5072 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-12-11 22:56:47 +00:00
Jean Delvare 9dbde1cc06 Drop unneeded include.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5071 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-12-11 22:00:49 +00:00
Jean Delvare e257a45fed sensord: Use the same colors for daily and weekly charts.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5070 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-12-11 21:48:34 +00:00
Jean Delvare 4f8196934c sensord: Fix rrd support (#2276).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5069 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-12-11 13:14:39 +00:00
Jean Delvare 35a5a7dbce Use /etc/sensors3.conf as the default configuration file. If it can't
be found, fallback to /etc/sensors.conf. This allows for an old
libsensors and a new libsensors to be installed in parallel, and each
one has its own configuration file.

One important change here is that the default configuration file will
be installed as /etc/sensors3.conf by "make install".


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4990 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-25 09:59:05 +00:00
Jean Delvare 6d5292cce4 "sensord" no longer needs a default configuration file name. If no
file name is provided on the command line, use the libsensors default.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4987 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-25 09:50:17 +00:00
Jean Delvare 3d9acfa6f9 sensord: Reload config on SIGHUP rather than automatically.
Reloading the configuration on SIGHUP is common for daemons. Reloading
automatically is less efficient and can be confusing or even racy.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4969 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-20 14:05:35 +00:00
Jean Delvare ff46494457 sensord manual page update.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4919 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-07 07:32:21 +00:00
Jean Delvare 3a87a433fd Drop the configuration file search path mechanism from sensord. It's
confusing and useless. We dropped it from sensors years ago.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4918 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-07 07:23:32 +00:00
Jean Delvare cb5a94578d Chip-specific code is gone.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4914 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-01 17:05:34 +00:00
Jean Delvare 43e4f551b7 Log the error code on failure, to make it easier to investigate
problems.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4888 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-26 17:15:13 +00:00
Jean Delvare 4b6f9ee727 Better error message if configuration file can't be loaded.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4853 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 13:48:52 +00:00
Jean Delvare c390c9e29f Hide warnings about unused parameters.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4849 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:47:27 +00:00
Jean Delvare e01466d993 New public library function: sensors_get_subfeature(). Applications can
use it to retrieve a specific subfeature by type. While it is slighly
less efficient than looping over sensors_get_all_subfeatures(), it
often makes the application code much more elegant.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4846 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:30:28 +00:00
Jean Delvare da7b4e48da Introduce a separate type for main features. Make subfeatures map to
the real main feature rather than the first subfeature.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4838 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:16:50 +00:00
Jean Delvare 65f1d1f1cd Rename subfeature types from *_FEATURE_* to *_SUBFEATURE_*, to better
reflect what they represent.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4837 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:12:19 +00:00
Jean Delvare 96c914bfda Define a separate structure to represent main features. This allows
for faster main features lookup. One side effect of this change is
that subfeatures can no longer have labels nor be ignored. I do not
think that this is a problem in practice, and actually this makes a
lot of sense.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4834 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:05:16 +00:00