解決: FILE* と FILE* を使う全ての関数をラップする
typedef struct __darwin_sFILE {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
// TODO(hamaji): we need to modify this value with ferror and feof...
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
FILE* linux_fp;
}
int __darwin_fputs(const char* s, __darwin_FILE* fp) {
return fputs(s, fp->linux_fp);
}
_flags をマジメに処理してないから feof と ferror はたぶんうまく動かない