summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-11-09 01:29:48 (UTC)
committer mickeyl <mickeyl>2003-11-09 01:29:48 (UTC)
commitfe2686a823f0dc41828ed75b759f34f117453e49 (patch) (unidiff)
treebf3eb1ee22b12c84d36eb53d4f4f2dcb0eac64a4
parent28d03a7d43f449949991a91cab63580ef6220725 (diff)
downloadopie-fe2686a823f0dc41828ed75b759f34f117453e49.zip
opie-fe2686a823f0dc41828ed75b759f34f117453e49.tar.gz
opie-fe2686a823f0dc41828ed75b759f34f117453e49.tar.bz2
get rid of some obsolete zombies.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--example/Example.pngbin1262 -> 0 bytes
-rw-r--r--example/README2
-rw-r--r--example/example.control12
-rw-r--r--example/example.cpp28
-rw-r--r--example/example.desktop10
-rw-r--r--example/example.h17
-rw-r--r--example/example.pro32
-rw-r--r--example/examplebase.ui55
-rw-r--r--example/main.cpp12
-rw-r--r--quickexec/config.in4
-rw-r--r--quickexec/johns/README21
-rw-r--r--quickexec/johns/library.lst2
-rw-r--r--quickexec/johns/qinit_srv.c242
-rw-r--r--quickexec/johns/so_stub.c23
-rw-r--r--quickexec/opie-quickexec.control12
-rw-r--r--quickexec/quickexec.cpp98
-rw-r--r--quickexec/quickexec.pro29
17 files changed, 0 insertions, 599 deletions
diff --git a/example/Example.png b/example/Example.png
deleted file mode 100644
index f63d0bc..0000000
--- a/example/Example.png
+++ b/dev/null
Binary files differ
diff --git a/example/README b/example/README
deleted file mode 100644
index 98c2c51..0000000
--- a/example/README
+++ b/dev/null
@@ -1,2 +0,0 @@
1See /opt/Qtopia/doc/html/qtopia/index.html for help.
2See doc.trolltech.com for more recent documentation updates.
diff --git a/example/example.control b/example/example.control
deleted file mode 100644
index 08c5a5d..0000000
--- a/example/example.control
+++ b/dev/null
@@ -1,12 +0,0 @@
1Package: example
2Files: bin/example apps/Applications/example.desktop pics/example.png
3Priority: optional
4Section: opie/applications
5Maintainer: Warwick Allison <warwick@trolltech.com>
6Architecture: arm
7Version: 1.0.0
8Depends: qpe-base
9License: Public Domain
10Description: Example program
11 An example program for the Opie environment.
12 Does nothing interesting.
diff --git a/example/example.cpp b/example/example.cpp
deleted file mode 100644
index 1e0bbe9..0000000
--- a/example/example.cpp
+++ b/dev/null
@@ -1,28 +0,0 @@
1#include "example.h"
2#include <qpushbutton.h>
3
4/*
5 * Constructs a Example which is a child of 'parent', with the
6 * name 'name' and widget flags set to 'f'
7 */
8Example::Example( QWidget* parent, const char* name, WFlags fl )
9 : ExampleBase( parent, name, fl )
10{
11 connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));
12}
13
14/*
15 * Destroys the object and frees any allocated resources
16 */
17Example::~Example()
18{
19 // no need to delete child widgets, Qt does it all for us
20}
21
22/*
23 * A simple slot... not very interesting.
24 */
25void Example::goodBye()
26{
27 close();
28}
diff --git a/example/example.desktop b/example/example.desktop
deleted file mode 100644
index c86fd81..0000000
--- a/example/example.desktop
+++ b/dev/null
@@ -1,10 +0,0 @@
1[Desktop Entry]
2Exec=example
3Icon=Example
4Type=Application
5Name=Example
6Comment=An Example Program
7Name[pt]=Exemplo
8Comment[pt]=Um programa de exemplo
9Name[pt_BR]=Exemplo
10Comment[pt_BR]=Um programa de exemplo
diff --git a/example/example.h b/example/example.h
deleted file mode 100644
index 24c58c0..0000000
--- a/example/example.h
+++ b/dev/null
@@ -1,17 +0,0 @@
1#ifndef EXAMPLE_H
2#define EXAMPLE_H
3#include "examplebase.h"
4
5class Example : public ExampleBase
6{
7 Q_OBJECT
8
9public:
10 Example( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
11 ~Example();
12
13private slots:
14 void goodBye();
15};
16
17#endif // EXAMPLE_H
diff --git a/example/example.pro b/example/example.pro
deleted file mode 100644
index dea78cf..0000000
--- a/example/example.pro
+++ b/dev/null
@@ -1,32 +0,0 @@
1 TEMPLATE= app
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4 HEADERS = example.h
5 SOURCES = main.cpp example.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe
9 INTERFACES= examplebase.ui
10 TARGET = example
11
12TRANSLATIONS = ../i18n/de/example.ts \
13 ../i18n/nl/example.ts \
14 ../i18n/da/example.ts \
15 ../i18n/xx/example.ts \
16 ../i18n/en/example.ts \
17 ../i18n/es/example.ts \
18 ../i18n/fr/example.ts \
19 ../i18n/hu/example.ts \
20 ../i18n/ja/example.ts \
21 ../i18n/ko/example.ts \
22 ../i18n/no/example.ts \
23 ../i18n/pl/example.ts \
24 ../i18n/pt/example.ts \
25 ../i18n/pt_BR/example.ts \
26 ../i18n/sl/example.ts \
27 ../i18n/zh_CN/example.ts \
28 ../i18n/zh_TW/example.ts
29
30
31
32include ( $(OPIEDIR)/include.pro )
diff --git a/example/examplebase.ui b/example/examplebase.ui
deleted file mode 100644
index b47d20c..0000000
--- a/example/examplebase.ui
+++ b/dev/null
@@ -1,55 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>ExampleBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>ExampleBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>245</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Example</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel1</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>&lt;p&gt;This is just an &lt;i&gt;example&lt;/i&gt;. It doesn't do anything interesting at all.</string>
40 </property>
41 </widget>
42 <widget>
43 <class>QPushButton</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>quit</cstring>
47 </property>
48 <property stdset="1">
49 <name>text</name>
50 <string>Quit</string>
51 </property>
52 </widget>
53 </vbox>
54</widget>
55</UI>
diff --git a/example/main.cpp b/example/main.cpp
deleted file mode 100644
index b705c44..0000000
--- a/example/main.cpp
+++ b/dev/null
@@ -1,12 +0,0 @@
1#include "example.h"
2#include <qpe/qpeapplication.h>
3
4int main( int argc, char ** argv )
5{
6 QPEApplication a( argc, argv );
7
8 Example mw;
9 a.showMainWidget( &mw );
10
11 return a.exec();
12}
diff --git a/quickexec/config.in b/quickexec/config.in
deleted file mode 100644
index 57eac96..0000000
--- a/quickexec/config.in
+++ b/dev/null
@@ -1,4 +0,0 @@
1# config #QUICKEXEC
2# boolean "quickexec"
3# default "y"
4# depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/quickexec/johns/README b/quickexec/johns/README
deleted file mode 100644
index 1af84dc..0000000
--- a/quickexec/johns/README
+++ b/dev/null
@@ -1,21 +0,0 @@
1
2Compile qinit_srv.c to qinit_srv as usual
3Compile your applications at shared libraries instead of as executables:
4 eg: gcc test.c -o test.so -shared
5Make a symbolic link from qinit_srv to the name of the application:
6 eg: ln -s qinit_srv test
7Now make sure 'test' (The symlink) and 'test.so' (the shared library version of the app) are together.
8When you run ./test it will load test.so and run it just like you were running the application for real.
9There will be a qinit_srv process created the first time you run a program this way.
10
11How it works:
12
13qinit_srv checks to see if there is already a server, if not it starts as a server which runs in the background as a deamon.
14If it's a server it loads all the libraries listed in the library.lst file.
15It then waits for signals to be sent to it which tell it to fork itself and load shared libraries and run them.
16If it decides it's not the server, it sends a signal to the server to run the given command.
17The server then executes a shared object file of whatever name the original process is invoked as (argv[0], the symlink trick)
18The other process waits until the forked server finishes and signals the original process that it as finished and to return
19
20
21
diff --git a/quickexec/johns/library.lst b/quickexec/johns/library.lst
deleted file mode 100644
index 42f310b..0000000
--- a/quickexec/johns/library.lst
+++ b/dev/null
@@ -1,2 +0,0 @@
1libqte.so
2libqpe.so
diff --git a/quickexec/johns/qinit_srv.c b/quickexec/johns/qinit_srv.c
deleted file mode 100644
index 03c6cd3..0000000
--- a/quickexec/johns/qinit_srv.c
+++ b/dev/null
@@ -1,242 +0,0 @@
1#include <stdlib.h>
2#include <stdio.h>
3#include <signal.h>
4#include <unistd.h>
5#include <dlfcn.h>
6
7
8#define PID_FILE "/tmp/qinit1.pid"
9#define CMD_FILE "/tmp/qinit1.cmd"
10#define RET_FILE "/tmp/qinit1.ret"
11
12
13static int librariesFinishedLoading = 0;
14static void **handles = NULL;
15static int handleCount = 0;
16
17
18static void savePid( void );
19static int loadPid( void );
20void saveRetVal( int retVal );
21int loadRetVal( void );
22static void saveCmd( int callingPid, int argc, char *argv[] );
23static int execCmd( void );
24static void loadLibraries( char *listFile );
25static void signalHandler( int signal );
26static void finishedHandler( int signal );
27static void cleanUpHandler( int signal );
28static void cleanUp( void );
29
30
31int main( int argc, char *argv[] ) {
32 FILE *fh;
33
34 // See if there is already a server running
35 if ( ( fh = fopen( PID_FILE, "r" ) ) != NULL ) {
36 // There appears to already be a server running
37 fclose( fh );
38 // Install handler that tells us when the process created by the server has finished
39 signal( SIGUSR2, finishedHandler );
40 // Send our command to the server (saved to a file)
41 saveCmd( getpid(), argc, argv );
42 // Send a signal to the server to run our command
43 kill( loadPid(), SIGUSR1 );
44 // Wait for the process created by the server to terminate
45 for (;;)
46 sleep( 1 ); // Will eventually terminate when the SIGUSER2 signal is sent to us by the server
47 }
48
49 // Send the server to the background
50 daemon( 1, 1 );
51
52 // Save the process number of this process somewhere (in a file)
53 savePid();
54
55 // Wait for signal used to let us know when to fork to run commands
56 signal( SIGUSR1, signalHandler );
57 signal( SIGTERM, cleanUpHandler );
58 signal( SIGINT, cleanUpHandler );
59 signal( SIGABRT, cleanUpHandler );
60 signal( SIGQUIT, cleanUpHandler );
61
62 // Iterate library list file and dynamically load at runtime
63 // the library files from the list
64 if ( argc > 1 )
65 loadLibraries( argv[1] ); // Use a library list file specified from command line
66 else
67 loadLibraries( "library.lst" ); // Use the default library list file
68
69 // Run the given command
70 signalHandler( SIGUSR1 );
71
72 // Keep waiting for signals infinitely that tell us to fork
73 for (;;)
74 wait( NULL ); // Wait for child processes to die or signals to be sent to us
75
76 cleanUp();
77
78 return 0;
79}
80
81
82void cleanUp( void ) {
83 int i;
84
85 // Close the shared libraries we opened
86 for ( i = 0; i < handleCount; i++ )
87 dlclose( handles[ i ] );
88 free( handles );
89
90 // Unlink the PID_FILE file
91 remove( PID_FILE );
92}
93
94
95void savePid( void ) {
96 int pid = getpid();
97 FILE *fh = fopen( PID_FILE, "w");
98 if ( !fh )
99 fputs("error writing pid to file " PID_FILE, stderr), exit(1);
100 fprintf( fh, "%i", pid );
101 fclose( fh );
102}
103
104
105int loadPid( void ) {
106 int pid;
107 FILE *fh = fopen( PID_FILE, "r" );
108 if ( !fh )
109 fputs("error loading pid from file " PID_FILE, stderr), exit(1);
110 fscanf( fh, "%i", &pid );
111 fclose( fh );
112 return pid;
113}
114
115
116void saveRetVal( int retVal ) {
117 FILE *fh = fopen( RET_FILE, "w");
118 if ( !fh )
119 fputs("error writing retVal to file " RET_FILE, stderr), exit(1);
120 fprintf( fh, "%i", retVal );
121 fclose( fh );
122}
123
124
125int loadRetVal( void ) {
126 int retVal;
127 FILE *fh = fopen( RET_FILE, "r" );
128 if ( !fh )
129 fputs("error loading retVal from file " RET_FILE, stderr), exit(1);
130 fscanf( fh, "%i", &retVal );
131 fclose( fh );
132 return retVal;
133}
134
135
136void saveCmd( int callingPid, int argc, char *argv[] ) {
137 int i;
138 FILE *fh = fopen( CMD_FILE, "w" );
139 if ( !fh )
140 fputs("error saving arg list to file " CMD_FILE, stderr), exit(1);
141 fprintf( fh, "%i\n", callingPid );
142 fprintf( fh, "%s.so", argv[0] );
143 for ( i = 0; i < argc; i++ )
144 fprintf( fh, "\n%s", argv[i] );
145 fclose( fh );
146}
147
148
149int execCmd( void ) {
150 int callingPid;
151 char sharedObject[128];
152 int argc;
153 char argv[128][128];
154 int (*childMain)( int argc, char *argv[] );
155 char *error;
156 void *handle;
157 int retVal = 0;
158
159 // Get the name of the file to dlopen and the arguments to pass (from a file)
160 FILE *fh = fopen( CMD_FILE, "r" );
161 fscanf( fh, "%i\n", &callingPid );
162 fgets( sharedObject, 128, fh );
163 sharedObject[strlen( sharedObject ) - 1] = '\0';
164 for ( argc = 0; fgets( argv[argc], 128, fh ); argc++)
165 argv[argc][strlen( argv[argc] ) - 1] = '\0';
166 fclose( fh );
167
168 // Open the shared object of what we want to execute
169 handle = dlopen( sharedObject, RTLD_LAZY );
170 if ( !handle )
171 fputs( dlerror(), stderr ), kill( callingPid, SIGUSR2 ), exit( 1 );
172
173 // Find main symbol and jump to it
174 childMain = dlsym( handle, "main" );
175 if ( ( error = dlerror() ) != NULL )
176 fputs( error, stderr ), kill( callingPid, SIGUSR2 ), exit( 1 );
177 retVal = (*childMain)( argc, (char**)argv );
178
179 // Notify caller that we have finished
180 saveRetVal( retVal );
181 kill( callingPid, SIGUSR2 );
182
183 // When we are done, close the shared object
184 dlclose( handle );
185 return retVal;
186}
187
188
189void finishedHandler( int signal ) {
190 // We have been notified of the completion of the task
191 exit( loadRetVal() );
192}
193
194
195void cleanUpHandler( int signal ) {
196 // Cleanup and exit if we have been told to quit
197 cleanUp();
198 exit(1);
199}
200
201
202void signalHandler( int signal ) {
203 //printf("got a signal of %i\n", signal );
204
205 if ( fork() == 0 ) {
206 // We are the child process
207
208/*
209 while ( librariesFinishedLoading != 1 ) {
210 printf("waiting for libraries to load\n");
211 sleep(1);
212 }
213*/
214 // Close file handles and open others etc
215
216 // Execute the command and return when done
217 exit( execCmd() );
218 }
219
220 // Parent process, just continue
221 sleep( 1 ); // Need to yield to child process
222}
223
224
225void loadLibraries( char *listFile ) {
226 FILE *fh = fopen( listFile, "r" );
227 char line[1024];
228 if ( !fh )
229 fputs("error opening library list file", stderr), exit(1);
230 while ( fgets( line, 1024, fh ) ) {
231 line[strlen( line ) - 1] = '\0';
232 printf("loading library: --%s--\n", line);
233 handleCount++;
234 handles = realloc( handles, handleCount * sizeof( void * ) );
235 handles[ handleCount - 1 ] = dlopen( line, RTLD_NOW );
236 if ( !handles[ handleCount - 1 ] )
237 fputs( dlerror(), stderr ), exit( 1 );
238 }
239 fclose( fh );
240 librariesFinishedLoading = 1;
241}
242
diff --git a/quickexec/johns/so_stub.c b/quickexec/johns/so_stub.c
deleted file mode 100644
index fe71f9c..0000000
--- a/quickexec/johns/so_stub.c
+++ b/dev/null
@@ -1,23 +0,0 @@
1#include <stdio.h>
2#include <string.h>
3#include <dlfcn.h>
4
5
6int main( int argc, char *argv[] ) {
7 char module[1024];
8 int (*loadedMain)( int argc, char *argv[] );
9 char *error;
10 int retVal = 0;
11 void *handle;
12 strcpy( module, argv[0] );
13 strcat( module, ".so" );
14 if ( !(handle = dlopen( module, RTLD_LAZY ) ) )
15 fputs( dlerror(), stderr ), exit( 1 );
16 loadedMain = dlsym( handle, "main" );
17 if ( ( error = dlerror() ) != NULL )
18 fputs( error, stderr ), exit( 1 );
19 retVal = (*loadedMain)( argc, argv );
20 dlclose( handle );
21 return retVal;
22}
23
diff --git a/quickexec/opie-quickexec.control b/quickexec/opie-quickexec.control
deleted file mode 100644
index 118a4da..0000000
--- a/quickexec/opie-quickexec.control
+++ b/dev/null
@@ -1,12 +0,0 @@
1Package: opie-quickexec
2Files: bin/quickexec
3Priority: required
4Section: opie/applications
5Maintainer: Warwick Allison <warwick@trolltech.com>
6Architecture: arm
7Arch: iPAQ
8Version: $QPE_VERSION-$SUB_VERSION
9Depends: task-opie-minimal
10Description: Calculator
11 A multi-function calculator for the Opie environment.
12 Includes units conversion.
diff --git a/quickexec/quickexec.cpp b/quickexec/quickexec.cpp
deleted file mode 100644
index 772ab4c..0000000
--- a/quickexec/quickexec.cpp
+++ b/dev/null
@@ -1,98 +0,0 @@
1#include <stdio.h>
2#include <sys/types.h>
3#include <sys/stat.h>
4#include <unistd.h>
5#include <fcntl.h>
6#include <dlfcn.h>
7
8#define QUICKEXEC "/tmp/.quickexec"
9
10#include <signal.h>
11#include <sys/wait.h>
12
13void sigchildhandler(int) {
14 wait(0);
15}
16
17int exec( const char *lib, int argc, char** argv )
18{
19 setpgid(0,0);
20// printf("loadlib %s, argc=%d\n", lib, argc );
21 void *handle = dlopen ( lib, RTLD_LAZY);
22 if (!handle) {
23 fprintf( stderr, "%s\n", dlerror());
24 exit(1);
25 }
26 typedef int (*Mainfunc)(int, char**);
27 Mainfunc mainfunc;
28 mainfunc = (Mainfunc) dlsym(handle, "main");
29 char *error;
30 if ((error = dlerror()) != NULL) {
31 fprintf (stderr, "%s\n", error);
32 exit(1);
33 }
34 (*mainfunc)(argc,argv);
35 return 0;
36}
37
38#define BUFFER_SIZE 1024
39int main( int argc, char** argv )
40{
41 signal( SIGCHLD, sigchildhandler );
42 (void) unlink( QUICKEXEC );
43 if ( mkfifo( QUICKEXEC, S_IFIFO | S_IWUSR | S_IRUSR ) == -1 ) {
44 perror( QUICKEXEC );
45 exit(1);
46 }
47
48 if ( argc > 1 && fork() == 0 )
49 return exec( argv[1], argc-2, argc > 2 ? argv+2 : 0 );
50
51 char buf[BUFFER_SIZE];
52 int p = 0;
53 int r;
54 int fd = open( QUICKEXEC, O_RDONLY );
55 if ( fd == -1 ) {
56 perror( QUICKEXEC );
57 exit(1);
58 }
59 for ( ;; ) {
60 r = read( fd, buf+p, BUFFER_SIZE-p );
61 p += r;
62 if ( r == 0 || p >= BUFFER_SIZE - 1 ) {
63 buf[p] = '\0';
64 close ( fd );
65 if ( fork() == 0 ) {
66 int argc = -1;
67 int i = 0;
68 int k = 0;
69 for ( i = 0; i <= p; i++ )
70 if ( buf[i] == '\0' )
71 argc++;
72 char** argv = new char*[argc];
73 for ( i = 0; i < p; i++ ) {
74 if ( buf[i] == '\0' )
75 argv[k++]=buf+i+1;
76 }
77 return exec( buf, argc, argv );
78 }
79 p = 0;
80 fd = open( QUICKEXEC, O_RDONLY );
81 }
82 }
83 return 0;
84}
85
86
87
88
89
90
91
92
93
94
95
96
97
98
diff --git a/quickexec/quickexec.pro b/quickexec/quickexec.pro
deleted file mode 100644
index 73b54d1..0000000
--- a/quickexec/quickexec.pro
+++ b/dev/null
@@ -1,29 +0,0 @@
1 TEMPLATE= app
2 CONFIG = qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS =
5 SOURCES = quickexec.cpp
6LIBS += -ldl -lqpe
7 TARGET = quickexec
8
9TRANSLATIONS = ../i18n/de/quickexec.ts \
10 ../i18n/nl/quickexec.ts \
11 ../i18n/da/quickexec.ts \
12 ../i18n/xx/quickexec.ts \
13 ../i18n/en/quickexec.ts \
14 ../i18n/es/quickexec.ts \
15 ../i18n/fr/quickexec.ts \
16 ../i18n/hu/quickexec.ts \
17 ../i18n/ja/quickexec.ts \
18 ../i18n/ko/quickexec.ts \
19 ../i18n/no/quickexec.ts \
20 ../i18n/pl/quickexec.ts \
21 ../i18n/pt/quickexec.ts \
22 ../i18n/pt_BR/quickexec.ts \
23 ../i18n/sl/quickexec.ts \
24 ../i18n/zh_CN/quickexec.ts \
25 ../i18n/zh_TW/quickexec.ts
26
27
28
29include ( $(OPIEDIR)/include.pro )