Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sysctl.c Create Date:2022-07-28 09:11:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:/proc/sys support

Proto:static int _proc_do_string(char *data, int maxlen, int write, char __user *buffer, size_t *lenp, loff_t *ppos)

Type:int

Parameter:

TypeParameterName
char *data
intmaxlen
intwrite
char __user *buffer
size_t *lenp
loff_t *ppos
2005  __user * p
2008  If Not data || Not maxlen || Not lenp Then
2009  lenp = 0
2010  Return 0
2013  If write Then
2016  len = strlen(data)
2017  If len > maxlen - 1 Then len = maxlen - 1
2020  If ppos > len Then Return 0
2022  len = ppos
2023  Else
2025  len = 0
2028  ppos += lenp
2029  p = buffer
2030  When p - buffer < lenp && len < maxlen - 1 cycle
2031  If Get a simple variable from user space(c, p++) Then Return -EFAULT
2033  If c == 0 || c == '\n' Then Break
2035  data[len++] = c
2037  data[len] = 0
2038  Else
2039  len = strlen - Find the length of a string*@s: The string to be sized
2040  If len > maxlen Then len = maxlen
2043  If ppos > len Then
2044  lenp = 0
2045  Return 0
2048  data += ppos
2049  len -= ppos
2051  If len > lenp Then len = lenp
2053  If len Then If copy_to_user(buffer, data, len) Then
2055  Return -EFAULT
2056  If len < lenp Then
2057  If Write a simple value into user space('\n', buffer + len) Then Return -EFAULT
2059  len++
2061  lenp = len
2062  ppos += len
2064  Return 0
Caller
NameDescribe
proc_dostringread a string sysctl