summaryrefslogtreecommitdiff
path: root/core/opiealarm
Side-by-side diff
Diffstat (limited to 'core/opiealarm') (more/less context) (ignore whitespace changes)
-rw-r--r--core/opiealarm/Makefile4
-rw-r--r--core/opiealarm/config.in2
-rw-r--r--core/opiealarm/opiealarm.c7
3 files changed, 5 insertions, 8 deletions
diff --git a/core/opiealarm/Makefile b/core/opiealarm/Makefile
index 0c8467e..255083d 100644
--- a/core/opiealarm/Makefile
+++ b/core/opiealarm/Makefile
@@ -11,16 +11,12 @@ LDFLAGS:=
all: $(DESTDIR)/opiealarm
$(DESTDIR)/opiealarm: opiealarm.c
$(CC) $(CFLAGS) opiealarm.c -o $(DESTDIR)/opiealarm $(LDFLAGS)
$(STRIP) --strip-all $(DESTDIR)/opiealarm
chmod u+s $(DESTDIR)/opiealarm
chown root $(DESTDIR)/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n"
clean:
-rm -f *~ core
-install:
- cp $(DESTDIR)/opiealarm $(INSTALL_ROOT)/opt/QtPalmtop/bin
- chown root $(INSTALL_ROOT)/opt/QtPalmtop/bin/opiealarm
- chmod u+s $(INSTALL_ROOT)/opt/QtPalmtop/bin/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n"
diff --git a/core/opiealarm/config.in b/core/opiealarm/config.in
index 2be9bd4..f86d01c 100644
--- a/core/opiealarm/config.in
+++ b/core/opiealarm/config.in
@@ -1,4 +1,4 @@
config OPIEALARM
- boolean "opie-opiealarm (Alarm daemon, sets RTC with wakeup time on suspend)"
+ boolean "Opiealarm (Alarm daemon, sets RTC with wakeup time on suspend)"
depends ! TARGET_X86
default "y"
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index 998cabd..90a743f 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -84,24 +84,25 @@ int fork_with_pidfile ( void )
// Solution: just wait for SIGUSR1 - the child process will
// signal this when it thinks it is safe to exit.
signal ( SIGUSR1, sig_handler_parent );
while ( 1 )
sleep ( 1000 );
exit ( 0 );
}
else if ( pid < 0 ) {
perror ( "forking failed" );
return 0;
}
+ // sleep( 60 );
// child process needs to react to SIGUSR2. This is sent when
// a new opiealarm process is started.
signal ( SIGUSR2, sig_handler_child );
// save pid
if (( fp = fopen ( PIDFILE, "w" ))) {
fprintf ( fp, "%d", getpid ( ));
fclose ( fp );
// detach
@@ -197,25 +198,25 @@ int main ( int argc, char **argv )
case 's':
default : opt = suspend ( fix_rtc );
break;
}
parent_pid = 0;
return opt;
}
int suspend ( int fix_rtc )
{
- FILE *fp;
+ FILE *fp = NULL;
char buf [64];
time_t alrt, syst, rtct;
struct tm alr, sys, rtc;
int fd;
int rtc_sys_diff;
if ( !fork_with_pidfile ( ))
return 3;
// we are the child process from here on ...
@@ -249,25 +250,25 @@ int suspend ( int fix_rtc )
if ( ioctl ( fd, RTC_SET_TIME, &set ) < 0 )
break; // ( 1, "ioctl RTC_SET_TIME" );
}
// read the wakeup time from TIMEFILE
if (!( fp = fopen ( TIMEFILE, "r" )))
break; // ( 1, TIMEFILE );
if ( !fgets ( buf, sizeof( buf ) - 1, fp ))
break; // ( 1, TIMEFILE );
fclose ( fp );
- fp = 0;
+ fp = NULL;
alrt = atoi ( buf ); // get the alarm time
if ( alrt == 0 )
break; // ( 0, TIMEFILE " contains an invalid time description" );
alrt -= 5; // wake up 5 sec before the specified time
alr = *gmtime ( &alrt );
if ( ioctl ( fd, RTC_ALM_SET, &alr ) < 0 ) // set RTC alarm time
break; // ( 1, "ioctl RTC_ALM_SET" );
@@ -362,22 +363,22 @@ int resume ( int resuspend )
argv[3] = 0;
// hard coded for now ...but needed
// another way would be to simulate a power-button press
setenv ( "LOGNAME", "root", 1 );
setenv ( "HOME", "/root", 1 );
setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 );
setenv ( "QTDIR", "/opt/QtPalmtop", 1 );
remove_pidfile ( );
- // no need for system() since this process is no longer usefull anyway
+ // no need for system() since this process is no longer usefull anyway
execv ( "/opt/QtPalmtop/bin/qcop", argv );
perror ( "exec for qcop failed" );
return 5;
}
}
}
return 0;
}