Commit Graph

31 Commits

Author SHA1 Message Date
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Karel Zak 20a3998222 sys-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:17 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Karel Zak 8063efea36 rtcwake: tiny coding style change
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-02 13:21:33 +02:00
Paul Fox 1707576155 rtcwake: only invoke RTC_AIE_ON/OFF ioctls in pairs
many rtc drivers don't implement the RTC_AIE_ON/OFF ioctls at all --
so if we never tried to enable the alarm interrupt, don't try to
disable it later.

Signed-off-by: Paul Fox <pgf@laptop.org>
2012-04-02 13:14:00 +02:00
Sami Kerola 0e00261d2e rtcwake: align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-10-30 14:23:54 +01:00
Petr Uzel 8cbe756a63 rtcwake: fix crash (invalid free)
~ $ rtcwake -d X -s 10
*** glibc detected *** rtcwake: munmap_chunk(): invalid pointer: 0x00007fff839253c3 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x733b6)[0x7f582677a3b6]
rtcwake[0x4022d5]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f5826725bfd]
rtcwake[0x4016b9]
======= Memory map: ========
<SNIP>

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-10-17 11:06:33 +02:00
Karel Zak 704c770555 rtcwake: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:23:30 +02:00
Davidlohr Bueso c1196d3ab7 rtcwake: do not duplicate argument strings
This is not necessary and prevents memory leaks.

Reported-by: Marek Otahal <markotahal@gmail.com>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-03-08 13:34:20 +01:00
Lawrence Rust e6d1dc9416 rtcwake: test for available suspend modes
Signed-off-by: Lawrence Rust <lawrence@softsystem.co.uk>
2011-02-28 10:21:12 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Karel Zak 07b336c92e rtcwake: use err.h routines
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-26 17:43:54 +01:00
Marek Otahal fcf6729430 rtcwake: add 'show' mode for rtc alarm
The 'show' mode prints information on current alarm setting.

[kzak@redhat.com: - code clean up
                  - don't setup alarm on 'disable' mode]

Signed-off-by: Marek Otahal <markotahal@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-26 16:47:38 +01:00
Davidlohr Bueso 2ab428f6a8 sys-utils: make use xalloc wrappers
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 16:43:23 +01:00
Marek Otahal c15dd93b17 rtcwake : add disable action for rtc alarm
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-23 14:16:59 +02:00
Karel Zak 569f3ca278 rtcwake: add --dry-run option
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-08 09:20:21 +02:00
Karel Zak ecd55f9647 rtcwake: does miss the "off" option
Reported-by: Piergiorgio Sartor <piergiorgio.sartor@nexgo.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=580296
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-08 08:51:00 +02:00
Paul Fox 1da17ec6c1 rtcwake: ignore the tm_isdst field returned from the RTC
Signed-off-by: Paul Fox <pgf@laptop.org>
2009-09-07 12:29:37 +02:00
Karel Zak 77f5744c98 rtcwake: add S5 support
Based on patch from
   Piergiorgio Sartor <piergiorgio.sartor@nexgo.de>
at
   https://bugzilla.redhat.com/show_bug.cgi?id=449115

Piergiorgio's note about S5:
> According to the ACPI specifications, chapter 4.7.2.4 "Real Time
> Clock Alarm", the wakeup from RTC, when supported, should work from
> *sleep* state S1-S3 and, optionally, from S4.
>
> Note 3 (same chapter) says that S5 is *not* a sleep state and should
> not be supported. Actually it also says that: "The OS will disable
> the RTC_EN bit prior to entering the G2/S5 or G3 states regardless."
>
> Nevertheless, on all PC supporting the RTC wakeup I tested, all were
> able to wake from S5.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-09-07 12:04:26 +02:00
Daniel Mierswa 437fa54f05 replace usleep() for systems that don't have them
This function is marked obsolete in POSIX.1-2001 and removed in
POSIX.1-2008.

Conditionally replaced with nanosleep().

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
2009-08-21 09:58:17 +02:00
Marco d'Itri e4b0fc36ff rtcwake: support not suspending
People usually want to use pm-utils to suspend the system instead of
the raw kernel interface, so I added an option to just exit after
configuring the wakeup time.
Actually I think that all the suspend code should be removed from
rtcwake, since it does not really belong there.

Signed-off-by: Marco d'Itri <md@linux.it>
2009-01-26 21:22:24 +01:00
Karel Zak f8d87ab139 rtcwake: cleanup return codes
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-06 12:36:10 +02:00
Gabriel Burt fc18118430 rtcwake: prefer RTC_WKALM_SET over RTC_ALM_SET
rtcwake: Prefer RTC_WKALM_SET over RTC_ALM_SET, fixing bug with not
waking up with new RTCs.  Also, return error if unable to set the alarm.

Signed-off-by: Gabriel Burt <gburt@novell.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-06 12:19:46 +02:00
Paulius Zaleckas 47bf8ef7f1 rtcwake: fix the default mode to "standby"
Writing "suspend" to /sys/power/state does nothing.
Even "man rtcwake" says that default should be "standby" :)

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-06-09 12:49:00 +02:00
Mike Frysinger d3cf541492 rtcwake: fix typo SATE -> STATE
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2008-02-15 02:01:00 +01:00
Mike Frysinger c41e134067 rtcwake: include libgen.h for basename prototype
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2008-02-15 01:36:19 +01:00
David Brownell 1b7c164c49 rtcwake: fix UTC time usage
Timezone handling is broken in this version since it's always
passing UTC time into the kernel, even on systems where the
RTC uses the local timezone.

I think that bug must come from bugs in how the system used to
to originally develop this code handled the RTC timezone.  Both
RTCs should have been kept in UTC ... but only one of them was.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2008-02-08 01:33:39 +01:00
David Brownell 2148b05182 rtcwake: misc cleanups
Cleanups for rtcwake:

  - Minor doc updates:  highlight the framebuffer problem,
    give correct history of this code
  - Improve debug output
  - Fix some linelength bugs

Note that this code predated the sysfs "wakealarm" mechanism, and
works around several now-fixed bugs in the kernel RTC framework.

Nowadays it would make sense to make this program use only the sysfs
interface to the RTC, using "since_epoch" instead of RTC_RD_TIME and
"wakealarm" instead of the four other ioctls.  That could simplify
the mess involved in timezone handling.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-12-03 13:29:47 +01:00
Karel Zak dd12a5b9cb rtcwake: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-11 14:27:08 +02:00
Karel Zak a6d35e6d68 rtcwake: fix verbose message
Just make NLS transtalors more happy. (rh#292081)

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-04 14:14:58 +02:00
Bernhard Walle 7670038954 misc-util: new rtcwake command
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-16 13:50:33 +02:00