signal발생시 systemcall 재시작 여부..

익명 사용자의 이미지

sigaction 구조체의 sa_flags가 SA_RESTART가 set이 되어있을때,

해당 시그널이 발생했을 경우, EINTR에러를 되돌리지 않고, 자동으로

재시작하는 system call종류가 OS마다 다 다르나요?

SunOS와 linux에서 프로그래밍하고 있는데, 좀 다른거 같기도 해서요..

답변 부탁드립니다~~

익명 사용자의 이미지

select와 poll을 제외하고는 모두 다시 시작되는 것으로 아는데..
아닌가요?

sliver wrote..
sigaction 구조체의 sa_flags가 SA_RESTART가 set이 되어있을때,

해당 시그널이 발생했을 경우, EINTR에러를 되돌리지 않고, 자동으로

재시작하는 system call종류가 OS마다 다 다르나요?

SunOS와 linux에서 프로그래밍하고 있는데, 좀 다른거 같기도 해서요..

답변 부탁드립니다~~

익명 사용자의 이미지

SunOS 5.7 상에서

sigaction함수의 man page에 다음과 같은 말이 있어요.

SA_RESTART
If set and the signal is caught, functions that
are interrupted by the execution of this signal's
handler are transparently restarted by the system,
namely fcntl(2), ioctl(2), wait(2), waitid(2),
and the following functions on slow devices like
terminals getmsg() and getpmsg() (see getmsg(2));
putmsg() and putpmsg() (see putmsg(2)); pread(),
read(), and readv() (see read(2)); pwrite(),
write(), and writev() (see write(2)); recv(),
recvfrom(), and recvmsg() (see recv(3N)); and
send(), sendto(), and sendmsg() (see recv(3N).
Otherwise, the function returns an EINTR error.

제가 궁금증을 가지게 된 이유가 accept함수 때문인데요..

accept함수는 위의 리스트에 없듯이 Sun에서는 SA_RESTART flag와는

상관없이 blocking도중에 signal이 오면 무조건 EINTR error를 return하더
군요..

근데 posix표준문서의 sigaction함수부분을 보면,

SA_RESTART This flag affects the behavior of interruptible
functions; that is, those
specified to fail with errno set to [EINTR]. If set, and a function
specified
as interruptible is interrupted by this signal, the function shall
restart and
shall not fail with [EINTR] unless otherwise specified. If the flag
is not
set, interruptible functions interrupted by this signal shall fail
with errno
set to [EINTR].

이런 말이 있거든요..

posix에서는 특정한 함수들을 나열하지 않고 그냥 interruptible
functions라고
지칭해서, 저는 그냥 SA_RESTART플랙만 설정해 주면 EINTR에러코드를
발생시킬 수 있는 모든 함수들을 시그널발생시 자동으로 재시작해주는
줄 알았는게 그게 아니었거든요..
정말 궁금하네요..

댓글 달기

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