From: Antoine Leca Date: Thu, 4 Apr 2013 10:21:23 +0000 (+0200) Subject: , MINIX style: remove as obsolete X-Git-Tag: v3.3.0~867 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=da82f9b2e852fc4be09cd0108948d524b7a7d0ed;p=minix.git , MINIX style: remove as obsolete Change-Id: Icc8b7210d60a93ac9cc4610d676dcba270756410 --- diff --git a/commands/fsck.mfs/fsck.c b/commands/fsck.mfs/fsck.c index ed7698d3d..b9cdda513 100644 --- a/commands/fsck.mfs/fsck.c +++ b/commands/fsck.mfs/fsck.c @@ -54,7 +54,6 @@ #include #include #include -#include #include #include "exitvalues.h" diff --git a/commands/writeisofs/writeisofs.c b/commands/writeisofs/writeisofs.c index 4b0ae0ea4..77aaad867 100644 --- a/commands/writeisofs/writeisofs.c +++ b/commands/writeisofs/writeisofs.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -164,7 +163,6 @@ int n_reserved_pathtableentries = 0, n_used_pathtableentries = 0; int bootmedia = BOOTMEDIA_UNSPECIFIED; unsigned long bootseg = 0; int system_type = 0; -int bootimage_is_aout = 0; int get_system_type(int fd); @@ -779,7 +777,6 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector, static unsigned char buf[1024*64], *addr; ssize_t written = 0, rest; int virtuals, rem; - struct exec hdr; struct stat sb; struct bap { off_t sector; @@ -794,26 +791,7 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector, exit(1); } - if (bootimage_is_aout) { - Read(bootfd, &hdr, A_MINHDR); - - if(hdr.a_magic[0] != A_MAGIC0) { - fprintf(stderr, "bad magic in a.out of boot image.\n"); - exit(1); - } - - if(hdr.a_hdrlen > sizeof(hdr)) { - fprintf(stderr, "surprisingly large header in boot image.\n"); - exit(1); - } - - /* read rest of a.out header. */ - Read(bootfd, (char *) &hdr + A_MINHDR, hdr.a_hdrlen - A_MINHDR); - - /* copy text+data */ - rem = hdr.a_text + hdr.a_data; - } else - rem = sb.st_size; + rem = sb.st_size; while(rem > 0) { int want; @@ -821,7 +799,7 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector, Read(bootfd, buf, want); if (written == 0) { /* check some properties at beginning. */ - if (!bootimage_is_aout && buf[0] == 1 && buf[1] == 3) { + if (buf[0] == 1 && buf[1] == 3) { fprintf(stderr, "boot image %s is an a.out executable\n", bootimage); exit(1); @@ -981,9 +959,6 @@ main(int argc, char *argv[]) case 'R': remove_after = 1; break; - case 'b': - bootimage_is_aout= 1; - /*FALLTHROUGH*/ case 'B': bootimage = optarg; if((bootfd = open(bootimage, O_RDONLY)) < 0) { diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index 2cfc61464..96bbc8d4d 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -581,9 +581,9 @@ ./usr/include/bzlib.h minix-sys ./usr/include/cdbr.h minix-sys ./usr/include/cdbw.h minix-sys -./usr/include/compat minix-sys -./usr/include/compat/a.out.h minix-sys +./usr/include/compat/a.out.h minix-sys obsolete ./usr/include/compat/machine minix-sys +./usr/include/compat minix-sys ./usr/include/complex.h minix-sys ./usr/include/configfile.h minix-sys ./usr/include/cpio.h minix-sys diff --git a/include/a.out.h b/include/a.out.h index 912cc3d9f..6cb43b843 100644 --- a/include/a.out.h +++ b/include/a.out.h @@ -59,10 +59,7 @@ #ifndef _AOUT_H_ #define _AOUT_H_ - -#ifdef __minix -#include -#else /* !__minix */ +#ifndef __minix #include diff --git a/kernel/arch/earm/direct_tty_utils.c b/kernel/arch/earm/direct_tty_utils.c index 2bd190a4c..314d58d41 100644 --- a/kernel/arch/earm/direct_tty_utils.c +++ b/kernel/arch/earm/direct_tty_utils.c @@ -1,20 +1,8 @@ #include "kernel/kernel.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "string.h" -#include "arch_proto.h" -#include "libexec.h" #include "direct_utils.h" #include "serial.h" #include "glo.h" -#include void direct_cls(void) { diff --git a/kernel/arch/earm/pg_utils.c b/kernel/arch/earm/pg_utils.c index b2d696d1e..e5ab5e8e6 100644 --- a/kernel/arch/earm/pg_utils.c +++ b/kernel/arch/earm/pg_utils.c @@ -2,14 +2,12 @@ #include #include -#include #include #include "kernel/kernel.h" #include "arch_proto.h" #include #include -#include #include /* These are set/computed in kernel.lds. */ diff --git a/kernel/arch/earm/pre_init.c b/kernel/arch/earm/pre_init.c index a54f1d3e9..d311c28c1 100644 --- a/kernel/arch/earm/pre_init.c +++ b/kernel/arch/earm/pre_init.c @@ -13,7 +13,6 @@ #include #include "string.h" #include "arch_proto.h" -#include "libexec.h" #include "direct_utils.h" #include "serial.h" #include "glo.h" diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index bb12b0682..f14d32ae1 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -20,7 +20,6 @@ #include "arch_proto.h" #include "serial.h" #include "oxpcie.h" -#include "direct_utils.h" #include #include "glo.h" diff --git a/kernel/arch/i386/direct_tty_utils.c b/kernel/arch/i386/direct_tty_utils.c index 3b5e36c46..eb8364bc9 100644 --- a/kernel/arch/i386/direct_tty_utils.c +++ b/kernel/arch/i386/direct_tty_utils.c @@ -8,10 +8,8 @@ #include #include #include -#include #include "string.h" #include "arch_proto.h" -#include "libexec.h" #include "direct_utils.h" #include "serial.h" #include "glo.h" diff --git a/kernel/arch/i386/pg_utils.c b/kernel/arch/i386/pg_utils.c index 83eb35e6a..91e4fab7a 100644 --- a/kernel/arch/i386/pg_utils.c +++ b/kernel/arch/i386/pg_utils.c @@ -3,11 +3,9 @@ #include #include "kernel/kernel.h" -#include #include "arch_proto.h" #include -#include /* These are set/computed in kernel.lds. */ extern char _kern_vir_base, _kern_phys_base, _kern_size; diff --git a/kernel/arch/i386/pre_init.c b/kernel/arch/i386/pre_init.c index cd2509d71..d63575e48 100644 --- a/kernel/arch/i386/pre_init.c +++ b/kernel/arch/i386/pre_init.c @@ -14,7 +14,6 @@ #include #include "string.h" #include "arch_proto.h" -#include "libexec.h" #include "direct_utils.h" #include "serial.h" #include "glo.h" diff --git a/kernel/main.c b/kernel/main.c index cf80c954e..20bd64ac7 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/kernel/proto.h b/kernel/proto.h index ed382c7b9..e59c54d6c 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -8,7 +8,6 @@ #include #include -#include /* Struct declarations. */ struct proc; diff --git a/lib/libcompat_minix/include/Makefile.inc b/lib/libcompat_minix/include/Makefile.inc index c62cb3ce4..2a9a9adbb 100644 --- a/lib/libcompat_minix/include/Makefile.inc +++ b/lib/libcompat_minix/include/Makefile.inc @@ -3,6 +3,5 @@ INCSDIR= /usr/include INCS+= configfile.h -INCS+= compat/a.out.h INCS+= net/gen/netdb.h net/gen/resolv.h net/gen/nameser.h INCS+= sys/jmp_buf.h ${MACHINE}/compat_jmp_buf.h diff --git a/lib/libcompat_minix/include/compat/a.out.h b/lib/libcompat_minix/include/compat/a.out.h deleted file mode 100644 index e85927de6..000000000 --- a/lib/libcompat_minix/include/compat/a.out.h +++ /dev/null @@ -1,113 +0,0 @@ -/* The header file describes the format of executable files. */ - -#ifndef _AOUT_H -#define _AOUT_H - -struct exec { /* a.out header */ - unsigned char a_magic[2]; /* magic number */ - unsigned char a_flags; /* flags, see below */ - unsigned char a_cpu; /* cpu id */ - unsigned char a_hdrlen; /* length of header */ - unsigned char a_unused; /* reserved for future use */ - unsigned short a_version; /* version stamp (not used at present) */ - long a_text; /* size of text segement in bytes */ - long a_data; /* size of data segment in bytes */ - long a_bss; /* size of bss segment in bytes */ - long a_entry; /* entry point */ - long a_total; /* total memory allocated */ - long a_syms; /* size of symbol table */ - - /* SHORT FORM ENDS HERE */ - long a_trsize; /* text relocation size */ - long a_drsize; /* data relocation size */ - long a_tbase; /* text relocation base */ - long a_dbase; /* data relocation base */ -}; - -#define A_MAGIC0 (unsigned char) 0x01 -#define A_MAGIC1 (unsigned char) 0x03 -#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1) - -/* CPU Id of TARGET machine (byte order coded in low order two bits) */ -#define A_NONE 0x00 /* unknown */ -#define A_I8086 0x04 /* intel i8086/8088 */ -#define A_M68K 0x0B /* motorola m68000 */ -#define A_NS16K 0x0C /* national semiconductor 16032 */ -#define A_I80386 0x10 /* intel i80386 */ -#define A_SPARC 0x17 /* Sun SPARC */ - -#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */ -#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */ - -/* Flags. */ -#define A_UZP 0x01 /* unmapped zero page (pages) */ -#define A_PAL 0x02 /* page aligned executable */ -#define A_NSYM 0x04 /* new style symbol table */ -#define A_IMG 0x08 /* image instead of executable (e.g. root FS) */ -#define A_EXEC 0x10 /* executable */ -#define A_SEP 0x20 /* separate I/D */ -#define A_PURE 0x40 /* pure text */ /* not used */ -#define A_TOVLY 0x80 /* text overlay */ /* not used */ - -/* Offsets of various things. */ -#define A_MINHDR 32 -#define A_TEXTPOS(X) ((long)(X).a_hdrlen) -#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text) -#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR) -#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8)) -#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16)) -#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24)) -#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data) -#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize) -#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \ - ((X).a_trsize + (X).a_drsize) : 0)) - -struct reloc { - long r_vaddr; /* virtual address of reference */ - unsigned short r_symndx; /* internal segnum or extern symbol num */ - unsigned short r_type; /* relocation type */ -}; - -/* r_type values: */ -#define R_ABBS 0 -#define R_RELLBYTE 2 -#define R_PCRBYTE 3 -#define R_RELWORD 4 -#define R_PCRWORD 5 -#define R_RELLONG 6 -#define R_PCRLONG 7 -#define R_REL3BYTE 8 -#define R_KBRANCHE 9 - -/* r_symndx for internal segments */ -#define S_ABS ((unsigned short)-1) -#define S_TEXT ((unsigned short)-2) -#define S_DATA ((unsigned short)-3) -#define S_BSS ((unsigned short)-4) - -struct nlist { /* symbol table entry */ - char n_name[8]; /* symbol name */ - long n_value; /* value */ - unsigned char n_sclass; /* storage class */ - unsigned char n_numaux; /* number of auxiliary entries (not used) */ - unsigned short n_type; /* language base and derived type (not used) */ -}; - -/* Low bits of storage class (section). */ -#define N_SECT 07 /* section mask */ -#define N_UNDF 00 /* undefined */ -#define N_ABS 01 /* absolute */ -#define N_TEXT 02 /* text */ -#define N_DATA 03 /* data */ -#define N_BSS 04 /* bss */ -#define N_COMM 05 /* (common) */ - -/* High bits of storage class. */ -#define N_CLASS 0370 /* storage class mask */ -#define C_NULL -#define C_EXT 0020 /* external symbol */ -#define C_STAT 0030 /* static */ - -int nlist(char *_file, struct nlist *_nl); - -#endif /* _AOUT_H */ diff --git a/lib/libexec/Makefile b/lib/libexec/Makefile index 0456ef81d..181749730 100644 --- a/lib/libexec/Makefile +++ b/lib/libexec/Makefile @@ -5,7 +5,7 @@ NOGCCERROR:= yes LIB= exec INCS= libexec.h -SRCS= exec_aout.c exec_elf.c exec_general.c +SRCS= exec_elf.c exec_general.c INCSDIR= /usr/include diff --git a/lib/libexec/exec_aout.c b/lib/libexec/exec_aout.c deleted file mode 100644 index f3eda79c8..000000000 --- a/lib/libexec/exec_aout.c +++ /dev/null @@ -1,83 +0,0 @@ -#define _SYSTEM 1 - -#include -#include -#include -#include -#include -#include -#include - -int read_header_aout( - const char *exec_hdr, /* executable header */ - size_t exec_len, /* executable file size */ - int *sep_id, /* true iff sep I&D */ - vir_bytes *text_bytes, /* place to return text size */ - vir_bytes *data_bytes, /* place to return initialized data size */ - vir_bytes *bss_bytes, /* place to return bss size */ - phys_bytes *tot_bytes, /* place to return total size */ - vir_bytes *pc, /* program entry point (initial PC) */ - int *hdrlenp -) -{ -/* Read the header and extract the text, data, bss and total sizes from it. */ - struct exec *hdr; /* a.out header is read in here */ - - /* Read the header and check the magic number. The standard MINIX header - * is defined in . It consists of 8 chars followed by 6 longs. - * Then come 4 more longs that are not used here. - * Byte 0: magic number 0x01 - * Byte 1: magic number 0x03 - * Byte 2: normal = 0x10 (not checked, 0 is OK), separate I/D = 0x20 - * Byte 3: CPU type, Intel 16 bit = 0x04, Intel 32 bit = 0x10, - * Motorola = 0x0B, Sun SPARC = 0x17 - * Byte 4: Header length = 0x20 - * Bytes 5-7 are not used. - * - * Now come the 6 longs - * Bytes 8-11: size of text segments in bytes - * Bytes 12-15: size of initialized data segment in bytes - * Bytes 16-19: size of bss in bytes - * Bytes 20-23: program entry point - * Bytes 24-27: total memory allocated to program (text, data + stack) - * Bytes 28-31: size of symbol table in bytes - * The longs are represented in a machine dependent order, - * little-endian on the 8088, big-endian on the 68000. - * The header is followed directly by the text and data segments, and the - * symbol table (if any). The sizes are given in the header. Only the - * text and data segments are copied into memory by exec. The header is - * used here only. The symbol table is for the benefit of a debugger and - * is ignored here. - */ - - assert(exec_hdr != NULL); - - hdr = (struct exec *)exec_hdr; - if (exec_len < A_MINHDR) return(ENOEXEC); - - /* Check magic number, cpu type, and flags. */ - if (BADMAG(*hdr)) return(ENOEXEC); -#if defined(__i386__) - if (hdr->a_cpu != A_I80386) return(ENOEXEC); -#endif - if ((hdr->a_flags & ~(A_NSYM | A_EXEC | A_SEP)) != 0) return(ENOEXEC); - - *sep_id = !!(hdr->a_flags & A_SEP); /* separate I & D or not */ - - /* Get text and data sizes. */ - *text_bytes = (vir_bytes) hdr->a_text; /* text size in bytes */ - *data_bytes = (vir_bytes) hdr->a_data; /* data size in bytes */ - *bss_bytes = (vir_bytes) hdr->a_bss; /* bss size in bytes */ - *tot_bytes = hdr->a_total; /* total bytes to allocate for prog */ - if (*tot_bytes == 0) return(ENOEXEC); - - if (!*sep_id) { - /* If I & D space is not separated, it is all considered data. Text=0*/ - *data_bytes += *text_bytes; - *text_bytes = 0; - } - *pc = hdr->a_entry; /* initial address to start execution */ - *hdrlenp = hdr->a_hdrlen & BYTE; /* header length */ - - return(OK); -} diff --git a/servers/pm/exec.c b/servers/pm/exec.c index 040dcd393..4691c731b 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/servers/procfs/inc.h b/servers/procfs/inc.h index ae411730f..342694a60 100644 --- a/servers/procfs/inc.h +++ b/servers/procfs/inc.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/servers/rs/exec.c b/servers/rs/exec.c index ffbab2c78..0701439c2 100644 --- a/servers/rs/exec.c +++ b/servers/rs/exec.c @@ -1,5 +1,4 @@ #include "inc.h" -#include #include #include #include diff --git a/servers/vfs/exec.c b/servers/vfs/exec.c index c0bbe58ae..638d1d404 100644 --- a/servers/vfs/exec.c +++ b/servers/vfs/exec.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/servers/vm/glo.h b/servers/vm/glo.h index f4d4002b5..880aca934 100644 --- a/servers/vm/glo.h +++ b/servers/vm/glo.h @@ -3,7 +3,6 @@ #include #include #include -#include #include "vm.h" #include "vmproc.h"