static void __task_rq_unlock(struct rq *rq) __releases(rq->lock) { raw_spin_unlock(&rq->lock); }
위의 함수처럼 함수문 다음 가로열기 전에 __releases(rq->lock) 이게 무슨의미죠?
함수시작하기 전에 초기화 해주는 것인가요?
이렇게 쓰는 경우를 처음봐서 어떻게 해석해야하는지 모르겠습니다.
어떤의미인지 알려주시면 감사하겠습니다.
검색을 해보니... 여러가지 설명이 있네요...http://pinocc.tistory.com/144http://stackoverflow.com/questions/21018778/what-does-static-int-function-acquires-releases-mean
__releases(rq->lock) 이 부분이 헤더에 어떻게 정의되어있는지 살펴보면
# define __releases(x) __attribute__((context(x,1,0)))
이렇게 되어있습니다.
__attribute__를 검색해보니 아래에 잘 설명해놓은곳이 있네요.
http://risingcjw.tistory.com/entry/attribute-packed-구조체-정렬
결론: 컴파일러에 구조체 사이즈 맞추라고 지시하는것이네요.
.
gcc 의 __attribute__ 확장엔 여러가지가 있고, 본문에 적혀있는 것은 컴파일러에게 뭘 요구하는 것이 아니라 sparse라는 툴을 위한 것이며, 커널 소스 받아서 make help 하면 다음과 같은 도움말을 볼 수 있습니다.
make C=1 [targets] Check all c source with $CHECK (sparse by default) make C=2 [targets] Force check of all c source with $CHECK
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
저도 잘은 모릅니다만...
검색을 해보니... 여러가지 설명이 있네요...
http://pinocc.tistory.com/144
http://stackoverflow.com/questions/21018778/what-does-static-int-function-acquires-releases-mean
__releases(rq->lock) 이 부분이
__releases(rq->lock) 이 부분이 헤더에 어떻게 정의되어있는지 살펴보면
# define __releases(x) __attribute__((context(x,1,0)))
이렇게 되어있습니다.
__attribute__를 검색해보니 아래에 잘 설명해놓은곳이 있네요.
http://risingcjw.tistory.com/entry/attribute-packed-구조체-정렬
결론: 컴파일러에 구조체 사이즈 맞추라고 지시하는것이네요.
.
gcc 의 __attribute__ 확장엔 여러가지가
gcc 의 __attribute__ 확장엔 여러가지가 있고,
본문에 적혀있는 것은 컴파일러에게 뭘 요구하는 것이 아니라 sparse라는 툴을 위한 것이며,
커널 소스 받아서 make help 하면 다음과 같은 도움말을 볼 수 있습니다.
sparse 는 딱히 리눅스 커널만을 위한 툴은 아니며 https://kldp.org/comment/504059#comment-504059 처럼 사용할 수 있습니다.
댓글 달기