「make_image()」の編集履歴(バックアップ)一覧はこちら

make_image()」(2005/10/31 (月) 16:05:53) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

<br> <br> <br> <br> <br> 以下全文<br> <br> void make_image(char *image, char **procv)<br> /* Collect a set of files in an image, each "segment" is nicely padded out<br> * to SECTOR_SIZE, so it may be read from disk into memory without trickery.<br> */<br> {<br>   FILE *imagef, *procf;<br>   char *proc, *file;<br>   int procn;<br>   struct image_header ihdr;<br>   struct exec phdr;<br>   struct stat st;<br> <br>   making_image= 1;<br> <br>   if ((imagef= fopen(image, "w")) == nil) {<br>     fatal(image);<br>   }<br> <br>   for (procn= 0; (proc= *procv++) != nil; procn++) {<br>     /* Remove the label from the file name. */<br>     if ((file= strchr(proc, ':')) != nil)<br>       file++;<br>     else<br>       file= proc;<br> <br>     /* Real files please, may need to seek. */<br>     if (stat(file, &amp;st) &lt; 0<br>       || (errno= EISDIR, !S_ISREG(st.st_mode))<br>       || (procf= fopen(file, "r")) == nil<br>     ) fatal(proc);<br> <br>     /* Read a.out header. */<br>     read_header(1, proc, procf, &amp;ihdr);<br> <br>     /* Scratch. */<br>     phdr= ihdr.process;<br> <br>     /* The symbol table is always stripped off. */<br>     ihdr.process.a_syms= 0;<br>     ihdr.process.a_flags &amp;= ~A_NSYM;<br> <br>     /* Write header padded to fill a sector */<br>     bwrite(imagef, image, &amp;ihdr, sizeof(ihdr));<br> <br>     padimage(image, imagef, SECTOR_SIZE - sizeof(ihdr));<br> <br>     /* A page aligned executable needs the header in text. */<br>     if (phdr.a_flags &amp; A_PAL) {<br>       rewind(procf);<br>       phdr.a_text+= phdr.a_hdrlen;<br>     }<br> <br>     /* Copy text and data of proc to image. */<br>     if (phdr.a_flags &amp; A_SEP) {<br>       /* Separate I&amp;D: pad text &amp; data separately. */<br> <br>       copyexec(proc, procf, image, imagef, phdr.a_text);<br>       copyexec(proc, procf, image, imagef, phdr.a_data);<br>     } else {<br>       /* Common I&amp;D: keep text and data together. */<br> <br>       copyexec(proc, procf, image, imagef,<br>             phdr.a_text + phdr.a_data);<br>     }<br> <br>     /* Done with proc. */<br>     (void) fclose(procf);<br>   }<br>   /* Done with image. */<br> <br>   if (fclose(imagef) == EOF) fatal(image);<br> <br>   printf(" ------ ------ ------ -------\n");<br>   printf("%8ld%8ld%8ld%9ld total\n",<br>     total_text, total_data, total_bss,<br>     total_text + total_data + total_bss);<br> }<br> <br>

表示オプション

横に並べて表示:
変化行の前後のみ表示:
目安箱バナー