Merge from head

This commit is contained in:
Baptiste Daroussin
2015-06-15 10:56:01 +00:00
2719 changed files with 74707 additions and 8031 deletions
+19 -2
View File
@@ -99,6 +99,11 @@
# #
# For more information, see the build(7) manual page. # For more information, see the build(7) manual page.
# #
.if ${MK_META_MODE:Uno} == "yes"
# targets/Makefile plays the role of top-level
.include "targets/Makefile"
.else
TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
check-old check-old-dirs check-old-files check-old-libs \ check-old check-old-dirs check-old-files check-old-libs \
checkdpadd clean cleandepend cleandir \ checkdpadd clean cleandepend cleandir \
@@ -517,10 +522,22 @@ universe_epilogue:
buildLINT: buildLINT:
${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
.if defined(.PARSEDIR) # This makefile does not run in meta mode
.MAKE.MODE= normal
# Normally the things we run from here don't either.
# Using -DWITH_META_FILES
# we can buildworld with meta files created which are useful
# for debugging, but without any of the rest of a meta mode build.
MK_META_MODE= no
MK_STAGING= no
# tell meta.autodep.mk to not even think about updating anything.
UPDATE_DEPENDFILE= NO
.export MK_META_MODE MK_STAGING UPDATE_DEPENDFILE
.if make(universe) .if make(universe)
# we do not want a failure of one branch abort all. # we do not want a failure of one branch abort all.
MAKE_JOB_ERROR_TOKEN= no MAKE_JOB_ERROR_TOKEN= no
.export MAKE_JOB_ERROR_TOKEN .export MAKE_JOB_ERROR_TOKEN
.endif .endif
.endif
.endif # META_MODE
+15 -4
View File
@@ -1400,8 +1400,8 @@ _sed= usr.bin/sed
.endif .endif
.if ${BOOTSTRAPPING} < 1000002 .if ${BOOTSTRAPPING} < 1000002
_m4= lib/libohash \ _libohash= lib/libohash
usr.bin/m4 _m4= usr.bin/m4
${_bt}-usr.bin/m4: ${_bt}-lib/libohash ${_bt}-usr.bin/m4: ${_bt}-lib/libohash
.endif .endif
@@ -1487,6 +1487,15 @@ _kerberos5_bootstrap_tools= \
.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
.endif .endif
.if ${MK_MANDOCDB} != "no"
_libohash?= lib/libohash
_makewhatis= lib/libsqlite3 \
usr.bin/mandoc
${_bt}-usr.bin/mandoc: ${_bt}-lib/libohash ${_bt}-lib/libsqlite3
.else
_makewhatis=usr.bin/makewhatis
.endif
# Rebuild up-to-date libmd for xinstall # Rebuild up-to-date libmd for xinstall
${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd ${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd
@@ -1507,7 +1516,8 @@ bootstrap-tools: .PHONY
${_awk} \ ${_awk} \
${_cat} \ ${_cat} \
usr.bin/lorder \ usr.bin/lorder \
usr.bin/makewhatis \ ${_libohash} \
${_makewhatis} \
usr.bin/rpcgen \ usr.bin/rpcgen \
${_sed} \ ${_sed} \
${_yacc} \ ${_yacc} \
@@ -1930,9 +1940,10 @@ kerberos5/lib/libroken__L: lib/libcrypt__L
kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
kerberos5/lib/libheimbase__L: lib/libthr__L kerberos5/lib/libheimbase__L: lib/libthr__L
kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
lib/libsqlite3__L: lib/libthr__L
.endif .endif
lib/libsqlite3__L: lib/libthr__L
.if ${MK_GSSAPI} != "no" .if ${MK_GSSAPI} != "no"
_lib_libgssapi= lib/libgssapi _lib_libgssapi= lib/libgssapi
.endif .endif
+4
View File
@@ -38,6 +38,10 @@
# xargs -n1 | sort | uniq -d; # xargs -n1 | sort | uniq -d;
# done # done
# 20150528: PCI IOV device driver methods moved to a separate kobj interface.
OLD_FILES+=usr/share/man/man9/PCI_ADD_VF.9
OLD_FILES+=usr/share/man/man9/PCI_INIT_IOV.9
OLD_FILES+=usr/share/man/man9/PCI_UNINIT_IOV.9
# 20150525: new clang import which bumps version from 3.6.0 to 3.6.1. # 20150525: new clang import which bumps version from 3.6.0 to 3.6.1.
OLD_FILES+=usr/lib/clang/3.6.0/include/__stddef_max_align_t.h OLD_FILES+=usr/lib/clang/3.6.0/include/__stddef_max_align_t.h
OLD_FILES+=usr/lib/clang/3.6.0/include/__wmmintrin_aes.h OLD_FILES+=usr/lib/clang/3.6.0/include/__wmmintrin_aes.h
+39
View File
@@ -31,6 +31,45 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".) "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20150614:
ALLOW_DEPRECATED_ATF_TOOLS/ATFFILE support has been removed from
atf.test.mk (included from bsd.test.mk). Please upgrade devel/atf
and devel/kyua to version 0.20+ and adjust any calling code to work
with Kyuafile and kyua.
20150614:
The import of openssl to address the FreeBSD-SA-15:10.openssl
security advisory includes a change which rejects handshakes
with DH parameters below 768 bits. sendmail releases prior
to 8.15.2 (not yet released), defaulted to a 512 bit
DH parameter setting for client connections. To work around
this interoperability, sendmail can be configured to use a
2048 bit DH parameter by:
1. Edit /etc/mail/`hostname`.mc
2. If a setting for confDH_PARAMETERS does not exist or
exists and is set to a string beginning with '5',
replace it with '2'.
3. If a setting for confDH_PARAMETERS exists and is set to
a file path, create a new file with:
openssl dhparam -out /path/to/file 2048
4. Rebuild the .cf file:
cd /etc/mail/; make; make install
5. Restart sendmail:
cd /etc/mail/; make restart
A sendmail patch is coming, at which time this file will be
updated.
20150604:
Generation of legacy formatted entries have been disabled by default
in pwd_mkdb(8), as all base system consumers of the legacy formatted
entries were converted to use the new format by default when the new,
machine independent format have been added and supported since FreeBSD
5.x.
Please see the pwd_mkdb(8) manual page for further details.
20150525: 20150525:
Clang and llvm have been upgraded to 3.6.1 release. Please see the Clang and llvm have been upgraded to 3.6.1 release. Please see the
20141231 entry below for information about prerequisites and upgrading, 20141231 entry below for information about prerequisites and upgrading,
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+4 -2
View File
@@ -162,14 +162,16 @@ done: argv += optind;
atflag = AT_SYMLINK_NOFOLLOW; atflag = AT_SYMLINK_NOFOLLOW;
switch (p->fts_info) { switch (p->fts_info) {
case FTS_D: /* Change it at FTS_DP. */ case FTS_D:
if (!Rflag) if (!Rflag)
fts_set(ftsp, p, FTS_SKIP); fts_set(ftsp, p, FTS_SKIP);
continue; break;
case FTS_DNR: /* Warn, chmod. */ case FTS_DNR: /* Warn, chmod. */
warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
rval = 1; rval = 1;
break; break;
case FTS_DP: /* Already changed at FTS_D. */
continue;
case FTS_ERR: /* Warn, continue. */ case FTS_ERR: /* Warn, continue. */
case FTS_NS: case FTS_NS:
warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+9 -4
View File
@@ -32,7 +32,7 @@
.\" @(#)cp.1 8.3 (Berkeley) 4/18/94 .\" @(#)cp.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd March 15, 2013 .Dd June 6, 2015
.Dt CP 1 .Dt CP 1
.Os .Os
.Sh NAME .Sh NAME
@@ -45,7 +45,7 @@
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl f | i | n .Op Fl f | i | n
.Op Fl alpvx .Op Fl alpsvx
.Ar source_file target_file .Ar source_file target_file
.Nm .Nm
.Oo .Oo
@@ -53,7 +53,7 @@
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl f | i | n .Op Fl f | i | n
.Op Fl alpvx .Op Fl alpsvx
.Ar source_file ... target_directory .Ar source_file ... target_directory
.Sh DESCRIPTION .Sh DESCRIPTION
In the first synopsis form, the In the first synopsis form, the
@@ -179,6 +179,8 @@ If the source file has both its set-user-ID and set-group-ID bits on,
and either the user ID or group ID cannot be preserved, neither and either the user ID or group ID cannot be preserved, neither
the set-user-ID nor set-group-ID bits are preserved in the copy's the set-user-ID nor set-group-ID bits are preserved in the copy's
permissions. permissions.
.It Fl s
Create symbolic links to regular files in a hierarchy instead of copying.
.It Fl v .It Fl v
Cause Cause
.Nm .Nm
@@ -298,7 +300,10 @@ differ as they copy special files as normal
files while recreating a hierarchy. files while recreating a hierarchy.
.Pp .Pp
The The
.Fl v .Fl l,
.Fl s,
.Fl v,
.Fl x
and and
.Fl n .Fl n
options are non-standard and their use in scripts is not recommended. options are non-standard and their use in scripts is not recommended.
+23 -17
View File
@@ -75,15 +75,15 @@ __FBSDID("$FreeBSD$");
#include "extern.h" #include "extern.h"
#define STRIP_TRAILING_SLASH(p) { \ #define STRIP_TRAILING_SLASH(p) { \
while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \ while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \
*--(p).p_end = 0; \ *--(p).p_end = 0; \
} }
static char emptystring[] = ""; static char emptystring[] = "";
PATH_T to = { to.p_path, emptystring, "" }; PATH_T to = { to.p_path, emptystring, "" };
int fflag, iflag, lflag, nflag, pflag, vflag; int fflag, iflag, lflag, nflag, pflag, sflag, vflag;
static int Rflag, rflag; static int Rflag, rflag;
volatile sig_atomic_t info; volatile sig_atomic_t info;
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
fts_options = FTS_NOCHDIR | FTS_PHYSICAL; fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
Hflag = Lflag = 0; Hflag = Lflag = 0;
while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1) while ((ch = getopt(argc, argv, "HLPRafilnprsvx")) != -1)
switch (ch) { switch (ch) {
case 'H': case 'H':
Hflag = 1; Hflag = 1;
@@ -145,6 +145,9 @@ main(int argc, char *argv[])
rflag = Lflag = 1; rflag = Lflag = 1;
Hflag = 0; Hflag = 0;
break; break;
case 's':
sflag = 1;
break;
case 'v': case 'v':
vflag = 1; vflag = 1;
break; break;
@@ -163,6 +166,8 @@ main(int argc, char *argv[])
if (Rflag && rflag) if (Rflag && rflag)
errx(1, "the -R and -r options may not be specified together"); errx(1, "the -R and -r options may not be specified together");
if (lflag && sflag)
errx(1, "the -l and -s options may not be specified together");
if (rflag) if (rflag)
Rflag = 1; Rflag = 1;
if (Rflag) { if (Rflag) {
@@ -183,7 +188,7 @@ main(int argc, char *argv[])
if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path)) if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
errx(1, "%s: name too long", target); errx(1, "%s: name too long", target);
to.p_end = to.p_path + strlen(to.p_path); to.p_end = to.p_path + strlen(to.p_path);
if (to.p_path == to.p_end) { if (to.p_path == to.p_end) {
*to.p_end++ = '.'; *to.p_end++ = '.';
*to.p_end = 0; *to.p_end = 0;
} }
@@ -240,10 +245,10 @@ main(int argc, char *argv[])
type = FILE_TO_FILE; type = FILE_TO_FILE;
if (have_trailing_slash && type == FILE_TO_FILE) { if (have_trailing_slash && type == FILE_TO_FILE) {
if (r == -1) if (r == -1) {
errx(1, "directory %s does not exist", errx(1, "directory %s does not exist",
to.p_path); to.p_path);
else } else
errx(1, "%s is not a directory", to.p_path); errx(1, "%s is not a directory", to.p_path);
} }
} else } else
@@ -294,8 +299,8 @@ copy(char *argv[], enum op type, int fts_options)
/* /*
* If we are in case (2) or (3) above, we need to append the * If we are in case (2) or (3) above, we need to append the
* source name to the target name. * source name to the target name.
*/ */
if (type != FILE_TO_FILE) { if (type != FILE_TO_FILE) {
/* /*
* Need to remember the roots of traversals to create * Need to remember the roots of traversals to create
@@ -374,7 +379,8 @@ copy(char *argv[], enum op type, int fts_options)
mode = curr->fts_statp->st_mode; mode = curr->fts_statp->st_mode;
if ((mode & (S_ISUID | S_ISGID | S_ISTXT)) || if ((mode & (S_ISUID | S_ISGID | S_ISTXT)) ||
((mode | S_IRWXU) & mask) != (mode & mask)) ((mode | S_IRWXU) & mask) != (mode & mask))
if (chmod(to.p_path, mode & mask) != 0){ if (chmod(to.p_path, mode & mask) !=
0) {
warn("chmod: %s", to.p_path); warn("chmod: %s", to.p_path);
rval = 1; rval = 1;
} }
@@ -382,7 +388,7 @@ copy(char *argv[], enum op type, int fts_options)
continue; continue;
} }
/* Not an error but need to remember it happened */ /* Not an error but need to remember it happened. */
if (stat(to.p_path, &to_stat) == -1) if (stat(to.p_path, &to_stat) == -1)
dne = 1; dne = 1;
else { else {
@@ -408,7 +414,7 @@ copy(char *argv[], enum op type, int fts_options)
switch (curr->fts_statp->st_mode & S_IFMT) { switch (curr->fts_statp->st_mode & S_IFMT) {
case S_IFLNK: case S_IFLNK:
/* Catch special case of a non-dangling symlink */ /* Catch special case of a non-dangling symlink. */
if ((fts_options & FTS_LOGICAL) || if ((fts_options & FTS_LOGICAL) ||
((fts_options & FTS_COMFOLLOW) && ((fts_options & FTS_COMFOLLOW) &&
curr->fts_level == 0)) { curr->fts_level == 0)) {
@@ -433,7 +439,7 @@ copy(char *argv[], enum op type, int fts_options)
* modified by the umask. Trade-off between being * modified by the umask. Trade-off between being
* able to write the directory (if from directory is * able to write the directory (if from directory is
* 555) and not causing a permissions race. If the * 555) and not causing a permissions race. If the
* umask blocks owner writes, we fail.. * umask blocks owner writes, we fail.
*/ */
if (dne) { if (dne) {
if (mkdir(to.p_path, if (mkdir(to.p_path,
@@ -452,7 +458,7 @@ copy(char *argv[], enum op type, int fts_options)
break; break;
case S_IFBLK: case S_IFBLK:
case S_IFCHR: case S_IFCHR:
if (Rflag) { if (Rflag && !sflag) {
if (copy_special(curr->fts_statp, !dne)) if (copy_special(curr->fts_statp, !dne))
badcp = rval = 1; badcp = rval = 1;
} else { } else {
@@ -462,10 +468,10 @@ copy(char *argv[], enum op type, int fts_options)
break; break;
case S_IFSOCK: case S_IFSOCK:
warnx("%s is a socket (not copied).", warnx("%s is a socket (not copied).",
curr->fts_path); curr->fts_path);
break; break;
case S_IFIFO: case S_IFIFO:
if (Rflag) { if (Rflag && !sflag) {
if (copy_fifo(curr->fts_statp, !dne)) if (copy_fifo(curr->fts_statp, !dne))
badcp = rval = 1; badcp = rval = 1;
} else { } else {
+1 -1
View File
@@ -37,7 +37,7 @@ typedef struct {
} PATH_T; } PATH_T;
extern PATH_T to; extern PATH_T to;
extern int fflag, iflag, lflag, nflag, pflag, vflag; extern int fflag, iflag, lflag, nflag, pflag, sflag, vflag;
extern volatile sig_atomic_t info; extern volatile sig_atomic_t info;
__BEGIN_DECLS __BEGIN_DECLS
+65 -49
View File
@@ -57,15 +57,19 @@ __FBSDID("$FreeBSD$");
#define cp_pct(x, y) ((y == 0) ? 0 : (int)(100.0 * (x) / (y))) #define cp_pct(x, y) ((y == 0) ? 0 : (int)(100.0 * (x) / (y)))
/* Memory strategy threshold, in pages: if physmem is larger then this, use a /*
* large buffer */ * Memory strategy threshold, in pages: if physmem is larger then this, use a
* large buffer.
*/
#define PHYSPAGES_THRESHOLD (32*1024) #define PHYSPAGES_THRESHOLD (32*1024)
/* Maximum buffer size in bytes - do not allow it to grow larger than this */ /* Maximum buffer size in bytes - do not allow it to grow larger than this. */
#define BUFSIZE_MAX (2*1024*1024) #define BUFSIZE_MAX (2*1024*1024)
/* Small (default) buffer size in bytes. It's inefficient for this to be /*
* smaller than MAXPHYS */ * Small (default) buffer size in bytes. It's inefficient for this to be
* smaller than MAXPHYS.
*/
#define BUFSIZE_SMALL (MAXPHYS) #define BUFSIZE_SMALL (MAXPHYS)
int int
@@ -77,13 +81,15 @@ copy_file(const FTSENT *entp, int dne)
ssize_t wcount; ssize_t wcount;
size_t wresid; size_t wresid;
off_t wtotal; off_t wtotal;
int ch, checkch, from_fd = 0, rcount, rval, to_fd = 0; int ch, checkch, from_fd, rcount, rval, to_fd;
char *bufp; char *bufp;
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
char *p; char *p;
#endif #endif
if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) { from_fd = to_fd = -1;
if (!lflag && !sflag &&
(from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {
warn("%s", entp->fts_path); warn("%s", entp->fts_path);
return (1); return (1);
} }
@@ -103,63 +109,65 @@ copy_file(const FTSENT *entp, int dne)
if (nflag) { if (nflag) {
if (vflag) if (vflag)
printf("%s not overwritten\n", to.p_path); printf("%s not overwritten\n", to.p_path);
(void)close(from_fd); rval = 1;
return (1); goto done;
} else if (iflag) { } else if (iflag) {
(void)fprintf(stderr, "overwrite %s? %s", (void)fprintf(stderr, "overwrite %s? %s",
to.p_path, YESNO); to.p_path, YESNO);
checkch = ch = getchar(); checkch = ch = getchar();
while (ch != '\n' && ch != EOF) while (ch != '\n' && ch != EOF)
ch = getchar(); ch = getchar();
if (checkch != 'y' && checkch != 'Y') { if (checkch != 'y' && checkch != 'Y') {
(void)close(from_fd);
(void)fprintf(stderr, "not overwritten\n"); (void)fprintf(stderr, "not overwritten\n");
return (1); rval = 1;
goto done;
} }
} }
if (fflag) { if (fflag) {
/* remove existing destination file name, /*
* create a new file */ * Remove existing destination file name create a new
(void)unlink(to.p_path); * file.
if (!lflag) */
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, (void)unlink(to.p_path);
fs->st_mode & ~(S_ISUID | S_ISGID)); if (!lflag && !sflag) {
} else { to_fd = open(to.p_path,
if (!lflag) O_WRONLY | O_TRUNC | O_CREAT,
/* overwrite existing destination file name */ fs->st_mode & ~(S_ISUID | S_ISGID));
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); }
} else if (!lflag && !sflag) {
/* Overwrite existing destination file name. */
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
} }
} else { } else if (!lflag && !sflag) {
if (!lflag) to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, fs->st_mode & ~(S_ISUID | S_ISGID));
fs->st_mode & ~(S_ISUID | S_ISGID));
} }
if (to_fd == -1) { if (!lflag && !sflag && to_fd == -1) {
warn("%s", to.p_path); warn("%s", to.p_path);
(void)close(from_fd); rval = 1;
return (1); goto done;
} }
rval = 0; rval = 0;
if (!lflag) { if (!lflag && !sflag) {
/* /*
* Mmap and write if less than 8M (the limit is so we don't totally * Mmap and write if less than 8M (the limit is so we don't
* trash memory on big files. This is really a minor hack, but it * totally trash memory on big files. This is really a minor
* wins some CPU back. * hack, but it wins some CPU back.
* Some filesystems, such as smbnetfs, don't support mmap, * Some filesystems, such as smbnetfs, don't support mmap,
* so this is a best-effort attempt. * so this is a best-effort attempt.
*/ */
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
if (S_ISREG(fs->st_mode) && fs->st_size > 0 && if (S_ISREG(fs->st_mode) && fs->st_size > 0 &&
fs->st_size <= 8 * 1024 * 1024 && fs->st_size <= 8 * 1024 * 1024 &&
(p = mmap(NULL, (size_t)fs->st_size, PROT_READ, (p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
MAP_SHARED, from_fd, (off_t)0)) != MAP_FAILED) { MAP_SHARED, from_fd, (off_t)0)) != MAP_FAILED) {
wtotal = 0; wtotal = 0;
for (bufp = p, wresid = fs->st_size; ; for (bufp = p, wresid = fs->st_size; ;
bufp += wcount, wresid -= (size_t)wcount) { bufp += wcount, wresid -= (size_t)wcount) {
wcount = write(to_fd, bufp, wresid); wcount = write(to_fd, bufp, wresid);
if (wcount <= 0) if (wcount <= 0)
break; break;
@@ -204,7 +212,7 @@ copy_file(const FTSENT *entp, int dne)
wtotal = 0; wtotal = 0;
while ((rcount = read(from_fd, buf, bufsize)) > 0) { while ((rcount = read(from_fd, buf, bufsize)) > 0) {
for (bufp = buf, wresid = rcount; ; for (bufp = buf, wresid = rcount; ;
bufp += wcount, wresid -= wcount) { bufp += wcount, wresid -= wcount) {
wcount = write(to_fd, bufp, wresid); wcount = write(to_fd, bufp, wresid);
if (wcount <= 0) if (wcount <= 0)
break; break;
@@ -230,13 +238,18 @@ copy_file(const FTSENT *entp, int dne)
rval = 1; rval = 1;
} }
} }
} else { } else if (lflag) {
if (link(entp->fts_path, to.p_path)) { if (link(entp->fts_path, to.p_path)) {
warn("%s", to.p_path); warn("%s", to.p_path);
rval = 1; rval = 1;
} }
} else if (sflag) {
if (symlink(entp->fts_path, to.p_path)) {
warn("%s", to.p_path);
rval = 1;
}
} }
/* /*
* Don't remove the target even after an error. The target might * Don't remove the target even after an error. The target might
* not be a regular file, or its attributes might be important, * not be a regular file, or its attributes might be important,
@@ -244,7 +257,7 @@ copy_file(const FTSENT *entp, int dne)
* to remove it if we created it and its length is 0. * to remove it if we created it and its length is 0.
*/ */
if (!lflag) { if (!lflag && !sflag) {
if (pflag && setfile(fs, to_fd)) if (pflag && setfile(fs, to_fd))
rval = 1; rval = 1;
if (pflag && preserve_fd_acls(from_fd, to_fd) != 0) if (pflag && preserve_fd_acls(from_fd, to_fd) != 0)
@@ -255,8 +268,9 @@ copy_file(const FTSENT *entp, int dne)
} }
} }
(void)close(from_fd); done:
if (from_fd != -1)
(void)close(from_fd);
return (rval); return (rval);
} }
@@ -338,7 +352,7 @@ setfile(struct stat *fs, int fd)
fdval = fd != -1; fdval = fd != -1;
islink = !fdval && S_ISLNK(fs->st_mode); islink = !fdval && S_ISLNK(fs->st_mode);
fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX | fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX |
S_IRWXU | S_IRWXG | S_IRWXO; S_IRWXU | S_IRWXG | S_IRWXO;
tspec[0] = fs->st_atim; tspec[0] = fs->st_atim;
tspec[1] = fs->st_mtim; tspec[1] = fs->st_mtim;
@@ -353,7 +367,7 @@ setfile(struct stat *fs, int fd)
else { else {
gotstat = 1; gotstat = 1;
ts.st_mode &= S_ISUID | S_ISGID | S_ISVTX | ts.st_mode &= S_ISUID | S_ISGID | S_ISVTX |
S_IRWXU | S_IRWXG | S_IRWXO; S_IRWXU | S_IRWXG | S_IRWXO;
} }
/* /*
* Changing the ownership probably won't succeed, unless we're root * Changing the ownership probably won't succeed, unless we're root
@@ -477,7 +491,7 @@ preserve_dir_acls(struct stat *fs, char *source_dir, char *dest_dir)
return (0); return (0);
/* /*
* If the file is a link we will not follow it * If the file is a link we will not follow it.
*/ */
if (S_ISLNK(fs->st_mode)) { if (S_ISLNK(fs->st_mode)) {
aclgetf = acl_get_link_np; aclgetf = acl_get_link_np;
@@ -536,8 +550,10 @@ usage(void)
{ {
(void)fprintf(stderr, "%s\n%s\n", (void)fprintf(stderr, "%s\n%s\n",
"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file", "usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpsvx] "
" cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... " "source_file target_file",
"target_directory"); " cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpsvx] "
"source_file ... "
"target_directory");
exit(EX_USAGE); exit(EX_USAGE);
} }
+243
View File
@@ -0,0 +1,243 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/arpa \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libcrypt \
lib/ncurses/ncursesw \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
ed.chared.o: ed.defns.h
ed.chared.o: sh.err.h
ed.chared.o: tc.const.h
ed.chared.po: ed.defns.h
ed.chared.po: sh.err.h
ed.chared.po: tc.const.h
ed.defns.o: sh.err.h
ed.defns.o: tc.const.h
ed.defns.po: sh.err.h
ed.defns.po: tc.const.h
ed.init.o: ed.defns.h
ed.init.o: sh.err.h
ed.init.o: tc.const.h
ed.init.po: ed.defns.h
ed.init.po: sh.err.h
ed.init.po: tc.const.h
ed.inputl.o: ed.defns.h
ed.inputl.o: sh.err.h
ed.inputl.o: tc.const.h
ed.inputl.po: ed.defns.h
ed.inputl.po: sh.err.h
ed.inputl.po: tc.const.h
ed.refresh.o: sh.err.h
ed.refresh.o: tc.const.h
ed.refresh.po: sh.err.h
ed.refresh.po: tc.const.h
ed.screen.o: ed.defns.h
ed.screen.o: sh.err.h
ed.screen.o: tc.const.h
ed.screen.po: ed.defns.h
ed.screen.po: sh.err.h
ed.screen.po: tc.const.h
ed.term.o: sh.err.h
ed.term.o: tc.const.h
ed.term.po: sh.err.h
ed.term.po: tc.const.h
ed.xmap.o: ed.defns.h
ed.xmap.o: sh.err.h
ed.xmap.o: tc.const.h
ed.xmap.po: ed.defns.h
ed.xmap.po: sh.err.h
ed.xmap.po: tc.const.h
glob.o: sh.err.h
glob.o: tc.const.h
glob.po: sh.err.h
glob.po: tc.const.h
mi.termios.o: sh.err.h
mi.termios.o: tc.const.h
mi.termios.po: sh.err.h
mi.termios.po: tc.const.h
sh.char.o: sh.err.h
sh.char.o: tc.const.h
sh.char.po: sh.err.h
sh.char.po: tc.const.h
sh.dir.o: sh.err.h
sh.dir.o: tc.const.h
sh.dir.po: sh.err.h
sh.dir.po: tc.const.h
sh.dol.o: sh.err.h
sh.dol.o: tc.const.h
sh.dol.po: sh.err.h
sh.dol.po: tc.const.h
sh.err.o: sh.err.h
sh.err.o: tc.const.h
sh.err.po: sh.err.h
sh.err.po: tc.const.h
sh.exec.o: sh.err.h
sh.exec.o: tc.const.h
sh.exec.po: sh.err.h
sh.exec.po: tc.const.h
sh.exp.o: sh.err.h
sh.exp.o: tc.const.h
sh.exp.po: sh.err.h
sh.exp.po: tc.const.h
sh.file.o: sh.err.h
sh.file.o: tc.const.h
sh.file.po: sh.err.h
sh.file.po: tc.const.h
sh.func.o: sh.err.h
sh.func.o: tc.const.h
sh.func.po: sh.err.h
sh.func.po: tc.const.h
sh.glob.o: sh.err.h
sh.glob.o: tc.const.h
sh.glob.po: sh.err.h
sh.glob.po: tc.const.h
sh.hist.o: sh.err.h
sh.hist.o: tc.const.h
sh.hist.po: sh.err.h
sh.hist.po: tc.const.h
sh.init.o: sh.err.h
sh.init.o: tc.const.h
sh.init.po: sh.err.h
sh.init.po: tc.const.h
sh.lex.o: sh.err.h
sh.lex.o: tc.const.h
sh.lex.po: sh.err.h
sh.lex.po: tc.const.h
sh.misc.o: sh.err.h
sh.misc.o: tc.const.h
sh.misc.po: sh.err.h
sh.misc.po: tc.const.h
sh.o: sh.err.h
sh.o: tc.const.h
sh.parse.o: sh.err.h
sh.parse.o: tc.const.h
sh.parse.po: sh.err.h
sh.parse.po: tc.const.h
sh.po: sh.err.h
sh.po: tc.const.h
sh.print.o: sh.err.h
sh.print.o: tc.const.h
sh.print.po: sh.err.h
sh.print.po: tc.const.h
sh.proc.o: sh.err.h
sh.proc.o: tc.const.h
sh.proc.po: sh.err.h
sh.proc.po: tc.const.h
sh.sem.o: sh.err.h
sh.sem.o: tc.const.h
sh.sem.po: sh.err.h
sh.sem.po: tc.const.h
sh.set.o: sh.err.h
sh.set.o: tc.const.h
sh.set.po: sh.err.h
sh.set.po: tc.const.h
sh.time.o: sh.err.h
sh.time.o: tc.const.h
sh.time.po: sh.err.h
sh.time.po: tc.const.h
tc.alloc.o: sh.err.h
tc.alloc.o: tc.const.h
tc.alloc.po: sh.err.h
tc.alloc.po: tc.const.h
tc.bind.o: ed.defns.h
tc.bind.o: sh.err.h
tc.bind.o: tc.const.h
tc.bind.po: ed.defns.h
tc.bind.po: sh.err.h
tc.bind.po: tc.const.h
tc.const.o: sh.err.h
tc.const.o: tc.const.h
tc.const.po: sh.err.h
tc.const.po: tc.const.h
tc.defs.o: sh.err.h
tc.defs.o: tc.const.h
tc.defs.o: tc.defs.c
tc.defs.po: sh.err.h
tc.defs.po: tc.const.h
tc.defs.po: tc.defs.c
tc.disc.o: sh.err.h
tc.disc.o: tc.const.h
tc.disc.po: sh.err.h
tc.disc.po: tc.const.h
tc.func.o: ed.defns.h
tc.func.o: sh.err.h
tc.func.o: tc.const.h
tc.func.po: ed.defns.h
tc.func.po: sh.err.h
tc.func.po: tc.const.h
tc.nls.o: sh.err.h
tc.nls.o: tc.const.h
tc.nls.po: sh.err.h
tc.nls.po: tc.const.h
tc.os.o: ed.defns.h
tc.os.o: sh.err.h
tc.os.o: tc.const.h
tc.os.po: ed.defns.h
tc.os.po: sh.err.h
tc.os.po: tc.const.h
tc.printf.o: sh.err.h
tc.printf.o: tc.const.h
tc.printf.po: sh.err.h
tc.printf.po: tc.const.h
tc.prompt.o: sh.err.h
tc.prompt.o: tc.const.h
tc.prompt.po: sh.err.h
tc.prompt.po: tc.const.h
tc.sched.o: sh.err.h
tc.sched.o: tc.const.h
tc.sched.po: sh.err.h
tc.sched.po: tc.const.h
tc.sig.o: sh.err.h
tc.sig.o: tc.const.h
tc.sig.po: sh.err.h
tc.sig.po: tc.const.h
tc.str.o: sh.err.h
tc.str.o: tc.const.h
tc.str.po: sh.err.h
tc.str.po: tc.const.h
tc.vers.o: sh.err.h
tc.vers.o: tc.const.h
tc.vers.po: sh.err.h
tc.vers.po: tc.const.h
tc.who.o: sh.err.h
tc.who.o: tc.const.h
tc.who.po: sh.err.h
tc.who.po: tc.const.h
tw.color.o: sh.err.h
tw.color.o: tc.const.h
tw.color.po: sh.err.h
tw.color.po: tc.const.h
tw.comp.o: sh.err.h
tw.comp.o: tc.const.h
tw.comp.po: sh.err.h
tw.comp.po: tc.const.h
tw.help.o: sh.err.h
tw.help.o: tc.const.h
tw.help.po: sh.err.h
tw.help.po: tc.const.h
tw.init.o: sh.err.h
tw.init.o: tc.const.h
tw.init.po: sh.err.h
tw.init.po: tc.const.h
tw.parse.o: sh.err.h
tw.parse.o: tc.const.h
tw.parse.po: sh.err.h
tw.parse.po: tc.const.h
tw.spell.o: sh.err.h
tw.spell.o: tc.const.h
tw.spell.po: sh.err.h
tw.spell.po: tc.const.h
.endif
+19
View File
@@ -0,0 +1,19 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/protocols \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+20
View File
@@ -0,0 +1,20 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libutil \
lib/libxo \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+19
View File
@@ -0,0 +1,19 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
secure/lib/libcrypto \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+21
View File
@@ -0,0 +1,21 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
usr.bin/yacc.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
expr.o: expr.c
expr.po: expr.c
.endif
+11
View File
@@ -0,0 +1,11 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+1 -1
View File
@@ -10,7 +10,7 @@ LIBADD= util
.if !defined(RELEASE_CRUNCH) && \ .if !defined(RELEASE_CRUNCH) && \
${MK_LS_COLORS} != no ${MK_LS_COLORS} != no
CFLAGS+= -DCOLORLS CFLAGS+= -DCOLORLS
LIBADD+= termcapw LIBADD+= termcapw xo
.endif .endif
.include <bsd.prog.mk> .include <bsd.prog.mk>
+20
View File
@@ -0,0 +1,20 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libutil \
lib/ncurses/ncursesw \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+7 -4
View File
@@ -45,14 +45,17 @@ int revsizecmp(const FTSENT *, const FTSENT *);
void printcol(const DISPLAY *); void printcol(const DISPLAY *);
void printlong(const DISPLAY *); void printlong(const DISPLAY *);
int printname(const char *); int printname(const char *, const char *);
void printscol(const DISPLAY *); void printscol(const DISPLAY *);
void printstream(const DISPLAY *); void printstream(const DISPLAY *);
void usage(void); void usage(void);
int prn_normal(const char *); int prn_normal(const char *, const char *);
char * getname(const char *);
size_t len_octal(const char *, int); size_t len_octal(const char *, int);
int prn_octal(const char *); int prn_octal(const char *, const char *);
int prn_printable(const char *); char * get_octal(const char *);
int prn_printable(const char *, const char *);
char * get_printable(const char *);
#ifdef COLORLS #ifdef COLORLS
void parsecolors(const char *cs); void parsecolors(const char *cs);
void colorquit(int); void colorquit(int);
+4 -1
View File
@@ -32,7 +32,7 @@
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd April 4, 2014 .Dd June 8, 2015
.Dt LS 1 .Dt LS 1
.Os .Os
.Sh NAME .Sh NAME
@@ -40,6 +40,7 @@
.Nd list directory contents .Nd list directory contents
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl -libxo
.Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1, .Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,
.Op Fl D Ar format .Op Fl D Ar format
.Op Ar .Op Ar
@@ -797,9 +798,11 @@ specification.
.Xr getfacl 1 , .Xr getfacl 1 ,
.Xr sort 1 , .Xr sort 1 ,
.Xr xterm 1 , .Xr xterm 1 ,
.Xr libxo 3 ,
.Xr localeconv 3 , .Xr localeconv 3 ,
.Xr strftime 3 , .Xr strftime 3 ,
.Xr strmode 3 , .Xr strmode 3 ,
.Xr xo_parse_args 3 ,
.Xr termcap 5 , .Xr termcap 5 ,
.Xr maclabel 7 , .Xr maclabel 7 ,
.Xr sticky 7 , .Xr sticky 7 ,
+44 -19
View File
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
#include <termcap.h> #include <termcap.h>
#include <signal.h> #include <signal.h>
#endif #endif
#include <libxo/xo.h>
#include "ls.h" #include "ls.h"
#include "extern.h" #include "extern.h"
@@ -185,6 +186,12 @@ main(int argc, char *argv[])
fts_options = FTS_PHYSICAL; fts_options = FTS_PHYSICAL;
if (getenv("LS_SAMESORT")) if (getenv("LS_SAMESORT"))
f_samesort = 1; f_samesort = 1;
argc = xo_parse_args(argc, argv);
if (argc < 0)
return (1);
xo_set_flags(NULL, XOF_COLUMNS);
while ((ch = getopt(argc, argv, while ((ch = getopt(argc, argv,
"1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,")) != -1) { "1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,")) != -1) {
switch (ch) { switch (ch) {
@@ -381,7 +388,7 @@ main(int argc, char *argv[])
f_color = 1; f_color = 1;
} }
#else #else
warnx("color support not compiled in"); xo_warnx("color support not compiled in");
#endif /*COLORLS*/ #endif /*COLORLS*/
#ifdef COLORLS #ifdef COLORLS
@@ -413,9 +420,14 @@ main(int argc, char *argv[])
/* /*
* If not -F, -P, -d or -l options, follow any symbolic links listed on * If not -F, -P, -d or -l options, follow any symbolic links listed on
* the command line. * the command line, unless in color mode in which case we need to
* distinguish file type for a symbolic link itself and its target.
*/ */
if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash)) if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash)
#ifdef COLORLS
&& !f_color
#endif
)
fts_options |= FTS_COMFOLLOW; fts_options |= FTS_COMFOLLOW;
/* /*
@@ -474,10 +486,13 @@ main(int argc, char *argv[])
else else
printfcn = printcol; printfcn = printcol;
xo_open_container("file-information");
if (argc) if (argc)
traverse(argc, argv, fts_options); traverse(argc, argv, fts_options);
else else
traverse(1, dotav, fts_options); traverse(1, dotav, fts_options);
xo_close_container("file-information");
xo_finish();
exit(rval); exit(rval);
} }
@@ -495,10 +510,11 @@ traverse(int argc, char *argv[], int options)
FTS *ftsp; FTS *ftsp;
FTSENT *p, *chp; FTSENT *p, *chp;
int ch_options; int ch_options;
int first = 1;
if ((ftsp = if ((ftsp =
fts_open(argv, options, f_nosort ? NULL : mastercmp)) == NULL) fts_open(argv, options, f_nosort ? NULL : mastercmp)) == NULL)
err(1, "fts_open"); xo_err(1, "fts_open");
/* /*
* We ignore errors from fts_children here since they will be * We ignore errors from fts_children here since they will be
@@ -520,11 +536,11 @@ traverse(int argc, char *argv[], int options)
while ((p = fts_read(ftsp)) != NULL) while ((p = fts_read(ftsp)) != NULL)
switch (p->fts_info) { switch (p->fts_info) {
case FTS_DC: case FTS_DC:
warnx("%s: directory causes a cycle", p->fts_name); xo_warnx("%s: directory causes a cycle", p->fts_name);
break; break;
case FTS_DNR: case FTS_DNR:
case FTS_ERR: case FTS_ERR:
warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); xo_warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
rval = 1; rval = 1;
break; break;
case FTS_D: case FTS_D:
@@ -532,31 +548,40 @@ traverse(int argc, char *argv[], int options)
p->fts_name[0] == '.' && !f_listdot) p->fts_name[0] == '.' && !f_listdot)
break; break;
if (first) {
first = 0;
xo_open_list("directory");
}
xo_open_instance("directory");
/* /*
* If already output something, put out a newline as * If already output something, put out a newline as
* a separator. If multiple arguments, precede each * a separator. If multiple arguments, precede each
* directory with its name. * directory with its name.
*/ */
if (output) { if (output) {
putchar('\n'); xo_emit("\n");
(void)printname(p->fts_path); (void)printname("path", p->fts_path);
puts(":"); xo_emit(":\n");
} else if (argc > 1) { } else if (argc > 1) {
(void)printname(p->fts_path); (void)printname("path", p->fts_path);
puts(":"); xo_emit(":\n");
output = 1; output = 1;
} }
chp = fts_children(ftsp, ch_options); chp = fts_children(ftsp, ch_options);
display(p, chp, options); display(p, chp, options);
xo_close_instance("directory");
if (!f_recursive && chp != NULL) if (!f_recursive && chp != NULL)
(void)fts_set(ftsp, p, FTS_SKIP); (void)fts_set(ftsp, p, FTS_SKIP);
break; break;
default: default:
break; break;
} }
if (!first)
xo_close_list("directory");
if (errno) if (errno)
err(1, "fts_read"); xo_err(1, "fts_read");
} }
/* /*
@@ -603,7 +628,7 @@ display(const FTSENT *p, FTSENT *list, int options)
/* Fill-in "::" as "0:0:0" for the sake of scanf. */ /* Fill-in "::" as "0:0:0" for the sake of scanf. */
jinitmax = malloc(strlen(initmax) * 2 + 2); jinitmax = malloc(strlen(initmax) * 2 + 2);
if (jinitmax == NULL) if (jinitmax == NULL)
err(1, "malloc"); xo_err(1, "malloc");
initmax2 = jinitmax; initmax2 = jinitmax;
if (*initmax == ':') if (*initmax == ':')
strcpy(initmax2, "0:"), initmax2 += 2; strcpy(initmax2, "0:"), initmax2 += 2;
@@ -674,7 +699,7 @@ display(const FTSENT *p, FTSENT *list, int options)
flags = NULL; flags = NULL;
for (cur = list, entries = 0; cur; cur = cur->fts_link) { for (cur = list, entries = 0; cur; cur = cur->fts_link) {
if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) { if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) {
warnx("%s: %s", xo_warnx("%s: %s",
cur->fts_name, strerror(cur->fts_errno)); cur->fts_name, strerror(cur->fts_errno));
cur->fts_number = NO_PRINT; cur->fts_number = NO_PRINT;
rval = 1; rval = 1;
@@ -740,7 +765,7 @@ display(const FTSENT *p, FTSENT *list, int options)
flags = strdup("-"); flags = strdup("-");
} }
if (flags == NULL) if (flags == NULL)
err(1, "fflagstostr"); xo_err(1, "fflagstostr");
flen = strlen(flags); flen = strlen(flags);
if (flen > (size_t)maxflags) if (flen > (size_t)maxflags)
maxflags = flen; maxflags = flen;
@@ -754,7 +779,7 @@ display(const FTSENT *p, FTSENT *list, int options)
error = mac_prepare_file_label(&label); error = mac_prepare_file_label(&label);
if (error == -1) { if (error == -1) {
warn("MAC label for %s/%s", xo_warn("MAC label for %s/%s",
cur->fts_parent->fts_path, cur->fts_parent->fts_path,
cur->fts_name); cur->fts_name);
goto label_out; goto label_out;
@@ -775,7 +800,7 @@ display(const FTSENT *p, FTSENT *list, int options)
error = mac_get_link(name, error = mac_get_link(name,
label); label);
if (error == -1) { if (error == -1) {
warn("MAC label for %s/%s", xo_warn("MAC label for %s/%s",
cur->fts_parent->fts_path, cur->fts_parent->fts_path,
cur->fts_name); cur->fts_name);
mac_free(label); mac_free(label);
@@ -785,7 +810,7 @@ display(const FTSENT *p, FTSENT *list, int options)
error = mac_to_text(label, error = mac_to_text(label,
&labelstr); &labelstr);
if (error == -1) { if (error == -1) {
warn("MAC label for %s/%s", xo_warn("MAC label for %s/%s",
cur->fts_parent->fts_path, cur->fts_parent->fts_path,
cur->fts_name); cur->fts_name);
mac_free(label); mac_free(label);
@@ -803,7 +828,7 @@ display(const FTSENT *p, FTSENT *list, int options)
if ((np = malloc(sizeof(NAMES) + labelstrlen + if ((np = malloc(sizeof(NAMES) + labelstrlen +
ulen + glen + flen + 4)) == NULL) ulen + glen + flen + 4)) == NULL)
err(1, "malloc"); xo_err(1, "malloc");
np->user = &np->data[0]; np->user = &np->data[0];
(void)strcpy(np->user, user); (void)strcpy(np->user, user);
+107 -62
View File
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <termcap.h> #include <termcap.h>
#include <signal.h> #include <signal.h>
#endif #endif
#include <libxo/xo.h>
#include "ls.h" #include "ls.h"
#include "extern.h" #include "extern.h"
@@ -65,9 +66,9 @@ __FBSDID("$FreeBSD$");
static int printaname(const FTSENT *, u_long, u_long); static int printaname(const FTSENT *, u_long, u_long);
static void printdev(size_t, dev_t); static void printdev(size_t, dev_t);
static void printlink(const FTSENT *); static void printlink(const FTSENT *);
static void printtime(time_t); static void printtime(const char *, time_t);
static int printtype(u_int); static int printtype(u_int);
static void printsize(size_t, off_t); static void printsize(const char *, size_t, off_t);
#ifdef COLORLS #ifdef COLORLS
static void endcolor(int); static void endcolor(int);
static int colortype(mode_t); static int colortype(mode_t);
@@ -109,26 +110,46 @@ printscol(const DISPLAY *dp)
{ {
FTSENT *p; FTSENT *p;
xo_open_list("entry");
for (p = dp->list; p; p = p->fts_link) { for (p = dp->list; p; p = p->fts_link) {
if (IS_NOPRINT(p)) if (IS_NOPRINT(p))
continue; continue;
xo_open_instance("entry");
(void)printaname(p, dp->s_inode, dp->s_block); (void)printaname(p, dp->s_inode, dp->s_block);
(void)putchar('\n'); xo_close_instance("entry");
xo_emit("\n");
} }
xo_close_list("entry");
} }
/* /*
* print name in current style * print name in current style
*/ */
int int
printname(const char *name) printname(const char *field, const char *name)
{
char fmt[BUFSIZ];
char *s = getname(name);
int rc;
snprintf(fmt, sizeof(fmt), "{:%s/%%hs}", field);
rc = xo_emit(fmt, s);
free(s);
return rc;
}
/*
* print name in current style
*/
char *
getname(const char *name)
{ {
if (f_octal || f_octal_escape) if (f_octal || f_octal_escape)
return prn_octal(name); return get_octal(name);
else if (f_nonprint) else if (f_nonprint)
return prn_printable(name); return get_printable(name);
else else
return prn_normal(name); return strdup(name);
} }
void void
@@ -144,46 +165,59 @@ printlong(const DISPLAY *dp)
if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) &&
(f_longform || f_size)) { (f_longform || f_size)) {
(void)printf("total %lu\n", howmany(dp->btotal, blocksize)); xo_emit("{L:total} {:total-blocks/%lu}\n",
howmany(dp->btotal, blocksize));
} }
xo_open_list("entry");
for (p = dp->list; p; p = p->fts_link) { for (p = dp->list; p; p = p->fts_link) {
char *name;
if (IS_NOPRINT(p)) if (IS_NOPRINT(p))
continue; continue;
xo_open_instance("entry");
sp = p->fts_statp; sp = p->fts_statp;
name = getname(p->fts_name);
if (name)
xo_emit("{ke:name}", name);
if (f_inode) if (f_inode)
(void)printf("%*ju ", xo_emit("{:inode/%*ju} ",
dp->s_inode, (uintmax_t)sp->st_ino); dp->s_inode, (uintmax_t)sp->st_ino);
if (f_size) if (f_size)
(void)printf("%*jd ", xo_emit("{:blocks/%*jd} ",
dp->s_block, howmany(sp->st_blocks, blocksize)); dp->s_block, howmany(sp->st_blocks, blocksize));
strmode(sp->st_mode, buf); strmode(sp->st_mode, buf);
aclmode(buf, p); aclmode(buf, p);
np = p->fts_pointer; np = p->fts_pointer;
(void)printf("%s %*u %-*s %-*s ", buf, dp->s_nlink, xo_attr("value", "%03o", (int) sp->st_mode & ALLPERMS);
sp->st_nlink, dp->s_user, np->user, dp->s_group, xo_emit("{t:mode/%s} {:links/%*u} {:user/%-*s} {:group/%-*s} ",
np->group); buf, dp->s_nlink, sp->st_nlink,
dp->s_user, np->user, dp->s_group, np->group);
if (f_flags) if (f_flags)
(void)printf("%-*s ", dp->s_flags, np->flags); xo_emit("{:flags/%-*s} ", dp->s_flags, np->flags);
if (f_label) if (f_label)
(void)printf("%-*s ", dp->s_label, np->label); xo_emit("{:label/%-*s} ", dp->s_label, np->label);
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode)) if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
printdev(dp->s_size, sp->st_rdev); printdev(dp->s_size, sp->st_rdev);
else else
printsize(dp->s_size, sp->st_size); printsize("size", dp->s_size, sp->st_size);
if (f_accesstime) if (f_accesstime)
printtime(sp->st_atime); printtime("access-time", sp->st_atime);
else if (f_birthtime) else if (f_birthtime)
printtime(sp->st_birthtime); printtime("birth-time", sp->st_birthtime);
else if (f_statustime) else if (f_statustime)
printtime(sp->st_ctime); printtime("change-time", sp->st_ctime);
else else
printtime(sp->st_mtime); printtime("modify-time", sp->st_mtime);
#ifdef COLORLS #ifdef COLORLS
if (f_color) if (f_color)
color_printed = colortype(sp->st_mode); color_printed = colortype(sp->st_mode);
#endif #endif
(void)printname(p->fts_name);
if (name) {
xo_emit("{dk:name}", name);
free(name);
}
#ifdef COLORLS #ifdef COLORLS
if (f_color && color_printed) if (f_color && color_printed)
endcolor(0); endcolor(0);
@@ -192,8 +226,10 @@ printlong(const DISPLAY *dp)
(void)printtype(sp->st_mode); (void)printtype(sp->st_mode);
if (S_ISLNK(sp->st_mode)) if (S_ISLNK(sp->st_mode))
printlink(p); printlink(p);
(void)putchar('\n'); xo_close_instance("entry");
xo_emit("\n");
} }
xo_close_list("entry");
} }
void void
@@ -208,17 +244,17 @@ printstream(const DISPLAY *dp)
/* XXX strlen does not take octal escapes into account. */ /* XXX strlen does not take octal escapes into account. */
if (strlen(p->fts_name) + chcnt + if (strlen(p->fts_name) + chcnt +
(p->fts_link ? 2 : 0) >= (unsigned)termwidth) { (p->fts_link ? 2 : 0) >= (unsigned)termwidth) {
putchar('\n'); xo_emit("\n");
chcnt = 0; chcnt = 0;
} }
chcnt += printaname(p, dp->s_inode, dp->s_block); chcnt += printaname(p, dp->s_inode, dp->s_block);
if (p->fts_link) { if (p->fts_link) {
printf(", "); xo_emit(", ");
chcnt += 2; chcnt += 2;
} }
} }
if (chcnt) if (chcnt)
putchar('\n'); xo_emit("\n");
} }
void void
@@ -252,7 +288,6 @@ printcol(const DISPLAY *dp)
if (dp->entries > lastentries) { if (dp->entries > lastentries) {
if ((narray = if ((narray =
realloc(array, dp->entries * sizeof(FTSENT *))) == NULL) { realloc(array, dp->entries * sizeof(FTSENT *))) == NULL) {
warn(NULL);
printscol(dp); printscol(dp);
return; return;
} }
@@ -283,17 +318,21 @@ printcol(const DISPLAY *dp)
if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) &&
(f_longform || f_size)) { (f_longform || f_size)) {
(void)printf("total %lu\n", howmany(dp->btotal, blocksize)); xo_emit("{L:total} {:total-blocks/%lu}\n",
howmany(dp->btotal, blocksize));
} }
xo_open_list("entry");
base = 0; base = 0;
for (row = 0; row < numrows; ++row) { for (row = 0; row < numrows; ++row) {
endcol = colwidth; endcol = colwidth;
if (!f_sortacross) if (!f_sortacross)
base = row; base = row;
for (col = 0, chcnt = 0; col < numcols; ++col) { for (col = 0, chcnt = 0; col < numcols; ++col) {
xo_open_instance("entry");
chcnt += printaname(array[base], dp->s_inode, chcnt += printaname(array[base], dp->s_inode,
dp->s_block); dp->s_block);
xo_close_instance("entry");
if (f_sortacross) if (f_sortacross)
base++; base++;
else else
@@ -304,13 +343,14 @@ printcol(const DISPLAY *dp)
<= endcol) { <= endcol) {
if (f_sortacross && col + 1 >= numcols) if (f_sortacross && col + 1 >= numcols)
break; break;
(void)putchar(f_notabs ? ' ' : '\t'); xo_emit(f_notabs ? " " : "\t");
chcnt = cnt; chcnt = cnt;
} }
endcol += colwidth; endcol += colwidth;
} }
(void)putchar('\n'); xo_emit("\n");
} }
xo_close_list("entry");
} }
/* /*
@@ -329,16 +369,16 @@ printaname(const FTSENT *p, u_long inodefield, u_long sizefield)
sp = p->fts_statp; sp = p->fts_statp;
chcnt = 0; chcnt = 0;
if (f_inode) if (f_inode)
chcnt += printf("%*ju ", chcnt += xo_emit("{:inode/%*ju} ",
(int)inodefield, (uintmax_t)sp->st_ino); (int)inodefield, (uintmax_t)sp->st_ino);
if (f_size) if (f_size)
chcnt += printf("%*jd ", chcnt += xo_emit("{:size/%*jd} ",
(int)sizefield, howmany(sp->st_blocks, blocksize)); (int)sizefield, howmany(sp->st_blocks, blocksize));
#ifdef COLORLS #ifdef COLORLS
if (f_color) if (f_color)
color_printed = colortype(sp->st_mode); color_printed = colortype(sp->st_mode);
#endif #endif
chcnt += printname(p->fts_name); chcnt += printname("name", p->fts_name);
#ifdef COLORLS #ifdef COLORLS
if (f_color && color_printed) if (f_color && color_printed)
endcolor(0); endcolor(0);
@@ -354,14 +394,14 @@ printaname(const FTSENT *p, u_long inodefield, u_long sizefield)
static void static void
printdev(size_t width, dev_t dev) printdev(size_t width, dev_t dev)
{ {
xo_emit("{:device/%#*jx} ", (u_int)width, (uintmax_t)dev);
(void)printf("%#*jx ", (u_int)width, (uintmax_t)dev);
} }
static void static void
printtime(time_t ftime) printtime(const char *field, time_t ftime)
{ {
char longstring[80]; char longstring[80];
char fmt[BUFSIZ];
static time_t now = 0; static time_t now = 0;
const char *format; const char *format;
static int d_first = -1; static int d_first = -1;
@@ -384,8 +424,10 @@ printtime(time_t ftime)
/* mmm dd yyyy || dd mmm yyyy */ /* mmm dd yyyy || dd mmm yyyy */
format = d_first ? "%e %b %Y" : "%b %e %Y"; format = d_first ? "%e %b %Y" : "%b %e %Y";
strftime(longstring, sizeof(longstring), format, localtime(&ftime)); strftime(longstring, sizeof(longstring), format, localtime(&ftime));
fputs(longstring, stdout);
fputc(' ', stdout); snprintf(fmt, sizeof(fmt), "{:%s/%%s} ", field);
xo_attr("value", "%ld", (long) ftime);
xo_emit(fmt, longstring);
} }
static int static int
@@ -394,7 +436,7 @@ printtype(u_int mode)
if (f_slash) { if (f_slash) {
if ((mode & S_IFMT) == S_IFDIR) { if ((mode & S_IFMT) == S_IFDIR) {
(void)putchar('/'); xo_emit("{D:\\/}{e:type/directory}");
return (1); return (1);
} }
return (0); return (0);
@@ -402,25 +444,25 @@ printtype(u_int mode)
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
case S_IFDIR: case S_IFDIR:
(void)putchar('/'); xo_emit("{D:/\\/}{e:type/directory}");
return (1); return (1);
case S_IFIFO: case S_IFIFO:
(void)putchar('|'); xo_emit("{D:|}{e:type/fifo}");
return (1); return (1);
case S_IFLNK: case S_IFLNK:
(void)putchar('@'); xo_emit("{D:@}{e:type/link}");
return (1); return (1);
case S_IFSOCK: case S_IFSOCK:
(void)putchar('='); xo_emit("{D:=}{e:type/socket}");
return (1); return (1);
case S_IFWHT: case S_IFWHT:
(void)putchar('%'); xo_emit("{D:%}{e:type/whiteout}");
return (1); return (1);
default: default:
break; break;
} }
if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
(void)putchar('*'); xo_emit("{D:*}{e:executable/}");
return (1); return (1);
} }
return (0); return (0);
@@ -430,7 +472,7 @@ printtype(u_int mode)
static int static int
putch(int c) putch(int c)
{ {
(void)putchar(c); xo_emit("{D:/%c}", c);
return 0; return 0;
} }
@@ -539,7 +581,7 @@ parsecolors(const char *cs)
if (c[j] >= '0' && c[j] <= '7') { if (c[j] >= '0' && c[j] <= '7') {
colors[i].num[j] = c[j] - '0'; colors[i].num[j] = c[j] - '0';
if (!legacy_warn) { if (!legacy_warn) {
warnx("LSCOLORS should use " xo_warnx("LSCOLORS should use "
"characters a-h instead of 0-9 (" "characters a-h instead of 0-9 ("
"see the manual page)"); "see the manual page)");
} }
@@ -552,7 +594,7 @@ parsecolors(const char *cs)
} else if (tolower((unsigned char)c[j]) == 'x') } else if (tolower((unsigned char)c[j]) == 'x')
colors[i].num[j] = -1; colors[i].num[j] = -1;
else { else {
warnx("invalid character '%c' in LSCOLORS" xo_warnx("invalid character '%c' in LSCOLORS"
" env var", c[j]); " env var", c[j]);
colors[i].num[j] = -1; colors[i].num[j] = -1;
} }
@@ -584,18 +626,19 @@ printlink(const FTSENT *p)
(void)snprintf(name, sizeof(name), (void)snprintf(name, sizeof(name),
"%s/%s", p->fts_parent->fts_accpath, p->fts_name); "%s/%s", p->fts_parent->fts_accpath, p->fts_name);
if ((lnklen = readlink(name, path, sizeof(path) - 1)) == -1) { if ((lnklen = readlink(name, path, sizeof(path) - 1)) == -1) {
(void)fprintf(stderr, "\nls: %s: %s\n", name, strerror(errno)); xo_error("\nls: %s: %s\n", name, strerror(errno));
return; return;
} }
path[lnklen] = '\0'; path[lnklen] = '\0';
(void)printf(" -> "); xo_emit(" -> ");
(void)printname(path); (void)printname("target", path);
} }
static void static void
printsize(size_t width, off_t bytes) printsize(const char *field, size_t width, off_t bytes)
{ {
char fmt[BUFSIZ];
if (f_humanval) { if (f_humanval) {
/* /*
* Reserve one space before the size and allocate room for * Reserve one space before the size and allocate room for
@@ -605,13 +648,15 @@ printsize(size_t width, off_t bytes)
humanize_number(buf, sizeof(buf), (int64_t)bytes, "", humanize_number(buf, sizeof(buf), (int64_t)bytes, "",
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
(void)printf("%*s ", (u_int)width, buf); snprintf(fmt, sizeof(fmt), "{:%s/%%%ds} ", field, (int) width);
} else if (f_thousands) { /* with commas */ xo_attr("value", "%jd", (intmax_t) bytes);
xo_emit(fmt, buf);
} else { /* with commas */
/* This format assignment needed to work round gcc bug. */ /* This format assignment needed to work round gcc bug. */
const char *format = "%*j'd "; snprintf(fmt, sizeof(fmt), "{:%s/%%%dj%sd} ",
(void)printf(format, (u_int)width, bytes); field, (int) width, f_thousands ? "'" : "");
} else xo_emit(fmt, (intmax_t) bytes);
(void)printf("%*jd ", (u_int)width, bytes); }
} }
/* /*
@@ -654,7 +699,7 @@ aclmode(char *buf, const FTSENT *p)
type = ACL_TYPE_NFS4; type = ACL_TYPE_NFS4;
supports_acls = 1; supports_acls = 1;
} else if (ret < 0 && errno != EINVAL) { } else if (ret < 0 && errno != EINVAL) {
warn("%s", name); xo_warn("%s", name);
return; return;
} }
if (supports_acls == 0) { if (supports_acls == 0) {
@@ -663,7 +708,7 @@ aclmode(char *buf, const FTSENT *p)
type = ACL_TYPE_ACCESS; type = ACL_TYPE_ACCESS;
supports_acls = 1; supports_acls = 1;
} else if (ret < 0 && errno != EINVAL) { } else if (ret < 0 && errno != EINVAL) {
warn("%s", name); xo_warn("%s", name);
return; return;
} }
} }
@@ -672,12 +717,12 @@ aclmode(char *buf, const FTSENT *p)
return; return;
facl = acl_get_link_np(name, type); facl = acl_get_link_np(name, type);
if (facl == NULL) { if (facl == NULL) {
warn("%s", name); xo_warn("%s", name);
return; return;
} }
if (acl_is_trivial_np(facl, &trivial)) { if (acl_is_trivial_np(facl, &trivial)) {
acl_free(facl); acl_free(facl);
warn("%s", name); xo_warn("%s", name);
return; return;
} }
if (!trivial) if (!trivial)
+33 -19
View File
@@ -50,13 +50,19 @@ __FBSDID("$FreeBSD$");
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <libxo/xo.h>
#include "ls.h" #include "ls.h"
#include "extern.h" #include "extern.h"
int int
prn_normal(const char *s) prn_normal(const char *field, const char *s)
{ {
char fmt[_POSIX2_LINE_MAX];
snprintf(fmt, sizeof(fmt), "{:%s/%%hs}", field);
return xo_emit(fmt, s);
#if 0
mbstate_t mbs; mbstate_t mbs;
wchar_t wc; wchar_t wc;
int i, n; int i, n;
@@ -83,43 +89,47 @@ prn_normal(const char *s)
n += wcwidth(wc); n += wcwidth(wc);
} }
return (n); return (n);
#endif
} }
int char *
prn_printable(const char *s) get_printable(const char *s)
{ {
mbstate_t mbs; mbstate_t mbs;
wchar_t wc; wchar_t wc;
int i, n; int i, n;
size_t clen; size_t clen;
int slen = strlen(s);
char *buf = alloca(slen + 1), *bp = buf;
memset(&mbs, 0, sizeof(mbs)); memset(&mbs, 0, sizeof(mbs));
n = 0; n = 0;
while ((clen = mbrtowc(&wc, s, MB_LEN_MAX, &mbs)) != 0) { while ((clen = mbrtowc(&wc, s, MB_LEN_MAX, &mbs)) != 0) {
if (clen == (size_t)-1) { if (clen == (size_t)-1) {
putchar('?'); *bp++ = '?';
s++; s++;
n++; n++;
memset(&mbs, 0, sizeof(mbs)); memset(&mbs, 0, sizeof(mbs));
continue; continue;
} }
if (clen == (size_t)-2) { if (clen == (size_t)-2) {
putchar('?'); *bp++ = '?';
n++; n++;
break; break;
} }
if (!iswprint(wc)) { if (!iswprint(wc)) {
putchar('?'); *bp++ = '?';
s += clen; s += clen;
n++; n++;
continue; continue;
} }
for (i = 0; i < (int)clen; i++) for (i = 0; i < (int)clen; i++)
putchar((unsigned char)s[i]); *bp++ = (unsigned char)s[i];
s += clen; s += clen;
n += wcwidth(wc); n += wcwidth(wc);
} }
return (n); *bp = '\0';
return strdup(buf);
} }
/* /*
@@ -165,8 +175,8 @@ len_octal(const char *s, int len)
return (r); return (r);
} }
int char *
prn_octal(const char *s) get_octal(const char *s)
{ {
static const char esc[] = "\\\\\"\"\aa\bb\ff\nn\rr\tt\vv"; static const char esc[] = "\\\\\"\"\aa\bb\ff\nn\rr\tt\vv";
const char *p; const char *p;
@@ -175,6 +185,8 @@ prn_octal(const char *s)
size_t clen; size_t clen;
unsigned char ch; unsigned char ch;
int goodchar, i, len, prtlen; int goodchar, i, len, prtlen;
int slen = strlen(s);
char *buf = alloca(slen * 4 + 1), *bp = buf;
memset(&mbs, 0, sizeof(mbs)); memset(&mbs, 0, sizeof(mbs));
len = 0; len = 0;
@@ -182,7 +194,7 @@ prn_octal(const char *s)
goodchar = clen != (size_t)-1 && clen != (size_t)-2; goodchar = clen != (size_t)-1 && clen != (size_t)-2;
if (goodchar && iswprint(wc) && wc != L'\"' && wc != L'\\') { if (goodchar && iswprint(wc) && wc != L'\"' && wc != L'\\') {
for (i = 0; i < (int)clen; i++) for (i = 0; i < (int)clen; i++)
putchar((unsigned char)s[i]); *bp++ = (unsigned char)s[i];
len += wcwidth(wc); len += wcwidth(wc);
} else if (goodchar && f_octal_escape && } else if (goodchar && f_octal_escape &&
#if WCHAR_MIN < 0 #if WCHAR_MIN < 0
@@ -190,8 +202,8 @@ prn_octal(const char *s)
#endif #endif
wc <= (wchar_t)UCHAR_MAX && wc <= (wchar_t)UCHAR_MAX &&
(p = strchr(esc, (char)wc)) != NULL) { (p = strchr(esc, (char)wc)) != NULL) {
putchar('\\'); *bp ++ = '\\';
putchar(p[1]); *bp++ = p[1];
len += 2; len += 2;
} else { } else {
if (goodchar) if (goodchar)
@@ -202,10 +214,10 @@ prn_octal(const char *s)
prtlen = strlen(s); prtlen = strlen(s);
for (i = 0; i < prtlen; i++) { for (i = 0; i < prtlen; i++) {
ch = (unsigned char)s[i]; ch = (unsigned char)s[i];
putchar('\\'); *bp++ = '\\';
putchar('0' + (ch >> 6)); *bp++ = '0' + (ch >> 6);
putchar('0' + ((ch >> 3) & 7)); *bp++ = '0' + ((ch >> 3) & 7);
putchar('0' + (ch & 7)); *bp++ = '0' + (ch & 7);
len += 4; len += 4;
} }
} }
@@ -217,13 +229,15 @@ prn_octal(const char *s)
} else } else
s += clen; s += clen;
} }
return (len);
*bp = '\0';
return strdup(buf);
} }
void void
usage(void) usage(void)
{ {
(void)fprintf(stderr, xo_error(
#ifdef COLORLS #ifdef COLORLS
"usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]" "usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]"
#else #else
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+19
View File
@@ -0,0 +1,19 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libkvm \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+22
View File
@@ -0,0 +1,22 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libjail \
lib/libkvm \
lib/libxo \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+1 -6
View File
@@ -180,7 +180,7 @@ main(int argc, char *argv[])
KINFO_STR *ks; KINFO_STR *ks;
struct varent *vent; struct varent *vent;
struct winsize ws = { .ws_row = 0 }; struct winsize ws = { .ws_row = 0 };
const char *nlistf, *memf, *fmtstr, *str; const char *nlistf, *memf, *str;
char *cols; char *cols;
int all, ch, elem, flag, _fmt, i, lineno, linelen, left; int all, ch, elem, flag, _fmt, i, lineno, linelen, left;
int descendancy, nentries, nkept, nselectors; int descendancy, nentries, nkept, nselectors;
@@ -649,11 +649,6 @@ main(int argc, char *argv[])
linelen = 0; linelen = 0;
xo_open_instance("process"); xo_open_instance("process");
STAILQ_FOREACH(vent, &varlist, next_ve) { STAILQ_FOREACH(vent, &varlist, next_ve) {
if (vent->var->flag & LJUST)
fmtstr = "%-*s";
else
fmtstr = "%*s";
ks = STAILQ_FIRST(&kinfo[i].ki_ks); ks = STAILQ_FIRST(&kinfo[i].ki_ks);
STAILQ_REMOVE_HEAD(&kinfo[i].ki_ks, ks_next); STAILQ_REMOVE_HEAD(&kinfo[i].ki_ks, ks_next);
/* Truncate rightmost column if necessary. */ /* Truncate rightmost column if necessary. */
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+17
View File
@@ -0,0 +1,17 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+22
View File
@@ -0,0 +1,22 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libsm \
lib/libutil \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
rmail.o: sm_os.h
rmail.po: sm_os.h
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+114
View File
@@ -0,0 +1,114 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libedit \
lib/ncurses/ncursesw \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
alias.o: builtins.h
alias.po: builtins.h
arith_yylex.o: syntax.h
arith_yylex.po: syntax.h
builtins.o: builtins.c
builtins.o: builtins.h
builtins.po: builtins.c
builtins.po: builtins.h
cd.o: builtins.h
cd.o: nodes.h
cd.po: builtins.h
cd.po: nodes.h
echo.o: builtins.h
echo.po: builtins.h
error.o: nodes.h
error.po: nodes.h
eval.o: builtins.h
eval.o: nodes.h
eval.o: syntax.h
eval.po: builtins.h
eval.po: nodes.h
eval.po: syntax.h
exec.o: builtins.h
exec.o: nodes.h
exec.o: syntax.h
exec.po: builtins.h
exec.po: nodes.h
exec.po: syntax.h
expand.o: builtins.h
expand.o: nodes.h
expand.o: syntax.h
expand.po: builtins.h
expand.po: nodes.h
expand.po: syntax.h
histedit.o: builtins.h
histedit.po: builtins.h
input.o: syntax.h
input.po: syntax.h
jobs.o: builtins.h
jobs.o: nodes.h
jobs.o: syntax.h
jobs.po: builtins.h
jobs.po: nodes.h
jobs.po: syntax.h
kill.o: builtins.h
kill.po: builtins.h
main.o: builtins.h
main.o: nodes.h
main.po: builtins.h
main.po: nodes.h
miscbltin.o: syntax.h
miscbltin.po: syntax.h
mystring.o: syntax.h
mystring.po: syntax.h
nodes.o: nodes.c
nodes.o: nodes.h
nodes.po: nodes.c
nodes.po: nodes.h
options.o: builtins.h
options.o: nodes.h
options.po: builtins.h
options.po: nodes.h
output.o: syntax.h
output.po: syntax.h
parser.o: nodes.h
parser.o: syntax.h
parser.o: token.h
parser.po: nodes.h
parser.po: syntax.h
parser.po: token.h
printf.o: builtins.h
printf.po: builtins.h
redir.o: nodes.h
redir.po: nodes.h
show.o: nodes.h
show.po: nodes.h
syntax.o: syntax.c
syntax.o: syntax.h
syntax.po: syntax.c
syntax.po: syntax.h
test.o: builtins.h
test.po: builtins.h
trap.o: builtins.h
trap.o: nodes.h
trap.o: syntax.h
trap.po: builtins.h
trap.po: nodes.h
trap.po: syntax.h
var.o: builtins.h
var.o: nodes.h
var.o: syntax.h
var.po: builtins.h
var.po: nodes.h
var.po: syntax.h
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+17
View File
@@ -0,0 +1,17 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+17
View File
@@ -0,0 +1,17 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
@@ -157,14 +157,22 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
"lockstat:::rw-block", "arg2 != 0 && arg3 == 1" }, "lockstat:::rw-block", "arg2 != 0 && arg3 == 1" },
{ 'C', "Lock", "R/W reader blocked by write wanted", "nsec", { 'C', "Lock", "R/W reader blocked by write wanted", "nsec",
"lockstat:::rw-block", "arg2 != 0 && arg3 == 0 && arg4" }, "lockstat:::rw-block", "arg2 != 0 && arg3 == 0 && arg4" },
{ 'C', "Lock", "Unknown event (type 8)", "units" }, { 'C', "Lock", "R/W writer spin on writer", "nsec",
{ 'C', "Lock", "Unknown event (type 9)", "units" }, "lockstat:::rw-spin", "arg2 == 0 && arg3 == 1" },
{ 'C', "Lock", "Unknown event (type 10)", "units" }, { 'C', "Lock", "R/W writer spin on readers", "nsec",
{ 'C', "Lock", "Unknown event (type 11)", "units" }, "lockstat:::rw-spin", "arg2 == 0 && arg3 == 0 && arg4" },
{ 'C', "Lock", "Unknown event (type 12)", "units" }, { 'C', "Lock", "R/W reader spin on writer", "nsec",
{ 'C', "Lock", "Unknown event (type 13)", "units" }, "lockstat:::rw-spin", "arg2 != 0 && arg3 == 1" },
{ 'C', "Lock", "Unknown event (type 14)", "units" }, { 'C', "Lock", "R/W reader spin on write wanted", "nsec",
{ 'C', "Lock", "Unknown event (type 15)", "units" }, "lockstat:::rw-spin", "arg2 != 0 && arg3 == 0 && arg4" },
{ 'C', "Lock", "SX exclusive block", "nsec",
"lockstat:::sx-block", "arg2 == 0" },
{ 'C', "Lock", "SX shared block", "nsec",
"lockstat:::sx-block", "arg2 != 0" },
{ 'C', "Lock", "SX exclusive spin", "nsec",
"lockstat:::sx-spin", "arg2 == 0" },
{ 'C', "Lock", "SX shared spin", "nsec",
"lockstat:::sx-spin", "arg2 != 0" },
{ 'C', "Lock", "Unknown event (type 16)", "units" }, { 'C', "Lock", "Unknown event (type 16)", "units" },
{ 'C', "Lock", "Unknown event (type 17)", "units" }, { 'C', "Lock", "Unknown event (type 17)", "units" },
{ 'C', "Lock", "Unknown event (type 18)", "units" }, { 'C', "Lock", "Unknown event (type 18)", "units" },
@@ -188,13 +196,17 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
"lockstat:::spin-release", NULL, "lockstat:::spin-release", NULL,
"lockstat:::spin-acquire" }, "lockstat:::spin-acquire" },
{ 'H', "Lock", "R/W writer hold", "nsec", { 'H', "Lock", "R/W writer hold", "nsec",
"lockstat:::rw-release", "arg1 == 0", "lockstat::rw_wunlock:rw-release", NULL,
"lockstat:::rw-acquire" }, "lockstat::rw_wlock:rw-acquire" },
{ 'H', "Lock", "R/W reader hold", "nsec", { 'H', "Lock", "R/W reader hold", "nsec",
"lockstat:::rw-release", "arg1 != 0", "lockstat::rw_runlock:rw-release", NULL,
"lockstat:::rw-acquire" }, "lockstat::rw_rlock:rw-acquire" },
{ 'H', "Lock", "Unknown event (type 36)", "units" }, { 'H', "Lock", "SX shared hold", "nsec",
{ 'H', "Lock", "Unknown event (type 37)", "units" }, "lockstat::sx_sunlock:sx-release", NULL,
"lockstat::sx_slock:sx-acquire" },
{ 'H', "Lock", "SX exclusive hold", "nsec",
"lockstat::sx_xunlock:sx-release", NULL,
"lockstat::sx_xlock:sx-acquire" },
{ 'H', "Lock", "Unknown event (type 38)", "units" }, { 'H', "Lock", "Unknown event (type 38)", "units" },
{ 'H', "Lock", "Unknown event (type 39)", "units" }, { 'H', "Lock", "Unknown event (type 39)", "units" },
{ 'H', "Lock", "Unknown event (type 40)", "units" }, { 'H', "Lock", "Unknown event (type 40)", "units" },
+6 -8
View File
@@ -90,10 +90,10 @@ uint8_t dump_opt[256];
typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
extern void dump_intent_log(zilog_t *); extern void dump_intent_log(zilog_t *);
uint64_t *zopt_object = NULL; static uint64_t *zopt_object = NULL;
int zopt_objects = 0; static int zopt_objects = 0;
libzfs_handle_t *g_zfs; static libzfs_handle_t *g_zfs;
uint64_t max_inflight = 1000; static uint64_t max_inflight = 1000;
/* /*
* These libumem hooks provide a reasonable set of defaults for the allocator's * These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -1488,16 +1488,14 @@ dump_deadlist(dsl_deadlist_t *dl)
dle = AVL_NEXT(&dl->dl_tree, dle)) { dle = AVL_NEXT(&dl->dl_tree, dle)) {
if (dump_opt['d'] >= 5) { if (dump_opt['d'] >= 5) {
char buf[128]; char buf[128];
(void) snprintf(buf, sizeof (buf), "mintxg %llu -> ", (void) snprintf(buf, sizeof (buf), "mintxg %llu -> "
(longlong_t)dle->dle_mintxg, "obj %llu", (longlong_t)dle->dle_mintxg,
(longlong_t)dle->dle_bpobj.bpo_object); (longlong_t)dle->dle_bpobj.bpo_object);
dump_bpobj(&dle->dle_bpobj, buf, 0); dump_bpobj(&dle->dle_bpobj, buf, 0);
} else { } else {
(void) printf("mintxg %llu -> obj %llu\n", (void) printf("mintxg %llu -> obj %llu\n",
(longlong_t)dle->dle_mintxg, (longlong_t)dle->dle_mintxg,
(longlong_t)dle->dle_bpobj.bpo_object); (longlong_t)dle->dle_bpobj.bpo_object);
} }
} }
} }
+30 -11
View File
@@ -592,6 +592,17 @@ finish_progress(char *done)
pt_header = NULL; pt_header = NULL;
} }
/*
* Check if the dataset is mountable and should be automatically mounted.
*/
static boolean_t
should_auto_mount(zfs_handle_t *zhp)
{
if (!zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, zfs_get_type(zhp)))
return (B_FALSE);
return (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON);
}
/* /*
* zfs clone [-p] [-o prop=value] ... <snap> <fs | vol> * zfs clone [-p] [-o prop=value] ... <snap> <fs | vol>
* *
@@ -677,9 +688,22 @@ zfs_do_clone(int argc, char **argv)
clone = zfs_open(g_zfs, argv[1], ZFS_TYPE_DATASET); clone = zfs_open(g_zfs, argv[1], ZFS_TYPE_DATASET);
if (clone != NULL) { if (clone != NULL) {
if (zfs_get_type(clone) != ZFS_TYPE_VOLUME) /*
if ((ret = zfs_mount(clone, NULL, 0)) == 0) * If the user doesn't want the dataset
ret = zfs_share(clone); * automatically mounted, then skip the mount/share
* step.
*/
if (should_auto_mount(clone)) {
if ((ret = zfs_mount(clone, NULL, 0)) != 0) {
(void) fprintf(stderr, gettext("clone "
"successfully created, "
"but not mounted\n"));
} else if ((ret = zfs_share(clone)) != 0) {
(void) fprintf(stderr, gettext("clone "
"successfully created, "
"but not shared\n"));
}
}
zfs_close(clone); zfs_close(clone);
} }
} }
@@ -728,7 +752,6 @@ zfs_do_create(int argc, char **argv)
int ret = 1; int ret = 1;
nvlist_t *props; nvlist_t *props;
uint64_t intval; uint64_t intval;
int canmount = ZFS_CANMOUNT_OFF;
if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
nomem(); nomem();
@@ -868,19 +891,15 @@ zfs_do_create(int argc, char **argv)
goto error; goto error;
ret = 0; ret = 0;
/*
* if the user doesn't want the dataset automatically mounted,
* then skip the mount/share step
*/
if (zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, type))
canmount = zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT);
/* /*
* Mount and/or share the new filesystem as appropriate. We provide a * Mount and/or share the new filesystem as appropriate. We provide a
* verbose error message to let the user know that their filesystem was * verbose error message to let the user know that their filesystem was
* in fact created, even if we failed to mount or share it. * in fact created, even if we failed to mount or share it.
* If the user doesn't want the dataset automatically mounted,
* then skip the mount/share step altogether.
*/ */
if (!nomount && canmount == ZFS_CANMOUNT_ON) { if (!nomount && should_auto_mount(zhp)) {
if (zfs_mount(zhp, NULL, 0) != 0) { if (zfs_mount(zhp, NULL, 0) != 0) {
(void) fprintf(stderr, gettext("filesystem " (void) fprintf(stderr, gettext("filesystem "
"successfully created, but not mounted\n")); "successfully created, but not mounted\n"));
+2 -17
View File
@@ -20,7 +20,7 @@
*/ */
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved. * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -969,21 +969,6 @@ ztest_random_spa_version(uint64_t initial_version)
return (version); return (version);
} }
/*
* Find the largest ashift used
*/
static uint64_t
ztest_spa_get_ashift() {
uint64_t i;
uint64_t ashift = SPA_MINBLOCKSHIFT;
vdev_t *rvd = ztest_spa->spa_root_vdev;
for (i = 0; i < rvd->vdev_children; i++) {
ashift = MAX(ashift, rvd->vdev_child[i]->vdev_ashift);
}
return (ashift);
}
static int static int
ztest_random_blocksize(void) ztest_random_blocksize(void)
{ {
@@ -995,7 +980,7 @@ ztest_random_blocksize(void)
int maxbs = SPA_OLD_MAXBLOCKSHIFT; int maxbs = SPA_OLD_MAXBLOCKSHIFT;
if (spa_maxblocksize(ztest_spa) == SPA_MAXBLOCKSIZE) if (spa_maxblocksize(ztest_spa) == SPA_MAXBLOCKSIZE)
maxbs = 20; maxbs = 20;
block_shift = ztest_random(maxbs - ztest_spa_get_ashift() + 1); block_shift = ztest_random(maxbs - ztest_spa->spa_max_ashift + 1);
return (1 << (SPA_MINBLOCKSHIFT + block_shift)); return (1 << (SPA_MINBLOCKSHIFT + block_shift));
} }
@@ -156,6 +156,21 @@ typedef struct dt_module {
#define DT_DM_KERNEL 0x2 /* module is associated with a kernel object */ #define DT_DM_KERNEL 0x2 /* module is associated with a kernel object */
#define DT_DM_PRIMARY 0x4 /* module is a krtld primary kernel object */ #define DT_DM_PRIMARY 0x4 /* module is a krtld primary kernel object */
#ifdef __FreeBSD__
/*
* A representation of a FreeBSD kernel module, used when checking module
* dependencies. This differs from dt_module_t, which refers to a KLD in the
* case of kernel probes. Since modules can be identified regardless of whether
* they've been compiled into the kernel, we use them to identify DTrace
* modules.
*/
typedef struct dt_kmodule {
struct dt_kmodule *dkm_next; /* hash table entry */
char *dkm_name; /* string name of module */
dt_module_t *dkm_module; /* corresponding KLD module */
} dt_kmodule_t;
#endif
typedef struct dt_provmod { typedef struct dt_provmod {
char *dp_name; /* name of provider module */ char *dp_name; /* name of provider module */
struct dt_provmod *dp_next; /* next module */ struct dt_provmod *dp_next; /* next module */
@@ -235,6 +250,9 @@ struct dtrace_hdl {
dt_idhash_t *dt_tls; /* hash table of thread-local identifiers */ dt_idhash_t *dt_tls; /* hash table of thread-local identifiers */
dt_list_t dt_modlist; /* linked list of dt_module_t's */ dt_list_t dt_modlist; /* linked list of dt_module_t's */
dt_module_t **dt_mods; /* hash table of dt_module_t's */ dt_module_t **dt_mods; /* hash table of dt_module_t's */
#ifdef __FreeBSD__
dt_kmodule_t **dt_kmods; /* hash table of dt_kmodule_t's */
#endif
uint_t dt_modbuckets; /* number of module hash buckets */ uint_t dt_modbuckets; /* number of module hash buckets */
uint_t dt_nmods; /* number of modules in hash and list */ uint_t dt_nmods; /* number of modules in hash and list */
dt_provmod_t *dt_provmod; /* linked list of provider modules */ dt_provmod_t *dt_provmod; /* linked list of provider modules */
@@ -37,6 +37,7 @@
#else #else
#include <sys/param.h> #include <sys/param.h>
#include <sys/linker.h> #include <sys/linker.h>
#include <sys/module.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
@@ -542,6 +543,22 @@ dt_module_lookup_by_ctf(dtrace_hdl_t *dtp, ctf_file_t *ctfp)
return (ctfp ? ctf_getspecific(ctfp) : NULL); return (ctfp ? ctf_getspecific(ctfp) : NULL);
} }
#ifdef __FreeBSD__
dt_kmodule_t *
dt_kmodule_lookup(dtrace_hdl_t *dtp, const char *name)
{
uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_modbuckets;
dt_kmodule_t *dkmp;
for (dkmp = dtp->dt_kmods[h]; dkmp != NULL; dkmp = dkmp->dkm_next) {
if (strcmp(dkmp->dkm_name, name) == 0)
return (dkmp);
}
return (NULL);
}
#endif
static int static int
dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp) dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp)
{ {
@@ -1124,6 +1141,12 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
char fname[MAXPATHLEN]; char fname[MAXPATHLEN];
struct stat64 st; struct stat64 st;
int fd, err, bits; int fd, err, bits;
#ifdef __FreeBSD__
struct module_stat ms;
dt_kmodule_t *dkmp;
uint_t h;
int modid;
#endif
dt_module_t *dmp; dt_module_t *dmp;
const char *s; const char *s;
@@ -1270,6 +1293,33 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
if (dmp->dm_info.objfs_info_primary) if (dmp->dm_info.objfs_info_primary)
dmp->dm_flags |= DT_DM_PRIMARY; dmp->dm_flags |= DT_DM_PRIMARY;
#ifdef __FreeBSD__
ms.version = sizeof(ms);
for (modid = kldfirstmod(k_stat->id); modid > 0;
modid = modnext(modid)) {
if (modstat(modid, &ms) != 0) {
dt_dprintf("modstat failed for id %d in %s: %s\n",
modid, k_stat->name, strerror(errno));
continue;
}
if (dt_kmodule_lookup(dtp, ms.name) != NULL)
continue;
dkmp = malloc(sizeof (*dkmp));
if (dkmp == NULL) {
dt_dprintf("failed to allocate memory\n");
dt_module_destroy(dtp, dmp);
return;
}
h = dt_strtab_hash(ms.name, NULL) % dtp->dt_modbuckets;
dkmp->dkm_next = dtp->dt_kmods[h];
dkmp->dkm_name = strdup(ms.name);
dkmp->dkm_module = dmp;
dtp->dt_kmods[h] = dkmp;
}
#endif
dt_dprintf("opened %d-bit module %s (%s) [%d]\n", dt_dprintf("opened %d-bit module %s (%s) [%d]\n",
bits, dmp->dm_name, dmp->dm_file, dmp->dm_modid); bits, dmp->dm_name, dmp->dm_file, dmp->dm_modid);
} }
@@ -44,6 +44,10 @@ extern void dt_module_destroy(dtrace_hdl_t *, dt_module_t *);
extern dt_module_t *dt_module_lookup_by_name(dtrace_hdl_t *, const char *); extern dt_module_t *dt_module_lookup_by_name(dtrace_hdl_t *, const char *);
extern dt_module_t *dt_module_lookup_by_ctf(dtrace_hdl_t *, ctf_file_t *); extern dt_module_t *dt_module_lookup_by_ctf(dtrace_hdl_t *, ctf_file_t *);
#ifdef __FreeBSD__
extern dt_kmodule_t *dt_kmodule_lookup(dtrace_hdl_t *, const char *);
#endif
extern int dt_module_hasctf(dtrace_hdl_t *, dt_module_t *); extern int dt_module_hasctf(dtrace_hdl_t *, dt_module_t *);
extern ctf_file_t *dt_module_getctf(dtrace_hdl_t *, dt_module_t *); extern ctf_file_t *dt_module_getctf(dtrace_hdl_t *, dt_module_t *);
extern dt_ident_t *dt_module_extern(dtrace_hdl_t *, dt_module_t *, extern dt_ident_t *dt_module_extern(dtrace_hdl_t *, dt_module_t *,
@@ -1178,6 +1178,9 @@ dt_vopen(int version, int flags, int *errp,
#endif #endif
dtp->dt_modbuckets = _dtrace_strbuckets; dtp->dt_modbuckets = _dtrace_strbuckets;
dtp->dt_mods = calloc(dtp->dt_modbuckets, sizeof (dt_module_t *)); dtp->dt_mods = calloc(dtp->dt_modbuckets, sizeof (dt_module_t *));
#ifdef __FreeBSD__
dtp->dt_kmods = calloc(dtp->dt_modbuckets, sizeof (dt_module_t *));
#endif
dtp->dt_provbuckets = _dtrace_strbuckets; dtp->dt_provbuckets = _dtrace_strbuckets;
dtp->dt_provs = calloc(dtp->dt_provbuckets, sizeof (dt_provider_t *)); dtp->dt_provs = calloc(dtp->dt_provbuckets, sizeof (dt_provider_t *));
dt_proc_hash_create(dtp); dt_proc_hash_create(dtp);
@@ -1199,6 +1202,7 @@ dt_vopen(int version, int flags, int *errp,
if (dtp->dt_mods == NULL || dtp->dt_provs == NULL || if (dtp->dt_mods == NULL || dtp->dt_provs == NULL ||
dtp->dt_procs == NULL || dtp->dt_ld_path == NULL || dtp->dt_procs == NULL || dtp->dt_ld_path == NULL ||
#ifdef __FreeBSD__ #ifdef __FreeBSD__
dtp->dt_kmods == NULL ||
dtp->dt_objcopy_path == NULL || dtp->dt_objcopy_path == NULL ||
#endif #endif
dtp->dt_cpp_path == NULL || dtp->dt_cpp_argv == NULL) dtp->dt_cpp_path == NULL || dtp->dt_cpp_argv == NULL)
@@ -1621,6 +1625,10 @@ dtrace_close(dtrace_hdl_t *dtp)
dtrace_prog_t *pgp; dtrace_prog_t *pgp;
dt_xlator_t *dxp; dt_xlator_t *dxp;
dt_dirpath_t *dirp; dt_dirpath_t *dirp;
#ifdef __FreeBSD__
dt_kmodule_t *dkm;
uint_t h;
#endif
int i; int i;
if (dtp->dt_procs != NULL) if (dtp->dt_procs != NULL)
@@ -1648,6 +1656,15 @@ dtrace_close(dtrace_hdl_t *dtp)
if (dtp->dt_tls != NULL) if (dtp->dt_tls != NULL)
dt_idhash_destroy(dtp->dt_tls); dt_idhash_destroy(dtp->dt_tls);
#ifdef __FreeBSD__
for (h = 0; h < dtp->dt_modbuckets; h++)
while ((dkm = dtp->dt_kmods[h]) != NULL) {
dtp->dt_kmods[h] = dkm->dkm_next;
free(dkm->dkm_name);
free(dkm);
}
#endif
while ((dmp = dt_list_next(&dtp->dt_modlist)) != NULL) while ((dmp = dt_list_next(&dtp->dt_modlist)) != NULL)
dt_module_destroy(dtp, dmp); dt_module_destroy(dtp, dmp);
@@ -1697,6 +1714,9 @@ dtrace_close(dtrace_hdl_t *dtp)
#endif #endif
free(dtp->dt_mods); free(dtp->dt_mods);
#ifdef __FreeBSD__
free(dtp->dt_kmods);
#endif
free(dtp->dt_provs); free(dtp->dt_provs);
free(dtp); free(dtp);
} }
@@ -278,6 +278,14 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
} else if (strcmp(cnp->dn_string, "module") == 0) { } else if (strcmp(cnp->dn_string, "module") == 0) {
dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string); dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
found = mp != NULL && dt_module_getctf(dtp, mp) != NULL; found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
#ifdef __FreeBSD__
if (!found) {
dt_kmodule_t *dkmp = dt_kmodule_lookup(dtp,
nnp->dn_string);
found = dkmp != NULL &&
dt_module_getctf(dtp, dkmp->dkm_module) != NULL;
}
#endif
} else if (strcmp(cnp->dn_string, "library") == 0) { } else if (strcmp(cnp->dn_string, "library") == 0) {
if (yypcb->pcb_cflags & DTRACE_C_CTL) { if (yypcb->pcb_cflags & DTRACE_C_CTL) {
assert(dtp->dt_filetag != NULL); assert(dtp->dt_filetag != NULL);
@@ -23,6 +23,7 @@
* Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2015 RackTop Systems.
*/ */
/* /*
@@ -1094,11 +1095,7 @@ zpool_open_func(void *arg)
} }
(void) close(fd); (void) close(fd);
rn->rn_config = config; rn->rn_config = config;
if (config != NULL) {
assert(rn->rn_nozpool == B_FALSE);
}
} }
/* /*
+14
View File
@@ -0,0 +1,14 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
include \
include/xlocale \
lib/libelf \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+21
View File
@@ -0,0 +1,21 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libelf \
lib/libz \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+53
View File
@@ -0,0 +1,53 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libctf \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/arpa \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libelf \
lib/libproc \
lib/librtld_db \
lib/libthr \
usr.bin/xinstall.host \
usr.bin/yacc.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
dt_cc.So: dt_grammar.h
dt_cc.o: dt_grammar.h
dt_cc.po: dt_grammar.h
dt_cg.So: dt_grammar.h
dt_cg.o: dt_grammar.h
dt_cg.po: dt_grammar.h
dt_errtags.So: dt_errtags.c
dt_errtags.o: dt_errtags.c
dt_errtags.po: dt_errtags.c
dt_grammar.So: dt_grammar.c
dt_grammar.o: dt_grammar.c
dt_grammar.po: dt_grammar.c
dt_lex.So: dt_grammar.h
dt_lex.So: dt_lex.c
dt_lex.o: dt_grammar.h
dt_lex.o: dt_lex.c
dt_lex.po: dt_grammar.h
dt_lex.po: dt_lex.c
dt_names.So: dt_names.c
dt_names.o: dt_names.c
dt_names.po: dt_names.c
dt_parser.So: dt_grammar.h
dt_parser.o: dt_grammar.h
dt_parser.po: dt_grammar.h
dt_xlator.So: dt_grammar.h
dt_xlator.o: dt_grammar.h
dt_xlator.po: dt_grammar.h
.endif
+20
View File
@@ -0,0 +1,20 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/msun \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+18
View File
@@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+19
View File
@@ -0,0 +1,19 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+30
View File
@@ -0,0 +1,30 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs_core \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libthr \
lib/libutil \
lib/msun \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+21
View File
@@ -0,0 +1,21 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libnvpair \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/msun \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+26
View File
@@ -0,0 +1,26 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libmd \
lib/libthr \
lib/libz \
lib/msun \
usr.bin/xinstall.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+32
View File
@@ -0,0 +1,32 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libjail \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+31
View File
@@ -0,0 +1,31 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+26
View File
@@ -0,0 +1,26 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
cddl/lib/libctf \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libc_nonshared \
lib/libcompiler_rt \
lib/libdwarf \
lib/libelf \
lib/libthr \
lib/libz \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+24
View File
@@ -0,0 +1,24 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libc_nonshared \
lib/libcompiler_rt \
lib/libelf \
lib/libthr \
lib/libz \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+26
View File
@@ -0,0 +1,26 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
cddl/lib/libctf \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libc_nonshared \
lib/libcompiler_rt \
lib/libdwarf \
lib/libelf \
lib/libthr \
lib/libz \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+19
View File
@@ -0,0 +1,19 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libelf \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+33
View File
@@ -0,0 +1,33 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
cddl/lib/libzpool \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+26
View File
@@ -0,0 +1,26 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libzpool \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libmd \
lib/libthr \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+33
View File
@@ -0,0 +1,33 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
cddl/lib/libzpool \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+32
View File
@@ -0,0 +1,32 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
cddl/lib/libctf \
cddl/lib/libdtrace \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libc_nonshared \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libproc \
lib/librtld_db \
lib/libthr \
lib/libutil \
lib/liby \
lib/libz \
usr.bin/lex/lib \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+13
View File
@@ -0,0 +1,13 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+28
View File
@@ -0,0 +1,28 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libctf \
cddl/lib/libdtrace \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libproc \
lib/librt \
lib/librtld_db \
lib/libthr \
lib/libutil \
lib/libz \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+33
View File
@@ -0,0 +1,33 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
cddl/lib/libzpool \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+33
View File
@@ -0,0 +1,33 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
cddl/lib/libzpool \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif
+6
View File
@@ -1,3 +1,9 @@
2015-06-06 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20150606
Merge with NetBSD make, pick up
o make.1: document .OBJDIR target
2015-05-05 Simon J. Gerraty <sjg@bad.crufty.net> 2015-05-05 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20150505 * Makefile (MAKE_VERSION): 20150505
+2 -2
View File
@@ -1,7 +1,7 @@
# $Id: Makefile,v 1.38 2015/05/05 21:58:05 sjg Exp $ # $Id: Makefile,v 1.39 2015/06/07 15:54:37 sjg Exp $
# Base version on src date # Base version on src date
MAKE_VERSION= 20150505 MAKE_VERSION= 20150606
PROG= bmake PROG= bmake
+15 -5
View File
@@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.247 2015/04/10 08:43:32 wiz Exp $ .\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $
.\" .\"
.\" Copyright (c) 1990, 1993 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd April 9, 2015 .Dd June 4, 2015
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@@ -993,14 +993,15 @@ This is especially useful with
.Ql Ev MAKEOBJDIR . .Ql Ev MAKEOBJDIR .
.Pp .Pp
.Ql Va .OBJDIR .Ql Va .OBJDIR
may be modified in the makefile as a global variable. may be modified in the makefile via the special target
.Ql Ic .OBJDIR .
In all cases, In all cases,
.Nm .Nm
will will
.Xr chdir 2 .Xr chdir 2
to to the specified directory if it exists, and set
.Ql Va .OBJDIR .Ql Va .OBJDIR
and set and
.Ql Ev PWD .Ql Ev PWD
to that directory before executing any targets. to that directory before executing any targets.
. .
@@ -2001,6 +2002,15 @@ Disable parallel mode.
Synonym for Synonym for
.Ic .NOTPARALLEL , .Ic .NOTPARALLEL ,
for compatibility with other pmake variants. for compatibility with other pmake variants.
.It Ic .OBJDIR
The source is a new value for
.Ql Va .OBJDIR .
If it exists,
.Nm
will
.Xr chdir 2
to it and update the value of
.Ql Va .OBJDIR .
.It Ic .ORDER .It Ic .ORDER
The named targets are made in sequence. The named targets are made in sequence.
This ordering does not add targets to the list of targets to be made. This ordering does not add targets to the list of targets to be made.
+8 -5
View File
@@ -647,10 +647,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
may be used. This is especially useful with may be used. This is especially useful with
`MAKEOBJDIR'. `MAKEOBJDIR'.
`_._O_B_J_D_I_R' may be modified in the makefile as a global `_._O_B_J_D_I_R' may be modified in the makefile via the special
variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' target `..OOBBJJDDIIRR'. In all cases, bbmmaakkee will chdir(2) to
and set `PWD' to that directory before executing any tar- the specified directory if it exists, and set `_._O_B_J_D_I_R'
gets. and `PWD' to that directory before executing any targets.
_._P_A_R_S_E_D_I_R A path to the directory of the current `_M_a_k_e_f_i_l_e' being _._P_A_R_S_E_D_I_R A path to the directory of the current `_M_a_k_e_f_i_l_e' being
parsed. parsed.
@@ -1271,6 +1271,9 @@ SSPPEECCIIAALL TTAARRGGEETTSS
Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake
variants. variants.
..OOBBJJDDIIRR The source is a new value for `_._O_B_J_D_I_R'. If it exists, bbmmaakkee
will chdir(2) to it and update the value of `_._O_B_J_D_I_R'.
..OORRDDEERR The named targets are made in sequence. This ordering does not ..OORRDDEERR The named targets are made in sequence. This ordering does not
add targets to the list of targets to be made. Since the depen- add targets to the list of targets to be made. Since the depen-
dents of a target do not get built until the target itself could dents of a target do not get built until the target itself could
@@ -1449,4 +1452,4 @@ BBUUGGSS
There is no way of escaping a space character in a filename. There is no way of escaping a space character in a filename.
NetBSD 5.1 April 9, 2015 NetBSD 5.1 NetBSD 5.1 June 4, 2015 NetBSD 5.1
+15 -5
View File
@@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.247 2015/04/10 08:43:32 wiz Exp $ .\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $
.\" .\"
.\" Copyright (c) 1990, 1993 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd April 9, 2015 .Dd June 4, 2015
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@@ -1004,14 +1004,15 @@ This is especially useful with
.Ql Ev MAKEOBJDIR . .Ql Ev MAKEOBJDIR .
.Pp .Pp
.Ql Va .OBJDIR .Ql Va .OBJDIR
may be modified in the makefile as a global variable. may be modified in the makefile via the special target
.Ql Ic .OBJDIR .
In all cases, In all cases,
.Nm .Nm
will will
.Xr chdir 2 .Xr chdir 2
to to the specified directory if it exists, and set
.Ql Va .OBJDIR .Ql Va .OBJDIR
and set and
.Ql Ev PWD .Ql Ev PWD
to that directory before executing any targets. to that directory before executing any targets.
. .
@@ -2012,6 +2013,15 @@ Disable parallel mode.
Synonym for Synonym for
.Ic .NOTPARALLEL , .Ic .NOTPARALLEL ,
for compatibility with other pmake variants. for compatibility with other pmake variants.
.It Ic .OBJDIR
The source is a new value for
.Ql Va .OBJDIR .
If it exists,
.Nm
will
.Xr chdir 2
to it and update the value of
.Ql Va .OBJDIR .
.It Ic .ORDER .It Ic .ORDER
The named targets are made in sequence. The named targets are made in sequence.
This ordering does not add targets to the list of targets to be made. This ordering does not add targets to the list of targets to be made.
+26
View File
@@ -1,3 +1,29 @@
2015-06-06 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20150606
* dirdeps.mk: don't rely on manually maintained Makefile.depend
to set DEP_RELDIR and reset DIRDEPS.
By setting DEP_RELDIR ourselves we can skip :tA
* gendirdeps.mk: skip setting DEP_RELDIR.
2015-05-24 Simon J. Gerraty <sjg@bad.crufty.net>
* dirdeps.mk: avoid wildcards like make(bootstrap*)
2015-05-20 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20150520
* dirdeps.mk: when we are building dirdeps cache file we *want*
meta_oodate to look at all the Makefile.depend files, so
set .MAKE.DEPENDFILE to something that won't match.
* meta.stage.mk: for STAGE_AS_* basename of file may not be unique
so first use absolute path as key.
Also skip staging at level 0.
2015-04-30 Simon J. Gerraty <sjg@bad.crufty.net> 2015-04-30 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20150430 * install-mk (MK_VERSION): 20150430
+11 -3
View File
@@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.51 2015/05/06 06:07:30 sjg Exp $ # $Id: dirdeps.mk,v 1.54 2015/06/08 20:55:11 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc. # Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved. # All rights reserved.
@@ -383,6 +383,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
DIRDEPS="${DIRDEPS}" \ DIRDEPS="${DIRDEPS}" \
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \ MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
.MAKE.DEPENDFILE=.none \
3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \ 3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \
mv ${.TARGET}.new ${.TARGET} mv ${.TARGET}.new ${.TARGET}
@@ -587,6 +588,11 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
_DEP_TARGET_SPEC := ${d:E} _DEP_TARGET_SPEC := ${d:E}
# some makefiles may still look at this # some makefiles may still look at this
_DEP_MACHINE := ${d:E:C/,.*//} _DEP_MACHINE := ${d:E:C/,.*//}
# set this "just in case"
# we can skip :tA since we computed the path above
DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,}
# and reset this
DIRDEPS =
.if ${_debug_reldir} && ${_qm} != ${_m} .if ${_debug_reldir} && ${_qm} != ${_m}
.info loading ${_m} for ${d:E} .info loading ${_m} for ${d:E}
.endif .endif
@@ -602,13 +608,15 @@ _DEP_MACHINE := ${d:E:C/,.*//}
.elif ${.MAKE.LEVEL} > 42 .elif ${.MAKE.LEVEL} > 42
.error You should have stopped recursing by now. .error You should have stopped recursing by now.
.else .else
_DEP_RELDIR := ${DEP_RELDIR} # we are building something
DEP_RELDIR := ${RELDIR}
_DEP_RELDIR := ${RELDIR}
# pickup local dependencies # pickup local dependencies
.-include <.depend> .-include <.depend>
.endif .endif
# bootstrapping new dependencies made easy? # bootstrapping new dependencies made easy?
.if make(bootstrap*) && !target(bootstrap) .if (make(bootstrap) || make(bootstrap-recurse)) && !target(bootstrap)
.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) .if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T})
# stop here # stop here
+1 -3
View File
@@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.26 2014/09/05 04:40:52 sjg Exp $ # $Id: gendirdeps.mk,v 1.27 2015/06/08 20:55:11 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc. # Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved. # All rights reserved.
@@ -311,7 +311,6 @@ CAT_DEPEND ?= .depend
# to output _{VAR} tokens which we will turn into proper ${VAR} references. # to output _{VAR} tokens which we will turn into proper ${VAR} references.
${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS} ${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS}
@(echo '# Autogenerated - do NOT edit!'; echo; \ @(echo '# Autogenerated - do NOT edit!'; echo; \
echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \
echo 'DIRDEPS = \'; \ echo 'DIRDEPS = \'; \
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \ echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
${_include_src_dirdeps} \ ${_include_src_dirdeps} \
@@ -332,7 +331,6 @@ all: ${_DEPENDFILE}
${_DEPENDFILE}: ${MAKEFILE} ${_this} ${_DEPENDFILE}: ${MAKEFILE} ${_this}
@(echo '# Autogenerated - do NOT edit!'; echo; \ @(echo '# Autogenerated - do NOT edit!'; echo; \
echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \
echo 'DIRDEPS = \'; \ echo 'DIRDEPS = \'; \
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \ echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
echo '.include <dirdeps.mk>'; \ echo '.include <dirdeps.mk>'; \
+2 -2
View File
@@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net> # Simon J. Gerraty <sjg@crufty.net>
# RCSid: # RCSid:
# $Id: install-mk,v 1.110 2015/05/01 06:37:49 sjg Exp $ # $Id: install-mk,v 1.112 2015/06/08 20:55:11 sjg Exp $
# #
# @(#) Copyright (c) 1994 Simon J. Gerraty # @(#) Copyright (c) 1994 Simon J. Gerraty
# #
@@ -70,7 +70,7 @@
# sjg@crufty.net # sjg@crufty.net
# #
MK_VERSION=20150430 MK_VERSION=20150606
OWNER= OWNER=
GROUP= GROUP=
MODE=444 MODE=444
+4 -2
View File
@@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.34 2014/11/20 22:40:08 sjg Exp $ # $Id: meta.stage.mk,v 1.35 2015/05/20 06:40:33 sjg Exp $
# #
# @(#) Copyright (c) 2011, Simon J. Gerraty # @(#) Copyright (c) 2011, Simon J. Gerraty
# #
@@ -218,7 +218,7 @@ STAGE_AS.$s ?= ${.ALLSRC:N.dirdep}
stage_as: stage_as.$s stage_as: stage_as.$s
stage_as.$s: .dirdep stage_as.$s: .dirdep
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:T}:U${f:T}}@} @${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
@touch $@ @touch $@
.endfor .endfor
@@ -238,7 +238,9 @@ staging:
# generally we want staging to wait until everything else is done # generally we want staging to wait until everything else is done
STAGING_WAIT ?= .WAIT STAGING_WAIT ?= .WAIT
.if ${.MAKE.LEVEL} > 0
all: ${STAGING_WAIT} staging all: ${STAGING_WAIT} staging
.endif
.if exists(${.PARSEDIR}/stage-install.sh) && !defined(STAGE_INSTALL) .if exists(${.PARSEDIR}/stage-install.sh) && !defined(STAGE_INSTALL)
# this will run install(1) and then followup with .dirdep files. # this will run install(1) and then followup with .dirdep files.
+9 -4
View File
@@ -1,4 +1,4 @@
# $Id: meta.sys.mk,v 1.20 2014/08/04 05:12:27 sjg Exp $ # $Id: meta.sys.mk,v 1.21 2015/06/01 22:43:49 sjg Exp $
# #
# @(#) Copyright (c) 2010, Simon J. Gerraty # @(#) Copyright (c) 2010, Simon J. Gerraty
@@ -108,11 +108,16 @@ _metaError: .NOMETA .NOTMAIN
.if ${.MAKE.MODE:Mmeta*} != "" .if ${.MAKE.MODE:Mmeta*} != ""
MKDEP_MK = meta.autodep.mk MKDEP_MK = meta.autodep.mk
# if we think we are updating dependencies, .if ${UPDATE_DEPENDFILE:Uyes:tl} != "no"
# then filemon had better be present .if ${.MAKEFLAGS:Uno:M-k} != ""
.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) # make this more obvious
.warning Setting UPDATE_DEPENDFILE=NO due to -k
UPDATE_DEPENDFILE= NO
.export UPDATE_DEPENDFILE
.elif !exists(/dev/filemon)
.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded.
.endif .endif
.endif
.if ${.MAKE.LEVEL} == 0 .if ${.MAKE.LEVEL} == 0
# make sure dirdeps target exists and do it first # make sure dirdeps target exists and do it first

Some files were not shown because too many files have changed in this diff Show More