| 1388 | } |
| 1389 | |
| 1390 | U32 KProcess::setitimer(U32 which, U32 newValue, U32 oldValue) { |
| 1391 | |
| 1392 | if (which != 0) { // ITIMER_REAL |
| 1393 | kpanic_fmt("setitimer which=%d not supported", which); |
| 1394 | } |
| 1395 | if (oldValue) { |
| 1396 | U32 remaining = this->timer.millies - KSystem::getMilliesSinceStart(); |
| 1397 | |
| 1398 | memory->writed(oldValue, this->timer.resetMillies / 1000); |
| 1399 | memory->writed(oldValue, (this->timer.resetMillies % 1000) * 1000); |
| 1400 | memory->writed(oldValue + 8, remaining / 1000); |
| 1401 | memory->writed(oldValue + 12, (remaining % 1000) * 1000); |
| 1402 | } |
| 1403 | if (newValue) { |
| 1404 | U32 millies = memory->readd(newValue + 8) * 1000 + memory->readd(newValue + 12) / 1000; |
| 1405 | U32 resetMillies = memory->readd(newValue) * 1000 + memory->readd(newValue + 4) / 1000; |
| 1406 | |
| 1407 | if (millies == 0) { |
| 1408 | if (this->timer.millies!=0) { |
| 1409 | removeTimer(&this->timer); |
| 1410 | this->timer.millies = 0; |
| 1411 | } |
| 1412 | } else { |
| 1413 | this->timer.resetMillies = resetMillies; |
| 1414 | if (this->timer.millies!=0) { |
| 1415 | this->timer.millies = millies + KSystem::getMilliesSinceStart(); |
| 1416 | } else { |
| 1417 | this->timer.millies = millies + KSystem::getMilliesSinceStart(); |
| 1418 | addTimer(&this->timer); |
| 1419 | } |
| 1420 | } |
| 1421 | } |
| 1422 | return 0; |
| 1423 | } |
| 1424 | |
| 1425 | #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ |
| 1426 | #define K_CLONE_VM 0x00000100 /* set if VM shared between processes */ |
no test coverage detected