Function report |
Source Code:ipc\sem.c |
Create Date:2022-07-28 16:44:47 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:semctl_main
Proto:static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, int cmd, void __user *p)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct ipc_namespace * | ns | |
| int | semid | |
| int | semnum | |
| int | cmd | |
| void __user * | p |
| 1393 | sem_io = fast_sem_io |
| 1397 | sma = sem_obtain_object_check(ns, semid) |
| 1403 | nsems = . of semaphores in array |
| 1409 | err = security_sem_semctl( & permissions .. see ipc.h , cmd) |
| 1410 | If err Then Go to out_rcu_wakeup |
| 1415 | Case cmd == get all semval's |
| 1423 | Go to out_unlock |
| 1425 | If nsems > 512 bytes on stack Then |
| 1426 | If Not ipc_rcu_getref( & permissions .. see ipc.h ) Then |
| 1428 | Go to out_unlock |
| 1430 | sem_unlock(sma, - 1) |
| 1432 | sem_io = kvmalloc_array(nsems, sizeof(ushort), GFP_KERNEL) |
| 1434 | If (sem_io == NULL) Then |
| 1435 | ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free) |
| 1436 | Return -ENOMEM |
| 1440 | sem_lock_and_putref(sma) |
| 1443 | Go to out_unlock |
| 1446 | When i < . of semaphores in array cycle sem_io[i] = current value |
| 1448 | sem_unlock(sma, - 1) |
| 1450 | err = 0 |
| 1453 | Go to out_free |
| 1455 | Case cmd == set all semval's |
| 1460 | If Not ipc_rcu_getref( & permissions .. see ipc.h ) Then |
| 1462 | Go to out_rcu_wakeup |
| 1466 | If nsems > 512 bytes on stack Then |
| 1467 | sem_io = kvmalloc_array(nsems, sizeof(ushort), GFP_KERNEL) |
| 1469 | If (sem_io == NULL) Then |
| 1470 | ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free) |
| 1471 | Return -ENOMEM |
| 1476 | ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free) |
| 1478 | Go to out_free |
| 1482 | If sem_io[i] > <= 32767 semaphore maximum value Then |
| 1483 | ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free) |
| 1485 | Go to out_free |
| 1489 | sem_lock_and_putref(sma) |
| 1492 | Go to out_unlock |
| 1496 | current value = sem_io[i] |
| 1502 | When i < nsems cycle array of adjustments [i] = 0 |
| 1508 | err = 0 |
| 1509 | Go to out_unlock |
| 1514 | If semnum < 0 || semnum >= nsems Then Go to out_rcu_wakeup |
| 1520 | Go to out_unlock |
| 1527 | Case cmd == get semval |
| 1528 | err = current value |
| 1529 | Go to out_unlock |
| 1530 | Case cmd == get sempid |
| 1532 | Go to out_unlock |
| 1533 | Case cmd == get semncnt |
| 1535 | Go to out_unlock |
| 1536 | Case cmd == get semzcnt |
| 1538 | Go to out_unlock |
| 1541 | out_unlock : |
| 1542 | sem_unlock(sma, - 1) |
| 1543 | out_rcu_wakeup : |
| 1546 | out_free : |
| 1549 | Return err |
| Name | Describe |
|---|---|
| ksys_semctl | |
| compat_ksys_semctl |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |