커널 프로그래밍에서 memcmp 쓸려면?

fuerza의 이미지

어떤 헤더를 써야 하죠..

그리고, strcmp를 쓰면 제꺼에서는 되는데 다른 곳(같은 커널버전)에 가면 뻑나는군요.

netdriver.h를 써서 그런가요?

bbok의 이미지

fuerza wrote:
어떤 헤더를 써야 하죠..

제가 직접 찾아서 해보진 않았지만 그냥, 어떤 헤더 파일에 정의되어 있는지
찾아서 넣어주면 되지 않을까요?

금방 찾아봤는데..
linux/string.h를 추가해주면 될것 같네요.

되는지는 모르겠어요 @.@ 될것 같긴 한데... ^^

@.@ 어제처럼, 오늘 처럼, 내일 처럼.

mach337의 이미지

MEMCMP(3)           Linux Programmer's Manual           MEMCMP(3)



NAME
       memcmp - compare memory areas

SYNOPSIS
       #include <string.h>

       int memcmp(const void *s1, const void *s2, size_t n);

DESCRIPTION
       The  memcmp() function compares the first n bytes of the memory areas s1 and s2.
       It returns an integer less than, equal to, or greater than zero if s1 is  found,
       respectively, to be less than, to match, or be greater than s2.

RETURN VALUE
       The  memcmp()  function  returns an integer less than, equal to, or greater than
       zero if the first n bytes of s1 is found, respectively,  to  be  less  than,  to
       match, or be greater than the first n bytes of s2.

CONFORMING TO
       SVID 3, BSD 4.3, ISO 9899 (C99)

SEE ALSO
       bcmp(3), strcasecmp(3), strcmp(3), strcoll(3), strncmp(3), strncasecmp(3)



                            1993-04-10                  MEMCMP(3)
bbok의 이미지

mach337 wrote:
MEMCMP(3)           Linux Programmer's Manual           MEMCMP(3)



NAME
       memcmp - compare memory areas

SYNOPSIS
       #include <string.h>

       int memcmp(const void *s1, const void *s2, size_t n);

DESCRIPTION
       The  memcmp() function compares the first n bytes of the memory areas s1 and s2.
       It returns an integer less than, equal to, or greater than zero if s1 is  found,
       respectively, to be less than, to match, or be greater than s2.

RETURN VALUE
       The  memcmp()  function  returns an integer less than, equal to, or greater than
       zero if the first n bytes of s1 is found, respectively,  to  be  less  than,  to
       match, or be greater than the first n bytes of s2.

CONFORMING TO
       SVID 3, BSD 4.3, ISO 9899 (C99)

SEE ALSO
       bcmp(3), strcasecmp(3), strcmp(3), strcoll(3), strncmp(3), strncasecmp(3)



                            1993-04-10                  MEMCMP(3)

질문은 커널에서 구현된 memcmp()를 사용하려면 어떻게 해야하는지를 물은것 같은데, 착각하셨나봐요^^ 아닌가? 제가 잘못알고 있는것인가?

@.@ 어제처럼, 오늘 처럼, 내일 처럼.

mach337의 이미지

예...그렇네요.
linux/string.h 입니다. ^^;;