socketcall 시스템콜에 대한 질문입니다.

einsok의 이미지

초보라서 그런지 책이란 책을 다 뒤져봐도 모르겠어서 질문을 올립니다. ㅠ.ㅠ

read()같은 시스템콜 함수를 부르면 인터럽트가 발생해서 sys_read() 를 entry.S참조해 찾아가 실행하는 식이라고 알고있습니다. 시스템콜을 그런식으로 이름을 맞춰서 만드는 예제도 봤고요..

그런데 socket() 함수를 부르면 sys_socket이 아니라 sys_socketcall이 불려져서 거기서 sys_socket을 부른다고 하네요. 어떻게 된건지...

너무 헷갈립니다. 조언 부탁드립니다. ㅠ.ㅠ

swunk의 이미지

socket() 함수 콜하면... 알고 계신대로 벡터테이블로 가서 해당 번지 값을 수행합니다.

socket 같은 경우는 sys_socketcall() 함수가 호출되고 sys_socketcall() 함수 내에서 switch case 문인걸로 기억하는데

socket() 인 경우는 sys_socket()
bind() 인 경우는 sys_bind()
connect() 인 경우는 sys_connect() 등의 함수가 호출 됩니다.

아래 소스를 찾았습니다. 참조 하세요...
socket.c 파일에 정의 되어 있네요...

1899 asmlinkage long sys_socketcall(int call, unsigned long __user *args)
1900 {
1901         unsigned long a[6];
1902         unsigned long a0,a1;
1903         int err;
1904 
1905         if(call<1||call>SYS_RECVMSG)
1906                 return -EINVAL;
1907 
1908         /* copy_from_user should be SMP safe. */
1909         if (copy_from_user(a, args, nargs[call]))
1910                 return -EFAULT;
1911                 
1912         a0=a[0];
1913         a1=a[1];
1914         
1915         switch(call) 
1916         {
1917                 case SYS_SOCKET:
1918                         err = sys_socket(a0,a1,a[2]);
1919                         break;
1920                 case SYS_BIND:
1921                         err = sys_bind(a0,(struct sockaddr __user *)a1, a[2]);
1922                         break;
1923                 case SYS_CONNECT:
1924                         err = sys_connect(a0, (struct sockaddr __user *)a1, a[2]);
1925                         break;
1926                 case SYS_LISTEN:
1927                         err = sys_listen(a0,a1);
einsok의 이미지

socket()을 호출하면 sys_socketcall 함수가 호출되게 하는 루틴을 어디서 볼 수 있는건가요? 인터럽트 발생시키는 코드는 어디에....흠.. ;;; 이책 저책을 다시한번 봐야할듯...정리가 안되네요..방향을 잡을 수 있는 조언을 해주시면 감사하겠습니다. 당최 시간만 낭비하는거 같고 헤메기만 하는듯 하네요...

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.