gethostbyname()?????

shamlock의 이미지

안녕하세요. 홈페이지 정신없네요 ㅎㅎ
질문 올리는 게시판을 한참 찾았어요
예전게 더 편한것 같은데..(아직 익숙하지 않아서 그런가..) ^^

답변좀 부탁드립니다.
아시다시피 gethostbyname()함수는 도메인 명을 IP어드레스로 변환하기 위해
dns 쿼리를 dns 서버에 날려주는 함수인데요( 맞죠? )

dns 서버는 resolve.conf에서 설정합니다

질문1----------------------
그러면 결국 gethostbyname()이 resolve.conf 파일을 참조하는 것 같은데요
resolve.conf 경로 및 파일명을 바꿀수 없을까요?
다른 경로에 저장한 후 그 파일을 참조하고 싶은데요..
(물론 시스템의 모든 프로세스가 참조할수 있어야 겠네요)
또는 공유메모리 같은 어떤 메모리 상에 띄워놓고 사용할 수 없을까요?

질문2----------------------
gethostbyname() 함수를 직접 만들어서 사용하면 젤 편할것 같은데..
방법을 잘 모르겟고..
라이브러리 함수를 변경할 수 있는 방법이나 문서에 대한 도움을 주시면 감사드리겠습니다.

wariua의 이미지

1. resolv.conf 파일의 경로
하드코딩 되어 있습니다. glibc의 경우 "/etc/resolv.conf"로, uClibc의 경우 "/etc/resolv.conf" 및 "/etc/config/resolv.conf"로 소스 코드에 정의되어 있습니다. RES_OPTIONS 환경 변수로 options 항목은 동적으로 지정이 가능하지만 nameserver에는 비슷한 방식이 존재하지 않습니다.

(가능한 경우라면) 가장 무난한 방법은 symbolic link를 거는 것이 아닐까 합니다.

2. gethostbyname() 작성하기
라이브러리를 직접 변경하시려면 glibc 소스 코드를 수정하고 컴파일 하셔야 합니다... 음음;; 좀 더 편한 방법으로는 glibc 소스를 참고해서 my_gethostbyname() 정도를 만드실 수 있겠는데, 어떤 목적을 위해 어떤 제한 하에 만들려고 하시는지 모르니 뭔가 더 말씀드리긴 힘드네요 :oops:
----
$PWD `date`

$PWD `date`

댓글 달기

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