diff options
42 files changed, 365 insertions, 108 deletions
diff --git a/contrib/pjdfstest/tests/ftruncate/11.t b/contrib/pjdfstest/tests/ftruncate/11.t index b00d7b8..8d9f0d5 100644 --- a/contrib/pjdfstest/tests/ftruncate/11.t +++ b/contrib/pjdfstest/tests/ftruncate/11.t @@ -8,6 +8,8 @@ dir=`dirname $0` [ "${os}" = "FreeBSD" ] || quick_exit +requires_exec + echo "1..2" n0=`namegen` diff --git a/contrib/pjdfstest/tests/misc.sh b/contrib/pjdfstest/tests/misc.sh index 8978b5f..654d3dd 100755 --- a/contrib/pjdfstest/tests/misc.sh +++ b/contrib/pjdfstest/tests/misc.sh @@ -219,3 +219,37 @@ create_file() { expect 0 lchmod ${name} ${3} fi } + +# Tests for whether or not a filesystem is mounted with a particular option +# with -o, e.g. `mount -o noexec`. +# +# Parameters: +# - mount_option - noatime, noexec, etc. +# +# Returns: +# - 0 if mounted with the option. +# - 1 otherwise. +has_mount_option() +{ + local IFS=, + local mount_opt + + local mount_option_search=$1 + + # XXX: mountpoint is defined in .../tests/sys/pjdfstest/tests/conf + for mount_opt in $(mount -d -p | awk '$2 == "'$mountpoint'" { print $4 }'); do + if [ "$mount_opt" = "$mount_option_search" ]; then + return 0 + fi + done + return 1 +} + +# Filesystem must be mounted with -o exec +requires_exec() +{ + if has_mount_option noexec; then + echo "1..0 # SKIP filesystem mounted with -o noexec" + exit 0 + fi +} diff --git a/contrib/pjdfstest/tests/open/20.t b/contrib/pjdfstest/tests/open/20.t index de80b61..a7eb3db 100644 --- a/contrib/pjdfstest/tests/open/20.t +++ b/contrib/pjdfstest/tests/open/20.t @@ -8,6 +8,8 @@ dir=`dirname $0` [ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit +requires_exec + echo "1..4" n0=`namegen` diff --git a/contrib/pjdfstest/tests/truncate/11.t b/contrib/pjdfstest/tests/truncate/11.t index b00d7b8..8d9f0d5 100644 --- a/contrib/pjdfstest/tests/truncate/11.t +++ b/contrib/pjdfstest/tests/truncate/11.t @@ -8,6 +8,8 @@ dir=`dirname $0` [ "${os}" = "FreeBSD" ] || quick_exit +requires_exec + echo "1..2" n0=`namegen` diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 9456f70..93f1ee4 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -219,15 +219,11 @@ xdr_putint32(XDR *xdrs, int32_t *ip) (*(xdrs)->x_ops->x_control)(xdrs, req, op) #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op) -/* - * Solaris strips the '_t' from these types -- not sure why. - * But, let's be compatible. - */ -#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp) -#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp) -#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp) -#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp) -#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp) +#define xdr_rpcvers(xdrs, versp) xdr_u_int32_t(xdrs, versp) +#define xdr_rpcprog(xdrs, progp) xdr_u_int32_t(xdrs, progp) +#define xdr_rpcproc(xdrs, procp) xdr_u_int32_t(xdrs, procp) +#define xdr_rpcprot(xdrs, protp) xdr_u_int32_t(xdrs, protp) +#define xdr_rpcport(xdrs, portp) xdr_u_int32_t(xdrs, portp) /* * Support struct for discriminated unions. diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c index 942d07e..2e98c6a 100644 --- a/lib/libc/rpc/svc_simple.c +++ b/lib/libc/rpc/svc_simple.c @@ -272,7 +272,7 @@ universal(rqstp, transp) /* decode arguments into a CLEAN buffer */ xdrbuf = pl->p_xdrbuf; /* Zero the arguments: reqd ! */ - (void) memset(xdrbuf, 0, sizeof (pl->p_recvsz)); + (void) memset(xdrbuf, 0, (size_t)pl->p_recvsz); /* * Assuming that sizeof (xdrbuf) would be enough * for the arguments; if not then the program diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 51fa291..8b333dd 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -38,7 +38,7 @@ SYMBOL_MAPS=${.CURDIR}/pthread.map MAN= libthr.3 -# enable extra internal consistancy checks +# enable extra internal consistency checks CFLAGS+=-D_PTHREADS_INVARIANTS PRECIOUSLIB= diff --git a/sbin/mdmfs/mdmfs.8 b/sbin/mdmfs/mdmfs.8 index ab5e1be..f38d29d 100644 --- a/sbin/mdmfs/mdmfs.8 +++ b/sbin/mdmfs/mdmfs.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 4, 2011 +.Dd March 7, 2016 .Dt MDMFS 8 .Os .Sh NAME @@ -36,7 +36,7 @@ driver .Sh SYNOPSIS .Nm -.Op Fl DLlMNPStUX +.Op Fl DLlMNnPStUX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group @@ -47,7 +47,6 @@ driver .Op Fl f Ar frag-size .Op Fl i Ar bytes .Op Fl m Ar percent-free -.Op Fl n Ar rotational-positions .Op Fl O Ar optimization .Op Fl o Ar mount-options .Op Fl p Ar permissions @@ -167,8 +166,10 @@ The percentage of space reserved for the superuser. Do not actually run the helper programs. This is most useful in conjunction with .Fl X . -.It Fl n Ar rotational-positions -The default number of rotational positions to distinguish. +.It Fl n +Do not create a +.Pa .snap +directory on the new file system. .It Fl O Ar optimization Select the optimization preference; valid choices are diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index c4a571b..2c3f632 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -580,7 +580,9 @@ MLINKS+=cfi.4 cfid.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=cxgb.4 if_cxgb.4 -MLINKS+=cxgbe.4 if_cxgbe.4 +MLINKS+=cxgbe.4 if_cxgbe.4 \ + cxgbe.4 cxl.4 \ + cxgbe.4 if_cxl.4 MLINKS+=dc.4 if_dc.4 MLINKS+=de.4 if_de.4 MLINKS+=disc.4 if_disc.4 diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index 4178fbc..2aa5528 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -9,13 +9,15 @@ __<bsd.files.mk>__: FILESGROUPS?= FILES -.for group in ${FILESGROUPS} +_FILESGROUPS= ${FILESGROUPS:C,[/*],_,g} + +.for group in ${_FILESGROUPS} buildfiles: ${${group}} .endfor all: buildfiles -.for group in ${FILESGROUPS} +.for group in ${_FILESGROUPS} .if defined(${group}) && !empty(${group}) installfiles: installfiles-${group} diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk index 74c378b..1b5f17f 100644 --- a/share/mk/bsd.incs.mk +++ b/share/mk/bsd.incs.mk @@ -8,8 +8,10 @@ INCSGROUPS?= INCS +_INCSGROUPS= ${INCSGROUPS:C,[/*],_,g} + .if !target(buildincludes) -.for group in ${INCSGROUPS} +.for group in ${_INCSGROUPS} buildincludes: ${${group}} .endfor .endif @@ -17,7 +19,7 @@ buildincludes: ${${group}} all: buildincludes .if !target(installincludes) -.for group in ${INCSGROUPS} +.for group in ${_INCSGROUPS} .if defined(${group}) && !empty(${group}) ${group}OWN?= ${BINOWN} diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c index de8b620..17e3735 100644 --- a/sys/amd64/linux32/linux32_dummy.c +++ b/sys/amd64/linux32/linux32_dummy.c @@ -70,7 +70,6 @@ DUMMY(mincore); DUMMY(ptrace); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); -DUMMY(fstatfs64); DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 124abb1..0f98b94 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ #ifndef _LINUX32_SYSPROTO_H_ @@ -844,7 +844,9 @@ struct linux_statfs64_args { char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * buf; char buf_r_[PADR_(struct l_statfs64_buf *)]; }; struct linux_fstatfs64_args { - register_t dummy; + char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; + char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; + char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * buf; char buf_r_[PADR_(struct l_statfs64_buf *)]; }; struct linux_tgkill_args { char tgid_l_[PADL_(int)]; int tgid; char tgid_r_[PADR_(int)]; diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h index 29c78a6..25747e4 100644 --- a/sys/amd64/linux32/linux32_syscall.h +++ b/sys/amd64/linux32/linux32_syscall.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ #define LINUX32_SYS_linux_exit 1 diff --git a/sys/amd64/linux32/linux32_syscalls.c b/sys/amd64/linux32/linux32_syscalls.c index 8e7585a..ef965d7 100644 --- a/sys/amd64/linux32/linux32_syscalls.c +++ b/sys/amd64/linux32/linux32_syscalls.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ const char *linux32_syscallnames[] = { diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index f254a86..6eb215e 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ #include "opt_compat.h" @@ -288,7 +288,7 @@ struct sysent linux32_sysent[] = { { AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 266 = linux_clock_getres */ { AS(linux_clock_nanosleep_args), (sy_call_t *)linux_clock_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 267 = linux_clock_nanosleep */ { AS(linux_statfs64_args), (sy_call_t *)linux_statfs64, AUE_STATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 268 = linux_statfs64 */ - { 0, (sy_call_t *)linux_fstatfs64, AUE_FSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 269 = linux_fstatfs64 */ + { AS(linux_fstatfs64_args), (sy_call_t *)linux_fstatfs64, AUE_FSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 269 = linux_fstatfs64 */ { AS(linux_tgkill_args), (sy_call_t *)linux_tgkill, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 270 = linux_tgkill */ { AS(linux_utimes_args), (sy_call_t *)linux_utimes, AUE_UTIMES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 271 = linux_utimes */ { AS(linux_fadvise64_64_args), (sy_call_t *)linux_fadvise64_64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 272 = linux_fadvise64_64 */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 80889bf..fc4c89a 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -1820,7 +1820,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_fstatfs64 */ case 269: { - *n_args = 0; + struct linux_fstatfs64_args *p = params; + iarg[0] = p->fd; /* l_uint */ + uarg[1] = p->bufsize; /* size_t */ + uarg[2] = (intptr_t) p->buf; /* struct l_statfs64_buf * */ + *n_args = 3; break; } /* linux_tgkill */ @@ -5118,6 +5122,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_fstatfs64 */ case 269: + switch(ndx) { + case 0: + p = "l_uint"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "struct l_statfs64_buf *"; + break; + default: + break; + }; break; /* linux_tgkill */ case 270: @@ -6878,6 +6895,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_fstatfs64 */ case 269: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_tgkill */ case 270: if (ndx == 0 || ndx == 1) diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 0396b30..e40247e 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -450,7 +450,7 @@ 267 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \ struct l_timespec *rqtp, struct l_timespec *rmtp); } 268 AUE_STATFS STD { int linux_statfs64(char *path, size_t bufsize, struct l_statfs64_buf *buf); } -269 AUE_FSTATFS STD { int linux_fstatfs64(void); } +269 AUE_FSTATFS STD { int linux_fstatfs64(l_uint fd, size_t bufsize, struct l_statfs64_buf *buf); } 270 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); } 271 AUE_UTIMES STD { int linux_utimes(char *fname, \ struct l_timeval *tptr); } diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 9e7c71f..f96559c 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -213,6 +213,18 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args) if (args->flags & LINUX_CLONE_SETTLS) linux_set_cloned_tls(td2, args->tls); + /* + * If CLONE_PARENT is set, then the parent of the new process will be + * the same as that of the calling process. + */ + if (args->flags & LINUX_CLONE_PARENT) { + sx_xlock(&proctree_lock); + PROC_LOCK(p2); + proc_reparent(p2, td->td_proc->p_pptr); + PROC_UNLOCK(p2); + sx_xunlock(&proctree_lock); + } + #ifdef DEBUG if (ldebug(clone)) printf(LMSG("clone: successful rfork to %d, " diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 538b9dc..e806d87 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -198,24 +198,27 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args) if (ldebug(alarm)) printf(ARGS(alarm, "%u"), args->secs); #endif - secs = args->secs; + /* + * Linux alarm() is always successfull. Limit secs to INT32_MAX / 2 + * to match kern_setitimer()'s limit to avoid error from it. + * + * XXX. Linux limit secs to INT_MAX on 32 and does not limit on 64-bit + * platforms. + */ + if (secs > INT32_MAX / 2) + secs = INT32_MAX / 2; - if (secs > INT_MAX) - secs = INT_MAX; - - it.it_value.tv_sec = (long) secs; + it.it_value.tv_sec = secs; it.it_value.tv_usec = 0; - it.it_interval.tv_sec = 0; - it.it_interval.tv_usec = 0; + timevalclear(&it.it_interval); error = kern_setitimer(td, ITIMER_REAL, &it, &old_it); - if (error) - return (error); - if (timevalisset(&old_it.it_value)) { - if (old_it.it_value.tv_usec != 0) - old_it.it_value.tv_sec++; - td->td_retval[0] = old_it.it_value.tv_sec; - } + KASSERT(error == 0, ("kern_setitimer returns %d", error)); + + if ((old_it.it_value.tv_sec == 0 && old_it.it_value.tv_usec > 0) || + old_it.it_value.tv_usec >= 500000) + old_it.it_value.tv_sec++; + td->td_retval[0] = old_it.it_value.tv_sec; return (0); } diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index dee4093..c19167a 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -289,6 +289,63 @@ linux_to_bsd_ip_sockopt(int opt) } static int +linux_to_bsd_ip6_sockopt(int opt) +{ + + switch (opt) { + case LINUX_IPV6_NEXTHOP: + return (IPV6_NEXTHOP); + case LINUX_IPV6_UNICAST_HOPS: + return (IPV6_UNICAST_HOPS); + case LINUX_IPV6_MULTICAST_IF: + return (IPV6_MULTICAST_IF); + case LINUX_IPV6_MULTICAST_HOPS: + return (IPV6_MULTICAST_HOPS); + case LINUX_IPV6_MULTICAST_LOOP: + return (IPV6_MULTICAST_LOOP); + case LINUX_IPV6_ADD_MEMBERSHIP: + return (IPV6_JOIN_GROUP); + case LINUX_IPV6_DROP_MEMBERSHIP: + return (IPV6_LEAVE_GROUP); + case LINUX_IPV6_V6ONLY: + return (IPV6_V6ONLY); + case LINUX_IPV6_DONTFRAG: + return (IPV6_DONTFRAG); +#if 0 + case LINUX_IPV6_CHECKSUM: + return (IPV6_CHECKSUM); + case LINUX_IPV6_RECVPKTINFO: + return (IPV6_RECVPKTINFO); + case LINUX_IPV6_PKTINFO: + return (IPV6_PKTINFO); + case LINUX_IPV6_RECVHOPLIMIT: + return (IPV6_RECVHOPLIMIT); + case LINUX_IPV6_HOPLIMIT: + return (IPV6_HOPLIMIT); + case LINUX_IPV6_RECVHOPOPTS: + return (IPV6_RECVHOPOPTS); + case LINUX_IPV6_HOPOPTS: + return (IPV6_HOPOPTS); + case LINUX_IPV6_RTHDRDSTOPTS: + return (IPV6_RTHDRDSTOPTS); + case LINUX_IPV6_RECVRTHDR: + return (IPV6_RECVRTHDR); + case LINUX_IPV6_RTHDR: + return (IPV6_RTHDR); + case LINUX_IPV6_RECVDSTOPTS: + return (IPV6_RECVDSTOPTS); + case LINUX_IPV6_DSTOPTS: + return (IPV6_DSTOPTS); + case LINUX_IPV6_RECVPATHMTU: + return (IPV6_RECVPATHMTU); + case LINUX_IPV6_PATHMTU: + return (IPV6_PATHMTU); +#endif + } + return (-1); +} + +static int linux_to_bsd_so_sockopt(int opt) { @@ -1515,6 +1572,9 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) case IPPROTO_IP: name = linux_to_bsd_ip_sockopt(args->optname); break; + case IPPROTO_IPV6: + name = linux_to_bsd_ip6_sockopt(args->optname); + break; case IPPROTO_TCP: name = linux_to_bsd_tcp_sockopt(args->optname); break; @@ -1601,6 +1661,9 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) case IPPROTO_IP: name = linux_to_bsd_ip_sockopt(args->optname); break; + case IPPROTO_IPV6: + name = linux_to_bsd_ip6_sockopt(args->optname); + break; case IPPROTO_TCP: name = linux_to_bsd_tcp_sockopt(args->optname); break; diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index b32a969..25c0ec3 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -302,6 +302,31 @@ int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args); #define LINUX_IP_ADD_MEMBERSHIP 35 #define LINUX_IP_DROP_MEMBERSHIP 36 +#define LINUX_IPV6_CHECKSUM 7 +#define LINUX_IPV6_NEXTHOP 9 +#define LINUX_IPV6_UNICAST_HOPS 16 +#define LINUX_IPV6_MULTICAST_IF 17 +#define LINUX_IPV6_MULTICAST_HOPS 18 +#define LINUX_IPV6_MULTICAST_LOOP 19 +#define LINUX_IPV6_ADD_MEMBERSHIP 20 +#define LINUX_IPV6_DROP_MEMBERSHIP 21 +#define LINUX_IPV6_V6ONLY 26 + +#define LINUX_IPV6_RECVPKTINFO 49 +#define LINUX_IPV6_PKTINFO 50 +#define LINUX_IPV6_RECVHOPLIMIT 51 +#define LINUX_IPV6_HOPLIMIT 52 +#define LINUX_IPV6_RECVHOPOPTS 53 +#define LINUX_IPV6_HOPOPTS 54 +#define LINUX_IPV6_RTHDRDSTOPTS 55 +#define LINUX_IPV6_RECVRTHDR 56 +#define LINUX_IPV6_RTHDR 57 +#define LINUX_IPV6_RECVDSTOPTS 58 +#define LINUX_IPV6_DSTOPTS 59 +#define LINUX_IPV6_RECVPATHMTU 60 +#define LINUX_IPV6_PATHMTU 61 +#define LINUX_IPV6_DONTFRAG 62 + #define LINUX_TCP_NODELAY 1 #define LINUX_TCP_MAXSEG 2 #define LINUX_TCP_KEEPIDLE 4 diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index f96acc0..2684d82 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -256,7 +256,7 @@ static int stat_copyout(struct stat *buf, void *ubuf) { struct l_stat lbuf; - + bzero(&lbuf, sizeof(lbuf)); lbuf.st_dev = buf->st_dev; lbuf.st_ino = buf->st_ino; @@ -302,7 +302,7 @@ linux_stat(struct thread *td, struct linux_stat_args *args) return (error); } LFREEPATH(path); - return(stat_copyout(&buf, args->up)); + return (stat_copyout(&buf, args->up)); } int @@ -324,7 +324,7 @@ linux_lstat(struct thread *td, struct linux_lstat_args *args) return (error); } LFREEPATH(path); - return(stat_copyout(&buf, args->up)); + return (stat_copyout(&buf, args->up)); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ @@ -380,10 +380,22 @@ bsd_to_linux_ftype(const char *fstypename) return (0L); } -static void +static int bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs) { +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) + uint64_t tmp; +#define LINUX_HIBITS 0xffffffff00000000ULL + + tmp = bsd_statfs->f_blocks | bsd_statfs->f_bfree | bsd_statfs->f_files | + bsd_statfs->f_bsize; + if ((bsd_statfs->f_bavail != -1 && (bsd_statfs->f_bavail & LINUX_HIBITS)) || + (bsd_statfs->f_ffree != -1 && (bsd_statfs->f_ffree & LINUX_HIBITS)) || + (tmp & LINUX_HIBITS)) + return (EOVERFLOW); +#undef LINUX_HIBITS +#endif linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename); linux_statfs->f_bsize = bsd_statfs->f_bsize; linux_statfs->f_blocks = bsd_statfs->f_blocks; @@ -394,6 +406,8 @@ bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs) linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0]; linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1]; linux_statfs->f_namelen = MAXNAMLEN; + + return (0); } int @@ -414,8 +428,10 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args) LFREEPATH(path); if (error) return (error); - bsd_to_linux_statfs(&bsd_statfs, &linux_statfs); - return copyout(&linux_statfs, args->buf, sizeof(linux_statfs)); + error = bsd_to_linux_statfs(&bsd_statfs, &linux_statfs); + if (error) + return (error); + return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs))); } #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) @@ -457,7 +473,28 @@ linux_statfs64(struct thread *td, struct linux_statfs64_args *args) if (error) return (error); bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs); - return copyout(&linux_statfs, args->buf, sizeof(linux_statfs)); + return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs))); +} + +int +linux_fstatfs64(struct thread *td, struct linux_fstatfs64_args *args) +{ + struct l_statfs64 linux_statfs; + struct statfs bsd_statfs; + int error; + +#ifdef DEBUG + if (ldebug(fstatfs64)) + printf(ARGS(fstatfs64, "%d, *"), args->fd); +#endif + if (args->bufsize != sizeof(struct l_statfs64)) + return (EINVAL); + + error = kern_fstatfs(td, args->fd, &bsd_statfs); + if (error) + return error; + bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs); + return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs))); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ @@ -474,9 +511,11 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args) #endif error = kern_fstatfs(td, args->fd, &bsd_statfs); if (error) - return error; - bsd_to_linux_statfs(&bsd_statfs, &linux_statfs); - return copyout(&linux_statfs, args->buf, sizeof(linux_statfs)); + return (error); + error = bsd_to_linux_statfs(&bsd_statfs, &linux_statfs); + if (error) + return (error); + return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs))); } struct l_ustat diff --git a/sys/dev/usb/controller/ehci_pci.c b/sys/dev/usb/controller/ehci_pci.c index 7952c8b..1fab1d3 100644 --- a/sys/dev/usb/controller/ehci_pci.c +++ b/sys/dev/usb/controller/ehci_pci.c @@ -168,9 +168,15 @@ ehci_pci_match(device_t self) return ("Intel Wildcat Point USB 2.0 controller USB-A"); case 0x8cad8086: return ("Intel Wildcat Point USB 2.0 controller USB-B"); + case 0x8d268086: + return ("Intel Wellsburg USB 2.0 controller"); + case 0x8d2d8086: + return ("Intel Wellsburg USB 2.0 controller"); + case 0x9c268086: + return ("Intel Lynx Point LP USB 2.0 controller USB"); case 0x00e01033: - return ("NEC uPD 720100 USB 2.0 controller"); + return ("NEC uPD 72010x USB 2.0 controller"); case 0x006810de: return "NVIDIA nForce2 USB 2.0 controller"; diff --git a/sys/dev/usb/controller/uhci_pci.c b/sys/dev/usb/controller/uhci_pci.c index a7db9a9..0c5d99f 100644 --- a/sys/dev/usb/controller/uhci_pci.c +++ b/sys/dev/usb/controller/uhci_pci.c @@ -161,6 +161,12 @@ uhci_pci_match(device_t self) case 0x24de8086: return ("Intel 82801EB (ICH5) USB controller USB-D"); + case 0x25a98086: + return ("Intel 6300ESB USB controller USB-A"); + + case 0x25aa8086: + return ("Intel 6300ESB USB controller USB-B"); + case 0x26588086: return ("Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-A"); diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index e85ac6e..48dee2c 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -115,6 +115,8 @@ xhci_pci_match(device_t self) return ("Intel Lynx Point USB 3.0 controller"); case 0x8cb18086: return ("Intel Wildcat Point USB 3.0 controller"); + case 0x8d318086: + return ("Intel Wellsburg USB 3.0 controller"); case 0x9cb18086: return ("Broadwell Integrated PCH-LP chipset USB 3.0 controller"); diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index f00b4b2..7a9ec7b 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -104,7 +104,8 @@ pfs_visible_proc(struct thread *td, struct pfs_node *pn, struct proc *proc) } static int -pfs_visible(struct thread *td, struct pfs_node *pn, pid_t pid, struct proc **p) +pfs_visible(struct thread *td, struct pfs_node *pn, pid_t pid, + bool allproc_locked, struct proc **p) { struct proc *proc; @@ -115,7 +116,8 @@ pfs_visible(struct thread *td, struct pfs_node *pn, pid_t pid, struct proc **p) *p = NULL; if (pid == NO_PID) PFS_RETURN (1); - if ((proc = pfind(pid)) == NULL) + proc = allproc_locked ? pfind_locked(pid) : pfind(pid); + if (proc == NULL) PFS_RETURN (0); if (pfs_visible_proc(td, pn, proc)) { if (p) @@ -202,7 +204,7 @@ pfs_getattr(struct vop_getattr_args *va) PFS_TRACE(("%s", pn->pn_name)); pfs_assert_not_owned(pn); - if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc)) + if (!pfs_visible(curthread, pn, pvd->pvd_pid, false, &proc)) PFS_RETURN (ENOENT); vap->va_type = vn->v_type; @@ -293,7 +295,7 @@ pfs_ioctl(struct vop_ioctl_args *va) * This is necessary because process' privileges may * have changed since the open() call. */ - if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc)) { + if (!pfs_visible(curthread, pn, pvd->pvd_pid, false, &proc)) { VOP_UNLOCK(vn, 0); PFS_RETURN (EIO); } @@ -326,7 +328,7 @@ pfs_getextattr(struct vop_getextattr_args *va) * This is necessary because either process' privileges may * have changed since the open() call. */ - if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc)) + if (!pfs_visible(curthread, pn, pvd->pvd_pid, false, &proc)) PFS_RETURN (EIO); if (pn->pn_getextattr == NULL) @@ -462,7 +464,7 @@ pfs_lookup(struct vop_cachedlookup_args *va) PFS_RETURN (ENOENT); /* check that parent directory is visible... */ - if (!pfs_visible(curthread, pd, pvd->pvd_pid, NULL)) + if (!pfs_visible(curthread, pd, pvd->pvd_pid, false, NULL)) PFS_RETURN (ENOENT); /* self */ @@ -546,7 +548,7 @@ pfs_lookup(struct vop_cachedlookup_args *va) got_pnode: pfs_assert_not_owned(pd); pfs_assert_not_owned(pn); - visible = pfs_visible(curthread, pn, pid, NULL); + visible = pfs_visible(curthread, pn, pid, false, NULL); if (!visible) { error = ENOENT; goto failed; @@ -635,7 +637,7 @@ pfs_read(struct vop_read_args *va) * This is necessary because either process' privileges may * have changed since the open() call. */ - if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc)) + if (!pfs_visible(curthread, pn, pvd->pvd_pid, false, &proc)) PFS_RETURN (EIO); if (proc != NULL) { _PHOLD(proc); @@ -791,7 +793,7 @@ pfs_readdir(struct vop_readdir_args *va) pfs_lock(pd); /* check if the directory is visible to the caller */ - if (!pfs_visible(curthread, pd, pid, &proc)) { + if (!pfs_visible(curthread, pd, pid, true, &proc)) { sx_sunlock(&allproc_lock); pfs_unlock(pd); PFS_RETURN (ENOENT); @@ -995,7 +997,7 @@ pfs_write(struct vop_write_args *va) * This is necessary because either process' privileges may * have changed since the open() call. */ - if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc)) + if (!pfs_visible(curthread, pn, pvd->pvd_pid, false, &proc)) PFS_RETURN (EIO); if (proc != NULL) { _PHOLD(proc); diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy.c index 8c42f89..0e37977 100644 --- a/sys/i386/linux/linux_dummy.c +++ b/sys/i386/linux/linux_dummy.c @@ -72,7 +72,6 @@ DUMMY(pivot_root); DUMMY(mincore); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); -DUMMY(fstatfs64); DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 62dc2ae..cc5da24 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293592 2016-01-09 17:54:37Z dchagin + * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -848,7 +848,9 @@ struct linux_statfs64_args { char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * buf; char buf_r_[PADR_(struct l_statfs64_buf *)]; }; struct linux_fstatfs64_args { - register_t dummy; + char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; + char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; + char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * buf; char buf_r_[PADR_(struct l_statfs64_buf *)]; }; struct linux_tgkill_args { char tgid_l_[PADL_(int)]; int tgid; char tgid_r_[PADR_(int)]; diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h index 170c1cc..e9d8ef7 100644 --- a/sys/i386/linux/linux_syscall.h +++ b/sys/i386/linux/linux_syscall.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293592 2016-01-09 17:54:37Z dchagin + * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ #define LINUX_SYS_linux_exit 1 diff --git a/sys/i386/linux/linux_syscalls.c b/sys/i386/linux/linux_syscalls.c index 20b4032..54d8423 100644 --- a/sys/i386/linux/linux_syscalls.c +++ b/sys/i386/linux/linux_syscalls.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293592 2016-01-09 17:54:37Z dchagin + * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ const char *linux_syscallnames[] = { diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 465a9d3..ce765b5 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293592 2016-01-09 17:54:37Z dchagin + * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 297300 2016-03-27 06:10:51Z dchagin */ #include <sys/param.h> @@ -287,7 +287,7 @@ struct sysent linux_sysent[] = { { AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 266 = linux_clock_getres */ { AS(linux_clock_nanosleep_args), (sy_call_t *)linux_clock_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 267 = linux_clock_nanosleep */ { AS(linux_statfs64_args), (sy_call_t *)linux_statfs64, AUE_STATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 268 = linux_statfs64 */ - { 0, (sy_call_t *)linux_fstatfs64, AUE_FSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 269 = linux_fstatfs64 */ + { AS(linux_fstatfs64_args), (sy_call_t *)linux_fstatfs64, AUE_FSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 269 = linux_fstatfs64 */ { AS(linux_tgkill_args), (sy_call_t *)linux_tgkill, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 270 = linux_tgkill */ { AS(linux_utimes_args), (sy_call_t *)linux_utimes, AUE_UTIMES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 271 = linux_utimes */ { AS(linux_fadvise64_64_args), (sy_call_t *)linux_fadvise64_64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 272 = linux_fadvise64_64 */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 85fc9ca..7feba47 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -1870,7 +1870,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_fstatfs64 */ case 269: { - *n_args = 0; + struct linux_fstatfs64_args *p = params; + iarg[0] = p->fd; /* l_uint */ + uarg[1] = p->bufsize; /* size_t */ + uarg[2] = (intptr_t) p->buf; /* struct l_statfs64_buf * */ + *n_args = 3; break; } /* linux_tgkill */ @@ -5265,6 +5269,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_fstatfs64 */ case 269: + switch(ndx) { + case 0: + p = "l_uint"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "struct l_statfs64_buf *"; + break; + default: + break; + }; break; /* linux_tgkill */ case 270: @@ -7138,6 +7155,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_fstatfs64 */ case 269: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_tgkill */ case 270: if (ndx == 0 || ndx == 1) diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 248770c..1032ef0 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -452,7 +452,7 @@ 267 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \ struct l_timespec *rqtp, struct l_timespec *rmtp); } 268 AUE_STATFS STD { int linux_statfs64(char *path, size_t bufsize, struct l_statfs64_buf *buf); } -269 AUE_FSTATFS STD { int linux_fstatfs64(void); } +269 AUE_FSTATFS STD { int linux_fstatfs64(l_uint fd, size_t bufsize, struct l_statfs64_buf *buf); } 270 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); } 271 AUE_UTIMES STD { int linux_utimes(char *fname, \ struct l_timeval *tptr); } diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 8413b25..89b7a00 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1355,7 +1355,8 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe) if (!unmap) { aiocbe->pbuf = pbuf = (struct buf *)getpbuf(NULL); BUF_KERNPROC(pbuf); - } + } else + pbuf = NULL; AIO_LOCK(ki); ki->kaio_count++; diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index c842ce0..a67cf0a 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -619,8 +619,8 @@ dummynet_task(void *context, int pending) dn_drain_queue(); } - DN_BH_WUNLOCK(); dn_reschedule(); + DN_BH_WUNLOCK(); if (q.head != NULL) dummynet_send(q.head); CURVNET_RESTORE(); diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 40b8e97..57216be 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -74,6 +74,7 @@ struct schk_new_arg { /*---- callout hooks. ----*/ static struct callout dn_timeout; +static int dn_gone; static struct task dn_task; static struct taskqueue *dn_tq = NULL; @@ -89,6 +90,8 @@ void dn_reschedule(void) { + if (dn_gone != 0) + return; callout_reset_sbt(&dn_timeout, tick_sbt, 0, dummynet, NULL, C_HARDCLOCK | C_DIRECT_EXEC); } @@ -2175,9 +2178,11 @@ ip_dn_init(void) static void ip_dn_destroy(int last) { - callout_drain(&dn_timeout); - DN_BH_WLOCK(); + /* ensure no more callouts are started */ + dn_gone = 1; + + /* check for last */ if (last) { ND("removing last instance\n"); ip_dn_ctl_ptr = NULL; @@ -2186,6 +2191,8 @@ ip_dn_destroy(int last) dummynet_flush(); DN_BH_WUNLOCK(); + + callout_drain(&dn_timeout); taskqueue_drain(dn_tq, &dn_task); taskqueue_free(dn_tq); diff --git a/sys/rpc/svc.c b/sys/rpc/svc.c index f725d53..b436c18 100644 --- a/sys/rpc/svc.c +++ b/sys/rpc/svc.c @@ -560,7 +560,7 @@ svc_loss_reg(SVCXPRT *xprt, void (*dispatch)(SVCXPRT *)) mtx_unlock(&pool->sp_lock); return (TRUE); } - s = malloc(sizeof (struct svc_callout), M_RPC, M_NOWAIT); + s = malloc(sizeof(struct svc_loss_callout), M_RPC, M_NOWAIT); if (s == NULL) { mtx_unlock(&pool->sp_lock); return (FALSE); diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 1b5ce2d..fece706 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1937,9 +1937,9 @@ softdep_waitidle(struct mount *mp, int flags __unused) vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(devvp, MNT_WAIT, td); VOP_UNLOCK(devvp, 0); + ACQUIRE_LOCK(ump); if (error != 0) break; - ACQUIRE_LOCK(ump); } ump->softdep_req = 0; if (i == SU_WAITIDLE_RETRIES && error == 0 && ump->softdep_deps != 0) { diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index c990849..82a9b2e 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -74,7 +74,7 @@ static int child; static const char *fname; static char *fmfname; static int fflg, qflg, ttyflg; -static int usesleep, rawout; +static int usesleep, rawout, showexit; static struct termios tt; @@ -107,6 +107,7 @@ main(int argc, char *argv[]) flushtime = 30; fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC warning. (not needed w/clang) */ + showexit = 0; while ((ch = getopt(argc, argv, "adfkpqrt:")) != -1) switch(ch) { @@ -195,7 +196,8 @@ main(int argc, char *argv[]) (void)fprintf(fscript, "Script started on %s", ctime(&tvec)); if (argv[0]) { - fprintf(fscript, "command: "); + showexit = 1; + fprintf(fscript, "Command: "); for (k = 0 ; argv[k] ; ++k) fprintf(fscript, "%s%s", k ? " " : "", argv[k]); @@ -355,9 +357,13 @@ done(int eno) if (rawout) record(fscript, NULL, 0, 'e'); if (!qflg) { - if (!rawout) + if (!rawout) { + if (showexit) + (void)fprintf(fscript, "\nCommand exit status:" + " %d", eno); (void)fprintf(fscript,"\nScript done on %s", ctime(&tvec)); + } (void)printf("\nScript done, output file is %s\n", fname); if (fflg) { (void)printf("Filemon done, output file is %s\n", diff --git a/usr.sbin/pc-sysinstall/backend-query/disk-list.sh b/usr.sbin/pc-sysinstall/backend-query/disk-list.sh index 2616ef9..875b330 100755 --- a/usr.sbin/pc-sysinstall/backend-query/disk-list.sh +++ b/usr.sbin/pc-sysinstall/backend-query/disk-list.sh @@ -82,8 +82,8 @@ do esac fi - # Try and find some identification information with camcontrol - NEWLINE=$(camcontrol identify $DEV 2>/dev/null | sed -ne 's/^device model *//p') + # Try and get some identification information from GEOM + NEWLINE=$(geom disk list $DEV 2>/dev/null | sed -ne 's/^ descr: *//p') if [ -z "$NEWLINE" ]; then NEWLINE=" <Unknown Device>" fi diff --git a/usr.sbin/pc-sysinstall/backend/functions-disk.sh b/usr.sbin/pc-sysinstall/backend/functions-disk.sh index eac10d9..03b6cde 100755 --- a/usr.sbin/pc-sysinstall/backend/functions-disk.sh +++ b/usr.sbin/pc-sysinstall/backend/functions-disk.sh @@ -257,17 +257,15 @@ delete_all_gpart() # Destroy the disk geom rc_nohalt "gpart destroy ${DISK}" - # Make sure we clear any hidden gpt tables - clear_backup_gpt_table "${DISK}" - - # Wipe out front of disk - rc_nohalt "dd if=/dev/zero of=${DISK} count=3000" - + wipe_metadata "${DISK}" }; # Function to export all zpools before starting an install stop_all_zfs() { + if [ ! -c /dev/zfs ]; then + return; + fi local DISK="`echo ${1} | sed 's|/dev/||g'`" # Export any zpools using this device so we can overwrite @@ -283,6 +281,9 @@ stop_all_zfs() # Function which stops all gmirrors before doing any disk manipulation stop_all_gmirror() { + if [ ! -d /dev/mirror ]; then + return; + fi local DISK="`echo ${1} | sed 's|/dev/||g'`" GPROV="`gmirror list | grep ". Name: mirror/" | cut -d '/' -f 2`" for gprov in $GPROV @@ -292,7 +293,7 @@ stop_all_gmirror() then echo_log "Stopping mirror $gprov $DISK" rc_nohalt "gmirror remove $gprov $DISK" - rc_nohalt "dd if=/dev/zero of=/dev/${DISK} count=4096" + wipe_metadata "${DISK}" fi done }; @@ -611,12 +612,17 @@ stop_gjournal() } ; -# Function to wipe the potential backup gpt table from a disk -clear_backup_gpt_table() +# Function to wipe the potential metadata from a disk +wipe_metadata() { - echo_log "Clearing gpt backup table location on disk" - rc_nohalt "dd if=/dev/zero of=${1} bs=1m count=1" - rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=`diskinfo ${1} | awk '{print int($3 / (1024*1024)) - 4;}'`" + echo_log "Wiping possible metadata on ${1}" + local SIZE="`diskinfo ${1} | awk '{print int($3/(1024*1024)) }'`" + if [ "$SIZE" -gt "5" ] ; then + rc_halt "dd if=/dev/zero of=${1} bs=1m count=1" + rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=$((SIZE-4))" + else + rc_nohalt "dd if=/dev/zero of=${1} bs=128k" + fi } ; # Function which runs gpart and creates a single large APM partition scheme @@ -696,8 +702,7 @@ init_mbr_full_disk() rc_halt "gpart add -a 4k -t freebsd -i 1 ${_intDISK}" sleep 2 - echo_log "Cleaning up ${_intDISK}s1" - rc_halt "dd if=/dev/zero of=${_intDISK}s1 count=1024" + wipe_metadata "${_intDISK}s1" # Make the partition active rc_halt "gpart set -a active -i 1 ${_intDISK}" @@ -770,9 +775,7 @@ run_gpart_gpt_part() rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}" sleep 2 - # Clean up old partition - echo_log "Cleaning up $slice" - rc_halt "dd if=/dev/zero of=${DISK}p${slicenum} count=1024" + wipe_metadata "${slice}" sleep 4 @@ -830,9 +833,7 @@ run_gpart_slice() rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}" sleep 2 - # Clean up old partition - echo_log "Cleaning up $slice" - rc_halt "dd if=/dev/zero of=${DISK}s${slicenum} count=1024" + wipe_metadata "${slice}" sleep 1 @@ -883,9 +884,8 @@ run_gpart_free() echo_log "Running gpart on ${DISK}" rc_halt "gpart add -a 4k -t freebsd -i ${slicenum} ${DISK}" sleep 2 - - echo_log "Cleaning up $slice" - rc_halt "dd if=/dev/zero of=${slice} count=1024" + + wipe_metadata "${slice}" sleep 1 |