티스토리 뷰
char \*get\_task\_comm(char \*buf, struct task\_struct \*tsk)
{
/\* buf must be at least sizeof(tsk->comm) in size \*/
task\_lock(tsk);
strncpy(buf, tsk->comm, sizeof(tsk->comm));
task\_unlock(tsk);
return buf;
}
fs/exec.c: In function ‘get\_task\_comm’:
fs/exec.c:1069:39: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? \[-Wsizeof-pointer-memaccess\]
1069 | strncpy(buf, tsk->comm, sizeof(tsk->comm));
|
일단 msm8917common kernel github에 올라온걸로 defconfig elitetlekx 옮겨서 뚜따뚜따하다가 빌드하는 중인데, 에러들 보니깐 뒷골이 멍해져서 하나하나 풀려고한다. 일단 첫번째 에러는 다음과 같다 그냥 스트럭트 구조체한번 뜯어보면 될것같다음-202402141004
아 알고보니깐 set_tastk_comm을 뜯어보고있었네 그냥 주석으로 buf 사이즈가 tsk->comm 사이즈보다 커야한다고 적어놨네요잉
CC kernel/irq/chip.o
In file included from include/linux/compiler.h:54,
from include/linux/linkage.h:4,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/mm.h:9,
from kernel/sched/core.c:29:
kernel/sched/core.c: In function ‘sched_init’:
include/linux/compiler-gcc.h:163:9: error: ‘struct cfs_rq’ has no member named ‘rq’
163 | __builtin_offsetof(a, b)
| ^~~~~~~~~~~~~~~~~~
include/linux/stddef.h:16:33: note: in expansion of macro ‘__compiler_offsetof’
16 | #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~~
kernel/sched/core.c:10615:25: note: in expansion of macro ‘offsetof’
10615 | offsetof(struct cfs_rq, rq));
| ^~~~~~~~
CC mm/swap.o
이제 이거 문제인데 또 뭔가 정의가 안됐다고 하네요잉
#ifdef CONFIG\_FAIR\_GROUP\_SCHED
struct rq \*rq; /\* cpu runqueue to which this cfs\_rq is attached \*/
/\*
\* leaf cfs\_rqs are those that hold tasks (lowest schedulable entity in
\* a hierarchy). Non-leaf lrqs hold other higher schedulable entities
\* (like users, containers etc.)
\*
\* leaf\_cfs\_rq\_list ties together list of leaf cfs\_rq's in a cpu. This
\* list is used during load balance.
\*/
int on\_list;
struct list\_head leaf\_cfs\_rq\_list;
struct task\_group \*tg; /\* group that "owns" this runqueue \*/
이거보니깐 아무래도 CONFIG_FAIR_GROUP_SCHED가 y로 정의가 안돼서 runqueue struct가 안잡힌거 같네요잉
진짜 뭐지뭐지하다가 알고보니 CONFIG_SMP도 y로 정의를 해줘야 굴러가는거요잉
이거 공룡책 처음에 나오는 Symmetric Multi Processor인가 그거같은데 그파트 공부해야겠어요잉 -202502151246
'공부한거 > OS' 카테고리의 다른 글
ABI README - GPT 번역 (1) | 2025.02.08 |
---|---|
Linux Document - (1) (0) | 2025.02.08 |
Kernel Configuration 진입 (0) | 2025.02.08 |