Join Now

BlueZ port using P.I.P.S. environment

Carbider | 16 October, 2007 15:01

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+forkpair 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.
Please look the sources of port using P.I.P.S. at my CVS repository http://bluspan.cvs.sourceforge.net/bluspan/pand_port_06/
The CVS checkout process to Carbide C++ IDE is described in my post: Get project from CVS to Carbide C++.
Please, checkout the newest pand_port_06 version.

Comments

Re: BlueZ port using P.I.P.S. environment

Octobit | 16/10/2007, 16:32

Hi Kostya,

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 :-) "

Re: BlueZ port using P.I.P.S. environment

Sorcery-ltd | 18/10/2007, 12:00

Sorcery-ltd Before PlatSec (Symbian 9.x) you can kill another process unless the process has explicitly been set as protected. With PlatSec all processes are protected and you can only kill another process if you created it and haven't resumed it yet (i.e. it's not used) or if you have PowerMgmt capability.

Re: BlueZ port using P.I.P.S. environment

Carbider | 19/10/2007, 11:06

Carbider But if I own the son process, what Symbiann method (or class) should I use to stop it?
RProcess?
I have this example:
TFullName theName;
TFindProcess process;
while ( process.Next( theName ) != KErrNotFound )
{
if ( ( theName.Find( KPROCNAME ) != KErrNotFound ) )
{
RProcess aProcess;
aProcess.Open( process );
aProcess.Kill(0);
aProcess.Close();
}
}
But i still did not find how to search a process by it's PID (process identifier)

And what does it mean Resume process? (when process returns to control to parent?)

Thanks
You must login to post comments. Login
 
 
Powered by LifeType
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZcppQ
     qfnZtopicQUqfnTopicZopenE5fcQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZBlogContentQ
     qfnZtypeQUqfnTypeZBlogE45ntryQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX