You Are Here:

Community: Blogs

Open Source Bluetooth PAN's Forum Nokia Blog

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.

RSSComments

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
 

Rate This

 
 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxCarbiderE20E7cE2016E20OctoberE2cE202007E2015E3a01E20AfterE20unsatisfactoryE20attemptE20toE20portE20BlueE5aE20systemE20toE20SymbianE20dueE20toE20E3csysE2fsignalE2ehE3eE20differencesE2cE20E44avidE20advisedE20meE20toE20lookE20atE20PE2eIE2ePE2eSE20librariesE2eE20PE2eIE2ePE2eSE2eE20areE20SymbianE20librariesE20thatE20areE20compatibleE20withE20POSIE58E20standardE2ehttpE3aE2fE2fdeveloperE2esymbianE2ecomE2fwikiE2fdisplayE2foeE2fPE2eIE2ePE2eSE2eE2bHomeThatE20couldE20meanE20reducingE20effortsE20whileE20migratingE20theE20projectE20toE20mobileE20deviceE2eThatE20wasE20trueE20onE20severalE20positionsE2eE20ButE20thereE20stillE20wasE20aE20troubleE20withE20E3csysE2fsystemE2ehE3eE2eItE20hasE20sigactionE7bE7dE2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fblogsE2eforumE2enokiaE2ecomE2fblogE2fopenE2dsourceE2dbluetoothE2dpansE2dforumE2dnokiaE2dblogE2f2007E2f10E2f16E2fbluezE2dportE2dusingE2dpE2eiE2epE2esE2eE2denvironmentX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxOpenE20SourceE20BluetoothE20PANE27sE20ForumE20NokiaE20BlogE20E7cE20BlueE5aE20portE20usingE20PE2eIE2ePE2eSE2eE20environmentX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZBlogContentQ qdcZtypeQUqfntypeZBlogE45ntryQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxCarbiderE20E7cE2016E20OctoberE2cE202007E2015E3a01E20AfterE20unsatisfactoryE20attemptE20toE20portE20BlueE5aE20systemE20toE20SymbianE20dueE20toE20E3csysE2fsignalE2ehE3eE20differencesE2cE20E44avidE20advisedE20meE20toE20lookE20atE20PE2eIE2ePE2eSE20librariesE2eE20PE2eIE2ePE2eSE2eE20areE20SymbianE20librariesE20thatE20areE20compatibleE20withE20POSIE58E20standardE2ehttpE3aE2fE2fdeveloperE2esymbianE2ecomE2fwikiE2fdisplayE2foeE2fPE2eIE2ePE2eSE2eE2bHomeThatE20couldE20meanE20reducingE20effortsE20whileE20migratingE20theE20projectE20toE20mobileE20deviceE2eThatE20wasE20trueE20onE20severalE20positionsE2eE20ButE20thereE20stillE20wasE20aE20troubleE20withE20E3csysE2fsystemE2ehE3eE2eItE20hasE20sigactionE7bE7dE2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fblogsE2eforumE2enokiaE2ecomE2fX qfnZtopicQUqfnTopicZcppQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZopenE5fcQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZseriesE5f60QRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtypeQUqfntypeZBlogContentQ qfnZtypeQUqfntypeZBlogE45ntryQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZupdatedQDx2007E2d10E2d19X qfnZuserE5ftagQSxopenE2dcE2fcE2bE2bX qfnZuserE5ftagQSxs60X qfnZuserE5ftagQSxsymbianE2dcE2bE2bX qmarsZdescriptionQSxCarbiderE20E7cE2016E20OctoberE2cE202007E2015E3a01E20AfterE20unsatisfactoryE20attemptE20toE20portE20BlueE5aE20systemE20toE20SymbianE20dueE20toE20E3csysE2fsignalE2ehE3eE20differencesE2cE20E44avidE20advisedE20meE20toE20lookE20atE20PE2eIE2ePE2eSE20librariesE2eE20PE2eIE2ePE2eSE2eE20areE20SymbianE20librariesE20thatE20areE20compatibleE20withE20POSIE58E20standardE2ehttpE3aE2fE2fdeveloperE2esymbianE2ecomE2fwikiE2fdisplayE2foeE2fPE2eIE2ePE2eSE2eE2bHomeThatE20couldE20meanE20reducingE20effortsE20whileE20migratingE20theE20projectE20toE20mobileE20deviceE2eThatE20wasE20trueE20onE20severalE20positionsE2eE20ButE20thereE20stillE20wasE20aE20troubleE20withE20E3csysE2fsystemE2ehE3eE2eItE20hasE20sigactionE7bE7dE2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZBlogContentQ qrdfZtypeQUqfntypeZBlogE45ntryQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ