| Function report | 
| Source Code: security\tomoyo\common.c | Create Date:2022-07-28 19:37:25 | 
| Last Modify:2020-03-18 09:15:18 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:moyo_write_control - write() for /sys/kernel/security/tomoyo/ interface.*@head: Pointer to "struct tomoyo_io_buffer".*@buffer: Pointer to buffer to read from.*@buffer_len: Size of @buffer.* Returns @buffer_len on success, negative value otherwise.
Proto:ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head, const char __user *buffer, const int buffer_len)
Type:ssize_t
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct tomoyo_io_buffer * | head | |
| const char __user * | buffer | |
| const int | buffer_len | 
| 2658 | error = buffer_len | 
| 2659 | avail_len = buffer_len | 
| 2660 | cp0 = Buffer for writing. | 
| 2667 | If mutex_lock_interruptible( & Exclusive lock for this structure. ) Then Return -EINTR | 
| 2669 | read_user_buf_avail = 0 | 
| 2670 | idx = moyo_read_lock - Take lock for protecting policy.* Returns index number for tomoyo_read_unlock(). | 
| 2675 | If Bytes available for writing. >= Size of write buffer. - 1 Then | 
| 2676 | len = Size of write buffer. * 2 | 
| 2677 | cp = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). | 
| 2679 | If Not cp Then | 
| 2683 | memmove(cp, cp0, Bytes available for writing. ) | 
| 2685 | Buffer for writing. = cp | 
| 2687 | Size of write buffer. = len | 
| 2689 | If Get a simple variable from user space(c, buffer) Then | 
| 2693 | buffer++ | 
| 2694 | avail_len-- | 
| 2695 | cp0[ Bytes available for writing. ++] = c | 
| 2696 | If c != '\n' Then Continue | 
| 2698 | cp0[ Bytes available for writing. - 1] = '\0' | 
| 2699 | Bytes available for writing. = 0 | 
| 2700 | tomoyo_normalize_line(cp0) | 
| 2702 | ns = tomoyo_kernel_namespace | 
| 2703 | The position currently writing to. = NULL | 
| 2705 | Continue | 
| 2709 | Case Type of this interface. == TOMOYO_PROCESS_STATUS | 
| 2711 | Break | 
| 2712 | Case Type of this interface. == TOMOYO_DOMAINPOLICY | 
| 2716 | Case Type of this interface. == TOMOYO_EXCEPTIONPOLICY | 
| 2718 | print_transition_related_only = true | 
| 2719 | Continue | 
| 2722 | Default | 
| 2725 | Go to out | 
| 2734 | Case Type of this interface. == TOMOYO_DOMAINPOLICY | 
| 2735 | Case Type of this interface. == TOMOYO_EXCEPTIONPOLICY | 
| 2736 | Case Type of this interface. == TOMOYO_STAT | 
| 2737 | Case Type of this interface. == TOMOYO_PROFILE | 
| 2738 | Case Type of this interface. == TOMOYO_MANAGER | 
| 2740 | Break | 
| 2741 | Default | 
| 2742 | Break | 
| 2744 | Break | 
| 2747 | out : | 
| 2750 | Return error | 
| Name | Describe | 
|---|---|
| tomoyo_write | moyo_write - write() for /sys/kernel/security/tomoyo/ interface.*@file: Pointer to "struct file".*@buf: Pointer to buffer.*@count: Size of @buf.*@ppos: Unused.* Returns @count on success, negative value otherwise. | 
| 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 |