After unsatisfactory attempt to port BlueZ system to Symbian due to <sys/signal.h> differences, David advised me to look at P.I.P.S libraries. P.I.P.S. are Symbian libraries that are compatible with POSIX standard.
That could mean reducing efforts while migrating the project to mobile device.
That was true on several positions. But there still was a trouble with <sys/system.h>.
It has sigaction{} structure inside. But BlueZ needs sigaction() function too.
I don’t know, if the trouble is that BlueZ doesn’t support POSIX. Or it is a Symbian’s trait.
[PIPS_Essential_Booklet.pdf]
Which says: “The P.I.P.S. environment does not support signals”.
Other functions that are not supported:
sigfillset()
sigdelset()
I had to examine what Signals are used for. I came to conclusion that they are used to halt child processes.
Sigaction()function was used to specify the action to be associated with a specific signal. After that the process generates his child instance (with fork and exec) which can be killed by sending “halt” signal with this statement:
kill(pid, SIGHUP)
So, I did not still find the replacement to this function to kill child processes. I’m thinking about Symbian’s RProcess class. Any ideas?
I found that Carbide C++ is very strict to data types. Even more strict than unix c.
I had to replace statements like:
struct bnep_setup_conn_req *req;
req = (void *) pkt;
to
req = (struct bnep_setup_conn_req *) pkt;
At this 2 documents:
I found recommendations how to substitute ther “fork”, “exec” operations with other posix functions. The main is posix_spawn().
I tried to follow this idea, outflanking the forks and execs with posix_spawn().It worked well.
At run_script() function there is instruction:
execv(script, argv);
Before run_script()is used, the fork()function is called to create the instance of program itself.
This “execv+fork”pair is replaced by one
posix_spawn(&Childpid,script,NULL,NULL,argv,NULL);
call.
There are still lots of goals to reach. I don’t know how to pass command line arguments to Carbide’s console application.
The sdp.c is not implemented in this version of port because it still makes too much errors and it will take time to solve.
I think there will be resulting GUI application which will run main PAND console instances. After that they should get into single signed SIS installation file.
.
Re: BlueZ port using P.I.P.S. environment
Octobit | 16/10/2007, 16:32
Getting a compile should give you some hope. The Service Discovery Protocol (SDP) is already available to you in the current Symbian OS, probably best to use the native functions. Good Luck with that,
BlueZ does "support POSIX" that's it's native environment (LINUX).
from:
http://www.symbian.com/Developer/techlib/v70sdocs/doc_source/reference/cpp/ThreadsAndProcesses/RProcessClass.html
"
Kill()
void Kill(TInt aReason);
Description
Ends this process specifying a reason code.
Notes:
Any attempt to end a process which is protected and is different from the process owning the thread which invokes this function, causes a KERN-EXEC 1 panic to be raised.
A process can call Kill() on itself whether it is protected or not. "
It looks like you are right, you'll handle child processes like this, I think you'll need to worry about trying to kill orphaned child processes in this case. Seems to me if the daemon dies, anything it's spawned during it's previous run will be left orphaned, even if you can identify the process (using PID file or something). I was hoping some of the other developers would jump in and help a bit, looks like you are on your own Kostya.
Remember google is your friend, Check out code search too. based on the number of available task managers for the s60, I'll put money on you finding a solution on your own. A lot of the older developers may be looking at you and saying, "akk, why help him, it's more fun to watch him suffer :-) "