시스템 콜 구현 질문입니다.

tgamma의 이미지

/usr/src/linux/include/asm-i386/unistd.h파일에 새로운 시스템 콜을 셋팅해주고요

/usr/src/linux/arch/i386/kernel/entry.S파일에도 새로운 시스템 콜을 시스템 콜 테이블에 첨가해줬습니다.

그리고 새로운 시스템 콜을 구현한 다음

Makefile에도 newsyscall.o를 첨가해줘서 제대로 컴파일했습니다.

그런데 이 시스템 콜을 테스트하는 프로그램에서 에러가 납니다.

_syscall0(int, newsyscall);

부분에서

'__NR_newsyscall' undeclared (first use in tihs function)
(Each undeclared identifier is reported only once.
for each function it appears in.)

이라고 에러가 뜹니다.

이상한 것은 얼마전에 수행했을 때는 잘 돌아갔었는데요

커널 컴파일하다가 리눅스가 맛이가서 다시 설치했거든요

다시 설치한 다음 예전에 짠 코드를 수행시켜 본 건데

이렇게 에러가 뜹니다.

unistd.h나 entry.S에 새로운 시스템 콜을 제대로 첨가해줬는데 왜 에러가 뜨는지 모르겠네요

혹시 잘 아시는 분 있으면 조언 좀 주세요 ㅜ_ㅠ

eyre의 이미지

그건 include디렉토리가 잘못되어서 그렇습니다.
컴파일시 /usr/include를 사용하셨을건데,
리눅스 커널이 깔린 곳을 잡아주면 됩니다.

커널이 /usr/src/linux에 있다고 하면

gcc -I/usr/src/linux/include XXX.c

하시면 됩니다

그외 컴파일 할 화일에 __NR_xxx 의 값을 직접
값을 define해주어도 됩니다.

tgamma의 이미지

아..감사합니다 ^^

해보니까 잘 되네요 ㅎㅎ

근데요 혹시 include설정을 항상 따로 안 하고

디폴트로 그 디렉토리를 가리키게끔 하려면 어떻게 해야하는지 가르쳐 줄 수 있으세요??

부탁드립니다 ^^

hys545의 이미지

tgamma wrote:
아..감사합니다 ^^

해보니까 잘 되네요 ㅎㅎ

근데요 혹시 include설정을 항상 따로 안 하고

디폴트로 그 디렉토리를 가리키게끔 하려면 어떻게 해야하는지 가르쳐 줄 수 있으세요??

부탁드립니다 ^^


/usr/src/linux/include
이 밑에 잇는겅 /usr/include에 링크하세여
이게 포준 헤더 디렉토리

즐린

tgamma의 이미지

앗..이렇게 빨리 답변을 ^^;;

고맙습니다

행복한 주말 되세요 ^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <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].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <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].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <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].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <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].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.