@@ -100,7 +100,9 @@ static ResIterable* createMovePidResource(int32_t cGroupdId, pid_t pid) {
100100static Request* createTuneRequestFromSignal (uint32_t sigId,
101101 uint32_t sigType,
102102 pid_t incomingPID,
103- pid_t incomingTID) {
103+ pid_t incomingTID,
104+ int32_t numArgs,
105+ int32_t * args) {
104106 try {
105107 std::shared_ptr<SignalRegistry> sigRegistry = SignalRegistry::getInstance ();
106108
@@ -130,6 +132,18 @@ static Request* createTuneRequestFromSignal(uint32_t sigId,
130132 // Copy
131133 Resource* resource = MPLACEV (Resource, (*((*signalLocks)[i])));
132134
135+ // fill placeholders if any
136+ int32_t listIndex = 0 ;
137+ for (int32_t j = 0 ; j < resource->getValuesCount (); j++) {
138+ if (resource->getValueAt (j) == -1 ) {
139+ if (args == nullptr ) return nullptr ;
140+ if (listIndex >= 0 && listIndex < numArgs) {
141+ resource->setValueAt (j, args[listIndex]);
142+ listIndex++;
143+ }
144+ }
145+ }
146+
133147 ResIterable* resIterable = MPLACED (ResIterable);
134148 resIterable->mData = resource;
135149 request->addResource (resIterable);
@@ -228,6 +242,8 @@ void ContextualClassifier::ClassifierMain() {
228242 std::string comm;
229243 uint32_t sigId = URM_SIG_APP_OPEN ;
230244 uint32_t sigType = DEFAULT_SIGNAL_TYPE ;
245+ int32_t numArgs = 0 ;
246+ int32_t * args = nullptr ;
231247 uint32_t ctxDetails = 0U ;
232248
233249 if (ev.pid != -1 ) {
@@ -252,7 +268,7 @@ void ContextualClassifier::ClassifierMain() {
252268 // Untune any Configurations from the last proc-invocation
253269 for (int64_t handle: this ->mCurrRestuneHandles ) {
254270 if (handle > 0 ) {
255- untuneRequestHelper (handle);
271+ this -> untuneRequestHelper (handle);
256272 }
257273 }
258274 this ->mCurrRestuneHandles .clear ();
@@ -276,15 +292,19 @@ void ContextualClassifier::ClassifierMain() {
276292 .mPid = ev.pid ,
277293 .mSigId = sigId,
278294 .mSigType = sigType,
295+ .mNumArgs = numArgs,
296+ .mArgs = args,
279297 };
280298 postCb ((void *)&postProcessData);
281299
282300 sigId = postProcessData.mSigId ;
283301 sigType = postProcessData.mSigType ;
302+ numArgs = postProcessData.mNumArgs ;
303+ args = postProcessData.mArgs ;
284304 }
285305
286306 // Apply actions, call tuneSignal
287- this ->ApplyActions (sigId, sigType, ev.pid , ev.tgid );
307+ this ->ApplyActions (sigId, sigType, ev.pid , ev.tgid , numArgs, args );
288308 }
289309 } else if (ev.type == CC_APP_CLOSE ) {
290310 // No Action Needed, Pulse Monitor to take care of cleanup
@@ -388,16 +408,18 @@ int32_t ContextualClassifier::ClassifyProcess(pid_t processPid,
388408void ContextualClassifier::ApplyActions (uint32_t sigId,
389409 uint32_t sigType,
390410 pid_t incomingPID,
391- pid_t incomingTID) {
411+ pid_t incomingTID,
412+ int32_t numArgs,
413+ int32_t * args) {
392414 Request* request =
393- createTuneRequestFromSignal (sigId, sigType, incomingPID, incomingTID);
415+ createTuneRequestFromSignal (sigId, sigType, incomingPID, incomingTID, numArgs, args );
394416 if (request != nullptr ) {
395417 if (request->getResourcesCount () > 0 ) {
396418 // Record:
397419 this ->mCurrRestuneHandles .push_back (request->getHandle ());
398420
399421 // fast path to Request Queue
400- submitResProvisionRequest (request, true );
422+ submitResProvisionRequest (request, false );
401423
402424 } else {
403425 Request::cleanUpRequest (request);
@@ -563,13 +585,15 @@ void ContextualClassifier::configureAppSignals(pid_t incomingPID,
563585 appConfig->mSignalCodes [i],
564586 0 ,
565587 incomingPID,
566- incomingTID);
588+ incomingTID,
589+ 0 ,
590+ nullptr );
567591
568592 if (request != nullptr ) {
569593 if (request->getResourcesCount () > 0 ) {
570594 // fast path to Request Queue
571595 this ->mCurrRestuneHandles .push_back (request->getHandle ());
572- submitResProvisionRequest (request, true );
596+ submitResProvisionRequest (request, false );
573597
574598 } else {
575599 Request::cleanUpRequest (request);
0 commit comments