Commit 8de81705 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New file. Generate simple wrappers that check for EINTR.

parent 3f9a6d92
{
incl=$1
rettype=$2
errval=$3
fnc=$4
fn=fnc ".c"
print "#include <errno.h>" > fn
printf "#include <%s>\n\n", incl >> fn
printf "#include \"eintr.h\"\n\n" >> fn
print rettype >> fn
printf "i_%s(", fnc >> fn
for (i = 5; i <= NF; i++) {
printf "%s %c", $i, 60+i >> fn
if (i <= NF - 1) printf ", " >> fn
}
print ")" >> fn
print "{" >> fn
printf " %s ret;\n\n", rettype >> fn
print " do {" >> fn
print "\terrno = 0;" >> fn
printf "\tret = %s(", fnc >> fn
for (i = 5; i <= NF; i++) {
printf "%c", 60+i >> fn
if (i <= NF - 1) printf ", " >> fn
}
print ");" >> fn
printf " } while (ret == %s && errno == EINTR);\n\n", errval >> fn
print " return ret;" >> fn
print "}" >> fn
printf "%s i_%s(", rettype, fnc >> "eintr.h"
for (i = 5; i <= NF; i++) {
printf "%s", $i >> "eintr.h"
if (i <= NF - 1) printf ", " >> "eintr.h"
}
print ");" >> "eintr.h"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment