diff options
author | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
commit | 3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch) | |
tree | b2f038222ff8a70f687652441df00d2b564c8abe /share/examples | |
parent | 952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff) | |
parent | 1d08d5f677c1dfa810e381073590adbae19cc69f (diff) | |
download | FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz |
Sync with HEAD.
Diffstat (limited to 'share/examples')
-rw-r--r-- | share/examples/Makefile | 1 | ||||
-rw-r--r-- | share/examples/cvsup/README | 14 | ||||
-rw-r--r-- | share/examples/cvsup/cvs-supfile | 120 | ||||
-rw-r--r-- | share/examples/cvsup/gnats-supfile | 60 | ||||
-rw-r--r-- | share/examples/cvsup/ports-supfile | 84 | ||||
-rw-r--r-- | share/examples/cvsup/stable-supfile | 41 | ||||
-rw-r--r-- | share/examples/cvsup/standard-supfile | 41 | ||||
-rw-r--r-- | share/examples/etc/make.conf | 41 | ||||
-rw-r--r-- | share/examples/ppp/ppp.conf.sample | 12 | ||||
-rw-r--r-- | share/examples/ppp/ppp.conf.span-isp | 2 | ||||
-rw-r--r-- | share/examples/ses/sesd/sesd.0 | 7 | ||||
-rw-r--r-- | share/examples/ses/srcs/eltsub.c | 10 | ||||
-rw-r--r-- | share/examples/ses/srcs/sesd.c | 58 |
13 files changed, 123 insertions, 368 deletions
diff --git a/share/examples/Makefile b/share/examples/Makefile index 5cfd76b..5657d3e 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -52,7 +52,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ csh/dot.cshrc \ cvsup/README \ cvsup/cvs-supfile \ - cvsup/gnats-supfile \ cvsup/ports-supfile \ cvsup/refuse \ cvsup/refuse.README \ diff --git a/share/examples/cvsup/README b/share/examples/cvsup/README index e025e8f..19ae270 100644 --- a/share/examples/cvsup/README +++ b/share/examples/cvsup/README @@ -1,5 +1,15 @@ # $FreeBSD$ +BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. + +The primary development work happens in Subversion and is temporarily +exported to the legacy CVS system with significant time delays. + +You should NOT set up a new consumer of FreeBSD source code via CVS. +Please see: +http://www.freebsd.org/doc/handbook/svn.html +http://www.freebsd.org/doc/handbook/svn-mirrors.html + This directory contains sample "supfiles" for obtaining and updating the FreeBSD sources via the Internet. These supfiles will work with CVSup version 14.0 or later. For general information on CVSup @@ -20,10 +30,6 @@ FreeBSD, use: cvs-supfile Main source tree and ports collection -To maintain a copy of the FreeBSD bug database, use the file: - - gnats-supfile FreeBSD bug database - IMPORTANT: Before you use any of the supfiles in this directory, you will need to edit in an appropriate "host" setting. See: diff --git a/share/examples/cvsup/cvs-supfile b/share/examples/cvsup/cvs-supfile index b4edfdc..f46d051 100644 --- a/share/examples/cvsup/cvs-supfile +++ b/share/examples/cvsup/cvs-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# CVS development tree of the FreeBSD system. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -61,36 +68,6 @@ # mega-collection. It includes all of the individual "src-*" collections. src-all -# These are the individual collections that make up "src-all". If you -# use these, be sure to comment out "src-all" above. -#src-base -#src-bin -#src-cddl -#src-contrib -#src-etc -#src-games -#src-gnu -#src-include -#src-kerberos5 -#src-kerberosIV -#src-lib -#src-libexec -#src-release -#src-rescue -#src-sbin -#src-share -#src-sys -#src-tools -#src-usrbin -#src-usrsbin -# These are the individual collections that make up FreeBSD's crypto -# collection. They are no longer export-restricted and are a part of -# src-all -#src-crypto -#src-eBones -#src-secure -#src-sys-crypto - ## Ports Collection. # # The easiest way to get the ports tree is to use the "ports-all" @@ -98,77 +75,6 @@ src-all # collections, ports-all -# These are the individual collections that make up "ports-all". If you -# use these, be sure to comment out "ports-all" above and always include -# "ports-base" if you use any of the other individual collections below. -# Your ports may not build correctly without an up-to-date "ports-base". -# -#ports-base -# -#ports-accessibility -#ports-arabic -#ports-archivers -#ports-astro -#ports-audio -#ports-benchmarks -#ports-biology -#ports-cad -#ports-chinese -#ports-comms -#ports-converters -#ports-databases -#ports-deskutils -#ports-devel -#ports-dns -#ports-editors -#ports-emulators -#ports-finance -#ports-french -#ports-ftp -#ports-games -#ports-german -#ports-graphics -#ports-hebrew -#ports-hungarian -#ports-irc -#ports-japanese -#ports-java -#ports-korean -#ports-lang -#ports-mail -#ports-math -#ports-misc -#ports-multimedia -#ports-net -#ports-net-im -#ports-net-mgmt -#ports-net-p2p -#ports-news -#ports-palm -#ports-picobsd -#ports-polish -#ports-ports-mgmt -#ports-portuguese -#ports-print -#ports-russian -#ports-science -#ports-security -#ports-shells -#ports-sysutils -#ports-textproc -#ports-ukrainian -#ports-vietnamese -#ports-www -#ports-x11 -#ports-x11-clocks -#ports-x11-drivers -#ports-x11-fm -#ports-x11-fonts -#ports-x11-servers -#ports-x11-themes -#ports-x11-toolkits -#ports-x11-wm - ## Projects # # This collection retrieves the projects tree of the FreeBSD @@ -179,11 +85,3 @@ projects-all # # This is to get the control files that cvs(1) needs and the commit logs. cvsroot-all - -# These are the individual collections that make up "cvsroot-all" If you -# use these, be sure to comment out "cvsroot-all" above. "cvsroot-common" -# is a synthetic CVSROOT that has all the modules from the other CVSROOT-* -# directories merged into one, and merged commitlogs via symlinks. -#cvsroot-common -#cvsroot-src -#cvsroot-ports diff --git a/share/examples/cvsup/gnats-supfile b/share/examples/cvsup/gnats-supfile deleted file mode 100644 index 57e9666..0000000 --- a/share/examples/cvsup/gnats-supfile +++ /dev/null @@ -1,60 +0,0 @@ -# $FreeBSD$ -# -# This file contains all of the "CVSup collections" that make up the -# FreeBSD GNATS bug report database. -# -# csup (CVS Update Protocol) allows you to download the latest CVS -# tree (or any branch of development therefrom) to your system easily -# and efficiently -# -# To keep your CVS tree up-to-date run: -# -# csup gnats-supfile -# -# Note that this only updates the tree contents and does not -# update what is actually installed. -# -# You may wish to change some of the settings in this file to better -# suit your system: -# -# host=CHANGE_THIS.FreeBSD.org -# This specifies the server host which will supply the -# file updates. You must change it to one of the CVSup -# mirror sites listed in the FreeBSD Handbook at -# http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -# You can override this setting on the command line -# with cvsup's "-h host" option. -# -# base=/var/db -# This specifies the root where csup will store information -# about the collections you have transferred to your system. -# A setting of "/var/db" will generate this information in -# /var/db/sup. You can override the "base" setting on the -# command line with cvsup's "-b base" option. This directory -# must exist in order to run CVSup. -# -# prefix=/usr -# This specifies where to place the requested files. A -# setting of "/usr" will place all of the files requested -# in "/usr/gnats". -# The prefix directory must exist in order to run CVSup. - -# Defaults that apply to all the collections -# -# IMPORTANT: Change the next line to use one of the CVSup mirror sites -# listed at http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -*default host=CHANGE_THIS.FreeBSD.org -*default base=/var/db -*default prefix=/usr -*default release=current -*default delete use-rel-suffix - -# If you seem to be limited by CPU rather than network or disk bandwidth, try -# commenting out the following line. (Normally, today's CPUs are fast enough -# that you want to run compression.) -*default compress - -## GNATS database -# -gnats - diff --git a/share/examples/cvsup/ports-supfile b/share/examples/cvsup/ports-supfile index 582f29f..f37af41 100644 --- a/share/examples/cvsup/ports-supfile +++ b/share/examples/cvsup/ports-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# ports collection. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -65,76 +72,3 @@ # mega-collection. It includes all of the individual "ports-*" # collections, ports-all - -# These are the individual collections that make up "ports-all". If you -# use these, be sure to comment out "ports-all" above. - -# Be sure to ALWAYS cvsup the ports-base collection if you use any of the -# other individual collections below. ports-base is a mandatory collection -# for the ports collection, and your ports may not build correctly if it -# is not kept up to date. -# -# Use of individual collections is not a supported configuration. -#ports-base -#ports-accessibility -#ports-arabic -#ports-archivers -#ports-astro -#ports-audio -#ports-benchmarks -#ports-biology -#ports-cad -#ports-chinese -#ports-comms -#ports-converters -#ports-databases -#ports-deskutils -#ports-devel -#ports-dns -#ports-editors -#ports-emulators -#ports-finance -#ports-french -#ports-ftp -#ports-games -#ports-german -#ports-graphics -#ports-hebrew -#ports-hungarian -#ports-irc -#ports-japanese -#ports-java -#ports-korean -#ports-lang -#ports-mail -#ports-math -#ports-misc -#ports-multimedia -#ports-net -#ports-net-im -#ports-net-mgmt -#ports-net-p2p -#ports-news -#ports-palm -#ports-polish -#ports-ports-mgmt -#ports-portuguese -#ports-print -#ports-russian -#ports-science -#ports-security -#ports-shells -#ports-sysutils -#ports-textproc -#ports-ukrainian -#ports-vietnamese -#ports-www -#ports-x11 -#ports-x11-clocks -#ports-x11-drivers -#ports-x11-fm -#ports-x11-fonts -#ports-x11-servers -#ports-x11-themes -#ports-x11-toolkits -#ports-x11-wm diff --git a/share/examples/cvsup/stable-supfile b/share/examples/cvsup/stable-supfile index c747944..54f6e89 100644 --- a/share/examples/cvsup/stable-supfile +++ b/share/examples/cvsup/stable-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# FreeBSD-stable source tree. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -80,33 +87,3 @@ # mega-collection. It includes all of the individual "src-*" collections. # Please note: If you want to track -STABLE, leave this uncommented. src-all - -# These are the individual collections that make up "src-all". If you -# use these, be sure to comment out "src-all" above. -#src-base -#src-bin -#src-cddl -#src-contrib -#src-etc -#src-games -#src-gnu -#src-include -#src-kerberos5 -#src-kerberosIV -#src-lib -#src-libexec -#src-release -#src-rescue -#src-sbin -#src-share -#src-sys -#src-tools -#src-usrbin -#src-usrsbin -# These are the individual collections that make up FreeBSD's crypto -# collection. They are no longer export-restricted and are a part of -# src-all -#src-crypto -#src-eBones -#src-secure -#src-sys-crypto diff --git a/share/examples/cvsup/standard-supfile b/share/examples/cvsup/standard-supfile index b56068d..94eec5e 100644 --- a/share/examples/cvsup/standard-supfile +++ b/share/examples/cvsup/standard-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# FreeBSD-current source tree. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -59,33 +66,3 @@ # The easiest way to get the main source tree is to use the "src-all" # mega-collection. It includes all of the individual "src-*" collections. src-all - -# These are the individual collections that make up "src-all". If you -# use these, be sure to comment out "src-all" above. -#src-base -#src-bin -#src-cddl -#src-contrib -#src-etc -#src-games -#src-gnu -#src-include -#src-kerberos5 -#src-kerberosIV -#src-lib -#src-libexec -#src-release -#src-rescue -#src-sbin -#src-share -#src-sys -#src-tools -#src-usrbin -#src-usrsbin -# These are the individual collections that make up FreeBSD's crypto -# collection. They are no longer export-restricted and are a part of -# src-all -#src-crypto -#src-eBones -#src-secure -#src-sys-crypto diff --git a/share/examples/etc/make.conf b/share/examples/etc/make.conf index 60c7668..9a74298 100644 --- a/share/examples/etc/make.conf +++ b/share/examples/etc/make.conf @@ -25,22 +25,28 @@ # The CPUTYPE variable controls which processor should be targeted for # generated code. This controls processor-specific optimizations in # certain code (currently only OpenSSL) as well as modifying the value -# of CFLAGS to contain the appropriate optimization directive to gcc. +# of CFLAGS to contain the appropriate optimization directive to cc. # The automatic setting of CFLAGS may be overridden using the # NO_CPU_CFLAGS variable below. # Currently the following CPU types are recognized: # Intel x86 architecture: -# (AMD CPUs) opteron-sse3 opteron athlon64-sse3 athlon64 athlon-mp -# athlon-xp athlon-4 athlon-tbird athlon k8-sse3 k8 -# geode k6-3 k6-2 k6 k5 -# (Intel CPUs) core2 core nocona pentium4m pentium4 prescott -# pentium3m pentium3 pentium-m pentium2 -# pentiumpro pentium-mmx pentium i486 i386 -# (Via CPUs) c3 c3-2 -# AMD64 architecture: opteron, athlon64, nocona, prescott, core2 -# Intel ia64 architecture: itanium2, itanium +# (AMD CPUs) opteron-sse3, athlon64-sse3, k8-sse3, opteron, +# athlon64, athlon-fx, k8, athlon-mp, athlon-xp, +# athlon-4, athlon-tbird, athlon, k7, geode, k6-3, +# k6-2, k6 +# (Intel CPUs) core2, core, nocona, pentium4m, pentium4, prescott, +# pentium3m, pentium3, pentium-m, pentium2, +# pentiumpro, pentium-mmx, pentium, i486 +# (VIA CPUs) c7, c3-2, c3 +# AMD64 architecture: opteron-sse3, athlon64-sse3, k8-sse3, opteron, +# athlon64, k8, core2, nocona +# Intel ia64 architecture: itanium2, itanium # SPARC-V9 architecture: v9 (generic 64-bit V9), ultrasparc (default # if omitted), ultrasparc3 +# Additionally the following CPU types are recognized by clang: +# Intel x86 architecture (for both amd64 and i386): +# (AMD CPUs) bdver2, bdver1, btver1, amdfam10 +# (Intel CPUs) core-avx2, core-avx-i, corei7-avx, corei7, atom # # (?= allows to buildworld for a different CPUTYPE.) # @@ -51,21 +57,20 @@ # CFLAGS controls the compiler settings used when compiling C code. # Note that optimization settings other than -O and -O2 are not recommended # or supported for compiling the world or the kernel - please revert any -# nonstandard optimization settings to "-O" or "-O2 -fno-strict-aliasing" +# nonstandard optimization settings # before submitting bug reports without patches to the developers. # -# Compiling with -fstrict-aliasing optimization breaks some [notable] ports. -# GCC turns on -fstrict-aliasing optimization at all levels above -O[1], so -# explicitly turn it off when using compiling with the -O2 optimization level. -# -#CFLAGS= -O2 -fno-strict-aliasing -pipe -# # CXXFLAGS controls the compiler settings used when compiling C++ code. # Note that CXXFLAGS is initially set to the value of CFLAGS. If you wish # to add to CXXFLAGS value, "+=" must be used rather than "=". Using "=" # alone will remove the often needed contents of CFLAGS from CXXFLAGS. # -#CXXFLAGS+= -fconserve-space +# Additional compiler flags can be specified that extend or override +# default ones. However, neither the base system nor ports are guaranteed +# to build and function without problems with non-default settings. +# +# CFLAGS+= -msse3 +# CXXFLAGS+= -msse3 # # MAKE_SHELL controls the shell used internally by make(1) to process the # command scripts in makefiles. Three shells are supported, sh, ksh, and diff --git a/share/examples/ppp/ppp.conf.sample b/share/examples/ppp/ppp.conf.sample index 7863eaa..2572644 100644 --- a/share/examples/ppp/ppp.conf.sample +++ b/share/examples/ppp/ppp.conf.sample @@ -29,7 +29,7 @@ # default: set log Phase Chat LCP IPCP CCP tun command - set device /dev/cuad1 + set device /dev/cuau1 set speed 115200 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" AT \ OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT" @@ -145,7 +145,7 @@ TA: set timeout 60 300 # The minimum charge period is 5 minutes, so don't # hangup before then - set device /dev/cuad0 # Or whatever + set device /dev/cuau0 # Or whatever set speed 115200 # Use as high a speed as possible enable dns # Ask the peer what to put in resolv.conf @@ -315,7 +315,7 @@ dodgy: dodgynet: set log Phase # Log link uptime allow mode auto # For autoconnect only - set device /dev/cuad1 # Define modem device and speed + set device /dev/cuau1 # Define modem device and speed set speed 115200 deny lqr # Don't support LQR set phone 0W1194 # Remote system phone number, @@ -472,7 +472,7 @@ radius-server: # direct-client: set dial - set device /dev/cuad0 + set device /dev/cuau0 set sp 115200 set timeout 900 set lqrperiod 10 @@ -651,7 +651,7 @@ callback-server: set cbcp set log +cbcp set redial 3 1 - set device /dev/cuad0 + set device /dev/cuau0 set speed 115200 set dial "TIMEOUT 10 \"\" AT OK-AT-OK ATDT\\T CONNECT" @@ -678,7 +678,7 @@ callback-server-client-decides: # mloop: load loop - set device /dev/cuad0 /dev/cuad1 /dev/cuad2 # Use any of these devices + set device /dev/cuau0 /dev/cuau1 /dev/cuau2 # Use any of these devices set mode interactive set mrru 1500 set mru 1504 # Room for the MP header diff --git a/share/examples/ppp/ppp.conf.span-isp b/share/examples/ppp/ppp.conf.span-isp index 446cee3..11084de 100644 --- a/share/examples/ppp/ppp.conf.span-isp +++ b/share/examples/ppp/ppp.conf.span-isp @@ -104,7 +104,7 @@ default: set speed 115200 - set device /dev/cuad0 /dev/cuad1 /dev/cuad2 /dev/cuad3 + set device /dev/cuau0 /dev/cuau1 /dev/cuau2 /dev/cuau3 set dial "ABORT BUSY ABORT NO\\sCARRIER ABORT NO\\sDIAL\\sTONE TIMEOUT 4 \ \"\" ATZ OK-ATZ-OK ATDT\\T TIMEOUT 60 CONNECT \\c \\n" set login diff --git a/share/examples/ses/sesd/sesd.0 b/share/examples/ses/sesd/sesd.0 index 29c0084..7a548c7 100644 --- a/share/examples/ses/sesd/sesd.0 +++ b/share/examples/ses/sesd/sesd.0 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 21, 2000 +.Dd November 5, 2012 .Dt SESD 8 .Os .Sh NAME @@ -39,6 +39,7 @@ .Nd monitor SCSI Environmental Services Devices .Sh SYNOPSIS .Nm +.Op Fl c .Op Fl d .Op Fl t Ar poll-interval .Ar device @@ -57,7 +58,9 @@ poll each device for a change in state. .Pp The following options may be used: .Bl -tag -width Ds -.It Fl p Ar poll-interval +.It Fl c +Try to clear enclosure status after read. +.It Fl t Ar poll-interval Change the interval of polling from the default 30 seconds to the number of seconds specified. .It Fl d diff --git a/share/examples/ses/srcs/eltsub.c b/share/examples/ses/srcs/eltsub.c index 9500423..c664895 100644 --- a/share/examples/ses/srcs/eltsub.c +++ b/share/examples/ses/srcs/eltsub.c @@ -71,7 +71,7 @@ geteltnm(int type) sprintf(rbuf, "Audible alarm"); break; case ELMTYP_ESCC: - sprintf(rbuf, "Enclosure Eervices Controller Electronics"); + sprintf(rbuf, "Enclosure Services Controller Electronics"); break; case ELMTYP_SCC: sprintf(rbuf, "SCC Controller Electronics"); @@ -180,7 +180,11 @@ stat2ascii(int eletype __unused, u_char *cstat) static char ebuf[256], *scode; scode = scode2ascii(cstat[0]); - sprintf(ebuf, "status: %s (0x%02x 0x%02x 0x%02x 0x%02x)", - scode, cstat[0], cstat[1], cstat[2], cstat[3]); + sprintf(ebuf, "status: %s%s%s%s (0x%02x 0x%02x 0x%02x 0x%02x)", + scode, + (cstat[0] & 0x40) ? ", Prd.Fail" : "", + (cstat[0] & 0x20) ? ", Disabled" : "", + (cstat[0] & 0x10) ? ", Swapped" : "", + cstat[0], cstat[1], cstat[2], cstat[3]); return (ebuf); } diff --git a/share/examples/ses/srcs/sesd.c b/share/examples/ses/srcs/sesd.c index 88627e9..acf9508 100644 --- a/share/examples/ses/srcs/sesd.c +++ b/share/examples/ses/srcs/sesd.c @@ -40,6 +40,7 @@ #include <errno.h> #include <string.h> #include <syslog.h> +#include <unistd.h> #include <sys/ioctl.h> #include <cam/scsi/scsi_all.h> #include <cam/scsi/scsi_enc.h> @@ -55,29 +56,33 @@ int main(int a, char **v) { static const char *usage = - "usage: %s [ -d ] [ -t pollinterval ] device [ device ]\n"; - int fd, polltime, dev, devbase, nodaemon; - encioc_enc_status_t stat, *carray; + "usage: %s [ -c ] [ -d ] [ -t pollinterval ] device [ device ]\n"; + int fd, polltime, dev, nodaemon, clear, c; + encioc_enc_status_t stat, nstat, *carray; if (a < 2) { fprintf(stderr, usage, *v); return (1); } - devbase = 1; - - if (strcmp(v[1], "-d") == 0) { - nodaemon = 1; - devbase++; - } else { - nodaemon = 0; - } - - if (a > 2 && strcmp(v[2], "-t") == 0) { - devbase += 2; - polltime = atoi(v[3]); - } else { - polltime = 30; + nodaemon = 0; + polltime = 30; + clear = 0; + while ((c = getopt(a, v, "cdt:")) != -1) { + switch (c) { + case 'c': + clear = 1; + break; + case 'd': + nodaemon = 1; + break; + case 't': + polltime = atoi(optarg); + break; + default: + fprintf(stderr, usage, *v); + return (1); + } } carray = malloc(a); @@ -85,13 +90,13 @@ main(int a, char **v) perror("malloc"); return (1); } - for (dev = devbase; dev < a; dev++) + for (dev = optind; dev < a; dev++) carray[dev] = (encioc_enc_status_t) -1; /* * Check to make sure we can open all devices */ - for (dev = devbase; dev < a; dev++) { + for (dev = optind; dev < a; dev++) { fd = open(v[dev], O_RDWR); if (fd < 0) { perror(v[dev]); @@ -115,7 +120,7 @@ main(int a, char **v) } for (;;) { - for (dev = devbase; dev < a; dev++) { + for (dev = optind; dev < a; dev++) { fd = open(v[dev], O_RDWR); if (fd < 0) { syslog(LOG_ERR, "%s: %m", v[dev]); @@ -131,6 +136,14 @@ main(int a, char **v) (void) close(fd); continue; } + if (stat != 0 && clear) { + nstat = 0; + if (ioctl(fd, ENCIOC_SETENCSTAT, + (caddr_t) &nstat) < 0) { + syslog(LOG_ERR, + "%s: ENCIOC_SETENCSTAT- %m", v[dev]); + } + } (void) close(fd); if (stat == carray[dev]) @@ -142,9 +155,8 @@ main(int a, char **v) "%s: Enclosure Status OK", v[dev]); } if (stat & SES_ENCSTAT_INFO) { - syslog(LOG_INFO, - "%s: Enclosure Status Has Information", - v[dev]); + syslog(LOG_NOTICE, + "%s: Enclosure Has Information", v[dev]); } if (stat & SES_ENCSTAT_NONCRITICAL) { syslog(LOG_WARNING, |