Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config After thought, revert "Generate *.c files und...
details: https://anonhg.NetBSD.org/src/rev/9fec29f8dbbf
branches: trunk
changeset: 340412:9fec29f8dbbf
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Sep 03 13:53:36 2015 +0000
description:
After thought, revert "Generate *.c files under conf/". Generate *.c files
under top build directory. *.c files are never placed just under $S/. Keep
this exclusiveness.
diffstat:
usr.bin/config/defs.h | 4 +---
usr.bin/config/files.c | 12 +++++-------
usr.bin/config/main.c | 15 ++-------------
usr.bin/config/mkdevsw.c | 17 ++++++-----------
usr.bin/config/mkheaders.c | 12 +++---------
usr.bin/config/mkioconf.c | 16 +++++-----------
usr.bin/config/mkswap.c | 12 ++++--------
7 files changed, 26 insertions(+), 62 deletions(-)
diffs (truncated from 323 to 300 lines):
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/defs.h
--- a/usr.bin/config/defs.h Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/defs.h Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.88 2015/09/03 09:28:00 uebayasi Exp $ */
+/* $NetBSD: defs.h,v 1.89 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -433,8 +433,6 @@
const char *ioconfname; /* ioconf name, mutually exclusive to machine */
const char *srcdir; /* path to source directory (rel. to build) */
const char *builddir; /* path to build directory */
-int builddirfd; /* dir fd of builddir */
-int buildconfdirfd; /* dir fd of builddir/conf */
const char *defbuilddir; /* default build directory */
const char *ident; /* kernel "ident"ification string */
int errors; /* counts calls to error() */
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/files.c
--- a/usr.bin/config/files.c Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/files.c Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: files.c,v 1.27 2015/09/02 05:09:25 uebayasi Exp $ */
+/* $NetBSD: files.c,v 1.28 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: files.c,v 1.27 2015/09/02 05:09:25 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.28 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <errno.h>
@@ -278,15 +278,13 @@
struct config *cf;
char swapname[100];
- buildprefix_push("conf");
- addfile("conf/devsw.c", NULL, 0, NULL);
- addfile("conf/ioconf.c", NULL, 0, NULL);
+ addfile("devsw.c", NULL, 0, NULL);
+ addfile("ioconf.c", NULL, 0, NULL);
TAILQ_FOREACH(cf, &allcf, cf_next) {
- (void)snprintf(swapname, sizeof(swapname), "conf/swap%s.c",
+ (void)snprintf(swapname, sizeof(swapname), "swap%s.c",
cf->cf_name);
addfile(intern(swapname), NULL, 0, NULL);
}
- buildprefix_pop();
}
err = 0;
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/main.c
--- a/usr.bin/config/main.c Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/main.c Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.87 2015/09/03 06:08:38 uebayasi Exp $ */
+/* $NetBSD: main.c,v 1.88 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.87 2015/09/03 06:08:38 uebayasi Exp $");
+__RCSID("$NetBSD: main.c,v 1.88 2015/09/03 13:53:36 uebayasi Exp $");
#ifndef MAKE_BOOTSTRAP
#include <sys/cdefs.h>
@@ -100,8 +100,6 @@
#endif
int dflag;
-static const char *buildconfdir = ".";
-
static struct dlhash *obsopttab;
static struct hashtab *mkopttab;
static struct nvlist **nextopt;
@@ -530,9 +528,6 @@
(void)printf("Build directory is %s\n", builddir);
(void)printf("Don't forget to run \"make depend\"\n");
- close(buildconfdirfd);
- close(builddirfd);
-
return 0;
}
@@ -702,7 +697,6 @@
mksubdirs(&allfiles);
mksubdirs(&allofiles);
- buildconfdir = "conf";
return 0;
}
@@ -720,9 +714,6 @@
p = buf;
- if ((buildconfdirfd = open(buildconfdir, O_RDONLY)) == -1)
- errx(EXIT_FAILURE, "cannot opens %s", buildconfdir);
-
snprintf(buf, sizeof(buf), "%s/arch/%s/include", srcdir, machine);
ret = recreate(p, "machine");
ret = recreate(p, machine);
@@ -1498,8 +1489,6 @@
errx(EXIT_FAILURE, "cannot create %s", builddir);
} else if (!S_ISDIR(st.st_mode))
errx(EXIT_FAILURE, "%s is not a directory", builddir);
- if ((builddirfd = open(builddir, O_RDONLY)) == -1)
- errx(EXIT_FAILURE, "cannot opens %s", builddir);
if (chdir(builddir) == -1)
err(EXIT_FAILURE, "cannot change to %s", builddir);
if (stat(srcdir, &st) == -1)
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/mkdevsw.c
--- a/usr.bin/config/mkdevsw.c Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/mkdevsw.c Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdevsw.c,v 1.13 2015/09/02 05:09:25 uebayasi Exp $ */
+/* $NetBSD: mkdevsw.c,v 1.14 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkdevsw.c,v 1.13 2015/09/02 05:09:25 uebayasi Exp $");
+__RCSID("$NetBSD: mkdevsw.c,v 1.14 2015/09/03 13:53:36 uebayasi Exp $");
#include <stdio.h>
#include <string.h>
@@ -53,10 +53,9 @@
{
FILE *fp;
- fchdir(buildconfdirfd);
if ((fp = fopen("devsw.c.tmp", "w")) == NULL) {
warn("cannot create devsw.c");
- goto err;
+ return (1);
}
emitheader(fp);
@@ -68,21 +67,17 @@
if (ferror(fp)) {
warn("error writing devsw.c");
fclose(fp);
- goto err;
+ return 1;
}
(void)fclose(fp);
if (moveifchanged("devsw.c.tmp", "devsw.c") != 0) {
warn("error renaming devsw.c");
- goto err;
+ return (1);
}
- fchdir(builddirfd);
+
return (0);
-
-err:
- fchdir(builddirfd);
- return (1);
}
static void
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/mkheaders.c
--- a/usr.bin/config/mkheaders.c Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/mkheaders.c Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkheaders.c,v 1.28 2015/09/02 05:09:25 uebayasi Exp $ */
+/* $NetBSD: mkheaders.c,v 1.29 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkheaders.c,v 1.28 2015/09/02 05:09:25 uebayasi Exp $");
+__RCSID("$NetBSD: mkheaders.c,v 1.29 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -392,7 +392,6 @@
struct devi *i;
tfname = "tmp_ioconf.h";
- fchdir(buildconfdirfd);
if ((tfp = fopen(tfname, "w")) == NULL)
return (herr("open", tfname, NULL));
@@ -416,11 +415,7 @@
if (fclose(tfp) == EOF)
return (herr("clos", tfname, NULL));
- if (moveifchanged(tfname, "ioconf.h") != 0)
- return (herr("mvif", tfname, NULL));
-
- fchdir(builddirfd);
- return 0;
+ return (moveifchanged(tfname, "ioconf.h"));
}
/*
@@ -533,7 +528,6 @@
warn("error %sing %s", what, fname);
if (fp)
(void)fclose(fp);
- fchdir(builddirfd);
return (1);
}
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/mkioconf.c
--- a/usr.bin/config/mkioconf.c Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/mkioconf.c Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkioconf.c,v 1.31 2015/09/02 05:09:25 uebayasi Exp $ */
+/* $NetBSD: mkioconf.c,v 1.32 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkioconf.c,v 1.31 2015/09/02 05:09:25 uebayasi Exp $");
+__RCSID("$NetBSD: mkioconf.c,v 1.32 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <err.h>
@@ -87,10 +87,9 @@
FILE *fp;
qsort(packed, npacked, sizeof *packed, cforder);
- fchdir(buildconfdirfd);
if ((fp = fopen("ioconf.c.tmp", "w")) == NULL) {
warn("cannot write ioconf.c");
- goto err;
+ return (1);
}
fprintf(fp, "#include \"ioconf.h\"\n");
@@ -117,20 +116,15 @@
#if 0
(void)unlink("ioconf.c.tmp");
#endif
- goto err;
+ return (1);
}
(void)fclose(fp);
if (moveifchanged("ioconf.c.tmp", "ioconf.c") != 0) {
warn("error renaming ioconf.c");
- goto err;
+ return (1);
}
- fchdir(builddirfd);
return (0);
-
-err:
- fchdir(builddirfd);
- return (1);
}
static int
diff -r 28ee9c67e2a3 -r 9fec29f8dbbf usr.bin/config/mkswap.c
--- a/usr.bin/config/mkswap.c Thu Sep 03 13:32:07 2015 +0000
+++ b/usr.bin/config/mkswap.c Thu Sep 03 13:53:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkswap.c,v 1.9 2015/09/02 05:09:25 uebayasi Exp $ */
+/* $NetBSD: mkswap.c,v 1.10 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkswap.c,v 1.9 2015/09/02 05:09:25 uebayasi Exp $");
+__RCSID("$NetBSD: mkswap.c,v 1.10 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <errno.h>
@@ -97,10 +97,9 @@
(void)snprintf(fname, sizeof(fname), "swap%s.c", cf->cf_name);
(void)snprintf(tname, sizeof(tname), "swap%s.c.tmp", cf->cf_name);
- fchdir(buildconfdirfd);
if ((fp = fopen(tname, "w")) == NULL) {
warn("cannot open %s", fname);
- goto err;
Home |
Main Index |
Thread Index |
Old Index